Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
5

Setting an attribute that isn't exposed in the OpenStudio API?

asked 2015-09-08 12:09:48 -0500

updated 2017-08-05 13:03:24 -0500

For example, I want to set the Setpoint of an OS:ShadingControl. The documentation for this object is here. As can be seen, there's no direct access to the setpoint.

How can I set it?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
4

answered 2015-09-08 12:10:09 -0500

updated 2015-09-08 12:15:40 -0500

Here is an example of what NOT to do.

Indeed, Openstudio will just ignore that value and replace it with 100.


Let's say you have stored your ShadingControl in the variable shading_ctrl

In [1]: puts shading_ctrl.to_s
Out[1]:
OS:ShadingControl,
  {a3e408c3-3dd3-4ea9-9c3f-b0af445a2c9d}, !- Handle
  Shading Control 1,                      !- Name
  SwitchableGlazing,                      !- Shading Type
  {f47a3380-fc6c-4fee-b208-3e45ebf9cd82}, !- Construction with Shading Name
  ,                                       !- Shading Device Material Name
  ,                                       !- Shading Control Type
  ,                                       !- Schedule Name
  ,                                       !- Setpoint {BasedOnField A4}
  ,                                       !- Shading Control Is Scheduled
  ,                                       !- Glare Control Is Active
  ,                                       !- Type of Slat Angle Control for Blinds
  ,                                       !- Slat Angle Schedule Name
  ;                                       !- Setpoint 2 {BasedOnField A4}

As can be seen above, setpoint has index 7 (it's 0-indexed, so Handle is 0, Name is 1...)

You can then use the setDouble method which accepts an index, and a double. Let's say I want to set setpoint to 25 W/m².

In[2]:  shading_ctrl.setAttribute(7, 20)
Out[2]: => true

In[3]: # Let's verify
puts shading_ctrl.to_s
Out[3]:
OS:ShadingControl,
  {a3e408c3-3dd3-4ea9-9c3f-b0af445a2c9d}, !- Handle
  Shading Control 1,                      !- Name
  SwitchableGlazing,                      !- Shading Type
  {f47a3380-fc6c-4fee-b208-3e45ebf9cd82}, !- Construction with Shading Name
  ,                                       !- Shading Device Material Name
  ,                                       !- Shading Control Type
  ,                                       !- Schedule Name
  20,                                       !- Setpoint {BasedOnField A4}
  ,                                       !- Shading Control Is Scheduled
  ,                                       !- Glare Control Is Active
  ,                                       !- Type of Slat Angle Control for Blinds
  ,                                       !- Slat Angle Schedule Name
  ;                                       !- Setpoint 2 {BasedOnField A4}
edit flag offensive delete link more

Comments

Except OpenStudio will remove it and use its default value. Bummer

Julien Marrec gravatar imageJulien Marrec ( 2015-09-08 12:14:50 -0500 )edit

Might still work, depending on the Shading Control Type. See here

Eric Ringold gravatar imageEric Ringold ( 2015-09-08 12:31:23 -0500 )edit

That field was intentionally not added to the API, however it is in the data model for future use. This really is an odd object where we are trying to balance between what you can do in EnergyPlus and in Radiance.

macumber gravatar imagemacumber ( 2015-09-08 14:20:35 -0500 )edit

@Julien Marrec does this mean you got IRuby working?

MatthewSteen gravatar imageMatthewSteen ( 2015-09-08 18:05:41 -0500 )edit

@Eric Ringold: I've checked the out.idf, it does strip out the value I've used and replaces it with 100, even though I'm using OnIfHighSolarOnWindow... I guess I'll have to use an EnergyPlus measure... @MatthewSteen: Nope, I'm just used to formatting code this way on Stack Overflow. I did try really hard to install iruby. I think I've just managed to induce some momentum to fix it (here, the creator of the failing rbcmz says he'll look into it)

Julien Marrec gravatar imageJulien Marrec ( 2015-09-09 03:45:37 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

 



Question Tools

1 follower

Stats

Asked: 2015-09-08 12:09:48 -0500

Seen: 199 times

Last updated: Sep 08 '15