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

Revision history [back]

If you just want to access the OpenStudio SDK via Ruby, you would require openstudio.rb like what is shown in this IRB.

irb(main):002:0> require "/Applications/OpenStudioApplication-1.0.0/Ruby/openstudio.rb"
/Applications/OpenStudioApplication-1.0.0/Ruby/openstudio.rb:31: warning: Insecure world writable dir /Applications/ParametricAnalysisTool-3.0.0/ParametricAnalysisTool.app/Contents/Resources/OpenStudio-server/bin in PATH, mode 040777
=> true
irb(main):003:0>

As a note, if you plan to use the openstudio-standards gem you will have to install that in your system ruby. An alternative you may consider is calling your script with command call of openstudio my_script.rb instead of ruby my_scxript.rb. OpenStudio will run the script with its own embedded ruby interpreter which will already be configured with both openstudio-standards gem and openstudio-extenstion gem. This allows you to run measure tests or other scripts you make without having to have a system Ruby installed on your computer. It also makes sure you are using the version or Ruby that particular version of OpenStudio expects.