2

How to save model by using the ruby bindings

Hi I want to modify a openstudio model in command prompt by ruby bindings. I want to load the model and then assign a a thermal zone to a HVAC loop.

require 'OpenStudio'

translator = OpenStudio::OSVersion::VersionTranslator.new
path = OpenStudio::Path.new('model.osm')
model = translator.loadModel(path).get
hVACs = model.getAirLoopHVACs[0]

floor = model.getBuildingStorys[1]

hVACs .addBranchForZone(floor.spaces[1].thermalZone.get)

I get a True for addBranchForZone, but when I open the model in openstudio, the zone wasn't assigend to that air loop. I suppose the model haven't be save yet, but I'm not sure there have save function in ruby bindings

Any advice and suggestion, or any tutorial or introduction or documentation about openstudio ruby binding would be appreciated!

dalin_si's avatar
496
dalin_si
asked 2017-01-05 14:46:51 -0500, updated 2017-01-05 14:49:22 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

If you look at the last two lines of the example measure test documented here it will show you how to save a model in a command prompt.

# save the model to test output directory
output_file_path = OpenStudio::Path.new(File.dirname(__FILE__) + "/output/my_test_model_test_a_output.osm")
model.save(output_file_path,true)
David Goldwasser's avatar
20.4k
David Goldwasser
answered 2017-01-05 15:02:15 -0500, updated 2017-01-05 15:02:31 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments