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

OSW for multiple seed models

asked 2018-06-22 09:21:16 -0500

antonszilasi's avatar

updated 2018-06-22 09:35:11 -0500

I would like to create an Open Studio Workflow json which contains multiple seed models and the application of multiple measures to each seed model to generate a parametric study.

Perhaps I am missing some documentation but the file "generate_workflows_parametric.rb"in the OpenStudio_CLI_Template which is the closest to what I need. Only demostrates how to create a OSW for one seed model, where can I find example code to generate an OSW for multiple seed models?

Or am I mistaken and one OSW should only correspond to one seed model, and therefore multiple seed models should be represented by a folder containing many subfolders which contain an OSW for each seed model like the pictures below ---

Many OSWs with each representing a seed model image description Inside the first folder image description The OSW inside the first folder - representing a workflow for a seed model image description

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2018-06-22 13:15:59 -0500

updated 2018-06-22 13:34:21 -0500

One model, one osw.

Documentation for the osw structure found here and schema here.

You can build an osw programmatically using the WorkflowJSON object

As an example, this is what your script might look like:

# the logic in the parametric script is built around making an .osw file
def make_osw(run_name, osm_filepath, epw_filepath, model_measure_steps = [], energyplus_measure_steps = [], reporting_measure_steps = [])
  puts "Making directory #{run_name}"
  FileUtils.mkdir "workflows/#{run_name}"
  osw_filepath ="#{Dir.pwd}/workflows/#{run_name}/workflow.osw")
  osw =
  if !model_measure_steps.empty?
    measure_type ="ModelMeasure")
    osw.setMeasureSteps(measure_type, model_measure_steps)
  if !energyplus_measure_steps.empty?
    measure_type ="EnergyPlusMeasure")
    osw.setMeasureSteps(measure_type, energyplus_measure_steps)
  if !reporting_measure_steps.empty?
    measure_type ="ReportingMeasure")
    osw.setMeasureSteps(measure_type, reporting_measure_steps)
  puts "#{run_name} osw written"
  return true

# define measures to add to the model
measure1 ="measure1")
measure1.setArgument("arg1","some string argument value")

measure2 ="measure2")

# path to an epw file and a list of paths to the multiple seed models
# use ruby Dir.glob or related script to pull all .osms paths in a directory into an array
# e.g. osm_files = Dir.glob(File.join("seed_models/**","*.osm"))
epw_path = "path/to/epw/tmy3.epw"
model_paths = ["/path/to/file/seed1.osm","/path/to/file/seed2.osm","/path/to/file/seed3.osm"]

# convert them to OpenStudio::Path objects
epw_path =
model_paths = {|x|}

model_paths.each do |path|
  run_name = path.to_s.split("/")[-1].chomp(".osm") + "_measure1and2"
  makeOSW(run_name, path, epw_path, [measure1, measure2], [], [])

Alternatively, you could adjust the measure so instead of making a directory for each .osw, it names each .osw and dumps them all in the same directory

edit flag offensive delete link more


Just what I was looking for to set up better unit tests. Thanks!

Phylroy Lopez's avatar Phylroy Lopez  ( 2019-09-05 16:34:25 -0500 )edit

answered 2018-06-23 08:07:04 -0500

I couldn't tell from your post, but if you're in the situation that you want to run the same measures on different seed models, you can accomplish this using a single OSW.

The trick is to leave the seed_file out of the OSW entirely. Then have the first measure in your OSW be a measure that takes in a path to your seed OSM of interest and loads it into a model like so:

translator =
path =
model = translator.loadModel(path)
assert((not model.empty?))
model = model.get

This would allow you to call the same OSW over and over but with the argument changing to different seed models.

edit flag offensive delete link more


can a similar thing be done with the weather_file? would love to run parametrics on different buildings (seed_file) in different locatios (weather_file).

Determinant's avatar Determinant  ( 2018-09-07 21:44:19 -0500 )edit

Yes, definitely. You can leave the weather file out of the OSW and apply it via an OS measure.

shorowit's avatar shorowit  ( 2022-09-19 19:50:56 -0500 )edit

@Determinant, if you are going to sweep across weather files I recommend adding the Change Building Location measure to your workflow, instead of the weather file field in the OSW. In addition to changing the weather file, the measure, changes design days, sets the water main temperatures, and sets the ASHRAE climate zone (important if you plan to run measures that use OpenStudio Standards gem to assign climate zone specific instructions). The measure expects .stat and .ddy with .epw.

David Goldwasser's avatar David Goldwasser  ( 2022-09-20 18:36:40 -0500 )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

Question Tools



Asked: 2018-06-22 09:21:16 -0500

Seen: 480 times

Last updated: Sep 19