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

Revision history [back]

I'll attempt to answer your questions but the OS developers might have some additional details about some of them.

Before starting to write measures it's a good idea to read the Measure Writing Guide.

  1. User's can interact with models through formal measures in the GUIs or more directly through the API with one of the language bindings for Ruby, C#, or Python. However, only Ruby and C# are fully supported, Python is less supported.

  2. See one definition of a language binding.

    • 2-1. No you don't need the source code to write measures. See the Measure Writing Guide.
    • 2-2. OpenStudio has methods in the SDK/API for translating OSM, IDF, and XML files.
  3. During a simulation OpenStudio uses the ForwardTranslator to translate the model to IDF for simulation using EnergyPlus. OpenStudio can also import IDFs via the GUI or the API, which uses the ReverseTranslator. Currently everything except the HVAC objects can be imported from an IDF. There isn't a gbXMLToidf method in the SDK, but there are ForwardTranslator and ReverseTranslator classes that have methods to convert to/from GBXML.

  4. No, user's do not need the source code for measures. The measures indirectly use the source code through the API.

I'll attempt to answer your questions but the OS developers others might have some additional details about some of them.

Before starting to write measures it's a good idea to read the Measure Writing Guide.

  1. User's can interact with models through formal measures in the GUIs or more directly through the API with one of the language bindings for Ruby, C#, or Python. However, only Ruby and C# are fully supported, Python is less supported.

  2. See one definition of a language binding.

    • 2-1. No you don't need the source code to write measures. See the Measure Writing Guide.
    • 2-2. OpenStudio has methods in the SDK/API for translating OSM, IDF, and XML files.
  3. During a simulation OpenStudio uses the ForwardTranslator to translate the model to IDF for simulation using EnergyPlus. OpenStudio can also import IDFs via the GUI or the API, which uses the ReverseTranslator. Currently everything except the HVAC objects can be imported from an IDF. There isn't a gbXMLToidf method in the SDK, but there are ForwardTranslator and ReverseTranslator classes that have methods to convert to/from GBXML.

  4. No, user's do not need the source code for measures. The measures indirectly use the source code through the API.

I'll attempt to answer your questions but others might have some additional details about some of them.

Before starting to write measures it's a good idea to read the Measure Writing Guide.

  1. User's can interact with models through formal measures in the GUIs GUIs, which are written in Ruby, or more directly through the API with one of the language bindings for Ruby, C#, or Python. However, only Ruby and C# are fully supported, Python is less supported. bindings require users to build OS from source code.

  2. See one definition of a language binding.

    • 2-1. No you don't need the source code to write measures. See the Measure Writing Guide.
    • 2-2. OpenStudio has methods in the SDK/API for translating OSM, IDF, and XML files.
  3. During a simulation OpenStudio uses the ForwardTranslator to translate the model to IDF for simulation using EnergyPlus. OpenStudio can also import IDFs via the GUI or the API, which uses the ReverseTranslator. Currently everything except the HVAC objects can be imported from an IDF. There isn't a gbXMLToidf method in the SDK, but there are ForwardTranslator and ReverseTranslator classes that have methods to convert to/from GBXML.

  4. No, user's do not need the source code for measures. The measures indirectly use the source code through the API.API and the Ruby bindings.

I'll attempt to answer your questions but others might have some additional details about some of them.

Before starting to write measures it's a good idea to read the Measure Writing Guide.

  1. User's can interact with models through formal measures in the GUIs, which are written in Ruby, or more directly through the API with one of the language bindings for Ruby, C#, or Python. However, only Ruby and C# are fully supported, Python bindings require users to build OS from source code.

  2. See one definition of a language binding.

    • 2-1. No you don't need the source code to write measures. See the Measure Writing Guide.
    • 2-2. OpenStudio has methods in the SDK/API for translating OSM, IDF, and XML files.
  3. During a simulation OpenStudio uses the ForwardTranslator to translate the model to IDF for simulation using EnergyPlus. OpenStudio can also import IDFs via the GUI or the API, which uses the ReverseTranslator. Currently everything except the HVAC objects can be imported from an IDF. There isn't a gbXMLToidf method in the SDK, but there are ForwardTranslator and ReverseTranslator classes that have methods to convert to/from GBXML.GBXML. See below for some untested code.

  4. No, user's do not need the source code for measures. The measures indirectly use the source code through the API and the Ruby bindings.


Here's an example of some untested code using the Ruby bindings outside of a formal measure that may work. See the Optional - Install Ruby instructions to enable this.

# OpenStudio Ruby Bindings
require 'openstudio'

# path to gbxml
xml_path = 'path/to/model.xml'

# gbxml to osm
reverse_translator = OpenStudio::GbXML::GbXMLReverseTranslator.new
model = reverse_translator.loadModel(xml_path)

# osm to idf
forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new
idf = forward_translator.translateModel(model)

# save IDF
idf_path = 'path/to/model.idf'
idf.save(idf_path, true)

I'll attempt to answer your questions but others might have some additional details about some of them.

Before starting to write measures it's a good idea to read the Measure Writing Guide.

  1. User's can interact with models through formal measures in the GUIs, which are written in Ruby, or more directly through the API with one of the language bindings for Ruby, C#, or Python. However, only Ruby and C# are fully supported, Python bindings require users to build OS from source code.

  2. See one definition of a language binding.

    • 2-1. No you don't need the source code to write measures. See the Measure Writing Guide.
    • 2-2. OpenStudio has methods in the SDK/API for translating OSM, IDF, and XML files.
  3. During a simulation OpenStudio uses the ForwardTranslator to translate the model to IDF for simulation using EnergyPlus. OpenStudio can also import IDFs via the GUI or the API, which uses the ReverseTranslator. Currently everything except the HVAC objects can be imported from an IDF. There isn't a gbXMLToidf method in the SDK, but there are ForwardTranslator and ReverseTranslator classes that have methods to convert to/from GBXML. See below for some untested code.

  4. No, user's do not need the source code for measures. The measures indirectly use the source code through the API and the Ruby bindings.


Here's an example of some untested code using the Ruby bindings outside of a formal measure that may work. See the Optional - Install Ruby instructions to enable this.

# OpenStudio Ruby Bindings
require 'openstudio'

# path to gbxml
xml_path = 'path/to/model.xml'

# gbxml to osm
reverse_translator = OpenStudio::GbXML::GbXMLReverseTranslator.new
model = reverse_translator.loadModel(xml_path)

# osm to idf
forward_translator = OpenStudio::EnergyPlus::ForwardTranslator.new
idf = forward_translator.translateModel(model)

# save IDF
idf
idf_path = 'path/to/model.idf'
idf.save(idf_path, true)