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

Method to check the OpenStudio version?

asked 2016-10-05 11:46:52 -0500

updated 2017-08-05 13:33:05 -0500

With the advent of OpenStudio 2.x, my existing measure content needs to support both v1.x and v2.x. How can I tell which version of OpenStudio my measure is running on, from within a measure?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-10-05 11:56:34 -0500

updated 2016-10-05 12:06:02 -0500

Currently, OpenStudio can report the model version, but there is not a definitive method or test for which version of the OpenStudio codebase (1.x or 2.x) a measure is currently running within. The following crude method was added to the Radiance measure to provide a more definitive OS-version test; while both OS versions are extant, you may want to implement something like this to maintain backward compatibility in your own measures as well:

def got_2x
    v2 = true
      got_workflow = OpenStudio::WorkflowJSON # i can haz wofkflow gem?
    rescue NameError
      v2 = false
      return v2
    return v2


if !got_2x
  # find EnergyPlus with 1.x Runmanager
  co = 
  require 'openstudio-workflow' #OS2.x only
  epp = OpenStudio::getEnergyPlusExecutable() # yeah, you know me

You get the idea.

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


Question Tools

1 follower


Asked: 2016-10-05 11:46:52 -0500

Seen: 306 times

Last updated: Oct 05 '16