Update usage handling in thermal zones

This commit is contained in:
Connor Brackley 2024-11-27 22:06:03 +00:00
parent e0d1f1f8fb
commit 66dbda5525

View File

@ -34,7 +34,7 @@ class ThermalZone:
volume, volume,
footprint_area, footprint_area,
number_of_storeys, number_of_storeys,
usage_name=None): usages=None):
self._id = None self._id = None
self._parent_internal_zone = parent_internal_zone self._parent_internal_zone = parent_internal_zone
self._footprint_area = footprint_area self._footprint_area = footprint_area
@ -51,10 +51,6 @@ class ThermalZone:
self._view_factors_matrix = None self._view_factors_matrix = None
self._total_floor_area = None self._total_floor_area = None
self._number_of_storeys = number_of_storeys self._number_of_storeys = number_of_storeys
self._usage_name = usage_name
self._usage_from_parent = False
if usage_name is None:
self._usage_from_parent = True
self._hours_day = None self._hours_day = None
self._days_year = None self._days_year = None
self._mechanical_air_change = None self._mechanical_air_change = None
@ -64,7 +60,8 @@ class ThermalZone:
self._internal_gains = None self._internal_gains = None
self._thermal_control = None self._thermal_control = None
self._domestic_hot_water = None self._domestic_hot_water = None
self._usages = None self._usage_name = None
self._usages = usages
@property @property
def parent_internal_zone(self) -> InternalZone: def parent_internal_zone(self) -> InternalZone:
@ -81,20 +78,8 @@ class ThermalZone:
Eg: 70-office_30-residential Eg: 70-office_30-residential
:return: str :return: str
""" """
if self._usage_from_parent: if self._usages is not None:
self._usages = copy.deepcopy(self._parent_internal_zone.usages) self._usages = copy.deepcopy(self._parent_internal_zone.usages)
else:
values = self._usage_name.split('_')
usages = []
for value in values:
usages.append(value.split('-'))
self._usages = []
for parent_usage in self._parent_internal_zone.usages:
for value in usages:
if parent_usage.name == value[1]:
new_usage = copy.deepcopy(parent_usage)
new_usage.percentage = float(value[0]) / 100
self._usages.append(new_usage)
return self._usages return self._usages
@property @property