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

Remove Os:AirTerminal

asked 2017-08-05 02:01:49 -0600

updated 2017-08-08 01:43:26 -0600

I have modified the user script to remove unused thermal zones (they remain after deleting the space). Before deleting the thermal zone, I delete the zone equipment. It works fine with everything except with AirTerminal type equipment. If there is an AirTerminal in the zone equipment, Sketchup or Openstudio will crash after removing. This is the code:

def removeUnusedThermalZones(model)
  thermal_zones = model.getThermalZones

  thermal_zone_handles_to_remove = OpenStudio::UUIDVector.new
  equipmentListToRemove = []

  thermal_zones.each do |thermal_zone|
    if thermal_zone.spaces.empty?  && thermal_zone.isRemovable
      thermal_zone_handles_to_remove << thermal_zone.handle
      if not thermal_zone.equipment.empty?
        thermal_zone.equipment.each do |equip| 
          equipmentListToRemove<< equip
        end
      end
    end
  end

  if not equipmentListToRemove.empty?
    equipmentListToRemove.each {|equip|
      equip.remove
    }
  end

  if not thermal_zone_handles_to_remove.empty?
    model.removeObjects(thermal_zone_handles_to_remove)
  else
    puts "No unused thermal zones to remove."
  end
end
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2017-08-07 16:45:11 -0600

You can use the removeBranchForZone method in the AirLoopHVAC object to delete the AirTerminal object.

Code will look something like:

model.getAirLoopHVACs.each do |loop|
  loop.removeBranchForZone(thermal_zone)
end

or better:

model.getThermalZones.each do |zone|
  if !zone.airLoopHVACTerminal.empty?
    terminal = zone.airLoopHVACTerminal.get
    if !terminal.airLoopHVAC.empty?
      air_loop = terminal.airLoopHVAC.get
      air_loop.removeBranchForZone(zone)
    end
  end
end
edit flag offensive delete link more

Comments

Thanks for your answer. I tried the first approach and it seems to work.

mapascual gravatar imagemapascual ( 2017-08-08 01:40:39 -0600 )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

Stats

Asked: 2017-08-05 02:01:49 -0600

Seen: 605 times

Last updated: Aug 08