hub/city_model_structure/building_demand/storey.py

111 lines
3.0 KiB
Python
Raw Normal View History

"""
Storey module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from __future__ import annotations
from typing import List
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
class Storey:
"""
Storey class
"""
def __init__(self, name, storey_surfaces, neighbours, volume, internal_zone, floor_area):
self._name = name
self._storey_surfaces = storey_surfaces
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
self._internal_zone = internal_zone
2022-03-08 19:19:52 -05:00
self._floor_area = floor_area
@property
def name(self):
"""
Get storey's name
:return: str
"""
return self._name
@property
def surfaces(self) -> List[Surface]:
"""
Get external surfaces enclosing the storey
:return: [Surface]
"""
return self._storey_surfaces
@property
def neighbours(self):
"""
Get the neighbour storeys' names
:return: [str]
"""
return self._neighbours
@property
def thermal_boundaries(self) -> List[ThermalBoundary]:
"""
Get the thermal boundaries bounding the thermal zone
: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)
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)
return self._thermal_boundaries
@property
def virtual_surfaces(self) -> List[Surface]:
"""
Get the internal surfaces enclosing the thermal zone
:return: [Surface]
"""
if self._virtual_surfaces is None:
self._virtual_surfaces = []
for thermal_boundary in self.thermal_boundaries:
self._virtual_surfaces.append(thermal_boundary.virtual_internal_surface)
return self._virtual_surfaces
@property
def thermal_zone(self) -> ThermalZone:
"""
Get the thermal zone inside the storey
:return: ThermalZone
"""
if self._thermal_zone is None:
self._thermal_zone = ThermalZone(self.thermal_boundaries, self._internal_zone, self.volume, self.floor_area)
return self._thermal_zone
2021-08-11 16:38:06 -04:00
@property
def volume(self):
"""
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