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

Revision history [back]

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/vt9xwviqnrh80fp/co2.idf?dl=0

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/vt9xwviqnrh80fp/co2.idf?dl=0