Setpoint manager DOAS templates

Hi @Erikbeeren ,

I am happy to say that I have implemented something that should greatly lower the learning curve for making use of the OpenStudio SDK. After recognizing how difficult it is to put together even a simple OpenStudio Measure because of all of the boilerplate code involved and the difficulty in setting up the dev environment, I have added a module that allows you to load and dump OpenStudio models from and to .osm files.

So this is all of the code that you need in order to change the setpoints that you noted here:

from ladybug_rhino.openstudio import load_osm, dump_osm

# load the Model from the OSM
model = load_osm(_osm)

# get all of the SetpointManagers and set their properties
setpt_managers = model.getSetpointManagerOutdoorAirResets()
for setpt in setpt_managers:
    setpt.setSetpointatOutdoorLowTemperature(_setp_at_low)
    setpt.setOutdoorLowTemperature(_low_temp)
    setpt.setSetpointatOutdoorHighTemperature(_setp_at_high)
    setpt.setOutdoorHighTemperature(_high_temp)

# save the edited OSM over the original one
osm = dump_osm(model, _osm)

… and all that you have to do it copy/paste this code into a GHPython component like so:


sample_editing_osm.gh (63.7 KB)

Importantly, this new module IS ONLY AVAILABLE IN THE LATEST DEVELOPMENT VERSION OF THE PLUGIN that you get with the LB Versioner but it will be in the LBT 1.4 stable release. Also, the code above ONLY WORKS ON WINDOWS for now but we should eventually be able to support it on Mac.

I think we’ll also eventually add some routines to turn any GHPython component like this into an actual Ruby measure since this would make it easier to use this type of custom functionality outside of Grasshopper (eg. on Pollination). The only thing that’s needed for such a routine is to add the boilerplate Measure code and to translate the “real” code from Python to Ruby. So the rules for this would be that everything in the component would have to be using only native Python operators without any special modules (other than the OpenStudio SDK, of course). Also, the type hints would need to be set correctly on the component. But it seems like a lot of the custom things that people want to do are small tweaks like the setpoints here. So it would be easy enough to take a component like this and automatically make a measure from it.

2 Likes