ladybug_rhino.openstudio module

Functions for importing OpenStudio into the Python environment.

ladybug_rhino.openstudio.dump_osm(model, osm_path)[source]

Dump an OpenStudio Model object to an OSM file.

Parameters:
  • model – An OpenStudio Model to be written to a file.

  • osm_path – The path of the .osm file where the OpenStudio Model will be saved.

Returns:

The path to the .osm file as a string.

Usage:

from ladybug_rhino.openstudio import load_osm, dump_osm

# load an OpenStudio model from an OSM file
osm_path = 'C:/path/to/model.osm'
model = load_osm(osm_path)

# get all of the SetpointManagers and set their properties
setpt_managers = model.getSetpointManagerOutdoorAirResets()
for setpt in setpt_managers:
    setpt.setSetpointatOutdoorLowTemperature(19)
    setpt.setOutdoorLowTemperature(12)
    setpt.setSetpointatOutdoorHighTemperature(16)
    setpt.setOutdoorHighTemperature(22)

# save the edited OSM over the original one
osm = dump_osm(model, osm_path)
ladybug_rhino.openstudio.import_openstudio()[source]

Import the OpenStudio SDK into the Python environment.

Returns:

The OpenStudio NameSpace with all of the modules, classes and methods of the OpenStudio SDK.

Usage:

from ladybug_rhino.openstudio import import_openstudio, dump_osm
OpenStudio = import_openstudio()

# create a new OpenStudio model from scratch
os_model = OpenStudio.Model()
space_type = OpenStudio.SpaceType(os_model)

# save the Model to an OSM
osm_path = 'C:/path/to/model.osm'
osm = dump_osm(os_model, osm_path)
ladybug_rhino.openstudio.load_osm(osm_path)[source]

Load an OSM file to an OpenStudio SDK Model object in the Python environment.

Parameters:

osm_path – The path to an OSM file to be loaded an an OpenStudio Model.

Returns:

An OpenStudio Model object derived from the input osm_path.

Usage:

from ladybug_rhino.openstudio import load_osm

# load an OpenStudio model from an OSM file
osm_path = 'C:/path/to/model.osm'
os_model = load_osm(osm_path)

# get the space types from the model
os_space_types = os_model.getSpaceTypes()
for spt in os_space_types:
    print(spt)