From 66dbda55250f2184dbe2a0d10ae9b8be49e368ff Mon Sep 17 00:00:00 2001 From: Connor Brackley Date: Wed, 27 Nov 2024 22:06:03 +0000 Subject: [PATCH] Update usage handling in thermal zones --- .../building_demand/thermal_zone.py | 23 ++++--------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/hub/city_model_structure/building_demand/thermal_zone.py b/hub/city_model_structure/building_demand/thermal_zone.py index 60d4907c..f4262aec 100644 --- a/hub/city_model_structure/building_demand/thermal_zone.py +++ b/hub/city_model_structure/building_demand/thermal_zone.py @@ -34,7 +34,7 @@ class ThermalZone: volume, footprint_area, number_of_storeys, - usage_name=None): + usages=None): self._id = None self._parent_internal_zone = parent_internal_zone self._footprint_area = footprint_area @@ -51,10 +51,6 @@ class ThermalZone: self._view_factors_matrix = None self._total_floor_area = None 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._days_year = None self._mechanical_air_change = None @@ -64,7 +60,8 @@ class ThermalZone: self._internal_gains = None self._thermal_control = None self._domestic_hot_water = None - self._usages = None + self._usage_name = None + self._usages = usages @property def parent_internal_zone(self) -> InternalZone: @@ -81,20 +78,8 @@ class ThermalZone: Eg: 70-office_30-residential :return: str """ - if self._usage_from_parent: + if self._usages is not None: 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 @property