First time here? Check our help page!
1

Not to run a program if there is no inputs in the model, CO2 Control

Hello Everyone,

I'm writing a script to control CO2 concentration through natural ventilation. There are different kind of spaces with different levels of CO2 allowed, which I want to use in all my projects. That’s why I need the script to have all the options, but not to run the options that are not in the model. The thing is that when I run a model with spaces that are not defined in the EMS, the following error occurs:

** Severe  ** IP: IDF line~5428 Error detected in Object=ENERGYMANAGEMENTSYSTEM:PROGRAM, name=CO2WINDOWCONTROLIDA1

   **   ~~~   ** Field [Program Line 1] is required but was blank

   ** Severe  ** IP: Blank "required" fields found in input

   ** Severe  ** IP: Out of "range" values and/or blank required fields found in input

   **  Fatal  ** IP: Errors occurred on processing IDF file. Preceding condition(s) cause termination.

The script I Used i that:

! SENSOR IDA1
<ForAllWindows> {ZoneIDFName=IDA1;Tag=CO2}
EnergyManagementSystem:Sensor,
   <LoopWindowVariableName>Air_CO2_Concentration_IDA1,
   <LoopWindowZoneIDFName>,
   Zone Air CO2 Concentration;

! ACTUADOR IDA1
EnergyManagementSystem:Actuator,
   Venting_Opening_Factor_IDA1<LoopWindowVariableName>,
   <LoopWindowIDFName>,
   AirFlow Network Window/Door Opening,
   Venting Opening Factor;
<LoopNextWindow>

! extra outputs for viewing in the results viewer
<If BuildingAttribute HourlyOutput = 1 Then>
Output:Variable, *, Zone Air CO2 Concentration, hourly; 
<Endif>
<If BuildingAttribute TimesteplyOutput = 1 Then>
Output:Variable, *, Zone Air CO2 Concentration, timestep; 
<Endif>

! NAME IDA1 PROGRAM
EnergyManagementSystem:ProgramCallingManager,
   CO2 Window Control IDA1,
   InsideHVACSystemIterationLoop,
   CO2WindowControlIDA1;

! programa per a IDA1
EnergyManagementSystem:Program,
   CO2WindowControlIDA1,
<ForAllWindows> {ZoneIDFName=IDA1;Tag=CO2}
If <LoopWindowVariableName>Air_CO2_Concentration_IDA1 <> Null,
   ! Proportional control of window opening
   ! CO2 levels in zone for this window
   SET ZoneCO2 = <LoopWindowVariableName>Air_CO2_Concentration_IDA1,
   ! CO2 level giving rise to lowest opening factor
   SET ZoneCO2Min = 650,
   ! Lowest opening factor
   SET OpenFactZoneCO2Min = 0,
   ! CO2 level giving rise to highest opening factor
   SET ZoneCO2Max = 750,   
   ! Highest opening factor
   SET OpenFactZoneCO2Max = 0.1,
   IF ZoneCO2 <= ZoneCO2Min,
      SET OpenFact = OpenFactZoneCO2Min,
   ELSEIF ZoneCO2 >= ZoneCO2Max,
      SET OpenFact = OpenFactZoneCO2Max,
   ELSE,
      SET m = (OpenFactZoneCO2Max - OpenFactZoneCO2Min) / (ZoneCO2Max - ZoneCO2Min),      
      SET C = (OpenFactZoneCO2Min + OpenFactZoneCO2Max - m * (ZoneCO2Min + ZoneCO2Max)) / 2,
      SET OpenFact = m * ZoneCO2 + C,
   ENDIF,
   SET Venting_Opening_Factor_IDA1<LoopWindowVariableName> = OpenFact,
<LoopNextWindow>
<ENDIF>
;

I used If <LoopWindowVariableName>Air_CO2_Concentration_IDA1 <> Null, before running the program but seems it didn't work,

Any help wouyld be great,

Thank you!

IDF in the link https://www.dropbox.com/s/vt9xwviqnrh...

Pablo-SO's avatar
21
Pablo-SO
asked 2020-03-19 04:39:33 -0500
shorowit's avatar
11.8k
shorowit
updated 2020-03-20 05:25:25 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

"Null" should only be used to deactivate actuators to not change the model anymore -- they should not be used with sensors. If you want to check if the zone air CO2 concentration sensors are not equal to zero, that should be written as:

If <loopwindowvariablename>Air_CO2_Concentration_IDA1 <> 0,

I believe that EMS is checking this first IF statement, not able to evaluate it, and as a result skipping over the remaining lines of your loop. The IDF you attached has the EMS program created below from this code.

! programa per a IDA1
EnergyManagementSystem:Program,
 CO2WindowControlIDA1,
;

As you can see, only the first "Name" input field is set, and no EMS code is generated. This is what the severe error message in your error file indicates as well.

It looks like you are using DesignBuilder to write this EMS code, since you are able to use loops and other features that "native" EnergyPlus IDF files can't use. If DesignBuilder has an <if> check function, then you can use that before the EMS program lines in order to not create the entire program under certain conditions. What you are doing now is always creating the program, the only adding it's EMS code under certain conditions.

On another note, I believe that your first loop over all windows to create the sensors is incorrect. Zone Air CO2 Concentration is an output variable for each zone in the model -- not for each window in the model. So, if multiple windows are attached to the same zone, the sensors created with your current loop are essentially copies of each other with the same CO2 concentration value. If you want to open windows for natural ventilation, then using a loop over all windows in the model to create actuators for Venting Opening Factor is correct.

Aaron Boranian's avatar
14.1k
Aaron Boranian
answered 2020-03-19 11:24:20 -0500, updated 2020-03-19 11:31:37 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments