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

Temperature control and CO2 control (EMS SCRIPT) not working together for Natural Ventilation

asked 2024-03-13 05:40:20 -0500

Adarsh's avatar

updated 2024-03-13 09:28:59 -0500

Hello,

I was previously trying to figure out the CO2 EMS code which I was able to get working. Essentially, I want my model to access the Natural Ventilation with the Temperature control and CO2 sensors together. But, the results I've noticed is that with the CO2 EMS script, the temperature control has been disregarded. I've tried to include both temperature control and CO2 sensors in my script but havent had any luck.

CO2 Control

EnergyManagementSystem:Program,
    CO2_Sensor09,            !- Name
    IF EMS_CO2_Sensor07 > 800,  !- Program Line 1
    SET OpenFactor09 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor09 = 0.0,  !- A5
    ENDIF ;

Temp Control

EnergyManagementSystem:Program,
    Temp_Program02,            !- Name
    IF Temperature_Sensor01 > 23,  !- Program Line 1
    SET Temp_OpenFactor01 = 1.0, !- Program Line 2
    ELSE,  !- A4
    SET Temp_OpenFactor01 = 0.0,  !- A5
    ENDIF ;  !- A6

EMS control with both Temperature and CO2. This does not work, maybe due to an error in my EMS sensor script below. I had to seperate the Output variables as it would not work when "Zone Air CO2 Conc" and "Zone Air Mean Temperature" Ran together.

EnergyManagementSystem:Sensor,
    EMS_CO2_Sensor09,        !- Name
    SecondFloorStudy,  !- Output:Variable or Output:Meter Index Key Name
    Zone Air CO2 Concentration;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Sensor,
    Temperature_Sensor01,        !- Name
    AtticBedroom-cutout,  !- Output:Variable or Output:Meter Index Key Name
    Zone Mean Air Temperature;  !- Output:Variable or Output:Meter Name

EnergyManagementSystem:Actuator,
    OpenFactor01,            !- Name
    Window_4_Opening,  !- Actuated Component Unique Name
    Zone Ventilation,        !- Actuated Component Type
    Air Exchange Flow Rate;  !- Actuated Component Control Type

EnergyManagementSystem:Program,
    CO2_Sensor09,            !- Name
    IF EMS_CO2_Sensor07 > 800,  !- Program Line 1
    AND Temperature_Sensor07 > 26, !- Program Line 2
    SET OpenFactor09 = 1.0,  !- A4
    ELSE,                    !- A5
    SET OpenFactor09 = 0.0,  !- A6
    ENDIF ;                  !- A7

This is the error I get when I run the above script

1.    ** Severe  ** Errors found parsing EMS Runtime Language program or subroutine = CO2_SENSOR01

Can anyone help me figure out the script that could include both temperature and CO2 control?

Cheers, Adarsh

edit retag flag offensive close merge delete

Comments

For reference, here's a link to the original post by @Adarsh

Aaron Boranian's avatar Aaron Boranian  ( 2024-03-13 09:28:45 -0500 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2024-03-13 09:45:29 -0500

You can't have an EMS line that starts with AND. The EMS program should be:

  EnergyManagementSystem:Program,
    CO2_Sensor09,
    IF (EMS_CO2_Sensor07 > 800) && (Temperature_Sensor07 > 26),
      SET OpenFactor09 = 1.0,
    ELSE,
      SET OpenFactor09 = 0.0,
    ENDIF;

Or another way to write it would be:

  EnergyManagementSystem:Program,
    CO2_Sensor09,
    SET OpenFactor09 = 0.0
    IF EMS_CO2_Sensor07 > 800,
      IF Temperature_Sensor07 > 26,
        SET OpenFactor09 = 1.0,
      ENDIF,
    ENDIF;
edit flag offensive delete link more

Comments

Hey @shorowit

Thank you ! Following your input, I just had to set an OR function instead of AND and it works out well.

The working script;

EnergyManagementSystem:Program,
    CO2_Sensor10,            !- Name
    IF (EMS_CO2_Sensor08 > 1000) || (Temperature_Sensor08 >= 23),  !- Program Line 1
    SET OpenFactor10 = 1.0, !- Program Line 2
    ELSE,  !- A4
    SET OpenFactor10 = 0.0,  !- A5
    ENDIF;  !- A6

Cheers, Adarsh

Adarsh's avatar Adarsh  ( 2024-03-14 05:09:34 -0500 )edit

Ah, right. Glad you got it working. I only used AND because you had that in your original program and I’d didn’t think too hard about it. :-)

shorowit's avatar shorowit  ( 2024-03-14 08:33:39 -0500 )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: 2024-03-13 05:40:20 -0500

Seen: 101 times

Last updated: Mar 13