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

Revision history [back]

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}

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}