Skip to content

Commit

Permalink
fix(model): Handle cases of zero window area
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Jul 9, 2021
1 parent 4259a8a commit 1be6ad0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion dragonfly_uwg/properties/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,10 @@ def average_shgc(self, climate_zone):
"""
ext_ap_areas = [bldg.exterior_aperture_area for bldg in self.host.buildings]
total_area = sum(ext_ap_areas)
ext_ap_weights = [area / total_area for area in ext_ap_areas]
try:
ext_ap_weights = [area / total_area for area in ext_ap_areas]
except ZeroDivisionError: # no apertures in model; just use dummy shgc
return 0.4
shgc = 0
for bldg, weight in zip(self.host.buildings, ext_ap_weights):
if bldg.properties.uwg._shgc is None:
Expand Down Expand Up @@ -371,6 +374,9 @@ def _create_bld_matrix(self, floor_area_weights):
bld_dict[key][2] += weight
except KeyError: # first time we have this program and vintage
bld_dict[key] = [uwg_prop.program_uwg, uwg_prop.vintage_uwg, weight]
# round all weight values to avoid tolerance issues
for val in bld_dict:
bld_dict[val][2] = round(bld_dict[val][2], 3)
return tuple(bld_dict.values())

def _autocalcualted_tree_coverage(self, ground_area):
Expand Down

0 comments on commit 1be6ad0

Please sign in to comment.