Plant Component EMS On/Off - Openstudio
I am trying to turn off my ASHP and turn on my Backup boiler based on the outdoor air temperature.
Below runs without errors but i am not seeing the desired results. The boiler is not turning on:
# Outdoor Air Sensor
ems_oa_db_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, "Site Outdoor Air Drybulb Temperature")
ems_oa_db_sensor.setName("OutdoorTemp")
ems_oa_db_sensor.setKeyName("Environment")
# ASHP Actuator
ashp_heating_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(ashp_heating, "Plant Component HeatPump:PlantLoop:EIR:Heating", "On/Off Supervisory")
ashp_heating_actuator.setName("ASHP_Heating_OnOff")
# Boiler Actuator
backup_boiler_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(backup_boiler, "Plant Component Boiler:HotWater", "On/Off Supervisory")
backup_boiler_actuator.setName("Backup_Boiler_OnOff")
# EMS
ems_program = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
ems_program.setName("HW_loop_operation")
ems_program.addLine("IF (OutdoorTemp < 10.0),")
ems_program.addLine("SET Boiler_Branch_OnOff = 1,") # Turn Boiler branch ON
ems_program.addLine("SET ASHP_Branch_OnOff = 0,") # Turn ASHP branch OFF
ems_program.addLine("ELSE,")
ems_program.addLine("SET Boiler_Branch_OnOff = 0,") # Turn Boiler branch OFF
ems_program.addLine("SET ASHP_Branch_OnOff = 1,") # Turn ASHP branch ON
ems_program.addLine("ENDIF;")
# EMS program calling manager
ems_calling_manager = OpenStudio::Model::EnergyManagementSystemProgramCallingManager.new(model)
ems_calling_manager.setName("Backup Boiler OnOff Management")
ems_calling_manager.setCallingPoint("InsideHVACSystemIterationLoop")
ems_calling_manager.addProgram(ems_program)