city_retrofit/hub/helpers/thermal_zones_creation.py

73 lines
3.0 KiB
Python

"""
Thermal zones creation module
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from hub.imports.construction.helpers.storeys_generation import StoreysGeneration
class ThermalZonesCreation:
"""
PeakLoads class
"""
def __init__(self, building=None):
self._building = building
# todo: ATTENTION!!
# try:
# thermal_boundary.window_ratio = catalog_construction.window_ratio
# except ValueError:
# # This is the normal operation way when the windows are defined in the geometry
# continue
# # The agreement is that the layers are defined from outside to inside
# external_layer = catalog_construction.layers[0]
# external_surface = thermal_boundary.parent_surface
# external_surface.short_wave_reflectance = 1 - external_layer.material.solar_absorptance
# external_surface.long_wave_emittance = 1 - external_layer.material.solar_absorptance
# internal_layer = catalog_construction.layers[len(catalog_construction.layers) - 1]
# internal_surface = thermal_boundary.internal_surface
# internal_surface.short_wave_reflectance = 1 - internal_layer.material.solar_absorptance
# internal_surface.long_wave_emittance = 1 - internal_layer.material.solar_absorptance
# if thermal_boundary.type in (cte.WALL, cte.ROOF):
# if catalog_construction.window is not None:
# if -math.sqrt(2) / 2 < math.sin(thermal_boundary.parent_surface.azimuth) < math.sqrt(2) / 2:
# if 0 < math.cos(thermal_boundary.parent_surface.azimuth):
# thermal_boundary.window_ratio = \
# float(catalog_construction.window_ratio['north']) / 100
# else:
# thermal_boundary.window_ratio = \
# float(catalog_construction.window_ratio['south']) / 100
# elif math.sqrt(2) / 2 <= math.sin(thermal_boundary.parent_surface.azimuth):
# thermal_boundary.window_ratio = \
# float(catalog_construction.window_ratio['east']) / 100
# else:
# thermal_boundary.window_ratio = \
# float(catalog_construction.window_ratio['west']) / 100
@property
def thermal_zones_from_storeys(self):
"""
Create and get thermal zones as 1 per each storey
:return: [ThermalZone]
"""
raise NotImplementedError
@staticmethod
def _create_storeys(building, archetype, divide_in_storeys):
building.average_storey_height = archetype.average_storey_height
thermal_zones = StoreysGeneration(building, building.internal_zones[0],
divide_in_storeys=divide_in_storeys).thermal_zones
building.internal_zones[0].thermal_zones_from_internal_zones = thermal_zones
@staticmethod
def _search_construction_in_archetype(archetype, construction_type):
construction_archetypes = archetype.constructions
for construction_archetype in construction_archetypes:
if str(construction_type) == str(construction_archetype.type):
return construction_archetype
return None