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

Revision history [back]

First of all, you should not be using commas and semicolons -- OpenStudio will do that for you.

Also, I think you want to use Null instead of 1 to resume normal operation, as shown in this EMS example.

So combined, your code would be:

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 = Null")  # 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 = Null")    # Turn ASHP branch ON
ems_program.addLine("ENDIF")

Also, 10C (50F) is an awfully high switchover temperature. Is that really what you intended?

Finally, if all of this doesn't help, you may need to debug the EMS program by setting the "EnergyPlus Runtime Language Debug Output Level" field of the Output:EnergyManagementSystem object to "Verbose" and looking at the EDD output file.

First of all, you should not be using commas and semicolons in the addLine methods -- OpenStudio will do that for you.

Also, I think you want to use Null instead of 1 to resume normal operation, as shown in this EMS example.

So combined, your code would be:

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 = Null")  # 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 = Null")    # Turn ASHP branch ON
ems_program.addLine("ENDIF")

Also, 10C (50F) is an awfully high switchover temperature. Is that really what you intended?

Finally, if all of this doesn't help, you may need to debug the EMS program by setting the "EnergyPlus Runtime Language Debug Output Level" field of the Output:EnergyManagementSystem object to "Verbose" and looking at the EDD output file.