2021-06-23 09:53:33 -04:00
|
|
|
"""
|
|
|
|
Storey module
|
|
|
|
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
|
2021-06-23 09:53:33 -04:00
|
|
|
"""
|
|
|
|
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import List
|
2021-08-06 12:28:20 -04:00
|
|
|
from city_model_structure.building_demand.surface import Surface
|
|
|
|
from city_model_structure.building_demand.thermal_boundary import ThermalBoundary
|
|
|
|
from city_model_structure.building_demand.thermal_zone import ThermalZone
|
2021-06-23 09:53:33 -04:00
|
|
|
|
|
|
|
|
|
|
|
class Storey:
|
|
|
|
"""
|
|
|
|
Storey class
|
|
|
|
"""
|
2022-04-06 16:06:55 -04:00
|
|
|
def __init__(self, name, storey_surfaces, neighbours, volume, internal_zone, floor_area):
|
2021-06-23 09:53:33 -04:00
|
|
|
self._name = name
|
2021-08-27 17:20:24 -04:00
|
|
|
self._storey_surfaces = storey_surfaces
|
2021-06-23 09:53:33 -04:00
|
|
|
self._thermal_boundaries = None
|
|
|
|
self._virtual_surfaces = None
|
|
|
|
self._thermal_zone = None
|
|
|
|
self._neighbours = neighbours
|
2021-08-11 16:38:06 -04:00
|
|
|
self._volume = volume
|
2022-04-06 16:06:55 -04:00
|
|
|
self._internal_zone = internal_zone
|
2022-03-08 19:19:52 -05:00
|
|
|
self._floor_area = floor_area
|
2021-06-23 09:53:33 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def name(self):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get storey's name
|
2021-06-23 09:53:33 -04:00
|
|
|
:return: str
|
|
|
|
"""
|
|
|
|
return self._name
|
|
|
|
|
|
|
|
@property
|
|
|
|
def surfaces(self) -> List[Surface]:
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get external surfaces enclosing the storey
|
2021-06-23 09:53:33 -04:00
|
|
|
:return: [Surface]
|
|
|
|
"""
|
2021-08-27 17:20:24 -04:00
|
|
|
return self._storey_surfaces
|
2021-06-23 09:53:33 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def neighbours(self):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get the neighbour storeys' names
|
2021-06-23 09:53:33 -04:00
|
|
|
:return: [str]
|
|
|
|
"""
|
|
|
|
return self._neighbours
|
|
|
|
|
|
|
|
@property
|
|
|
|
def thermal_boundaries(self) -> List[ThermalBoundary]:
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get the thermal boundaries bounding the thermal zone
|
2021-06-23 09:53:33 -04:00
|
|
|
:return: [ThermalBoundary]
|
|
|
|
"""
|
|
|
|
if self._thermal_boundaries is None:
|
|
|
|
self._thermal_boundaries = []
|
|
|
|
for surface in self.surfaces:
|
2022-03-08 19:19:52 -05:00
|
|
|
if surface.holes_polygons is None:
|
|
|
|
windows_areas = None
|
|
|
|
else:
|
|
|
|
windows_areas = []
|
|
|
|
for hole in surface.holes_polygons:
|
|
|
|
windows_areas.append(hole.area)
|
2022-11-08 16:28:07 -05:00
|
|
|
new_thermal_boundary = ThermalBoundary(surface, surface.solid_polygon.area, windows_areas)
|
|
|
|
surface.associated_thermal_boundaries.append(new_thermal_boundary)
|
|
|
|
self._thermal_boundaries.append(new_thermal_boundary)
|
2021-06-23 09:53:33 -04:00
|
|
|
return self._thermal_boundaries
|
|
|
|
|
|
|
|
@property
|
|
|
|
def virtual_surfaces(self) -> List[Surface]:
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get the internal surfaces enclosing the thermal zone
|
2021-06-23 09:53:33 -04:00
|
|
|
:return: [Surface]
|
|
|
|
"""
|
|
|
|
if self._virtual_surfaces is None:
|
|
|
|
self._virtual_surfaces = []
|
|
|
|
for thermal_boundary in self.thermal_boundaries:
|
2022-11-09 14:22:26 -05:00
|
|
|
self._virtual_surfaces.append(thermal_boundary.internal_surface)
|
2021-06-23 09:53:33 -04:00
|
|
|
return self._virtual_surfaces
|
|
|
|
|
|
|
|
@property
|
|
|
|
def thermal_zone(self) -> ThermalZone:
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get the thermal zone inside the storey
|
2021-06-23 09:53:33 -04:00
|
|
|
:return: ThermalZone
|
|
|
|
"""
|
|
|
|
if self._thermal_zone is None:
|
2022-04-06 16:06:55 -04:00
|
|
|
self._thermal_zone = ThermalZone(self.thermal_boundaries, self._internal_zone, self.volume, self.floor_area)
|
2021-06-23 09:53:33 -04:00
|
|
|
return self._thermal_zone
|
2021-08-11 16:38:06 -04:00
|
|
|
|
|
|
|
@property
|
|
|
|
def volume(self):
|
|
|
|
"""
|
2021-08-30 14:39:24 -04:00
|
|
|
Get storey's volume in cubic meters
|
2021-08-11 16:38:06 -04:00
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._volume
|
2022-03-08 19:19:52 -05:00
|
|
|
|
|
|
|
@property
|
|
|
|
def floor_area(self):
|
|
|
|
"""
|
|
|
|
Get storey's floor area in square meters
|
|
|
|
:return: float
|
|
|
|
"""
|
|
|
|
return self._floor_area
|