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

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
10

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:

Sensor

Create an output variable for OATdb

output_var = "Site Outdoor Air Drybulb Temperature"
output_var_oat = OpenStudio::Model::OutputVariable.new(output_var, model)

Create a sensor to sense the outdoor air temperature

oat_sensor = OpenStudio::Model::EnergyManagementSystemSensor.new(model, output_var_oat)
oat_sensor_name = "OATdb Sensor"
oat_sensor.setName(oat_sensor_name)

Actuator

create a fan

always_on = model.alwaysOnDiscreteSchedule
fan = OpenStudio::Model::FanConstantVolume.new(model,always_on)

Create an actuator to set the fan pressure rise

fan_press = "Fan Pressure Rise"
fan_actuator = OpenStudio::Model::EnergyManagementSystemActuator.new(fan, "fan", fan_press)
fan_actuator.setName("#{fan.name} Press Actuator")

Programs

Create a program all at once

fan_program_1 = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
fan_program_1.setName("#{fan.name} 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
EMS
fan_program_1.setBody(fan_program_1_body)

Create a second program line by line

fan_program_2 = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
fan_program_2.setName("#{fan.name} 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 = OpenStudio::Model::EnergyManagementSystemProgram.new(model)
fan_program_3.setName("#{fan.name} 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"
fan_program_3.setLines(fan_program_3_lines)
edit flag offensive delete link more
3

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 = OpenStudio::Model::ScheduleConstant.new(model)
sch_compact = OpenStudio::Model::ScheduleCompact.new(model)

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

Comments

7

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

Training Workshops

Careers

Question Tools

5 followers

Stats

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

Seen: 1,842 times

Last updated: Sep 07 '17