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

Revision history [back]

It seems that I can control the bypass using a Constant:Schedule

erv_bypass_stp = 24.0
erv_unit = eqpt.to_ZoneHVACEnergyRecoveryVentilator.get          
erv_controller = erv_unit.controller.get

ems_zone_mean_air_temp_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, "Zone Mean Air Temperature")
ems_zone_mean_air_temp_sensor.setName("T_#{thermal_zone.name.to_s}")
ems_zone_mean_air_temp_sensor.setKeyName(thermal_zone.name.to_s)

erv_bypass_onoff = 1 # 0: bypass is off, 1: bypass is on
erv_bypass_onoff_sch = OpenStudio::Model::ScheduleConstant.new(model)
erv_bypass_onoff_sch.setName("ERV_BYPASS_ONOFF_#{thermal_zone.name.to_s}")
erv_bypass_onoff_sch.setValue(erv_bypass_onoff)

erv_controller.setTimeofDayEconomizerFlowControlSchedule(erv_bypass_onoff_sch)

ems_erv_bypass_onoff_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(erv_bypass_onoff_sch,"Schedule:Constant","Schedule Value")
ems_erv_bypass_onoff_actuator.setName("myERV_BYPASS_ONOFF_SCH_#{thermal_zone.name.to_s}")

ems_erv_bypass_onoff_prg = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
ems_erv_bypass_onoff_prg.setName("ERVBypassONOFFProg_#{thermal_zone.name.to_s}")
ems_erv_bypass_onoff_prg.addLine("SET T_zone_air = #{ems_zone_mean_air_temp_sensor.name}")
ems_erv_bypass_onoff_prg.addLine("IF T_zone_air > #{erv_bypass_stp}")
ems_erv_bypass_onoff_prg.addLine("SET #{ems_erv_bypass_onoff_actuator.name} = 1")
ems_erv_bypass_onoff_prg.addLine("ELSE")
ems_erv_bypass_onoff_prg.addLine("SET #{ems_erv_bypass_onoff_actuator.name} = 0")
ems_erv_bypass_onoff_prg.addLine("ENDIF")

ems_prgm_calling_mngr = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
ems_prgm_calling_mngr.setName("ERVBypassONOFFProgCall_#{thermal_zone.name.to_s}")
ems_prgm_calling_mngr.setCallingPoint("BeginTimestepBeforePredictor")
ems_prgm_calling_mngr.addProgram(ems_erv_bypass_onoff_prg)