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

Revision history [back]

If you don't need to save anything from the original system you can use the heavy handed approach that is used on the AEDG HVAC measures. Everything is removed then the new systems is added. This is in the 'OsLiv_HVAC.rb' file in the resources directory. It is run before new systems are added.

def OsLib_HVAC.removeEquipment(model, runner)

airloops = model.getAirLoopHVACs
plantLoops = model.getPlantLoops
zones = model.getThermalZones

# remove all airloops 
airloops.each do |air_loop|
  air_loop.remove
end

# remove all zone equipment except zone exhaust fans
zones.each do |zone|
  zone.equipment.each do |equip|
    if equip.to_FanZoneExhaust.is_initialized
    else  
      equip.remove
    end
  end
end       

# remove plant loops
plantLoops.each do |plantLoop|
  # get the demand components and see if water use connection, then save it
  # notify user with info statement if supply side of plant loop had heat exchanger for refrigeration
  usedForSHWorRefrigeration = false
  plantLoop.demandComponents.each do |comp| #AP code to check your comments above
    if comp.to_WaterUseConnections.is_initialized or comp.to_CoilWaterHeatingDesuperheater.is_initialized
      usedForSHWorRefrigeration = true
    end
  end
  if usedForSHWorRefrigeration == false
    plantLoop.remove
  else
    runner.registerWarning("#{plantLoop.name} is used for SHW or refrigeration heat reclaim.  Loop will not be deleted")
  end
end #next plantLoop

end # end of def

If you don't need to save anything from the original system you can use the heavy handed approach that is used on the AEDG HVAC measures. Everything is removed then the new systems is added. This is in the 'OsLiv_HVAC.rb' file in the resources directory. It is run before new systems are added.

def OsLib_HVAC.removeEquipment(model, runner)

airloops = model.getAirLoopHVACs
plantLoops = model.getPlantLoops
zones = model.getThermalZones

# remove all airloops 
airloops.each do |air_loop|
  air_loop.remove
end

# remove all zone equipment except zone exhaust fans
zones.each do |zone|
  zone.equipment.each do |equip|
    if equip.to_FanZoneExhaust.is_initialized
    else  
      equip.remove
    end
  end
end       

# remove plant loops
plantLoops.each do |plantLoop|
  # get the demand components and see if water use connection, then save it
  # notify user with info statement if supply side of plant loop had heat exchanger for refrigeration
  usedForSHWorRefrigeration = false
  plantLoop.demandComponents.each do |comp| #AP code to check your comments above
    if comp.to_WaterUseConnections.is_initialized or comp.to_CoilWaterHeatingDesuperheater.is_initialized
      usedForSHWorRefrigeration = true
    end
  end
  if usedForSHWorRefrigeration == false
    plantLoop.remove
  else
    runner.registerWarning("#{plantLoop.name} is used for SHW or refrigeration heat reclaim.  Loop will not be deleted")
  end
end #next plantLoop

end # end of def

end # end of def

If you don't need to save anything from the original system you can use the heavy handed approach that is used on the AEDG HVAC measures. Everything is removed then the new systems is added. This is in the 'OsLiv_HVAC.rb' 'OsLib_HVAC.rb' file in the resources directory. It is run before new systems are added.

def OsLib_HVAC.removeEquipment(model, runner)

airloops = model.getAirLoopHVACs
plantLoops = model.getPlantLoops
zones = model.getThermalZones

# remove all airloops 
airloops.each do |air_loop|
  air_loop.remove
end

# remove all zone equipment except zone exhaust fans
zones.each do |zone|
  zone.equipment.each do |equip|
    if equip.to_FanZoneExhaust.is_initialized
    else  
      equip.remove
    end
  end
end       

# remove plant loops
plantLoops.each do |plantLoop|
  # get the demand components and see if water use connection, then save it
  # notify user with info statement if supply side of plant loop had heat exchanger for refrigeration
  usedForSHWorRefrigeration = false
  plantLoop.demandComponents.each do |comp| #AP code to check your comments above
    if comp.to_WaterUseConnections.is_initialized or comp.to_CoilWaterHeatingDesuperheater.is_initialized
      usedForSHWorRefrigeration = true
    end
  end
  if usedForSHWorRefrigeration == false
    plantLoop.remove
  else
    runner.registerWarning("#{plantLoop.name} is used for SHW or refrigeration heat reclaim.  Loop will not be deleted")
  end
end #next plantLoop

end # end of def