Writing CO2 sensors into the Window Opening Component

Hey everyone,

I’m currently trying to validate a residential module with CO2 sensor-operated natural ventilation and without any mechanical ventilation. I’ve tried to work on the Honeybee Ventilation Control code to see if I can incorporate the CO2 setpoints along with the existing temperature setpoint.

I’m new to coding so my question is, using the VentilationControl template from the honeybee_energy.ventcool.control library, is there a workable way to add CO2 setpoints?
I’ve realised that if I want to use CO2 values, I need the template used by Window Opening to also have the option of CO2 setpoints already written into the code.

If anyone has an idea about this, I would appreciate some help.

Warm regards.

Hi @Adarsh! if I’m not mistaken you may want to use energyplus EMS for this.
here is an example that uses humidity to control window opening, it hopefully shouldn’t take too much to change out to get the example to using CO2 I think.

hopefully that is helpful
-trevor

1 Like

Hey @TrevorFedyna,

This seems to be similar to what I’m looking for, I believe that with some tweaks, I should be able to achieve the CO2 setpoints.
Unfortunately, I’m not familiar with EMS and/or working with the IDF editor.
If you have some experience with EMS, can you maybe tell me if, using this code on the IDF editor is the right way to do it?
I’m unsure if the process is straightforward.

Thanks in Advance

Cheers,
Adarsh

Hi @Adarsh personally I use a text editor like vs code to edit the idf file manually rather than using the IDF editor (I’ve not spent a ton of time with the IDF editor in general).

In the energyplus directory: EnergyPlus-23.2\ExampleFiles folder
there are a number example idf’s with more than a few handfulls containing EMS for reference, and here is the link to the Table of Contents: Application Guide for EMS — EnergyPlus 23.2.

1 Like

Hey @TrevorFedyna,

Your comments have been really helpful.
I was finally able to figure out the script for EMS (CO2 sensors).
However, I’ve encountered certain errors which I’m not able to decode. It has to do with the Actuator Unique name and the Actuator Control type.

* Severe  ** Invalid Actuated Component Control Type =NATVENT OPENING EFFECTIVENESS
   **   ~~~   ** Entered in EnergyManagementSystem:Actuator=OPENFACTOR03
   **   ~~~   ** Control Type not found
   **   ~~~   ** Use Output:EnergyManagementSystem object to create .edd file for valid component control types.
   ** Severe  ** Invalid Actuated Component Type =ZONEVENTILATION:WINDANDSTACKOPENAREA
   **   ~~~   ** Entered in EnergyManagementSystem:Actuator=OPENFACTOR04
   **   ~~~   ** Component Type not found
   **   ~~~   ** Use Output:EnergyManagementSystem object to create .edd file for valid component types.
   ** Severe  ** Invalid Actuated Component Unique Name =WINDOW_3_8434952D_OPENING
   **   ~~~   ** Entered in EnergyManagementSystem:Actuator=OPENFACTOR04
   **   ~~~   ** Component Unique key name not found 
   **   ~~~   ** Use Output:EnergyManagementSystem object to create .edd file for valid component names.
   ** Severe  ** Invalid Actuated Component Control Type =NATVENT OPENING EFFECTIVENESS
   **   ~~~   ** Entered in EnergyManagementSystem:Actuator=OPENFACTOR04
   **   ~~~   ** Control Type not found
   **   ~~~   ** Use Output:EnergyManagementSystem object to create .edd file for valid component control types.
   ** Severe  ** Invalid Actuated Component Type =ZONEVENTILATION:WINDANDSTACKOPENAREA
   **   ~~~   ** Entered in EnergyManagementSystem:Actuator=OPENFACTOR05
   **   ~~~   ** Component Type not found

The above is a part of the error. It is recurring for all my input windows. I’m sure that the fix could be as easy as changing the name of the control units.
But, that is what I couldn’t figure out yet.

The EMS script as below-

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

EnergyManagementSystem:Sensor,
    EMS_CO2_Sensor01,        !- Name
    AtticBedroom-cutout_86b9b809,  !- Output:Variable or Output:Meter Index Key Name
    Zone Air CO2 Concentration;  !- Output:Variable or Output:Meter Name

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

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

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

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

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

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

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

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


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

EnergyManagementSystem:Actuator,
    OpenFactor01,            !- Name
    Window_4_41d06319_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor02,            !- Name
    Window_8_2ef770f0_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor03,            !- Name
    Window_9_55eee64c_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor04,            !- Name
    Window_3_8434952d_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor05,            !- Name
    Window_2_0e3f0653_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor06,            !- Name
    Window_1_001eb33a_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor07,            !- Name
    Window_6_82509380_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor08,            !- Name
    Window_7_04f3642d_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor09,            !- Name
    Window_5_08bd986a_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor10,            !- Name
    Window_11_5d1d3891_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type

EnergyManagementSystem:Actuator,
    OpenFactor11,            !- Name
    Window_10_e72cd52b_Opening,  !- Actuated Component Unique Name
    ZoneVentilation:WindandStackOpenArea,  !- Actuated Component Type
    NatVent Opening Effectiveness;  !- Actuated Component Control Type


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

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control01,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor01;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control02,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor02;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control03,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor03;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control04,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor04;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control05,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor05;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control06,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor06;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control07,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor07;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control08,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor08;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control09,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor09;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control10,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor10;            !- Program Name 1

EnergyManagementSystem:ProgramCallingManager,
    CO2 Control11,           !- Name
    BeginTimestepBeforePredictor,  !- EnergyPlus Model Calling Point
    CO2_Sensor11;            !- Program Name 1


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

EnergyManagementSystem:Program,
    CO2_Sensor01,            !- Name
    IF EMS_CO2_Sensor02 > 800,  !- Program Line 1
    SET OpenFactor01 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor01 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor02,            !- Name
    IF EMS_CO2_Sensor01 > 800,  !- Program Line 1
    SET OpenFactor02 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor02 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor03,            !- Name
    IF EMS_CO2_Sensor03 > 800,  !- Program Line 1
    SET OpenFactor03 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor03 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor04,            !- Name
    IF EMS_CO2_Sensor04 > 800,  !- Program Line 1
    SET OpenFactor04 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor04 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor05,            !- Name
    IF EMS_CO2_Sensor05 > 800,  !- Program Line 1
    SET OpenFactor05 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor05 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor06,            !- Name
    IF EMS_CO2_Sensor05 > 800,  !- Program Line 1
    SET OpenFactor06 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor06 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor07,            !- Name
    IF EMS_CO2_Sensor05 > 800,  !- Program Line 1
    SET OpenFactor07 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor07 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor08,            !- Name
    IF EMS_CO2_Sensor06 > 800,  !- Program Line 1
    SET OpenFactor08 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor08 = 0.0,  !- A5
    ENDIF ;                  !- A6

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 ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor10,            !- Name
    IF EMS_CO2_Sensor08 > 800,  !- Program Line 1
    SET OpenFactor10 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor10 = 0.0,  !- A5
    ENDIF ;                  !- A6

EnergyManagementSystem:Program,
    CO2_Sensor11,            !- Name
    IF EMS_CO2_Sensor09 > 800,  !- Program Line 1
    SET OpenFactor11 = 1.0,  !- Program Line 2
    ELSE,                    !- A4
    SET OpenFactor11 = 0.0,  !- A5
    ENDIF ;                  !- A6

I appreciate you helping me out with this.

Warm regards,
Adarsh

An Update on this error,

I was able to figure out the cause of this issue with the help of EMS application Guide and I could finally simulate with CO2 Setpoints!
My current issue, as I’m running it on Honeybee is that my value for Output:Variable or Output:Meter Index Key Name for my EMS sensors keeps updating after every simulation.
Is there a way to make this a constant key name so I don’t have to keep updating the EMS file after every simulation?

On top of this, I notice that my results are now only considering the CO2 setpoints while disregarding the existing Natural Ventilation Setpoints.

This is with the CO2 command to open the window when the indoor reaches 800ppm

This is with only a Natural Ventilation setpoint resulting in

Keep in mind, that both the above scenarios consider the Natural Ventilation Setpoints.

I’m yet to figure out the cause for this, but I would appreciate any help :slight_smile:
Cheers,
Adarsh

1 Like

Hey @TrevorFedyna,

I hope you’re well!
Thanks to your suggestion about EMS code, I was finally able to figure out the setup. Now my model runs with both CO2 setpoints and temperature control.
I only needed to write a script which includes both these controls.

The script goes something like this;

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

Thanks and Cheers,
Adarsh

2 Likes

Hi @Adarsh I’m happy to hear you have everything you need working!
all the best
-trevor

1 Like