bug dividing by 0 in nrcan_usage_parameters.py solved

This commit is contained in:
Pilar Monsalvete 2023-04-28 14:14:18 -04:00
parent 3bfb985c04
commit d5196fc54f

View File

@ -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):