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

Use python to run OpenStudio models automatically?

asked 2017-04-10 07:46:14 -0600

I want to use python to run OpenStudio models automatically. I need to load baseline models from BCL, change the weather files, use measures to change inputs, run models and search useful energy data by using code. There are too many models, and therefore, I hope that all the works can be done automatically. Are there detailed instructions or cases?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2017-04-10 09:38:13 -0600

updated 2017-04-10 09:44:27 -0600

The use case you described would actually be a great fit for the OpenStudio Command Line Interface (CLI) in OpenStudio 2.0. You can use the Python to create an OSW file that describes the measures to call, then make system calls to the CLI to download measures and run the simulation. Note that if you use Python to write OSW files (which are JSON format) and make system calls to interact with the CLI you can still work in Python without needing to load the OpenStudio Python bindings. You can read about the CLI here.

edit flag offensive delete link more

Comments

Sound great. Are there some case study or teaching videos on the website now?

Yunyang Ye's avatar Yunyang Ye  ( 2017-04-10 10:42:48 -0600 )edit

There is documentation at openstudio.net. Also an example OSW file is included in the installer.

macumber's avatar macumber  ( 2017-04-10 11:23:56 -0600 )edit

To be clear, this approach allows you to use python for calling OpenStudio measures with particular arguments, but the OpenStudio measures themselves must still be written in ruby.

shorowit's avatar shorowit  ( 2017-04-10 16:16:44 -0600 )edit

Thanks. It works for me. All the measures have been got from BCL or created by myself.

Yunyang Ye's avatar Yunyang Ye  ( 2017-04-10 18:25:04 -0600 )edit
4

answered 2017-04-10 08:33:29 -0600

updated 2017-04-10 08:34:01 -0600

By default OS doesn't generate the python bindings (they do ship ruby bindings natively). You'll have to download the source code and compile it yourself asking to generate the python bindings. There is documentation out there, including on this very site and on Github:

edit flag offensive delete link more

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

3 followers

Stats

Asked: 2017-04-10 07:46:14 -0600

Seen: 1,147 times

Last updated: Apr 10 '17