From d5196fc54f68197684c7d80f4c2259303cb0e797 Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Fri, 28 Apr 2023 14:14:18 -0400 Subject: [PATCH] bug dividing by 0 in nrcan_usage_parameters.py solved --- hub/imports/usage/nrcan_usage_parameters.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hub/imports/usage/nrcan_usage_parameters.py b/hub/imports/usage/nrcan_usage_parameters.py index 5898f2a0..8073ca67 100644 --- a/hub/imports/usage/nrcan_usage_parameters.py +++ b/hub/imports/usage/nrcan_usage_parameters.py @@ -130,11 +130,16 @@ class NrcanUsageParameters: def _assign_comnet_extra_values(usage, archetype, occupancy_density): _occupancy = usage.occupancy archetype_density = archetype.occupancy.occupancy_density - _occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain \ - * occupancy_density / archetype_density - _occupancy.latent_internal_gain = archetype.occupancy.latent_internal_gain * occupancy_density / archetype_density - _occupancy.sensible_convective_internal_gain = archetype.occupancy.sensible_convective_internal_gain \ - * occupancy_density / archetype_density + if archetype_density == 0: + _occupancy.sensible_radiative_internal_gain = 0 + _occupancy.latent_internal_gain = 0 + _occupancy.sensible_convective_internal_gain = 0 + else: + _occupancy.sensible_radiative_internal_gain = archetype.occupancy.sensible_radiative_internal_gain \ + * occupancy_density / archetype_density + _occupancy.latent_internal_gain = archetype.occupancy.latent_internal_gain * occupancy_density / archetype_density + _occupancy.sensible_convective_internal_gain = archetype.occupancy.sensible_convective_internal_gain \ + * occupancy_density / archetype_density @staticmethod def _calculate_reduced_values_from_extended_library(usage, archetype):