diff --git a/hub/city_model_structure/building.py b/hub/city_model_structure/building.py index 03b386e8..67f2add3 100644 --- a/hub/city_model_structure/building.py +++ b/hub/city_model_structure/building.py @@ -14,6 +14,7 @@ import hub.helpers.constants as cte from hub.city_model_structure.attributes.polyhedron import Polyhedron from hub.city_model_structure.building_demand.household import Household from hub.city_model_structure.building_demand.internal_zone import InternalZone +from hub.city_model_structure.building_demand.thermal_zone import ThermalZone from hub.city_model_structure.building_demand.surface import Surface from hub.city_model_structure.city_object import CityObject from hub.city_model_structure.energy_systems.energy_system import EnergySystem @@ -40,6 +41,7 @@ class Building(CityObject): self._floor_area = None self._roof_type = None self._internal_zones = None + self._thermal_zones = None self._shell = None self._aliases = [] self._type = 'building' @@ -115,6 +117,24 @@ class Building(CityObject): self._internal_zones = [InternalZone(self.surfaces, self.floor_area)] return self._internal_zones + @property + def thermal_zones(self) -> Union[None, List[ThermalZone]]: + """ + Get building thermal zones + For Lod up to 3, there can be more than one thermal zone per internal zone. + In LoD 4, there can be more than one internal zone, and therefore, only one thermal zone per internal zone + :return: [ThermalZone] + """ + if self._thermal_zones is None: + self._thermal_zones = [] + for internal_zone in self.internal_zones: + if internal_zone.thermal_zones is None: + self._thermal_zones = None + return self._thermal_zones + for thermal_zone in internal_zone.thermal_zones: + self._thermal_zones.append(thermal_zone) + return self._thermal_zones + @property def grounds(self) -> List[Surface]: """