6

Use python to run OpenStudio models automatically?

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?

Yunyang Ye's avatar
816
Yunyang Ye
asked 2017-04-10 07:46:14 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

2 Answers

4

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:

Julien Marrec's avatar
29.7k
Julien Marrec
answered 2017-04-10 08:33:29 -0500, updated 2017-04-10 08:34:01 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
4

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.

macumber's avatar
12k
macumber
answered 2017-04-10 09:38:13 -0500, updated 2017-04-10 09:44:27 -0500
edit flag offensive 0 remove flag delete link

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 -0500) 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 -0500) 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 -0500) 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 -0500) edit
add a comment see more comments