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

How to locate each heating water coil by Ruby binding?

asked 2017-01-11 10:26:25 -0500

dalin_si gravatar image

updated 2017-01-11 19:12:15 -0500

I have some redundant heating water coil in plant loop, OpenStudio model, but I'm not sure how to locate them. My primary idea is checking whether these coils belong to any other HVAC Components (reheater, etc), or belong to some air loop. any other possibility? here is my Ruby code:

coils = model.getCoilHeatingWaters

hotWaterLoop = model.getPlantLoopByName('hot water loop')

coils.each do |coil|
    if coil.airLoopHVAC.empty?
        if coil.containingHVACComponent.empty?
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-01-11 13:28:14 -0500

updated 2017-01-11 13:30:26 -0500

I think your code is pretty much on point. Here are a couple of thoughts.

coils = model.getCoilHeatingWaters
coils.each do |coil|
  # This is the one method your example didn't check.
  # Since the water coil sits between the air and plant loops, check for both air and plant loops,
  # you might have a half connected coil.
  if coil.plantLoop.empty?
  elsif coil.airLoopHVAC.empty?
  elsif coil.containingHVACComponent.empty?
   # you might get here. In which case the coil might be in the model, but not hooked up to anything.
   # The other possibility is that it is inside a piece of zone hvac or terminal unit that containingHVACComponent
   # does not know about. This would be a bug in OpenStudio if found to be the case. 

The other key method I would like to draw your attention to is this...

plants = model.getPlantLoops
plants.each do |plant|
  coils = plant.demandComponents(OpenStudio::Model::CoilHeatingWater::iddObjectType)
  coils.each do |coil|
edit flag offensive delete link more


Very appreciated, but as you said, in the else, how to distinguish between coil not hook up anything and coil in zone hvac or terminal unit?

dalin_si gravatar imagedalin_si ( 2017-01-11 14:01:56 -0500 )edit

containingHVACComponent is supposed to do the job. But I confess we might uncover a bug here. If you send me a model I'll find it for you if it exists.

Kyle Benne gravatar imageKyle Benne ( 2017-01-11 14:26:41 -0500 )edit

Thank you very much, but could you please tell me more detail about that bugs, seems containingHVACComponent can not help me to locate the coil which in Unit Heater

dalin_si gravatar imagedalin_si ( 2017-01-11 14:55:06 -0500 )edit

ah. So you have isolated it to a coil in the unit heater? I do not know of a confirmed bug, but the code is not particularly generic in this area. We have to add a piece of code to check all the types a coil can be in. From your post I was wondering something was added (like UnitHeater) that did not update the containingHVACComponent. I'll take a look at the unit heater related code in particular and see if I see something.

Kyle Benne gravatar imageKyle Benne ( 2017-01-11 15:09:11 -0500 )edit

Thank you for your follow my post, now I can locate those unknown heat coil in hot water loop to unit heaters (from OpenStudio check one by one, because containingHVACComponent.empty? is still true, no zoneHVACComponent come out)

dalin_si gravatar imagedalin_si ( 2017-01-11 16:01:28 -0500 )edit

Your Answer

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

Add Answer


Question Tools

1 follower


Asked: 2017-01-11 10:26:25 -0500

Seen: 60 times

Last updated: Jan 11 '17