## Application Guide for EMS — EnergyPlus 8.8

### Application Guide for EMS

The traditional way of modeling supervisory control of HVAC systems in EnergyPlus is to use SetpointManagers and AvailabilityManagers. To gain experience with EMS, we should ask, Is there a way to take a model such as the Large Office Reference Building (RefBldgLargeOfficeNew2004_Chicago.idf) and replicate the traditional HVAC managers by using only the EMS?

A review of the example file shows that three types of traditional HVAC managers are being used: scheduled setpoints, mixed air setpoints, and night cycle availability. We will discuss these separately.

The input object SetpointManager:Scheduled functions by placing a setpoint value on a specified node based on the value in a schedule. Therefore, our EMS program will do the same. First we will need to access the schedule. In this example, a schedule called Seasonal-Reset-Supply-Air-Temp-Sch contains the temperature values desired for the air system’s supply deck. We use an EnergyManagementSystem:Sensor object based on the output variable called “Schedule Value” to fill schedule values into an Erl variable called Seasonal_Reset_SAT_Sched. Once we have the sensor and actuator setup, putting the setpoint on the node involves a single line of Erl code, “SET VAV_1_SAT_setpoint = Seasonal_Reset_SAT_Sched.”

The input object SetpointManager:Mixed air functions by placing a setpoint value on a specified node based on the value of the setpoint at another node and the temperature rise across the fan. The temperature rise is found by taking the temperature at the fan outlet node and subtracting the temperature at the fan inlet node. The EMS needs two additional sensors to obtain these temperatures, which are set up by using a pair EnergyManagementSystem:Sensor objects. The example file has three mixed air setpoint managers that place setpoints on the outlet of the outdoor air mixer, the outlet of the cooling coil, and the outlet of the heating coil. Therefore, we need three actuators to place setpoints at these three nodes, which are set up using three EnergyManagementSystem:Actuator objects. Each mixed air setpoint calculation is a simple single-line of program code such as “SET VAV_1_CoolC_Setpoint = Seasonal_Reset_SAT_Sched - (T_VAV1FanOut - T_VAV1FanIn).”

The input object AvailabilityManager:NightCycle functions by monitoring zone temperature and starting up the air system (if needed) to keep the building within the thermostat range. The sensors here are the zone air temperatures, which are set up by using EnergyManagementSystem:Sensor objects in the same way as for Example 1. We will need one zone temperature sensor for each zone that is served by the air system so we can emulate the “CycleOnAny” model being used. The other sensors we need are the desired zone temperatures used by the thermostat. We access these temperatures directly from the schedules (HTGSETP_SCH and CLGSETP_SCH in the example) by using EnergyManagementSystem:Sensor objects. To control the air system’s operation status, we use an EnergyManagementSystem:Actuator object that is assigned to an “AirLoopHVAC” component type using the control variable called “Availability Status.” EnergyPlus recognizes four availability states that control the behavior of the air system. Inside EnergyPlus these are integers, but EMS has only real-valued variables, so we will use the following whole numbers:

• NoAction = 0.0

• ForceOff = 1.0

• CycleOn = 2.0

• CycleOnZoneFansOnly = 3.0.

The traditional AvailabilityManager:NightCycle object operates by turning on the system for a prescribed amount of time (1800 seconds in the example file), and then turning it off for the same amount of time. You should be able to model this starting and stopping in EMS by using Trend variables to record the history of the actions. However, this cycling is not necessarily how real buildings are operated, and for this example we do not try to precisely emulate the traditional EnergyPlus night cycle manager. Rather, we use a simpler temperature-based control to start and stop the air system for the night cycle. The algorithm first assumes an offset tolerance of 0.83°C and calculates limits for when heating should turn on and off and when cooling should turn on and off. It then finds the maximum and minimum zone temperatures for all the zones attached to the air system. These use the @Max and @Min built-in functions, which take on two operators at a time. Then a series of logic statements is used to compare temperatures and decide what the availability status of the air system should be.

EMS examples are provided for the three types of traditional HVAC managers. The full set to run with no traditional managers is provided in the example file “EMSReplaceTraditionalManagers_LargeOffice.idf.”

Example input objects that replicate a scheduled setpoint manager using EMS follow.

EnergyManagementSystem:Sensor,
Seasonal_Reset_SAT_Sched, !Name
Seasonal-Reset-Supply-Air-Temp-Sch , ! Output:Variable Index Key Name
Schedule Value;   ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Actuator,
VAV_1_SAT_setpoint,                ! Name
VAV_1 Supply Equipment Outlet Node,      ! Component Name
System Node Setpoint,              ! Component Type
Temperature Setpoint;              ! Control Variable

EnergyManagementSystem:Program,
VAV_1_SchedSetpoint , ! Name
SET VAV_1_SAT_setpoint = Seasonal_Reset_SAT_Sched;

Example input objects that replicate a mixed air setpoint manager using EMS follow.
EnergyManagementSystem:Sensor,
T_VAV1FanIn, !Name
VAV_1_HeatC-VAV_1_FanNode , ! Output:Variable Key Name
System Node Temperature; ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
T_VAV1FanOut, !Name
VAV_1 Supply Equipment Outlet Node, ! Output:Variable Index Key Name
System Node Temperature ; ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Actuator,
VAV_1_CoolC_Setpoint,            ! Name
VAV_1_CoolC-VAV_1_HeatCNode ,    ! Component Name
System Node Setpoint,            ! Component Type
Temperature Setpoint;            ! Control Variable

EnergyManagementSystem:Actuator,
VAV_1_HeatC_Setpoint,                            ! Name
VAV_1_HeatC-VAV_1_FanNode ,                  ! Component Name
System Node Setpoint,                          ! Component Type
Temperature Setpoint;            ! Control Variable

EnergyManagementSystem:Actuator,
VAV_1_OA_Setpoint,                            ! Name
VAV_1_OA-VAV_1_CoolCNode ,                  ! Component Name
System Node Setpoint,                          ! Component Type
Temperature Setpoint;            ! Control Variable

EnergyManagementSystem:Program,
VAV1MixedAirManagers , ! Name
SET VAV_1_CoolC_Setpoint = Seasonal_Reset_SAT_Sched - ( T_VAV1FanOut - T_VAV1FanIn),
SET VAV_1_HeatC_Setpoint = Seasonal_Reset_SAT_Sched - ( T_VAV1FanOut - T_VAV1FanIn),
SET VAV_1_OA_Setpoint = Seasonal_Reset_SAT_Sched - ( T_VAV1FanOut - T_VAV1FanIn);

Example input objects for a night cycle availability manager follow.
EnergyManagementSystem:Actuator,
VAV_1_NightCycleStatus,   ! Name
VAV_1,                    ! Component Name
AirLoopHVAC,              ! Component Type
Availability Status;      ! Control Variable

EnergyManagementSystem:Sensor,
heating_setpoint,                  ! Name
HTGSETP_SCH ,         ! Output:Variable or Output:Meter Index Key Name
Schedule Value ; ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
cooling_setpoint,                  ! Name
CLGSETP_SCH ,         ! Output:Variable or Output:Meter Index Key Name
Schedule Value ; ! Output:Variable or Output:Meter Name

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

EnergyManagementSystem:Sensor,
TzoneVAV1_2,                  ! Name
Perimeter_bot_ZN_3 ,         ! Output:Variable Key Name
Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
TzoneVAV1_3,                  ! Name
Perimeter_bot_ZN_2 ,         ! Output:Variable Key Name
Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
TzoneVAV1_4,                  ! Name
Perimeter_bot_ZN_1 ,         ! Output:Variable Key Name
Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
TzoneVAV1_5,                  ! Name
Perimeter_bot_ZN_4 ,         ! Output:Variable Key Name
Zone Mean Air Temperature ; ! Output:Variable or Output:Meter Name

EnergyManagementSystem:Program,
VAV_1_NightCycleMGR , ! Name
SET Toffset = 0.8333  ,  ! 1.5F
SET NoAction = 0.0 ,
SET ForceOff = 1.0 ,
SET CycleOn = 2.0 ,
SET CycleOnZoneFansOnly = 3.0 ,
SET VAV1_heating_TurnOn  = heating_setpoint - Toffset ,
SET VAV1_heating_TurnOff = heating_setpoint + Toffset ,
SET VAV1_cooling_TurnOn  = cooling_setpoint + Toffset ,
SET VAV1_cooling_TurnOff = cooling_setpoint - Toffset ,
! find max and min for "cycleOnAny" operation
SET Tmin = @MIN TzoneVAV1_1 TzoneVAV1_2  ,
SET Tmin = @MIN Tmin        TzoneVAV1_3  ,
SET Tmin = @MIN Tmin        TzoneVAV1_4  ,
SET Tmin = @MIN Tmin        TzoneVAV1_5  ,
SET Tmax = @MAX TzoneVAV1_1 TzoneVAV1_2  ,
SET Tmax = @MAX Tmax        TzoneVAV1_3  ,
SET Tmax = @MAX Tmax        TzoneVAV1_4  ,
SET Tmax = @MAX Tmax        TzoneVAV1_5  ,
IF Tmin < VAV1_heating_TurnOn ,
SET VAV_1_NightCycleStatus = CycleOn,
RETURN,  ! need to exit early or cooling check could also trigger
ELSEIF Tmin > VAV1_heating_TurnOff,
SET VAV_1_NightCycleStatus = NoAction,
ENDIF,
IF Tmax > VAV1_cooling_TurnOn,
SET VAV_1_NightCycleStatus = CycleOn,
ELSEIF Tmax < VAV1_cooling_TurnOff,
SET VAV_1_NightCycleStatus = NoAction   ,
ENDIF;