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

Revision history [back]

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 to maintain backward compatibility this in your own measures:

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

e.g.

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

You get the idea.

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 to maintain backward compatibility this in your own measures:

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

e.g.

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

You get the idea.

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 to maintain backward compatibility this in your own measures:

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

e.g.

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

You get the idea.

Currently, OpenStudio can report the model version, but there is not a definitive method or test for which version of the OpenStudio _codebase_ 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 test; while both OS versions are extant, you may want to implement something like this to maintain backward compatibility in your own measures:measures as well:

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

e.g.

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

You get the idea.