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

Revision history [back]

click to hide/show revision 1
initial version

I was able to solve this. The key was using the <loopzoneattribute occupancyschedule=""> as the sensor Object IDF name. This caused DesignBuilder to look up the occupancy schedule for each zone. My final working code is below, which randomizes both the occupancy and the internal equipment power level.

<foralloccupiedzones> EnergyManagementSystem:Sensor, Schedule_Value_Occ_<loopzonevariablename>, <loopzoneattribute occupancyschedule="">, Schedule Value; Output:Variable, <loopzoneattribute occupancyschedule="">, Schedule Value, Hourly; Output:Variable, <loopzoneattribute occupancyschedule="">, Schedule Value, Daily; <loopnextzone>

<foralloccupiedzones> EnergyManagementSystem:Sensor, Schedule_Value_Eq_<loopzonevariablename>, <loopzoneattribute equipmentschedule="">, Schedule Value; <loopnextzone>

<foralloccupiedzones> EnergyManagementSystem:Actuator, Number_of_People_<loopzonevariablename>, PEOPLE <loopzoneidfname>, People, Number of People; <loopnextzone>

<foralloccupiedzones> EnergyManagementSystem:Actuator, Power_Level_<loopzonevariablename>, <loopzoneidfname> EQUIPMENT GAIN 1, OtherEquipment, Power Level; <loopnextzone>

<foralloccupiedzones> EnergyManagementSystem:InternalVariable, People_Count_Design_Level_<loopzonevariablename>, PEOPLE <loopzoneidfname>, People Count Design Level; Output:Variable, PEOPLE <loopzoneidfname>, People Count Design Level, Hourly; <loopnextzone>

<foralloccupiedzones> EnergyManagementSystem:InternalVariable, Other_Equipment_Design_Level_<loopzonevariablename>, <loopzoneidfname> Equipment gain 1, Other Equipment Design Level; <loopnextzone>

<foralloccupiedzones> EnergyManagementSystem:Sensor, People_Occupant_Count_<loopzonevariablename>, PEOPLE <loopzoneidfname>, People Occupant Count; Output:Variable, PEOPLE <loopzoneidfname>, People Occupant Count, Hourly; <loopnextzone>

EnergyManagementSystem:ProgramCallingManager, Occupancy Factor, AfterPredictorBeforeHVACManagers, OccFactor;

EnergyManagementSystem:Program, OccFactor, <foralloccupiedzones> SET fac = @RandomNormal 1 0.2 0.5 1.5, ! Mean SD LowerLimit UpperLimit SET Number_of_People_<loopzonevariablename> = facSchedule_Value_Occ_<loopzonevariablename>People_Count_Design_Level_<loopzonevariablename>, SET fac2 = @RandomNormal 1 0.2 0.5 1.5, ! Mean SD LowerLimit UpperLimit SET Power_Level_<loopzonevariablename> = fac2Schedule_Value_Eq_<loopzonevariablename>Other_Equipment_Design_Level_<loopzonevariablename>,

<loopnextzone> ! add program code ;

I was able to solve this. The key was using the <loopzoneattribute occupancyschedule=""> as the sensor Object IDF name. This caused DesignBuilder to look up the occupancy schedule for each zone. My final working code is below, which randomizes both the occupancy and the internal equipment power level.

<foralloccupiedzones>

<ForAllOccupiedZones>
EnergyManagementSystem:Sensor,
   Schedule_Value_Occ_<loopzonevariablename>,
   <loopzoneattribute occupancyschedule="">,
Schedule_Value_Occ_<LoopZoneVariableName>,
   <LoopZoneAttribute OccupancySchedule>,
   Schedule Value;
Output:Variable, <loopzoneattribute occupancyschedule="">, <LoopZoneAttribute OccupancySchedule>, Schedule Value, Hourly;
Output:Variable, <loopzoneattribute occupancyschedule="">, <LoopZoneAttribute OccupancySchedule>, Schedule Value, Daily;
<loopnextzone>

<foralloccupiedzones> <LoopNextZone> <ForAllOccupiedZones> EnergyManagementSystem:Sensor, Schedule_Value_Eq_<loopzonevariablename>, <loopzoneattribute equipmentschedule="">, Schedule_Value_Eq_<LoopZoneVariableName>, <LoopZoneAttribute EquipmentSchedule>, Schedule Value; <loopnextzone>

<foralloccupiedzones> <LoopNextZone> <ForAllOccupiedZones> EnergyManagementSystem:Actuator, Number_of_People_<loopzonevariablename>, PEOPLE <loopzoneidfname>, Number_of_People_<LoopZoneVariableName>, PEOPLE <LoopZoneIDFName>, People, Number of People; <loopnextzone>

<foralloccupiedzones> <LoopNextZone> <ForAllOccupiedZones> EnergyManagementSystem:Actuator, Power_Level_<loopzonevariablename>, <loopzoneidfname> Power_Level_<LoopZoneVariableName>, <LoopZoneIDFName> EQUIPMENT GAIN 1, OtherEquipment, Power Level; <loopnextzone>

<foralloccupiedzones> <LoopNextZone> <ForAllOccupiedZones> EnergyManagementSystem:InternalVariable, People_Count_Design_Level_<loopzonevariablename>, PEOPLE <loopzoneidfname>, People_Count_Design_Level_<LoopZoneVariableName>, PEOPLE <LoopZoneIDFName>, People Count Design Level; Output:Variable, PEOPLE <loopzoneidfname>, <LoopZoneIDFName>, People Count Design Level, Hourly; <loopnextzone>

<foralloccupiedzones> <LoopNextZone> <ForAllOccupiedZones> EnergyManagementSystem:InternalVariable, Other_Equipment_Design_Level_<loopzonevariablename>, <loopzoneidfname> Other_Equipment_Design_Level_<LoopZoneVariableName>, <LoopZoneIDFName> Equipment gain 1, Other Equipment Design Level; <loopnextzone>

<foralloccupiedzones> <LoopNextZone> <ForAllOccupiedZones> EnergyManagementSystem:Sensor, People_Occupant_Count_<loopzonevariablename>, PEOPLE <loopzoneidfname>, People_Occupant_Count_<LoopZoneVariableName>, PEOPLE <LoopZoneIDFName>, People Occupant Count; Output:Variable, PEOPLE <loopzoneidfname>, <LoopZoneIDFName>, People Occupant Count, Hourly; <loopnextzone>

<LoopNextZone> EnergyManagementSystem:ProgramCallingManager, Occupancy Factor, AfterPredictorBeforeHVACManagers, OccFactor;

OccFactor; EnergyManagementSystem:Program, OccFactor, <foralloccupiedzones> <ForAllOccupiedZones> SET fac = @RandomNormal 1 0.2 0.5 1.5, ! Mean SD LowerLimit UpperLimit SET Number_of_People_<loopzonevariablename> Number_of_People_<LoopZoneVariableName> = facSchedule_Value_Occ_<loopzonevariablename>People_Count_Design_Level_<loopzonevariablename>, fac*Schedule_Value_Occ_<LoopZoneVariableName>*People_Count_Design_Level_<LoopZoneVariableName>, SET fac2 = @RandomNormal 1 0.2 0.5 1.5, ! Mean SD LowerLimit UpperLimit SET Power_Level_<loopzonevariablename> Power_Level_<LoopZoneVariableName> = fac2Schedule_Value_Eq_<loopzonevariablename>Other_Equipment_Design_Level_<loopzonevariablename>,

<loopnextzone> fac2*Schedule_Value_Eq_<LoopZoneVariableName>*Other_Equipment_Design_Level_<LoopZoneVariableName>, <LoopNextZone> ! add program code ;

;

I was able to solve this. The key was using the <loopzoneattribute occupancyschedule=""> as the sensor Object IDF name. This caused DesignBuilder to look up the occupancy schedule for each zone. My final working code is below, which randomizes both the occupancy and the internal equipment power level.

<ForAllOccupiedZones>
EnergyManagementSystem:Sensor,
   Schedule_Value_Occ_<LoopZoneVariableName>,
   <LoopZoneAttribute OccupancySchedule>,
   Schedule Value;
Output:Variable, <LoopZoneAttribute OccupancySchedule>, Schedule Value, Hourly;
Output:Variable, <LoopZoneAttribute OccupancySchedule>, Schedule Value, Daily;
<LoopNextZone>

<ForAllOccupiedZones>
EnergyManagementSystem:Sensor,
   Schedule_Value_Eq_<LoopZoneVariableName>,
   <LoopZoneAttribute EquipmentSchedule>,
   Schedule Value;
<LoopNextZone>

<ForAllOccupiedZones>
EnergyManagementSystem:Actuator,
   Number_of_People_<LoopZoneVariableName>,
   PEOPLE <LoopZoneIDFName>,
   People,
   Number of People;
<LoopNextZone>

<ForAllOccupiedZones>
EnergyManagementSystem:Actuator,
   Power_Level_<LoopZoneVariableName>,
   <LoopZoneIDFName> EQUIPMENT GAIN 1,
   OtherEquipment,
   Power Level;
<LoopNextZone>

<ForAllOccupiedZones>
EnergyManagementSystem:InternalVariable,
   People_Count_Design_Level_<LoopZoneVariableName>,
   PEOPLE <LoopZoneIDFName>,
   People Count Design Level;
Output:Variable, PEOPLE <LoopZoneIDFName>, People Count Design Level, Hourly;
<LoopNextZone>

<ForAllOccupiedZones>
EnergyManagementSystem:InternalVariable,
   Other_Equipment_Design_Level_<LoopZoneVariableName>,
   <LoopZoneIDFName> Equipment gain 1,
   Other Equipment Design Level;
<LoopNextZone>

<ForAllOccupiedZones>
EnergyManagementSystem:Sensor,
   People_Occupant_Count_<LoopZoneVariableName>,
   PEOPLE <LoopZoneIDFName>,
   People Occupant Count;
Output:Variable, PEOPLE <LoopZoneIDFName>, People Occupant Count, Hourly;
<LoopNextZone>

EnergyManagementSystem:ProgramCallingManager,
   Occupancy Factor,
   AfterPredictorBeforeHVACManagers,
   OccFactor;

EnergyManagementSystem:Program,
   OccFactor,
<ForAllOccupiedZones>
   SET fac = @RandomNormal 1 0.2 0.5 1.5, ! Mean SD LowerLimit UpperLimit
   SET Number_of_People_<LoopZoneVariableName> = fac*Schedule_Value_Occ_<LoopZoneVariableName>*People_Count_Design_Level_<LoopZoneVariableName>,
   SET fac2 = @RandomNormal 1 0.2 0.5 1.5, ! Mean SD LowerLimit UpperLimit
   SET Power_Level_<LoopZoneVariableName> = fac2*Schedule_Value_Eq_<LoopZoneVariableName>*Other_Equipment_Design_Level_<LoopZoneVariableName>,

<LoopNextZone>
   ! add program code
   ;