2

Shading control set point measure

Based on the answers here and the minimal example here @Julien Marrec, I understand how to set the setpoint once I have the shading control object.

However, I don't want to create a new SC, but find all existing ones.

The following line:

scs = model.getObjectsByType("ShadingControl".to_IddObjectType)

returns an uninformative error:

 eval:1:in `initialize': Unknown Value (RuntimeError)

in an OpenStudio measure. Should I be using an EnergyPlus measure instead?

revins's avatar
23
revins
asked 2017-02-01 23:25:06 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-08-20 14:50:59 -0500
edit flag offensive 0 remove flag close merge delete

Comments

A good place to start getting familiar with measures is the Measure Writing Guide as well as looking at example measures found on BCL for example.

Julien Marrec's avatar Julien Marrec (2017-02-02 10:37:15 -0500) edit
add a comment see more comments

1 Answer

1

Use model.getShadingControls which will return an array of your shading controls.

Example: set all Shading Control's setpoint to 250:

model.getShadingControls.each do |sc|
   sc.setSetpoint(250)
end

Note that this is true of all objects in the OS API. If you want to get all Constructions in the model: model.getConstructions, etc.


Side note:

FYI, if you decompose your command call (always a good idea), you'll see that your problem is with ("ShadingControl".to_IddObjectType). This does work:

model.getObjectsByType("OS_ShadingControl".to_IddObjectType)

but it'll return an array of WorkspaceObject, that you'll have to cast to their actual object type (x.to_ShadingControl.get).

Bottom line: use model.getShadingControls!

Julien Marrec's avatar
29.7k
Julien Marrec
answered 2017-02-02 10:27:31 -0500, updated 2017-02-02 10:36:22 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments