""" ThermalZone module SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Contributors Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca """ import uuid from typing import List, TypeVar from city_model_structure.building_demand.usage_zone import UsageZone ThermalBoundary = TypeVar('ThermalBoundary') Polyhedron = TypeVar('Polyhedron') class ThermalZone: """ ThermalZone class """ def __init__(self, thermal_boundaries, volume): self._floor_area = None self._thermal_boundaries = thermal_boundaries self._is_mechanically_ventilated = None self._additional_thermal_bridge_u_value = None self._effective_thermal_capacity = None self._indirectly_heated_area_ratio = None self._infiltration_rate_system_on = None self._infiltration_rate_system_off = None self._usage_zones = [] self._volume = volume self._volume_geometry = None self._id = None self._ordinate_number = None @property def id(self): """ Get thermal zone id, an universally unique identifier randomly generated :return: str """ if self._id is None: self._id = uuid.uuid4() return self._id @property def is_mechanically_ventilated(self): """ Get thermal zone mechanical ventilation flag :return: Boolean """ return self._is_mechanically_ventilated @property def floor_area(self): """ Get thermal zone floor area in m2 :return: float """ if self._floor_area is None: self._floor_area = 0 for thermal_boundary in self.thermal_boundaries: s = thermal_boundary.surface if s.type == 'Ground': self._floor_area += s.perimeter_polygon.area return self._floor_area @property def thermal_boundaries(self) -> List[ThermalBoundary]: """ Get thermal boundaries bounding with the thermal zone :return: [ThermalBoundary] """ return self._thermal_boundaries @property def additional_thermal_bridge_u_value(self): """ Get thermal zone additional thermal bridge u value W/m2K :return: float """ return self._additional_thermal_bridge_u_value @additional_thermal_bridge_u_value.setter def additional_thermal_bridge_u_value(self, value): """ Set thermal zone additional thermal bridge u value W/m2K :param value: float """ self._additional_thermal_bridge_u_value = value @property def effective_thermal_capacity(self): """ Get thermal zone effective thermal capacity in J/m2K :return: float """ return self._effective_thermal_capacity @effective_thermal_capacity.setter def effective_thermal_capacity(self, value): """ Set thermal zone effective thermal capacity in J/m2K :param value: float """ self._effective_thermal_capacity = value @property def indirectly_heated_area_ratio(self): """ Get thermal zone indirectly heated area ratio :return: float """ return self._indirectly_heated_area_ratio @indirectly_heated_area_ratio.setter def indirectly_heated_area_ratio(self, value): """ Set thermal zone indirectly heated area ratio :param value: float """ self._indirectly_heated_area_ratio = value @property def infiltration_rate_system_on(self): """ Get thermal zone infiltration rate system on in air changes per hour (ACH) :return: float """ return self._infiltration_rate_system_on @infiltration_rate_system_on.setter def infiltration_rate_system_on(self, value): """ Set thermal zone infiltration rate system on in air changes per hour (ACH) :param value: float """ self._infiltration_rate_system_on = value @property def infiltration_rate_system_off(self): """ Get thermal zone infiltration rate system off in air changes per hour (ACH) :return: float """ return self._infiltration_rate_system_off @infiltration_rate_system_off.setter def infiltration_rate_system_off(self, value): """ Set thermal zone infiltration rate system on in air changes per hour (ACH) :param value: float """ self._infiltration_rate_system_off = value @property def usage_zones(self) -> List[UsageZone]: """ Get thermal zone usage zones :return: [UsageZone] """ return self._usage_zones @usage_zones.setter def usage_zones(self, values): """ Set thermal zone usage zones :param values: [UsageZone] """ self._usage_zones = values @property def volume(self): """ Get thermal zone volume :return: float """ return self._volume @property def volume_geometry(self) -> Polyhedron: """ Get the polyhedron defined by the thermal zone :return: Polyhedron """ return self._volume_geometry @property def ordinate_number(self): """ In case the thermal_zones need to be enumerated and their order saved, this property saves that order :return: int """ return self._ordinate_number @ordinate_number.setter def ordinate_number(self, value): """ Sets an specific order of the zones to be called :param value: int """ self._ordinate_number = value