Created
October 28, 2016 18:13
-
-
Save kbenne/10996583867f2edf742af4c9a14a22fc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openstudio' | |
model = OpenStudio::Model::Model::load('broken.osm').get | |
zones = model.getThermalZones; | |
zones.each do |zone| | |
puts "#{zone.nameString}" | |
pl = zone.exhaustPortList | |
pl_objects = pl.modelObjects | |
puts " exhaust port list size: #{pl_objects.size}" | |
pl_objects.each do |exhaust_node| | |
puts " exhaust node: #{exhaust_node.nameString}" | |
exhaust_node_outlet = exhaust_node.to_StraightComponent.get.outletModelObject | |
if exhaust_node_outlet.empty? | |
puts " exhaust node outlet is empty" | |
exhaust_node.to_HVACComponent.get.disconnect | |
exhaust_node.remove | |
else | |
puts " exhaust node outlet: #{exhaust_node_outlet.get.nameString}" | |
end | |
end | |
end | |
model.save 'fix.osm', true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment