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

Revision history [back]

click to hide/show revision 1
initial version

OpenStudio SDK - saving an optional model as a OSM

Unfortunately I am struggling with the OpenStudio SDK, I am creating a OpenStudio model from a gbxml using the GbXMLReverseTranslator which produces a OpenStudio::Model::OptionalModel.

Unfortunately I can't work out how to actually save the model to my desktop as the OpenStudio::Model::OptionalModel doesn't have a save method.

What am I missing here?

" require 'openstudio'

Make a translator

translator = OpenStudio::GbXML::GbXMLReverseTranslator.new

newModel = translator.loadModel(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\gbxml3.xml'))

newModel.save(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\newModel.osm'),true)

"

OpenStudio SDK - saving an optional model as a OSM

Unfortunately I am struggling with the OpenStudio SDK, I am creating a OpenStudio model from a gbxml using the GbXMLReverseTranslator which produces a OpenStudio::Model::OptionalModel.

Unfortunately I can't work out how to actually save the model to my desktop as the OpenStudio::Model::OptionalModel doesn't have a save method.

What am I missing here?here? The code can be seen below.

" require 'openstudio'

Make a translator

translator = = OpenStudio::GbXML::GbXMLReverseTranslator.new

newModel = = translator.loadModel(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\gbxml3.xml'))

newModel.save(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\newModel.osm'),true)

"

OpenStudio SDK - saving an optional model as a OSM

Unfortunately I am struggling with the OpenStudio SDK, I am creating a OpenStudio model from a gbxml using the GbXMLReverseTranslator which produces a OpenStudio::Model::OptionalModel.

Unfortunately I can't work out how to actually save the model to my desktop as the OpenStudio::Model::OptionalModel doesn't have a save method.

What am I missing here? The code can be seen below.

require 'openstudio'

translator = OpenStudio::GbXML::GbXMLReverseTranslator.new

newModel = translator.loadModel(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\gbxml3.xml'))

newModel.save(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\newModel.osm'),true)

OpenStudio SDK - saving an optional model as a OSM

Unfortunately I am struggling with the OpenStudio SDK, I am creating a OpenStudio model from a gbxml using the GbXMLReverseTranslator which produces a OpenStudio::Model::OptionalModel.

Unfortunately I can't work out how to actually save the model to my desktop as the OpenStudio::Model::OptionalModel doesn't have a save method.

What am I missing here? The code can be seen below.below, I want to save the newModel created from the reverseGbXML.

require 'openstudio'

translator = OpenStudio::GbXML::GbXMLReverseTranslator.new

newModel = translator.loadModel(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\gbxml3.xml'))

newModel.save(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\newModel.osm'),true)

OpenStudio SDK - saving an optional model as a OSM

Unfortunately I am struggling with have managed to make an optional model by using the OpenStudio SDK, I am creating a OpenStudio model from a gbxml reverse translator using the GbXMLReverseTranslator which produces a OpenStudio::Model::OptionalModel.

Unfortunately I can't work out how to actually save the model to my desktop as the OpenStudio::Model::OptionalModel doesn't have a save method.

What am I missing here? The code can be seen below, I want to save the newModel created from the reverseGbXML.below:

require 'openstudio'

translator = OpenStudio::GbXML::GbXMLReverseTranslator.new

newModel = translator.loadModel(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\gbxml3.xml'))

Unfortunately the model is not initalized so I can't convert it to a model as seen here

newModel.save(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\newModel.osm'),true)

How can I initalize the model?

OpenStudio SDK - saving an optional model as a OSM

I have managed to make an optional model by using the gbxml reverse translator using the code below:

require 'openstudio'

translator = OpenStudio::GbXML::GbXMLReverseTranslator.new

newModel = translator.loadModel(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\gbxml3.xml'))

Unfortunately the model is not initalized so I can't convert it to a model as seen here

How can I initalize the model?

OpenStudio SDK - saving an optional model as a OSM

I have managed to make an optional model by using the gbxml reverse translator using the code below:

require 'openstudio'

translator = OpenStudio::GbXML::GbXMLReverseTranslator.new

newModel = translator.loadModel(OpenStudio::Path.new('C:\Users\szilasia\Documents\dscEngine\gbxml3.xml'))

Unfortunately the model is not initalized so I can't convert it to a model as seen here

How can I initalize the model?