My end-goal is to load different Schedule values based on some conditions. I have setup a minimal complete and verifiable example (MCVE) to showcase a problem that you can find here. For this I have basically set up some Sensors that read some schedule values (will end up being Schedule:File objects), and a "Shadow" schedule that has an EMS Actuator attached to it.
During the Warmup, I am facing a problem where the schedule value isn't initialized at the first ever occurrence, which causes Eplus to fatal out if I use said shadow chedule as my cooling thermostat schedule (because Cooling Setpoint ends up 0 and heating is 18). I have tried to use the BeginTimestepBeforePredictor
calling point.
My MCVE is based off of 1ZoneUncontrolled.idf
where I added an Ideal Loads Air Sytem, a Thermostat, and my EMS program. The important portions are recopied at the end of the post for convenience.
I also include a truncated extract from the eplusout.edd
(Full EDD also available here) showing that the first occurrence only doesn't have an initialized value.
How can I circumvent this problem? I do not want to have to hardcode the very first value of this shadow schedule.
eplusout.edd:
**** Begin EMS Language Processor Error and Trace Output ***
<Erl program name, line #, line text, result, occurance timing information ... >
COOLING_SCH_PROGRAM,Line 1,SET LOCCURRENTENV = CURRENTENVIRONMENT,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 2,SET LOCWEEKENDVALUE = COOLING_SCH_SENSOR,0.0, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 3,SET LOCWARMUP = WARMUPFLAG,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 4,IF CURRENTENVIRONMENT < 3,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 5,IF LOCWEEKENDVALUE > 0,0.0, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 7,ELSE,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 8,SET COOLING_SCH_SHADOW_ACTUATOR = 32,32.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 9,ENDIF,, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 12,ENDIF,, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 1,SET LOCCURRENTENV = CURRENTENVIRONMENT,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 2,SET LOCWEEKENDVALUE = COOLING_SCH_SENSOR,26.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 3,SET LOCWARMUP = WARMUPFLAG,0.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 4,IF CURRENTENVIRONMENT < 3,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 5,IF LOCWEEKENDVALUE > 0,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 6,SET COOLING_SCH_SHADOW_ACTUATOR = COOLING_SCH_SENSOR,26.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 9,ENDIF,, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 12,ENDIF,, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 1,SET LOCCURRENTENV = CURRENTENVIRONMENT,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 2,SET LOCWEEKENDVALUE = COOLING_SCH_SENSOR,26.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 3,SET LOCWARMUP = WARMUPFLAG,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 4,IF CURRENTENVIRONMENT < 3,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 5,IF LOCWEEKENDVALUE > 0,1.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 6,SET COOLING_SCH_SHADOW_ACTUATOR = COOLING_SCH_SENSOR,26.000000, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 9,ENDIF,, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 12,ENDIF,, During Warmup & Sizing, Occurrence info=WINTER DD, 12/21 23:45 - 24:00
COOLING_SCH_PROGRAM,Line 1,SET LOCCURRENTENV = CURRENTENVIRONMENT,2.000000, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 2,SET LOCWEEKENDVALUE = COOLING_SCH_SENSOR,26.000000, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 3,SET LOCWARMUP = WARMUPFLAG,1.000000, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 4,IF CURRENTENVIRONMENT < 3,1.000000, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 5,IF LOCWEEKENDVALUE > 0,1.000000, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 6,SET COOLING_SCH_SHADOW_ACTUATOR = COOLING_SCH_SENSOR,26.000000, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 9,ENDIF,, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
COOLING_SCH_PROGRAM,Line 12,ENDIF,, During Warmup & Sizing, Occurrence info=SUMMER DD, 07/21 00:00 - 00:15
Important part of IDF:
ScheduleTypeLimits,
no_limit, ! Name
-1000000000.0, ! Lower Limit Value
1000000000.0, ! Upper Limit Value
continuous, ! Numeric Type
dimensionless; ! Unit Type
Schedule:Constant,Heating_SCH,no_limit,18;
! A schedule for reading, will be replaced with Schedule:File
Schedule:Constant,Cooling_SCH,no_limit,26;
! The computed schedule
Schedule:Constant,Cooling_SCH_shadow,no_limit,1;
Schedule:Compact,
schedule|dual, ! Name
no_limit, ! Schedule Type Limits Name
through: 12/31, ! Field 0
for: alldays, ! Field 1
until: 24:00, ! Field 2
4; ! Field 3
ZoneControl:Thermostat,
ZONE ONE TSTAT, ! Name
ZONE ONE, ! Zone or ZoneList Name
schedule|dual, ! Control Type Schedule Name
ThermostatSetpoint:DualSetpoint, ! Control 1 Object Type
Dual Setpoint, ! Control 1 Name
, ! Control 2 Object Type
, ! Control 2 Name
, ! Control 3 Object Type
, ! Control 3 Name
, ! Control 4 Object Type
, ! Control 4 Name
0.0; ! Temperature Difference Between Cutout And Setpoint
ThermostatSetpoint:DualSetpoint,
Dual Setpoint, ! Name
Heating_SCH, ! Heating Setpoint Temperature Schedule Name
Cooling_SCH_shadow; ! Cooling Setpoint Temperature Schedule Name
EnergyManagementSystem:Sensor,
Cooling_SCH_Sensor, ! Name
Cooling_SCH, ! Output:Variable or Output:Meter Index Key Name
Schedule Value; ! Output:Variable or Output:Meter Name
EnergyManagementSystem:Actuator,
Cooling_SCH_shadow_Actuator, ! Name
Cooling_SCH_shadow, ! Actuated Component Unique Name
Schedule:Constant, ! Actuated Component Type
schedule value; ! Actuated Component Control Type
EnergyManagementSystem:Program,
Cooling_SCH_program, ! Name
set locCurrentEnv = CurrentEnvironment, ! Echo out for debug
set locWeekendValue = Cooling_SCH_Sensor, ! Debug
set locWarmup = WarmupFlag, ! Debug
IF CurrentEnvironment < 3, ! 1 & 2 are sizing runs (1=Winter, 2=Summer, 3=Runperiod)
! Without this block, simulation fails
IF locWeekendValue > 0,
set Cooling_SCH_shadow_Actuator = Cooling_SCH_Sensor,
ELSE,
set Cooling_SCH_shadow_Actuator = 32,
ENDIF,
ELSE, ! Program Line 9
set Cooling_SCH_shadow_Actuator = 26,
ENDIF; ! Program Line 18
EnergyManagementSystem:ProgramCallingManager,
Cooling_SCH_programCallingManager, ! Name
begintimestepbeforepredictor, ! EnergyPlus Model Calling Point
Cooling_SCH_program;