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

Open Studio Ruby code - getting the existing HVAC air loop template

asked 2023-05-31 08:59:05 -0500

MDW's avatar

updated 2023-05-31 11:13:43 -0500

Hello, I tried using AI as a starting point to code an ASHP measure on Ruby to be used on Open Studio. Two lines of code are:

thermal_zone = thermal_zone.get
existing_template = thermal_zone.airLoopHVACTemplate

The second line is throwing an error, as the method "airLoopHVACTemplate" is undefined. I've been unsuccessful in finding documentation explaining this method - does anyone know what alternatives could be used to achieve what I am hoping to accomplish (get the existing HVAC air loop for the thermal zone)?

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-05-31 15:02:06 -0500

Don't think the SDK has an airLoopHVACTemplate method. You're likely after airLoopHVAC, which the ThermalZone class inherits from HVACComponent. An example.

edit flag offensive delete link more


Exactly. Mind that this returns an OptionalAirLoopHVAC, eg a_ = z.airLoopHVAC, so you should check if !a_.empty? or a_.is_initialized before calling a = a_.get when a is now an AirLoopHVAC

Julien Marrec's avatar Julien Marrec  ( 2023-06-01 02:02:51 -0500 )edit

Got it - thank you both for the responses.

MDW's avatar MDW  ( 2023-06-01 10:11:15 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Training Workshops


Question Tools

1 follower


Asked: 2023-05-31 08:59:05 -0500

Seen: 50 times

Last updated: May 31 '23