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

OpenStudio python bindings

asked 2021-07-20 15:34:39 -0600

Michel's avatar


I am very new to OpenStudio and I want to integrate the software in a statistical analysis on python. I do not know how to compile and use the python bindings. Can anyone give me a tutorial for it?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2021-07-20 22:11:21 -0600

updated 2021-07-20 22:12:59 -0600

You can install the openstudio python bindings using pip install openstudio.

Then you can test they work:

import openstudio
m = openstudio.model.Model()

That results in:

  {b1c739b0-8af6-4d47-b6a2-96df1d55f3cb}, !- Handle
  3.2.1;                                  !- Version Identifier

You can find more information at

edit flag offensive delete link more


Thank you, it worked

Michel's avatar Michel  ( 2021-07-21 01:58:19 -0600 )edit

Where is the documentation for all the package functions? I want to use some OpenStudio modifications in my python scripts?

mechyai's avatar mechyai  ( 2021-07-21 11:14:49 -0600 )edit

Are you referring to the OpenStudio SDK documentation?

shorowit's avatar shorowit  ( 2021-07-21 11:25:57 -0600 )edit

Is there a python-specific version of the above SDK documentation that shows us the syntax of how to call the methods? Thanks

wassimj's avatar wassimj  ( 2021-07-26 02:26:50 -0600 )edit

The SDK documentation is for all languages (Ruby, C#, Python); I don't know what python-specific documentation would look like.

shorowit's avatar shorowit  ( 2021-07-26 08:30:48 -0600 )edit

answered 2022-03-15 14:43:39 -0600

To expand on Scott's point, I've been learning how to use the Python bindings for the last couple of weeks. I've put together a Python Jupyter notebook as I've figured out a few of the things I wanted to do. The notation is a little different from Ruby for a few things, but with some practice, you should start to catch the patterns to the differences. Maybe this will help you in your own work.


edit flag offensive delete link more



Hi. Are you using the Ruby Documentation and getting this done? I have a Ruby Script that I'm looking to convert to Python. Specifically this ( Do you think it's possible to do this? Because openstudio-standards seems to be Ruby only.

asrjy's avatar asrjy  ( 2022-03-17 09:40:16 -0600 )edit

Yes, I am. It's not a 1 for 1 syntax match-up, but I'm using it as the starting place for object association.

As for openstudio-standards, I think you're correct. However, since they're all ruby scripts, you could still call them from Python's command-line interface as noted in the comment thread here. I think you can use the OS package in python to do those calls. See this link for ideas.

GFlechas's avatar GFlechas  ( 2022-03-17 10:27:57 -0600 )edit

So for that LBNL project, I think you could rewrite the main workflow script in python using the openstudio python bindings, and then call the openstudio-standards gem as needed as command line scripts. Might be a little slower but it certainly looks possible!

GFlechas's avatar GFlechas  ( 2022-03-17 10:29:34 -0600 )edit

Yea. I'll try doing that. Having no proper documentation is making the conversion really hard haha. I'll use your notebook as a reference. Thank you.

asrjy's avatar asrjy  ( 2022-03-17 10:44:38 -0600 )edit

Could you please elaborate on using openstudio-standards using command line scripts? In the repository, Openstudio Standards was called using Standards.Build which creates a prototype building model. If I were to write a ruby script to do that, how would I send the created prototype object back to python? I'm stuck there. I finished converting the other part of the script to Python.

asrjy's avatar asrjy  ( 2022-03-22 04:43:14 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2021-07-20 15:34:39 -0600

Seen: 1,063 times

Last updated: Mar 15 '22