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

HOW TO EMS with OpenStudio ?

asked 2017-09-06 06:10:30 -0600

updated 2017-09-06 07:10:51 -0600

As M. Dahlhausen has pointed out in Question on Results Visualization, EMS can be run with OpenStudio.

I did not, however, find any EMS measure at online BCL. Furthermore, many of my EMS controls use Constant Schedules (to be modified during simulation), but apparently it is not possible (or obvious how to) create Constant Schedules in OpenStudio.

Hence my question: How do you EMS with OpenStudio ? Do you need to be a programmer (using the API) ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2017-09-06 10:28:34 -0600

updated 2017-09-07 08:16:00 -0600

here is some sample ruby code that you would use in a measure to create a sensor, an actuator and a program:


Create an output variable for OATdb

output_var = "Site Outdoor Air Drybulb Temperature"
output_var_oat =, model)

Create a sensor to sense the outdoor air temperature

oat_sensor =, output_var_oat)
oat_sensor_name = "OATdb Sensor"


create a fan

always_on = model.alwaysOnDiscreteSchedule
fan =,always_on)

Create an actuator to set the fan pressure rise

fan_press = "Fan Pressure Rise"
fan_actuator =, "fan", fan_press)
fan_actuator.setName("#{} Press Actuator")


Create a program all at once

fan_program_1 =
fan_program_1.setName("#{} Pressure Rise Program by Line")
fan_program_1_body = <<-EMS
  SET mult = #{oat_sensor.handle} / 15.0 !- This is nonsense
  SET #{fan_actuator.handle} = 250 * mult !- More nonsense

Create a second program line by line

fan_program_2 =
fan_program_2.setName("#{} Pressure Rise Program by Line")
fan_program_2.addLine("SET mult = #{oat_sensor.handle} / 15.0 !- This is nonsense")
fan_program_2.addLine("SET #{fan_actuator.handle} = 250 * mult !- More nonsense")

Create a third program from vector of lines

fan_program_3 =
fan_program_3.setName("#{} Pressure Rise Program by Vector of Lines")
fan_program_3_lines = []
fan_program_3_lines << "SET mult = #{oat_sensor.handle} / 15.0 !- This is nonsense"
fan_program_3_lines << "SET #{fan_actuator.handle} = 250 * mult !- More nonsense"
edit flag offensive delete link more

answered 2017-09-06 08:06:22 -0600

You need to use the API, yes. There's no way to do this in the OS App currently.

And you can create such schedules in OpenStudio (using the API):

sch_constant =
sch_compact =

The EMS is a bit weird to work with, but the SDK documentation should help, for example here is it for EMS:Sensor.

edit flag offensive delete link more



UI additions to place sensors and actuators within loops and connect them to Measure IO are planned for this coming year - plus some other controls related goodies.

ljbrackney's avatar ljbrackney  ( 2017-09-06 09:19:06 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer


Question Tools



Asked: 2017-09-06 06:10:30 -0600

Seen: 1,754 times

Last updated: Sep 07 '17