Relationship between objects
I'm writing a measure to add a daylighting control to a zone/space. I'm not sure I understand the relationship between DaylightControl, Space and ThermalZone.
OS:Daylighting:Control,
{Handle_of_Daylight_Control}, !- Handle
{Handle_of_Space}, !- Space Name
OS:Space,
{Handle_of_Space}, !- Handle
[...]
{Handle_of_ThermalZone}, !- Thermal Zone Name
OS:ThermalZone,
{Handle_of_ThermalZone}, !- Handle
[...]
{Handle_of_Daylight_Control}, !- Primary Daylighting Control Name
[...]
Using my awesome MSPaint skills, I can see it looks redundant, doesn't it?
Even more confusing, I can see the OS:ThermalZone object has a method
openstudio::model::ThermalZone::setPrimaryDaylightingControl ( const DaylightingControl & daylightingControl )
But if you use it, it doesn't assign anything to the ThermalZone.
Looking at DaylightingControl Class Reference, it seems it does belong to a Space, not a thermal zone. So why do we need the the daylightControl handle in the OS:ThermalZone object?
So, what am I missing there?
Further problem
Looking at a measure called "Add Daylight Sensor at the Center of Spaces with a Specified Space Type Assigned", what's used is:
sensor = OpenStudio::Model::DaylightingControl.new(model)
...
sensor.setSpace(space)
First, I didn't find anywhere in the documentation the setSpace
method. Where can I find it?
Second, I'm having a problem. I initially wrote the measure asking the user to select the ThermalZone for which he wants a daylight control, considering that I knew in E+ it was linked to a zone (spaces don't exists anyways...). Is that a bad idea?
If not a truly awful idea right from the start, is it bad to just use
#Get first space linked to the ThermalZone we selected
zone_space = zone.spaces[0]
#Assign sensor to space
sensor.setSpace(zone_space)
Do I also need to do this in addition?
# Assign the sensor as a Primary Daylightlighting Control to the Thermal Zone
zone.setPrimaryDaylightingControl(sensor)