a bug in usage -> division by 0
This commit is contained in:
parent
70c0dba6bd
commit
ffc956b2d0
|
@ -510,10 +510,14 @@ class ThermalZone:
|
|||
_schedule.values = values[:day]
|
||||
_schedules.append(_schedule)
|
||||
|
||||
_internal_gain.convective_fraction = _convective_fraction / _average_internal_gain
|
||||
_internal_gain.radiative_fraction = _radiative_fraction / _average_internal_gain
|
||||
_internal_gain.latent_fraction = _latent_fraction / _average_internal_gain
|
||||
_internal_gain.average_internal_gain = _average_internal_gain
|
||||
_internal_gain.convective_fraction = 0
|
||||
_internal_gain.radiative_fraction = 0
|
||||
_internal_gain.latent_fraction = 0
|
||||
if _average_internal_gain != 0:
|
||||
_internal_gain.convective_fraction = _convective_fraction / _average_internal_gain
|
||||
_internal_gain.radiative_fraction = _radiative_fraction / _average_internal_gain
|
||||
_internal_gain.latent_fraction = _latent_fraction / _average_internal_gain
|
||||
_internal_gain.type = 'mean_value'
|
||||
_internal_gain.schedules = _schedules
|
||||
self._internal_gains = [_internal_gain]
|
||||
|
|
|
@ -91,9 +91,13 @@ class Usage:
|
|||
+ self.occupancy.sensible_radiative_internal_gain
|
||||
+ self.occupancy.latent_internal_gain)
|
||||
_internal_gain.average_internal_gain = _total_heat_gain
|
||||
_internal_gain.latent_fraction = self.occupancy.latent_internal_gain / _total_heat_gain
|
||||
_internal_gain.radiative_fraction = self.occupancy.sensible_radiative_internal_gain / _total_heat_gain
|
||||
_internal_gain.convective_fraction = self.occupancy.sensible_convective_internal_gain / _total_heat_gain
|
||||
_internal_gain.latent_fraction = 0
|
||||
_internal_gain.radiative_fraction = 0
|
||||
_internal_gain.convective_fraction = 0
|
||||
if _total_heat_gain != 0:
|
||||
_internal_gain.latent_fraction = self.occupancy.latent_internal_gain / _total_heat_gain
|
||||
_internal_gain.radiative_fraction = self.occupancy.sensible_radiative_internal_gain / _total_heat_gain
|
||||
_internal_gain.convective_fraction = self.occupancy.sensible_convective_internal_gain / _total_heat_gain
|
||||
_internal_gain.schedules = self.occupancy.occupancy_schedules
|
||||
self._internal_gains = [_internal_gain]
|
||||
if self.lighting is not None:
|
||||
|
|
|
@ -91,9 +91,13 @@ class UsageZone:
|
|||
+ self.occupancy.sensible_radiative_internal_gain
|
||||
+ self.occupancy.latent_internal_gain)
|
||||
_internal_gain.average_internal_gain = _total_heat_gain
|
||||
_internal_gain.latent_fraction = self.occupancy.latent_internal_gain / _total_heat_gain
|
||||
_internal_gain.radiative_fraction = self.occupancy.sensible_radiative_internal_gain / _total_heat_gain
|
||||
_internal_gain.convective_fraction = self.occupancy.sensible_convective_internal_gain / _total_heat_gain
|
||||
_internal_gain.latent_fraction = 0
|
||||
_internal_gain.radiative_fraction = 0
|
||||
_internal_gain.convective_fraction = 0
|
||||
if _total_heat_gain != 0:
|
||||
_internal_gain.latent_fraction = self.occupancy.latent_internal_gain / _total_heat_gain
|
||||
_internal_gain.radiative_fraction = self.occupancy.sensible_radiative_internal_gain / _total_heat_gain
|
||||
_internal_gain.convective_fraction = self.occupancy.sensible_convective_internal_gain / _total_heat_gain
|
||||
_internal_gain.schedules = self.occupancy.occupancy_schedules
|
||||
self._internal_gains = [_internal_gain]
|
||||
if self.lighting is not None:
|
||||
|
|
|
@ -323,9 +323,12 @@ class Idf:
|
|||
|
||||
def _add_occupancy(self, thermal_zone, zone_name):
|
||||
number_of_people = thermal_zone.occupancy.occupancy_density * thermal_zone.total_floor_area
|
||||
fraction_radiant = thermal_zone.occupancy.sensible_radiative_internal_gain / \
|
||||
(thermal_zone.occupancy.sensible_radiative_internal_gain +
|
||||
thermal_zone.occupancy.sensible_convective_internal_gain)
|
||||
fraction_radiant = 0
|
||||
total_sensible = thermal_zone.occupancy.sensible_radiative_internal_gain + \
|
||||
thermal_zone.occupancy.sensible_convective_internal_gain
|
||||
if total_sensible != 0:
|
||||
fraction_radiant = thermal_zone.occupancy.sensible_radiative_internal_gain / total_sensible
|
||||
|
||||
self._idf.newidfobject(self._PEOPLE,
|
||||
Name=f'{zone_name}_occupancy',
|
||||
Zone_or_ZoneList_Name=zone_name,
|
||||
|
@ -377,7 +380,6 @@ class Idf:
|
|||
self._rename_building(self._city.name)
|
||||
self._lod = self._city.level_of_detail.geometry
|
||||
for building in self._city.buildings:
|
||||
|
||||
for internal_zone in building.internal_zones:
|
||||
for thermal_zone in internal_zone.thermal_zones:
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
|
|
|
@ -112,7 +112,9 @@ class InselMonthlyEnergyBalance(Insel):
|
|||
|
||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
||||
type_code = _CONSTRUCTION_CODE[thermal_boundary.type]
|
||||
window_area = thermal_boundary.opaque_area * thermal_boundary.window_ratio / (1 - thermal_boundary.window_ratio)
|
||||
window_area = 0
|
||||
if thermal_boundary.window_ratio < 1:
|
||||
window_area = thermal_boundary.opaque_area * thermal_boundary.window_ratio / (1 - thermal_boundary.window_ratio)
|
||||
|
||||
parameters.append(type_code)
|
||||
if thermal_boundary.type != cte.GROUND:
|
||||
|
|
|
@ -189,10 +189,15 @@ class ComnetUsageParameters:
|
|||
_schedule_values[v, day] += value * archetype.appliances.density
|
||||
_sum += value * archetype.appliances.density * _number_of_days_per_type[day]
|
||||
|
||||
_latent_fraction = _latent_heat_gain / _total_heat_gain
|
||||
_radiative_fraction = _radiative_heat_gain / _total_heat_gain
|
||||
_convective_fraction = _convective_heat_gain / _total_heat_gain
|
||||
_average_internal_gain = _sum / _total_heat_gain
|
||||
_latent_fraction = 0
|
||||
_radiative_fraction = 0
|
||||
_convective_fraction = 0
|
||||
_average_internal_gain = 0
|
||||
if _total_heat_gain != 0:
|
||||
_latent_fraction = _latent_heat_gain / _total_heat_gain
|
||||
_radiative_fraction = _radiative_heat_gain / _total_heat_gain
|
||||
_convective_fraction = _convective_heat_gain / _total_heat_gain
|
||||
_average_internal_gain = _sum / _total_heat_gain
|
||||
|
||||
_schedules = []
|
||||
for day in range(0, len(_DAYS)):
|
||||
|
|
Loading…
Reference in New Issue
Block a user