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

Open Studio SDK questions

asked 2015-10-27 14:19:23 -0600

antonszilasi gravatar image

updated 2015-10-28 14:30:28 -0600

I am attempting to continue Chien Si Harriman's excellent work with the Honeybee Open Studio HVAC components. However I am having quite a number of issues understanding the Open Studio SDK and as a result I've hit a roadblock. If you could answer/explain the questions below, it would help me with my understanding of the SDK and be greatly appreciated. I'm using C# bindings from version 1.9.0.

A. Why does adding either a SystemType1 or a SystemType2 return void while adding any other SystemType return a Loop class object.

B. How is it possible to get the Airloop of a SystemType1 or SystemType2 HVAC system? I can get the get the Airloop of SystemTypes 3-6 using the following code.

handle = OpenStudio.OpenStudioModelHVAC.addSystemType3(model).handle()

airloop = model.getAirLoopHVAC(handle).get()

However clearly this doesn't work with SystemType1 or 2 because the add SystemType1 methods return void.

C. I cannot find the method .getAirLoopHVAC anywhere in the OS SDK as well as the property handle() and get(). Could you provide a hyper link to these properties and methods?

D. With SystemType2 I can get the package terminal heat pumps using the code.


How can I get the HVAC systems in the same way for SystemTypes 3-6? getZoneHVAC yields no results in the OS SDK.

E. I need to set the cooling and heating Airflow rates for SystemTypes 3-6 is this possible? Since I can't get the HVAC systems at this stage (question D.) I don't know how to change their properties.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-10-28 02:14:14 -0600

updated 2015-10-28 19:52:22 -0600

I think some of the confusion is that method to make system type 1 and 2 take in the model and an array of zones and results in zone equipment, without an air loop. System types 3-10 result in an air loop, with zones added to the system with additional API calls. Some systems also add one or more plant loops.

Here is the header file for HVACTemplates. I'm not sure why it does' show on our developer API documentation. I'll look into that. We do have some same code that uses this on a private repo. I'll put a few ruby examples below that may be helpful.

In the example below "conditioned_zones" is an array of zones.

  #add a system type 1 - PTAC to each zone
  hvac = OpenStudio::Model::addSystemType1(model, conditioned_zones)

The code above results in zone equipment linked to a hot water plant loop. System 2 (PTHP) looks just like this but only creates zone equipment.

To create single zone systems loop through conditioned zones adding a system for each one. (types 3,4,9,10) Updated to remove un-necessary lines per Kyle's comment

  #add a system type 3 - PSZ-AC to each zone and set this zone to be the controlling zone
  conditioned_zones.each do|zone|
    hvac = OpenStudio::Model::addSystemType3(model)
    hvac = hvac.to_AirLoopHVAC.get

To create a multizone system, make the system first then loop through the zones adding them to the demand side of the loop. (types 5,6,7,8)

  #add a system type 5 - Packaged VAV with Reheat to the model and hook up
  #each zone to this system
  hvac = OpenStudio::Model::addSystemType5(model)
  hvac = hvac.to_AirLoopHVAC.get      
  conditioned_zones.each do|zone|

Please let us know if you have additional questions. We can provide more code for other system types or advise on how to build up custom system types instead of using the "addSystemType" call; this gives you a lot of flexibility.

edit flag offensive delete link more


Here is an example of getting the air loop for a zone. You wan to confirm it has an air loop before doing ".get"

air_loop = zone.airLoopHVAC.get

If you have a model and you want to get all of the air loops use this.

air_loops = model.getAirLoopHVACs
air_loops.each do |air_loop|
David Goldwasser gravatar image David Goldwasser  ( 2015-10-28 02:26:48 -0600 )edit


Thanks for your detailed response. This is a fairly basic question but I can't work it out at this stage. I am using Python, for the 3rd HVAC system with the line of code.

hvac = hvac.to_AirLoopHVAC

The variable hvac is set to a "built-in method to_AirLoopHVAC of Loop object". However when I try.

hvac = hvac.to_AirLoopHVAC.get()

, which I think should be the Python equivalent of Ruby "get" the compiler gives me the error the object has no attribute 'get'.

Could you please point me in the right direction with how I can duplicate this code with Python.


antonszilasi gravatar image antonszilasi  ( 2015-10-28 13:20:46 -0600 )edit

@antonszilasi, I think you need to call it from the model. Here is an example that worked for me before:

hvacHandle = ops.OpenStudioModelHVAC.addSystemType5(model).handle()

#get the airloop

airloop = model.getAirLoopHVAC(hvacHandle).get()

#use air loop object as you want

Mostapha Roudsari gravatar image Mostapha Roudsari  ( 2015-10-28 13:43:59 -0600 )edit

That will work. Or you can follow the approach in this post.

Kyle Benne gravatar image Kyle Benne  ( 2015-10-28 14:00:20 -0600 )edit

Some of the niceties we put into Ruby around casting just don't exist in the other bindings.

Kyle Benne gravatar image Kyle Benne  ( 2015-10-28 14:01:04 -0600 )edit

answered 2015-10-29 10:23:51 -0600

updated 2015-10-29 10:25:09 -0600

This is in reply to part E of your question...

"E. I need to set the cooling and heating Airflow rates for SystemTypes 3-6"

In EnergyPlus airflow rates are established by the terminal units. Imagine the terminal units making flow requests back to the "supply side" as opposed to the supply side (fan) pushing flow values forward to the zones. By default OpenStudio will autosize all of your components so typically you aren't thinking about these things. In an autosizing situation the SizingZone object is key to determining how the flow will size out. The SizingZone object defines the heating and cooling supply temperatures that will be assumed during the sizing calculation. Given a zone load and the desired supply air temperature, a design airflow will fall out during the EnergyPlus sizing calc.

If you want to hard size the flow, the details depend on your terminal type. System type 3 uses AirTerminalSingleDuctUncontrolled so you would do something like this...

  conditioned_zones.each do|zone|

This is the syntax for Ruby. As @Mostapha Roudsari pointed out in the comments, the casting (in this case for terminals) will look a little different in c#. Maybe one of the C# gurus will clean up my syntax to be appropriate for C#.

For reference system type 4 uses AirTerminalSingleDuctUncontrolled, 5 is AirTerminalSingleDuctVAVReheat, and 6 is AirTerminalSingleDuctParallelPIUReheat. See here for details. You could also just create these systems and open them up in the OpenStudio Application to figure out what content they have.

Note that hard sizing some components and leaving some autosized can be a little risky if you don't pay attention. You can end up with components that aren't well matched to each other. Imagine a hard sized terminal asking for a certain flow, pulling air through an autosized coil designed for a completely different airflow.

edit flag offensive delete link more


@Kyle Benne@David Goldwasser

Thank you for your comments and your detailed answers! I think that answers most of my questions for now I'll get back to you with any other questions that I have.



antonszilasi gravatar image antonszilasi  ( 2015-10-29 18:35:32 -0600 )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



Asked: 2015-10-27 14:19:23 -0600

Seen: 591 times

Last updated: Oct 29 '15