First time here? Check out the Help page!

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

how to run a simulation using python

asked 1 year ago

oprislan's avatar

updated 1 year ago

Hi,

I have installed openstudio 3.7 from pipy and I would like to have a sample python script that runs a simulation directly from my python IDE. Model,osm and weather-file both reside in the same folder.

As I couldn't find the python-bindings api reference, I'm a bit lost as I was unable to find a "run" or "run_simulation" method as in earlier versions.

So both (reference python bindings 3.7 and example) would be highly appreciated.

Thank you

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
3

answered 1 year ago

In order to actually run a simulation, you must have the openstudio SDK installed separately (get it from here), so you can use the Command Line Interface (CLI) openstudio(.exe). Make a syscall to it once you've prepared your OSM model and Workflow JSON (workflow.osw).

import subprocess
subprocess.run(['openstudio', 'run', '-w', 'workflow.osw'])

example workflow.osw:

{
  "weather_file": "weather.epw",
  "seed_file": "model.osm",
}
Preview: (hide)
link

Comments

Thank you Julien, it works!

oprislan's avatar oprislan  ( 1 year ago )

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

1 follower

Stats

Asked: 1 year ago

Seen: 523 times

Last updated: Jan 07 '24