First time here? Check out the Help page!

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 8 years ago

dalin_si's avatar

updated 8 years ago

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!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 8 years ago

updated 8 years ago

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)
Preview: (hide)
link

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: 8 years ago

Seen: 216 times

Last updated: Jan 05 '17