lib/openstudio-standards/btap/geometry.rb in openstudio-standards-0.2.11 vs lib/openstudio-standards/btap/geometry.rb in openstudio-standards-0.2.12.rc1

- old
+ new

@@ -2714,10 +2714,37 @@ average_conductance = "NA" average_conductance = temp / total_area unless total_area == 0.0 return average_conductance end + #determine average conductance on set of surfaces or subsurfaces. + def self.get_weighted_average_surface_shgc(surfaces) + total_area = 0.0 + temp = 0.0 + surfaces.each do |surface| + temp = temp + BTAP::Geometry::Surfaces::get_surface_net_area(surface) * BTAP::Geometry::Surfaces::get_surface_construction_shgc(surface) + total_area = total_area + BTAP::Geometry::Surfaces::get_surface_net_area(surface) + end + ave_shgc = "NA" + ave_shgc = temp / total_area unless total_area == 0.0 + return ave_shgc + end + + #determine average conductance on set of surfaces or subsurfaces. + def self.get_weighted_average_surface_tvis(surfaces) + total_area = 0.0 + temp = 0.0 + surfaces.each do |surface| + temp = temp + BTAP::Geometry::Surfaces::get_surface_net_area(surface) * BTAP::Geometry::Surfaces::get_surface_construction_tvis(surface) + total_area = total_area + BTAP::Geometry::Surfaces::get_surface_net_area(surface) + end + ave_tvis = "NA" + ave_tvis = temp / total_area unless total_area == 0.0 + return ave_tvis + end + + #get total exterior surface area of building. def self.get_total_ext_wall_area(model) outdoor_surfaces = BTAP::Geometry::Surfaces::filter_by_boundary_condition(model.getSurfaces(), "Outdoors") outdoor_walls = BTAP::Geometry::Surfaces::filter_by_surface_types(outdoor_surfaces, "Wall") @@ -2790,10 +2817,27 @@ construction = OpenStudio::Model::getConstructionByName(surface.model, surface.construction.get.name.to_s).get #create a new construction with the requested RSI value based on the current construction. return BTAP::Resources::Envelope::Constructions::get_conductance(construction) end + #This method gets the shgc for a surface + def self.get_surface_construction_shgc(surface) + #a bit of acrobatics to get the construction object from the ConstrustionBase object's name. + construction = OpenStudio::Model::getConstructionByName(surface.model, surface.construction.get.name.to_s).get + #create a new construction with the requested RSI value based on the current construction. + return BTAP::Resources::Envelope::Constructions::get_shgc(model,construction) + end + + #This method gets the tvis for the surface + def self.get_surface_construction_tvis(surface) + #a bit of acrobatics to get the construction object from the ConstrustionBase object's name. + construction = OpenStudio::Model::getConstructionByName(surface.model, surface.construction.get.name.to_s).get + #create a new construction with the requested RSI value based on the current construction. + return BTAP::Resources::Envelope::Constructions::get_tvis(model,construction) + end + + def self.get_surface_net_area(surface) return surface.netArea() end def self.get_sub_surface_net_area(subsurface) @@ -3010,10 +3054,13 @@ # Is this line segment pointing up? If no, then ignore it and go to the next line segment. if surf_verts[i][:y] > surf_verts[i - 1][:y] # Go through each line segment for j in 1..(surf_verts.length - 1) # Is the line segment to the left of the current (index i) line segment? If no, then ignore it and go to the next one. - if surf_verts[j][:x] < surf_verts[i][:x] and surf_verts[j - 1][:x] < surf_verts[i - 1][:x] + # I revised this to check if the start or end of the current (index i) line segment is to the left of the + # line segment being checked. + #if surf_verts[j][:x] < surf_verts[i][:x] and surf_verts[j - 1][:x] < surf_verts[i - 1][:x] + if surf_verts[j][:x] < surf_verts[i][:x] || surf_verts[j - 1][:x] < surf_verts[i - 1][:x] # Is the line segment pointing down? If no, then ignore it and go to the next line segment. if surf_verts[j][:y] < surf_verts[j - 1][:y] # Do the y coordinates of the line segment overlap with the current (index i) line segment? If no # then ignore it and go to the next line segment. overlap_y = line_segment_overlap_y?(point_a1: surf_verts[i][:y], point_a2: surf_verts[i - 1][:y], point_b1: surf_verts[j][:y], point_b2: surf_verts[j - 1][:y])