You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This page provides information on how to get started with using irb in the OpenStudio API.
Getting Started with IRB
Since there is no plugin for the existing text editors for OpenStudio, in addition to the OpenStudio's repository on the NREL's github and doxygen documentation, irb is one of the best way to test different methods. Here, is an example of using irb in the command line to create the OpenStudio model and get the RunPeriod object:
The other example is using irb to find the exiting fields in the OS:Building object:
The results show that getBuilding has different fields such as Name and, Building Sector Type. For example, to get the name of the building, building.setName("This is a test to set the building name").
Using IRB Completion to Facilitate Using the API
One of the best way to identify existing methods in the API is to benefit from the irb/completion in the command line. When user type require 'irb/completion' in the command line, user can use tab key to auto complete the command or provide suggestions. Here is an example of benefiting from the irb/completion:
The results show that there are three methods starting with setN for the building object.
Call a Specific Version of the IRB
If you have a specific OpenStudio building that need to call, you need to use irb -I build-make/OpenStudioCode-prefix/src/OpenStudioCore-build/ruby to call this specific version.