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 2023-12-27 12:10:59 -0500

oprislan's avatar

updated 2023-12-28 09:48:03 -0500

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-12-29 09:19:12 -0500

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",
}
edit flag offensive delete link more

Comments

Thank you Julien, it works!

oprislan's avatar oprislan  ( 2024-01-07 04:31:09 -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

Careers

Question Tools

1 follower

Stats

Asked: 2023-12-27 12:10:59 -0500

Seen: 322 times

Last updated: Jan 07