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

EMS - load existing schedule value each timestep

asked 2019-11-08 08:17:10 -0500

mdedoes gravatar image

updated 2020-03-03 11:53:27 -0500

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
    ;
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2020-04-16 14:40:38 -0500

mdedoes gravatar image

updated 2020-04-16 14:43:43 -0500

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
   ;
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

 

Question Tools

1 follower

Stats

Asked: 2019-11-08 08:17:10 -0500

Seen: 270 times

Last updated: Apr 16 '20