Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
0

EMS control is off by one hour

asked 2023-12-10 01:52:43 -0600

Keigo's avatar

updated 2024-03-13 21:26:13 -0600

A bug report. I've been aware of it for a long time. Now I posted just because I have time to do so.

When we try to control actuated components in AirLoop and PlantLoop with the built-In Unique Variable "Hour" by EMS, the components are controlled one hour later than the "Hour" we specify.

I reprodued the bug with an ExampleFile 5ZoneCAV_MaxTemp.idf (Any ExampleFiles are fine). The idf file is here (V23-2-0). I added EMS to override Fan Air Mass Flow Rate of Supply Fan 1 as follows.

Fan:VariableVolume,
    Supply Fan 1,            !- Name
    FanAvailSched,           !- Availability Schedule Name
    0.7,                     !- Fan Total Efficiency
    600.0,                   !- Pressure Rise {Pa}
    autosize,                !- Maximum Flow Rate {m3/s}
    Fraction,                !- Fan Power Minimum Flow Rate Input Method
    0.25,                    !- Fan Power Minimum Flow Fraction
    ,                        !- Fan Power Minimum Air Flow Rate {m3/s}
    0.9,                     !- Motor Efficiency
    1.0,                     !- Motor In Airstream Fraction
    0.35071223,              !- Fan Power Coefficient 1
    0.30850535,              !- Fan Power Coefficient 2
    -0.54137364,             !- Fan Power Coefficient 3
    0.87198823,              !- Fan Power Coefficient 4
    0.000,                   !- Fan Power Coefficient 5
    Main Heating Coil 1 Outlet Node,  !- Air Inlet Node Name
    VAV Sys 1 Outlet Node;   !- Air Outlet Node Name

EnergyManagementSystem:Actuator,
    Fan_Flow,                !- Name
    Supply Fan 1,            !- Actuated Component Unique Name
    Fan,                     !- Actuated Component Type
    Fan Air Mass Flow Rate;  !- Actuated Component Control Type

EnergyManagementSystem:ProgramCallingManager,
    EMS_PCM_Fan_Flow,        !- Name
    InsideHVACSystemIterationLoop,  !- EnergyPlus Model Calling Point
    EMS_Program_Fan_Flow;    !- Program Name 1

EnergyManagementSystem:Program,
    EMS_Program_Fan_Flow,    !- Name
    IF (Hour >10) && (Hour <= 15),  !- Program Line 1
    SET Fan_Flow = 0,        !- Program Line 2
    ELSE,                    !- A4
    SET Fan_Flow = 0.480944716911248,  !- A5
    ENDIF;                   !- A6

TimeStep is set to 6. The original Fan Availability Schedule is 1 for 24h a day from Jan to Mar. Fan Air Mass Flow Rate of Supply Fan 1 is supposed to be 0 kg/s from 10:10:00 to 15:00:00 aftter I added EMS above. However, the simulation result shows that it is 0 kg/s from 11:10:00 to 16:00:00.

image description

The bug occurs in other actuated components in AirLoop and PlantLoop as well such as Pumps. I haven't tested all the Calling Points, but InsideHVACSystemIterationLoop is often used to control HVAC systems, and the "Hour" specification in that calling point should be correctly simulated as entered by users.


Addendum

@Aaron Boranian, please let me show you another example. An ExampleFile EMSCustomSchedule.idf overrides Cooling Setpoint Temperature Schedule in ThermostatSetpoint:DualSetpoint as follows.

EnergyManagementSystem:Actuator,
    myCLGSETP_SCH_Override,  !- Name
    CLGSETP_SCH,             !- Actuated Component Unique Name
    Schedule:Constant,       !- Actuated Component Type
    Schedule Value;          !- Actuated Component Control Type

EnergyManagementSystem:ProgramCallingManager,
    My Setpoint Schedule Calculator Example,  !- Name
    InsideHVACSystemIterationLoop,  !- EnergyPlus Model Calling Point
    MyComputedCoolingSetpointProg,  !- Program Name 1

EnergyManagementSystem:Program,
    MyComputedCoolingSetpointProg,  !- Name
    IF (DayOfWeek == 1),     !- Program Line 1
    Set myCLGSETP_SCH_Override = 30.0,  !- Program Line 2
    ELSEIF (Holiday == 3.0) && (DayOfMonth == 21) && (Month == 1),  !- A4
    Set myCLGSETP_SCH_Override = 30.0,  !- A5
    ELSEIF HOUR < 6,         !- A6
    Set myCLGSETP_SCH_Override = 30.0,  !- A7
    ELSEIF (Hour >= 6) && (Hour < 22)  && (DayOfWeek >=2) && (DayOfWeek < ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2023-12-10 08:24:36 -0600

I believe that this is not a bug and correct behavior. Looking at the EMS Application Guide section for Built-In Variables, the table shows the value ranges of the Hour variable are 0-23. This means:

  • Hour = 0 from 12 AM - 1 AM
  • Hour = 1 from 1 AM - 2 AM ...
  • Hour = 10 from 10 AM - 11 AM

If you want to apply a specific flow rate from 10:10:00 to 15:00:00, then you should update the first IF line of your EMS program from

IF (Hour >10) && (Hour <= 15),  !- Program Line 1

to

IF (Hour >9) && (Hour <= 14),  !- Program Line 1
edit flag offensive delete link more

Comments

Or should I use CurrentTime rather than Hour?

Keigo's avatar Keigo  ( 2023-12-10 08:50:42 -0600 )edit

I updated my Question.

Keigo's avatar Keigo  ( 2023-12-10 10:34:11 -0600 )edit

@Keigo sorry for the slow reply.

ELSEIF HOUR < 6,         !- A6
Set myCLGSETP_SCH_Override = 30.0,  !- A7

This line in your second example from the update will be applied for hours 0-5, or from 12 AM - 6 AM. So, I believe your EMS program is behaving correctly according to the way that you defined the if/else logic.

ELSEIF (Hour >= 6) && (Hour < 22)  && (DayOfWeek >=2) && (DayOfWeek <=6),  !- A8
Set myCLGSETP_SCH_Override = 24.0,  !- A9

Same here, Hour >= 6 equates to anything after 6 AM.

Aaron Boranian's avatar Aaron Boranian  ( 2024-03-13 12:23:31 -0600 )edit

@Aaron Boranian Thank you for your reply. I misunderstood. Yes, both the first example and the second example work correctly as intended.

To summarise using 6AM as an example, when Timestep = 6,

Hour < 6 is until 06:00.

Hour <= 6 is until 07:00.

Hour == 6 is from 06:10 until 07:00.

Hour >= 6 is from 06:10.

Hour > 6 is from 07:10.

Personally, Hour in EMS is not intuitive. I will use CurrentTime from now on to avoid mistakes.

Keigo's avatar Keigo  ( 2024-03-13 21:17:35 -0600 )edit

@Keigo yes, that is correct.

Sure, CurrentTime going from 0.0 - 24.0, allowing you to account for sub-hourly timesteps, might be a better built-in variable for EMS programs.

Aaron Boranian's avatar Aaron Boranian  ( 2024-03-14 15:42:45 -0600 )edit

Your Answer

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

Add Answer

Training Workshops

Careers

Question Tools

1 follower

Stats

Asked: 2023-12-10 01:52:43 -0600

Seen: 82 times

Last updated: Dec 10 '23