Application Guide for EMS — EnergyPlus 9.2

<< Prev | Table of Contents | Next >>

Example 1. Whole-Building Average Zone Air Temperature[LINK]

Problem Statement[LINK]

Although EnergyPlus can report an enormous number of output variables, you may want a custom report variable such as one for the average temperature in the building. Only zone-by-zone indoor air temperatures are available. Because it is nearly always important to check that models are properly controlling zone air conditions, you may need to examine air temperature results from your models. Compared to scanning across the many zones in a large building, you could save time when checking a model if you have a single value for a whole-building average temperature. Of course, you could calculate such a value after a run by postprocessing, but redoing this for every run is cumbersome and time consuming. Therefore, it would be more convenient to automatically calculate such a value inside the program and output it in the usual manner. For example, if we take the Small Office Reference Building (RefBldgSmallOfficeNew2004_Chicago.idf), is there a way to create a custom report variable that provides a weighted average for the indoor temperature of all the occupied zones in a model?

EMS Design Discussion[LINK]

This is a fairly simple example in that the EMS controls nothing. There are no actuators.

The example file has six zones, but one is an attic that we do not care about. Therefore, the main inputs, or EMS sensors, will be the zone air temperatures for the five occupied zones. We will use EnergyManagementSystem:Sensor objects to obtain the values for the air temperatures by mapping to the output variable called “Zone Mean Air Temperature."

A model for average temperature can be constructed by using the zone air volumes as weights so larger zones have more influence than smaller zones on the resulting average. The model equation we will implement in EMS for our new report variable is

Taverage=(TzoneVolzone)(Volzone)

The example file specifies the zone volume in its zone objects so we have the data needed for the weighting factors from elsewhere in the IDF. However, a study could vary the geometry such that the volumes differ from one simulation to another. Zone Air Volume is available as internal data, so we will use EnergyManagementSystem:InternalVariable input objects to assign these weighting factors into global Erl variables. If we did not know beforehand that Zone Air Volume was an available internal variable, we would have had to prerun the model with some EMS-related objects and the appropriate level of reporting selected in an Output:EnergyManagementSystem object, and then studied the EDD output file. Note that the EDD file is only produced if you have EMS/Erl programs in your input file.

The custom output variable will be defined by using an EnergyManagementSystem:OutputVariable input object. This requires the Erl variable to be global, so we need to declare a variable. Let’s call it AverageBuildingTemp, to be global using an EnergyManagementSystem:GlobalVariable object so we have a way to connect the result calculated in the Erl program to the custom output.

There are two main considerations when selecting an EMS calling point:

  • The call should be toward the end of the zone timestep so the zone air temperature calculations are finalized.

  • The call should be before reporting updates so our new value is available before the reporting is finalized.

We therefore choose the EMS calling point with the key of “EndOfZoneTimestepBeforeReporting.”

EMS Input Objects[LINK]

A set of input objects to solve this problem appears below and is included in the example file called “EMSCustomOutputVariable.idf.”

EnergyManagementSystem:Sensor,
     T1, !Name
     Perimeter_ZN_1 ,! Output:Variable or Output:Meter Index Key Name
     Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name


   EnergyManagementSystem:Sensor,
     T2, !Name
     Perimeter_ZN_2 , ! Output:Variable or Output:Meter Index Key Name
     Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name


   EnergyManagementSystem:Sensor,
     T3, !Name
     Perimeter_ZN_3 , ! Output:Variable or Output:Meter Index Key Name
     Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name


   EnergyManagementSystem:Sensor,
     T4, !Name
     Perimeter_ZN_4, ! Output:Variable or Output:Meter Index Key Name
     Zone Mean Air Temperature ;! Output:Variable or Output:Meter Name


   EnergyManagementSystem:Sensor,
     T5, !Name
     Core_ZN , ! Output:Variable or Output:Meter Index Key Name
     Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name


   EnergyManagementSystem:ProgramCallingManager,
     Average Building Temperature , ! Name
     EndOfZoneTimestepBeforeZoneReporting , ! EnergyPlus Model Calling Point
     AverageZoneTemps ; ! Program Name 1


   EnergyManagementSystem:GlobalVariable,
     AverageBuildingTemp;


   EnergyManagementSystem:OutputVariable,
     Weighted Average Building Zone Air Temperature [C], ! Name
     AverageBuildingTemp, ! EMS Variable Name
     Averaged, ! Type of Data in Variable
     ZoneTimeStep ; ! Update Frequency


   EnergyManagementSystem:InternalVariable,
     Zn1vol,
     Perimeter_ZN_1,
     Zone Air Volume;


   EnergyManagementSystem:InternalVariable,
     Zn2vol,
     Perimeter_ZN_2,
     Zone Air Volume;


   EnergyManagementSystem:InternalVariable,
     Zn3vol,
     Perimeter_ZN_3,
     Zone Air Volume;


   EnergyManagementSystem:InternalVariable,
     Zn4vol,
     Perimeter_ZN_4,
     Zone Air Volume;


   EnergyManagementSystem:InternalVariable,
     Zn5vol,
     Core_ZN ,
     Zone Air Volume;


   EnergyManagementSystem:Program,
     AverageZoneTemps , ! Name
     SET SumNumerator = T1*Zn1vol + T2*Zn2vol + T3*Zn3vol + T4*Zn4vol + T5*Zn5vol,
     SET SumDenominator = Zn1vol + Zn2vol + Zn3vol + Zn4vol + Zn5vol,
     SET AverageBuildingTemp = SumNumerator / SumDenominator;


   Output:EnergyManagementSystem,
     Verbose,
     Verbose,
     Verbose;


   Output:Variable,
     *,                       !- Key Value
     Weighted Average Building Zone Air Temperature,  !- Variable Name
     timestep;                  !- Reporting Frequency