First time here? Check out the Help page!
1 | initial version |
TL;DR Use the @TrendSum
trend variable function to sum up temperatures from now to different periods in the past and subtract the sums from more recent periods to calculate "in the past" averages.
If all three average temperatures focus on the same parameter (outside temperature), then you can use the @TrendSum
EMS trend variable function to get the sum from now to different points in the past. Borrowing the example from this post:
EnergyManagementSystem:Sensor,
OAT_sensor, !- Name
OutdoorAirNodeName, !- Output:Variable or Output:Meter Index Key Name
System Node Temperature; !- Output:Variable or Output:Meter Name
EnergyManagementSystem:TrendVariable,
Trend_24hr, !- Name
OAT_sensor, !- EMS Variable Name
24; !- Number of Timesteps to be logged
EnergyManagementSystem:TrendVariable,
Trend_48hr, !- Name
OAT_sensor, !- EMS Variable Name
48; !- Number of Timesteps to be logged
EnergyManagementSystem:TrendVariable,
Trend_72hr, !- Name
OAT_sensor, !- EMS Variable Name
72; !- Number of Timesteps to be logged
This is assuming that you're using hourly timesteps, if it's a different timestep frequency you'll need to update the last Number of Timesteps to be logged input fields for each EnergyManagementSystem:TrendVariable
objects above.
Then in the EMS program sum each trend variable over the total number of time steps they have logged the sensor data.
EnergyManagementSystem:Program,
SET T_24hr = @TrendSum Trend_24hr 24, !- sum of temp over last 24 hours
SET T_48hr = @TrendSum Trend_48hr 48, !- sum of temp over last 48 hours
SET T_72hr = @TrendSum Trend_72hr 72, !- sum of temp over last 72 hours
Then, to get the average over just the 24-hour period you want, subtract the appropriate temperature variables from the program lines above and divide by the number of timesteps that have been logged.
SET T_today = T_24hr / 24, !- Divide sum by 24 hour timesteps to calculate average over last 24 hours
SET T_yesterday = (T_48hr - T_24hr) / 24, !- Calculate average over past 25 to 48 hours
SET T_day_before_yesterday = (T_72hr - T_48hr) / 24; !- Calculate average over past 49 to 72 hours
You could also use the ZoneTimeStep
built-in variable within your program to automate the number of timesteps that the trend variables are logging and the numerators used to calculate the averages. I don't believe that this built-in variable could be used for the Number of Timesteps to be logged input fields of the EnergyManagementSystem:TrendVariable
objects.