EMS - load existing schedule value each timestep
I'm trying to write an EMS program that will apply a Gaussian multiplier to the occupancy value of each space at each timestep (using the EMS editor in DesignBuilder). To do this, I need the Schedule:Value for the occupancy schedule of each zone. However, in the idf, the Schedule Name is associated with the zone, and the schedule values are associated with the schedule name, so the schedule values are not a direct property of the zone. Therefore, the Sensor object will not return a schedule value when I loop over zones.
How do loop over all zones and access the occupancy Schedule Value for each zone? The code below does not run, but I thought it was the best illustration of what I was trying to accomplish. Thanks for your help.
<ForAllOccupiedZones>
EnergyManagementSystem:Sensor,
Schedule_Value,
Number of People SCHEDULE Name <LoopZoneIDFName>,
Schedule Value;
<LoopNextZone>
<ForAllOccupiedZones>
EnergyManagementSystem:Actuator,
Number_of_People_<LoopZoneVariableName>,
PEOPLE <LoopZoneIDFName>,
People,
Number of People;
<LoopNextZone>
<ForAllOccupiedZones>
EnergyManagementSystem:InternalVariable,
People_Count_Design_Level_<LoopZoneVariableName>,
PEOPLE <LoopZoneIDFName>,
People Count Design Level;
<LoopNextZone>
EnergyManagementSystem:ProgramCallingManager,
Occupancy Factor,
BeginTimestepBeforePredictor,
OccFactor;
EnergyManagementSystem:Program,
OccFactor,
<ForAllOccupiedZones>
Set Number_of_People_<LoopZoneVariableName> = Schedule_Value*People_Count_Design_Level_<LoopZoneVariableName>,
Set fac = @RandomNormal 1 0.2 0.5 1.5,
Set Number_of_People_<LoopZoneVariableName> = fac*Number_of_People_<LoopZoneVariableName>,
<LoopNextZone>
! add program code
;