First time here? Check out the Help page!
1 | initial version |
I would write an OpenStudio Measure to remove these orphaned objects. You can run the Measure on your model via "Components & Measures > Apply Measure Now" and see the impact of the Measure before saving the edited model.
Here is the ruby code you to put inside the run
method in measure.rb
:
# Remove orphaned hot water heating coils
model.getCoilHeatingWaters.each do |coil|
if coil.airLoopHVAC.is_initialized and coil.plantLoop.is_initialized
next # Ignore coils that are already connected properly
elsif coil.plantLoop.is_initialized
next # Ignore hot water coils that are already connected properly inside air terminals
else
coil.remove
runner.registerInfo("Removed an orphaned hot water coil called #{coil.name.get}")
end
end
# Remove orphaned chilled water cooling coils
model.getCoilCoolingWaters.each do |coil|
if coil.airLoopHVAC.is_initialized and coil.plantLoop.is_initialized
next # Ignore coils that are already connected properly
else
coil.remove
runner.registerInfo("Removed an orphaned chilled water coil called #{coil.name.get}")
end
end
# Remove orphaned water coil controllers (for hot and chilled water coils)
model.getControllerWaterCoils.each do |controller_water_coil|
controller_used = false
model.getCoilHeatingWaters.each do |coil|
if coil.controllerWaterCoil.is_initialized
if coil.controllerWaterCoil.get == controller_water_coil
controller_used = true
end
end
end
model.getCoilCoolingWaters.each do |coil|
if coil.controllerWaterCoil.is_initialized
if coil.controllerWaterCoil.get == controller_water_coil
controller_used = true
end
end
end
# Remove unused water coil controllers
if controller_used == false
controller_water_coil.remove
runner.registerInfo("Removed #{controller_water_coil.name.get} because it is unused")
end
end