2022-03-08 20:08:03 -05:00
|
|
|
"""
|
|
|
|
InternalZone module. It saves the original geometrical information from interiors together with some attributes of those
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
2022-03-08 20:08:03 -05:00
|
|
|
"""
|
2022-03-17 18:49:44 -04:00
|
|
|
|
2022-03-08 20:08:03 -05:00
|
|
|
import uuid
|
2022-03-17 18:49:44 -04:00
|
|
|
from typing import Union, List
|
2022-03-08 20:08:03 -05:00
|
|
|
from city_model_structure.building_demand.usage_zone import UsageZone
|
2022-03-17 18:49:44 -04:00
|
|
|
from city_model_structure.building_demand.thermal_zone import ThermalZone
|
2022-03-08 20:08:03 -05:00
|
|
|
from city_model_structure.attributes.polyhedron import Polyhedron
|
2022-03-17 18:49:44 -04:00
|
|
|
from city_model_structure.energy_systems.hvac_system import HvacSystem
|
2022-03-08 20:08:03 -05:00
|
|
|
|
|
|
|
|
|
|
|
class InternalZone:
|
|
|
|
"""
|
|
|
|
InternalZone class
|
|
|
|
"""
|
|
|
|
def __init__(self, surfaces, area):
|
|
|
|
self._surfaces = surfaces
|
|
|
|
self._id = None
|
|
|
|
self._geometry = None
|
|
|
|
self._volume = None
|
|
|
|
self._area = area
|
2022-03-17 18:49:44 -04:00
|
|
|
self._thermal_zones = None
|
|
|
|
self._usage_zones = None
|
|
|
|
self._hvac_system = None
|
2022-03-08 20:08:03 -05:00
|
|
|
|
|
|
|
@property
|
|
|
|
def id(self):
|
|
|
|
"""
|
|
|
|
Get internal zone id, an universally unique identifier randomly generated
|
|
|
|
:return: str
|
|
|
|
"""
|
|
|
|
if self._id is None:
|
|
|
|
self._id = uuid.uuid4()
|
|
|
|
return self._id
|
|
|
|
|
|
|
|
@property
|
|
|
|
def geometry(self) -> Polyhedron:
|
|
|
|
"""
|
|
|
|
Get internal zone geometry
|
|
|
|
:return: Polyhedron
|
|
|
|
"""
|
|
|
|
if self._geometry is None:
|
|
|
|
polygons = []
|
|
|
|
for surface in self.surfaces:
|
|
|
|
polygons.append(surface.perimeter_polygon)
|
|
|
|
self._geometry = Polyhedron(polygons)
|
|
|
|
return self._geometry
|
|
|
|
|
|
|
|
@property
|
|
|
|
def surfaces(self):
|
|
|
|
"""
|
|
|
|
Get internal zone surfaces
|
|
|
|
:return: [Surface]
|
|
|
|
"""
|
|
|
|
return self._surfaces
|
|
|
|
|
|
|
|
@property
|
|
|
|
def volume(self):
|
|
|
|
"""
|
|
|
|
Get internal zone volume in cubic meters
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self.geometry.volume
|
|
|
|
|
|
|
|
@property
|
|
|
|
def area(self):
|
|
|
|
"""
|
|
|
|
Get internal zone area in square meters
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._area
|
|
|
|
|
|
|
|
@property
|
|
|
|
def usage_zones(self) -> [UsageZone]:
|
|
|
|
"""
|
|
|
|
Get internal zone usage zones
|
|
|
|
:return: [UsageZone]
|
|
|
|
"""
|
|
|
|
return self._usage_zones
|
|
|
|
|
|
|
|
@usage_zones.setter
|
|
|
|
def usage_zones(self, value):
|
|
|
|
"""
|
|
|
|
Set internal zone usage zones
|
|
|
|
:param value: [UsageZone]
|
|
|
|
"""
|
|
|
|
self._usage_zones = value
|
2022-03-17 18:49:44 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def hvac_system(self) -> Union[None, HvacSystem]:
|
|
|
|
"""
|
|
|
|
Get HVAC system installed for this thermal zone
|
|
|
|
:return: None or HvacSystem
|
|
|
|
"""
|
|
|
|
return self._hvac_system
|
|
|
|
|
|
|
|
@hvac_system.setter
|
|
|
|
def hvac_system(self, value):
|
|
|
|
"""
|
|
|
|
Set HVAC system installed for this thermal zone
|
|
|
|
:param value: HvacSystem
|
|
|
|
"""
|
|
|
|
self._hvac_system = value
|
|
|
|
|
|
|
|
@property
|
|
|
|
def thermal_zones(self) -> Union[None, List[ThermalZone]]:
|
|
|
|
"""
|
|
|
|
Get building thermal zones
|
|
|
|
:return: [ThermalZone]
|
|
|
|
"""
|
|
|
|
return self._thermal_zones
|
|
|
|
|
|
|
|
@thermal_zones.setter
|
|
|
|
def thermal_zones(self, value):
|
|
|
|
"""
|
|
|
|
Set city object thermal zones
|
|
|
|
:param value: [ThermalZone]
|
|
|
|
"""
|
|
|
|
self._thermal_zones = value
|