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

Revision history [back]

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

coils = model.getCoilsHeatingWaters
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?
    ...
  elsie 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 you attention to is this...

plants = model.getPlantLoops
plants.each do |plant|
  coils = plant.supplyComponents(OpenStudio::Model::CoilHeatingWater::iddObjectType)
  coils.each do |coil|
     ....
  end
end

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

coils = model.getCoilsHeatingWaters
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?
    ...
  elsie 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 you attention to is this...

plants = model.getPlantLoops
plants.each do |plant|
  coils = plant.supplyComponents(OpenStudio::Model::CoilHeatingWater::iddObjectType)
  coils.each do |coil|
     ....
  end
end

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

coils = model.getCoilsHeatingWaters
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 you your attention to is this...

plants = model.getPlantLoops
plants.each do |plant|
  coils = plant.supplyComponents(OpenStudio::Model::CoilHeatingWater::iddObjectType)
  coils.each do |coil|
     ....
  end
end

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

coils = model.getCoilsHeatingWaters
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.supplyComponents(OpenStudio::Model::CoilHeatingWater::iddObjectType)
plant.demandComponents(OpenStudio::Model::CoilHeatingWater::iddObjectType)
  coils.each do |coil|
     ....
  end
end

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

coils = model.getCoilsHeatingWaters
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