5

HOW TO EMS with OpenStudio ?

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) ?

OS-user-AT's avatar
2.3k
OS-user-AT
asked 2017-09-06 06:10:30 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-09-06 07:10:51 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

10

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)
BrianLBall's avatar
2k
BrianLBall
answered 2017-09-06 10:28:34 -0500
Julien Marrec's avatar
29.7k
Julien Marrec
updated 2017-09-07 08:16:00 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
3

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.

Julien Marrec's avatar
29.7k
Julien Marrec
answered 2017-09-06 08:06:22 -0500
edit flag offensive 0 remove flag delete link

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 -0500) edit
add a comment see more comments