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

How to save model by using the ruby bindings

asked 2017-01-05 14:46:51 -0600

dalin_si's avatar

updated 2017-01-05 14:49:22 -0600

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!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-01-05 15:02:15 -0600

updated 2017-01-05 15:02:31 -0600

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)
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

Careers

Question Tools

1 follower

Stats

Asked: 2017-01-05 14:46:51 -0600

Seen: 195 times

Last updated: Jan 05 '17