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

EMS routine doesn't work

asked 2019-10-25 02:24:27 -0600

Bambo gravatar image

updated 2019-10-27 10:14:57 -0600

Hi all! I am writing to you to understand why the EMS routine I have implemented in the model doesn’t give output values. I've created all the sensors, then the actuators. In the program section I've added the routine and in the global variable I've put variables coming from the routine. In Output:variable I've created a variable with the schedule of the routine, but after that analysis ends in the excel file in the column of the schedule result are 0. The EMS code is the following:

!-   ===========  ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:SENSOR ===========

EnergyManagementSystem:Sensor,
   Tout,                    !- Name
   Environment,             !- Output:Variable or Output:Meter Index Key Name
   Site Outdoor Air Drybulb Temperature;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
   RHout,                   !- Name
   Environment,             !- Output:Variable or Output:Meter Index Key Name
   Site Outdoor Air Relative Humidity;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
   WS,                      !- Name
   Environment,             !- Output:Variable or Output:Meter Index Key Name
   Site Wind Speed;         !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
   Rain,                    !- Name
   Environment,             !- Output:Variable or Output:Meter Index Key Name
   Site Rain Status;        !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
   Tin_KXS1,                !- Name
   PianoSecondo:KXS1,       !- Output:Variable or Output:Meter Index Key Name
   Zone Mean Air Temperature;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
   RHin_KXS1,               !- Name
   PianoSecondo:KXS1,       !- Output:Variable or Output:Meter Index Key Name
   Zone Air Relative Humidity;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
   OCC_KXS1,                !- Name
   PianoSecondo:KXS1,       !- Output:Variable or Output:Meter Index Key Name
   Zone People Occupant Count;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
   Tin_LM1,                 !- Name
   PianoSecondo:LM1,        !- Output:Variable or Output:Meter Index Key Name
   Zone Mean Air Temperature;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
    RHin_LM1,                !- Name
    PianoSecondo:LM1,        !- Output:Variable or Output:Meter Index Key Name
    Zone Air Relative Humidity;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
    OCC_LM1,                 !- Name
    PianoSecondo:LM1,        !- Output:Variable or Output:Meter Index Key Name
    Zone People Occupant Count;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
    Tin_LS1,                 !- Name
    PianoSecondo:LS1,        !- Output:Variable or Output:Meter Index Key Name
    Zone Mean Air Temperature;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
    RH_LS1,                  !- Name
    PianoSecondo:LS1,        !- Output:Variable or Output:Meter Index Key Name
    Zone Air Relative Humidity;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
    OCC_LS1,                 !- Name
    PianoSecondo:LS1,        !- Output:Variable or Output:Meter Index Key Name
    Zone People Occupant Count;  !- Output:Variable or Output:Meter Name


!-   ===========  ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:ACTUATOR ===========

EnergyManagementSystem:Actuator,
    Window1_S1_act,          !- Name
    BLDG_KXS1_WINDOW1_Jones_2017_SCH,  !- Actuated Component Unique Name
    Schedule:Compact,        !- Actuated Component Type
    Schedule Value;          !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    Window2_S1_act,          !- Name
    BLDG_KXS1_WINDOW2_Jones_2017_SCH,  !- Actuated Component Unique Name
    Schedule:Compact,        !- Actuated Component Type
    Schedule Value;          !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    Window_LM1_act,          !- Name
    BLDG_LM1_WINDOW_Jones_2017_SCH,  !- Actuated Component Unique Name
    Schedule:Compact,        !- Actuated Component Type
    Schedule Value;          !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    Window_LS1_act,          !- Name
    BLDG_LS1_WINDOW_Jones_2017_SCH,  !- Actuated Component Unique Name
    Schedule:Compact,        !- Actuated Component Type
    Schedule Value;          !- Actuated Component Control Type

!-   ===========  ALL OBJECTS IN CLASS: ENERGYMANAGEMENTSYSTEM:PROGRAM ===========

EnergyManagementSystem ...
(more)
edit retag flag offensive close merge delete

Comments

How about you share your EMS code (+ Output:Variable) so we get a chance to see what's going on?

Julien Marrec gravatar imageJulien Marrec ( 2019-10-25 04:37:34 -0600 )edit

I've edited the question in order to share the EMS code + Output:Variable.

Bambo gravatar imageBambo ( 2019-10-25 05:29:35 -0600 )edit
1

I formatted it as code and took the liberty of indenting your EMS program so that it's actually readable.

Julien Marrec gravatar imageJulien Marrec ( 2019-10-25 07:10:06 -0600 )edit

Perfect! Thank you! The issue is related to the Output:Variable BLDG_KXS1_WINDOW1_Jones_2017_SCH. It seems that the code doesn't work even though I have created all the relevant sensors.

Bambo gravatar imageBambo ( 2019-10-25 07:33:33 -0600 )edit
1

This EMS code is only for the programs, could you also include the code lines where the sensors and actuators are defined? Also, are you sure that BLDG_KXS1_WINDOW1_Jones_2017_SCH is a schedule object created in the model?

Aaron Boranian gravatar imageAaron Boranian ( 2019-10-25 12:38:09 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2019-10-28 15:57:43 -0600

tl;dr -- You should replace "Window1_KXS1_act" with "Window1_S1_act".

I think the issue is that you have a mismatch of EMS:Actuator names. Here is what I have gathered from your EMS code:

  • The schedule that you are trying to change is named BLDG_KXS1_WINDOW1_Jones_2017_SCH
  • The EMS:Actuator object changing that schedule is named Window1_S1_act
  • Window1_S1_act only appears in Line 1 of the EMS:Program object named Window_Jones_2017 (set Wind_Cur_State=Window1_S1_act, !- Program Line 1).
  • Later lines in the same EMS:Program object are using if/else logic to set 0 or 1 to Window1_KXS1_act -- a slightly different name that has an extra "KX" compared to the original EMS:Actuator created.

In short, you are never actually overriding the schedule value because the EMS:Actuator name isn't entered correctly in EMS:Program lines. You should replace "Window1_KXS1_act" with "Window1_S1_act", and that should fix it.

edit flag offensive delete link more

Comments

Thank you for the answer, I really appreciate your interest! I've tried to change the name of the actuator, but unfortunately results are still equal to 0. I think that the problem should be the schedule value, because it is On/Off for all days until 24 through 12/31 equal to 0, so even if the program overrides the schedule value nothing will change. So the question is: is the variable the right one? Or maybe should I evaluate the action of the window through another variable?

Bambo gravatar imageBambo ( 2019-10-29 06:25:48 -0600 )edit

Yes, the schedule value output variable is the correct one to use. Even though the schedule is originally a constant 0, the actuator should override it. Looking at the EMS:Program, you want to set the schedule value to 1 depending on 3 variables: OCC_KXS1, handle and R. OCC_KXS1 is a sensor for zone people occupant count, which you already have an output variable for. I would recommend adding output variables for handle and R to confirm that they match your expectations. This will require EMS:OutputVariable objects for handle and R since they are local EMS:Program variables.

Aaron Boranian gravatar imageAaron Boranian ( 2019-10-29 10:21:46 -0600 )edit

Perfectly clear, I was doubting about the variable because I've tried to turn the schedule value from 0 to 1 and in the output all the results were 1. It seems that the routine does not consider the schedule.

Bambo gravatar imageBambo ( 2019-10-29 12:57:46 -0600 )edit

Your Answer

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

Add Answer

 



Question Tools

2 followers

Stats

Asked: 2019-10-25 02:24:27 -0600

Seen: 485 times

Last updated: Oct 28