First time here? Check our help page!
1

How to locate each heating water coil by Ruby binding?

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?
            hotWaterLoop.removeDemandBranchWithComponent(coil)
        end
    end
end
dalin_si's avatar
496
dalin_si
asked 2017-01-11 10:26:25 -0500
Julien Marrec's avatar
29.7k
Julien Marrec
updated 2017-01-11 19:12:15 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

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?
    ...
  else
   # 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. 
  end
end

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|
     ....
  end
end
Kyle Benne's avatar
6k
Kyle Benne
answered 2017-01-11 13:28:14 -0500, updated 2017-01-11 13:30:26 -0500
edit flag offensive 0 remove flag delete link

Comments

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's avatar dalin_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@nrel.gov.

Kyle Benne's avatar Kyle 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's avatar dalin_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's avatar Kyle 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's avatar dalin_si (2017-01-11 16:01:28 -0500) edit
add a comment see more comments