2

rename modelObject by ruby

Hi I want to construct a new airloop in openstudio model using ruby bindings, now I know how to construct it but the name is defaulted:

irb(main):068:0>new_AirLoop = OpenStudio::Model::AirLoopHVAC.new(model)
irb(main):069:0> new_AirLoop.name.get
=> "Air Loop HVAC 1"

How can I change this name? Any suggestion?

dalin_si's avatar
496
dalin_si
asked 2017-01-05 17:17:24 -0500
__AmirRoth__'s avatar
4.4k
__AmirRoth__
updated 2017-01-09 08:05:45 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

new_AirLoop.setName("A new Name") should do the trick!

Lyle K's avatar
2.2k
Lyle K
answered 2017-01-05 17:24:10 -0500
Julien Marrec's avatar
29.7k
Julien Marrec
updated 2017-01-09 05:20:31 -0500
edit flag offensive 0 remove flag delete link

Comments

Thanks, sorry to bother you but do you have any tutorial or other documentation? I barely find these material online.

dalin_si's avatar dalin_si (2017-01-05 17:32:18 -0500) edit
1

The OpenStudio::Model object list can be found HERE which contains most of the methods needed for each model object. Some of the more general methods can be tricky to find, if you click on the 'inheritance diagram' for AirLoopHVAC you will see it traces back to OpenStudio::IdfObject which contains the setName() method, found HERE

Lyle K's avatar Lyle K (2017-01-05 17:42:14 -0500) edit
1

The OpenStudio measure writing guide found HERE will lead you to all the documentation available as well.

Lyle K's avatar Lyle K (2017-01-05 17:45:22 -0500) edit
1

Using new_airLoop.methods in an interactive prompt is also a good way to see what's available. The naming conventions in openstudio are generally pretty clear.

Julien Marrec's avatar Julien Marrec (2017-01-09 05:21:12 -0500) edit
add a comment see more comments