2021-01-05 15:01:36 -05:00
|
|
|
"""
|
|
|
|
Nrel-based interface, it reads format defined within the CERC team based on NREL structure
|
|
|
|
and enriches the city with archetypes and materials
|
|
|
|
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-01-05 15:01:36 -05:00
|
|
|
"""
|
|
|
|
|
2022-03-24 16:51:01 -04:00
|
|
|
from imports.construction.helpers.storeys_generation import StoreysGeneration
|
2021-01-05 15:01:36 -05:00
|
|
|
|
|
|
|
|
2021-01-06 16:42:38 -05:00
|
|
|
class NrelPhysicsInterface:
|
2021-01-05 15:01:36 -05:00
|
|
|
"""
|
2021-01-06 16:42:38 -05:00
|
|
|
NrelPhysicsInterface abstract class
|
2021-01-05 15:01:36 -05:00
|
|
|
"""
|
2021-08-26 13:27:43 -04:00
|
|
|
|
2022-03-24 16:51:01 -04:00
|
|
|
# todo: verify windows
|
|
|
|
@staticmethod
|
|
|
|
def _calculate_view_factors(thermal_zone):
|
|
|
|
"""
|
|
|
|
Get thermal zone view factors matrix
|
|
|
|
:return: [[float]]
|
|
|
|
"""
|
|
|
|
total_area = 0
|
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
|
|
total_area += thermal_boundary.opaque_area
|
|
|
|
for thermal_opening in thermal_boundary.thermal_openings:
|
|
|
|
total_area += thermal_opening.area
|
|
|
|
|
|
|
|
view_factors_matrix = []
|
|
|
|
for thermal_boundary_1 in thermal_zone.thermal_boundaries:
|
|
|
|
values = []
|
|
|
|
for thermal_boundary_2 in thermal_zone.thermal_boundaries:
|
|
|
|
value = 0
|
|
|
|
if thermal_boundary_1.id != thermal_boundary_2.id:
|
|
|
|
value = thermal_boundary_2.opaque_area / (total_area - thermal_boundary_1.opaque_area)
|
|
|
|
values.append(value)
|
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
|
|
for thermal_opening in thermal_boundary.thermal_openings:
|
|
|
|
value = thermal_opening.area / (total_area - thermal_boundary_1.opaque_area)
|
|
|
|
values.append(value)
|
|
|
|
view_factors_matrix.append(values)
|
|
|
|
|
|
|
|
for thermal_boundary_1 in thermal_zone.thermal_boundaries:
|
|
|
|
values = []
|
|
|
|
for thermal_opening_1 in thermal_boundary_1.thermal_openings:
|
|
|
|
for thermal_boundary_2 in thermal_zone.thermal_boundaries:
|
|
|
|
value = thermal_boundary_2.opaque_area / (total_area - thermal_opening_1.area)
|
|
|
|
values.append(value)
|
|
|
|
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
|
|
for thermal_opening_2 in thermal_boundary.thermal_openings:
|
|
|
|
value = 0
|
|
|
|
if thermal_opening_1.id != thermal_opening_2.id:
|
|
|
|
value = thermal_opening_2.area / (total_area - thermal_opening_1.area)
|
|
|
|
values.append(value)
|
|
|
|
view_factors_matrix.append(values)
|
|
|
|
thermal_zone.view_factors_matrix = view_factors_matrix
|
|
|
|
|
|
|
|
@staticmethod
|
2022-04-26 18:39:42 -04:00
|
|
|
def _create_storeys(building, archetype, divide_in_storeys):
|
2022-03-24 16:51:01 -04:00
|
|
|
building.average_storey_height = archetype.average_storey_height
|
2022-04-19 15:49:41 -04:00
|
|
|
building.storeys_above_ground = 1
|
2022-04-26 18:39:42 -04:00
|
|
|
thermal_zones = StoreysGeneration(building, building.internal_zones[0],
|
|
|
|
divide_in_storeys=divide_in_storeys).thermal_zones
|
2022-03-24 16:51:01 -04:00
|
|
|
building.internal_zones[0].thermal_zones = thermal_zones
|
2022-04-19 15:49:41 -04:00
|
|
|
|
|
|
|
def enrich_buildings(self):
|
|
|
|
"""
|
|
|
|
Raise not implemented error
|
|
|
|
"""
|
|
|
|
raise NotImplementedError
|