erased not used classes
This commit is contained in:
parent
c61dca2fe6
commit
3e46da13d4
|
@ -1,98 +0,0 @@
|
||||||
"""
|
|
||||||
BuildingArchetype stores construction information by building archetypes
|
|
||||||
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 typing import List
|
|
||||||
from hub.imports.construction.data_classes.thermal_boundary_archetype import ThermalBoundaryArchetype
|
|
||||||
|
|
||||||
|
|
||||||
class BuildingArchetype:
|
|
||||||
"""
|
|
||||||
BuildingArchetype class
|
|
||||||
"""
|
|
||||||
def __init__(self, archetype_keys, average_storey_height, storeys_above_ground, effective_thermal_capacity,
|
|
||||||
additional_thermal_bridge_u_value, indirectly_heated_area_ratio, infiltration_rate_system_off,
|
|
||||||
infiltration_rate_system_on, thermal_boundary_archetypes):
|
|
||||||
self._archetype_keys = archetype_keys
|
|
||||||
self._average_storey_height = average_storey_height
|
|
||||||
self._storeys_above_ground = storeys_above_ground
|
|
||||||
self._effective_thermal_capacity = effective_thermal_capacity
|
|
||||||
self._additional_thermal_bridge_u_value = additional_thermal_bridge_u_value
|
|
||||||
self._indirectly_heated_area_ratio = indirectly_heated_area_ratio
|
|
||||||
self._infiltration_rate_system_off = infiltration_rate_system_off
|
|
||||||
self._infiltration_rate_system_on = infiltration_rate_system_on
|
|
||||||
self._thermal_boundary_archetypes = thermal_boundary_archetypes
|
|
||||||
|
|
||||||
@property
|
|
||||||
def archetype_keys(self) -> {}:
|
|
||||||
"""
|
|
||||||
Get keys that define the archetype
|
|
||||||
:return: dictionary
|
|
||||||
"""
|
|
||||||
return self._archetype_keys
|
|
||||||
|
|
||||||
@property
|
|
||||||
def average_storey_height(self):
|
|
||||||
"""
|
|
||||||
Get archetype's building storey height in meters
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._average_storey_height
|
|
||||||
|
|
||||||
@property
|
|
||||||
def storeys_above_ground(self):
|
|
||||||
"""
|
|
||||||
Get archetype's building storey height in meters
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._storeys_above_ground
|
|
||||||
|
|
||||||
@property
|
|
||||||
def effective_thermal_capacity(self):
|
|
||||||
"""
|
|
||||||
Get archetype's effective thermal capacity in J/m2K
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._effective_thermal_capacity
|
|
||||||
|
|
||||||
@property
|
|
||||||
def additional_thermal_bridge_u_value(self):
|
|
||||||
"""
|
|
||||||
Get archetype's additional U value due to thermal bridges per area of shell in W/m2K
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._additional_thermal_bridge_u_value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def indirectly_heated_area_ratio(self):
|
|
||||||
"""
|
|
||||||
Get archetype's indirectly heated area ratio
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._indirectly_heated_area_ratio
|
|
||||||
|
|
||||||
@property
|
|
||||||
def infiltration_rate_system_off(self):
|
|
||||||
"""
|
|
||||||
Get archetype's infiltration rate when conditioning systems OFF in air changes per hour (ACH)
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._infiltration_rate_system_off
|
|
||||||
|
|
||||||
@property
|
|
||||||
def infiltration_rate_system_on(self):
|
|
||||||
"""
|
|
||||||
Get archetype's infiltration rate when conditioning systems ON in air changes per hour (ACH)
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._infiltration_rate_system_on
|
|
||||||
|
|
||||||
@property
|
|
||||||
def thermal_boundary_archetypes(self) -> List[ThermalBoundaryArchetype]:
|
|
||||||
"""
|
|
||||||
Get thermal boundary archetypes associated to the building archetype
|
|
||||||
:return: list of boundary archetypes
|
|
||||||
"""
|
|
||||||
return self._thermal_boundary_archetypes
|
|
|
@ -1,104 +0,0 @@
|
||||||
"""
|
|
||||||
LayerArchetype stores layer and materials information, complementing the BuildingArchetype class
|
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
||||||
Copyright © 2022 Concordia CERC group
|
|
||||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class LayerArchetype:
|
|
||||||
"""
|
|
||||||
LayerArchetype class
|
|
||||||
"""
|
|
||||||
def __init__(self, name, solar_absorptance, thermal_absorptance, visible_absorptance, thickness=None,
|
|
||||||
conductivity=None, specific_heat=None, density=None, no_mass=False, thermal_resistance=None):
|
|
||||||
self._thickness = thickness
|
|
||||||
self._conductivity = conductivity
|
|
||||||
self._specific_heat = specific_heat
|
|
||||||
self._density = density
|
|
||||||
self._solar_absorptance = solar_absorptance
|
|
||||||
self._thermal_absorptance = thermal_absorptance
|
|
||||||
self._visible_absorptance = visible_absorptance
|
|
||||||
self._no_mass = no_mass
|
|
||||||
self._name = name
|
|
||||||
self._thermal_resistance = thermal_resistance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def thickness(self):
|
|
||||||
"""
|
|
||||||
Get thickness in meters
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._thickness
|
|
||||||
|
|
||||||
@property
|
|
||||||
def conductivity(self):
|
|
||||||
"""
|
|
||||||
Get conductivity in W/mK
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._conductivity
|
|
||||||
|
|
||||||
@property
|
|
||||||
def specific_heat(self):
|
|
||||||
"""
|
|
||||||
Get specific heat in J/kgK
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._specific_heat
|
|
||||||
|
|
||||||
@property
|
|
||||||
def density(self):
|
|
||||||
"""
|
|
||||||
Get density in kg/m3
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._density
|
|
||||||
|
|
||||||
@property
|
|
||||||
def solar_absorptance(self):
|
|
||||||
"""
|
|
||||||
Get solar absorptance
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._solar_absorptance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def thermal_absorptance(self):
|
|
||||||
"""
|
|
||||||
Get thermal absorptance
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._thermal_absorptance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def visible_absorptance(self):
|
|
||||||
"""
|
|
||||||
Get visible absorptance
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._visible_absorptance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def no_mass(self) -> bool:
|
|
||||||
"""
|
|
||||||
Get no mass flag
|
|
||||||
:return: Boolean
|
|
||||||
"""
|
|
||||||
return self._no_mass
|
|
||||||
|
|
||||||
@property
|
|
||||||
def name(self):
|
|
||||||
"""
|
|
||||||
Get name
|
|
||||||
:return: str
|
|
||||||
"""
|
|
||||||
return self._name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def thermal_resistance(self):
|
|
||||||
"""
|
|
||||||
Get thermal resistance in m2K/W
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._thermal_resistance
|
|
|
@ -1,137 +0,0 @@
|
||||||
"""
|
|
||||||
ThermalBoundaryArchetype stores thermal boundaries information, complementing the BuildingArchetype class
|
|
||||||
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 typing import List
|
|
||||||
|
|
||||||
from hub.imports.construction.data_classes.layer_archetype import LayerArchetype
|
|
||||||
from hub.imports.construction.data_classes.thermal_opening_archetype import ThermalOpeningArchetype
|
|
||||||
|
|
||||||
|
|
||||||
class ThermalBoundaryArchetype:
|
|
||||||
"""
|
|
||||||
ThermalBoundaryArchetype class
|
|
||||||
"""
|
|
||||||
def __init__(self, boundary_type, window_ratio, construction_name, layers, thermal_opening,
|
|
||||||
outside_solar_absorptance=None, outside_thermal_absorptance=None, outside_visible_absorptance=None,
|
|
||||||
overall_u_value=None, shortwave_reflectance=None, inside_emissivity=None, alpha_coefficient=None,
|
|
||||||
radiative_coefficient=None):
|
|
||||||
self._boundary_type = boundary_type
|
|
||||||
self._outside_solar_absorptance = outside_solar_absorptance
|
|
||||||
self._outside_thermal_absorptance = outside_thermal_absorptance
|
|
||||||
self._outside_visible_absorptance = outside_visible_absorptance
|
|
||||||
self._window_ratio = window_ratio
|
|
||||||
self._construction_name = construction_name
|
|
||||||
self._overall_u_value = overall_u_value
|
|
||||||
self._layers = layers
|
|
||||||
self._thermal_opening_archetype = thermal_opening
|
|
||||||
self._shortwave_reflectance = shortwave_reflectance
|
|
||||||
self._inside_emissivity = inside_emissivity
|
|
||||||
self._alpha_coefficient = alpha_coefficient
|
|
||||||
self._radiative_coefficient = radiative_coefficient
|
|
||||||
|
|
||||||
@property
|
|
||||||
def boundary_type(self):
|
|
||||||
"""
|
|
||||||
Get type
|
|
||||||
:return: str
|
|
||||||
"""
|
|
||||||
return self._boundary_type
|
|
||||||
|
|
||||||
@property
|
|
||||||
def outside_solar_absorptance(self):
|
|
||||||
"""
|
|
||||||
Get outside solar absorptance
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._outside_solar_absorptance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def outside_thermal_absorptance(self):
|
|
||||||
"""
|
|
||||||
Get outside thermal absorptance
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._outside_thermal_absorptance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def outside_visible_absorptance(self):
|
|
||||||
"""
|
|
||||||
Get outside visible absorptance
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._outside_visible_absorptance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def window_ratio(self):
|
|
||||||
"""
|
|
||||||
Get window ratio
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._window_ratio
|
|
||||||
|
|
||||||
@property
|
|
||||||
def construction_name(self):
|
|
||||||
"""
|
|
||||||
Get construction name
|
|
||||||
:return: str
|
|
||||||
"""
|
|
||||||
return self._construction_name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def layers(self) -> List[LayerArchetype]:
|
|
||||||
"""
|
|
||||||
Get layers
|
|
||||||
:return: [NrelLayerArchetype]
|
|
||||||
"""
|
|
||||||
return self._layers
|
|
||||||
|
|
||||||
@property
|
|
||||||
def thermal_opening_archetype(self) -> ThermalOpeningArchetype:
|
|
||||||
"""
|
|
||||||
Get thermal opening archetype
|
|
||||||
:return: ThermalOpeningArchetype
|
|
||||||
"""
|
|
||||||
return self._thermal_opening_archetype
|
|
||||||
|
|
||||||
@property
|
|
||||||
def overall_u_value(self):
|
|
||||||
"""
|
|
||||||
Get overall U-value in W/m2K
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._overall_u_value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def shortwave_reflectance(self):
|
|
||||||
"""
|
|
||||||
Get shortwave reflectance
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._shortwave_reflectance
|
|
||||||
|
|
||||||
@property
|
|
||||||
def inside_emissivity(self):
|
|
||||||
"""
|
|
||||||
Get emissivity inside
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._inside_emissivity
|
|
||||||
|
|
||||||
@property
|
|
||||||
def alpha_coefficient(self):
|
|
||||||
"""
|
|
||||||
Get alpha coefficient
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._alpha_coefficient
|
|
||||||
|
|
||||||
@property
|
|
||||||
def radiative_coefficient(self):
|
|
||||||
"""
|
|
||||||
Get radiative coefficient
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._radiative_coefficient
|
|
|
@ -1,131 +0,0 @@
|
||||||
"""
|
|
||||||
ThermalOpeningArchetype stores thermal openings information, complementing the BuildingArchetype class
|
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
||||||
Copyright © 2022 Concordia CERC group
|
|
||||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class ThermalOpeningArchetype:
|
|
||||||
"""
|
|
||||||
ThermalOpeningArchetype class
|
|
||||||
"""
|
|
||||||
def __init__(self, conductivity=None, frame_ratio=None, g_value=None, thickness=None,
|
|
||||||
back_side_solar_transmittance_at_normal_incidence=None,
|
|
||||||
front_side_solar_transmittance_at_normal_incidence=None, overall_u_value=None,
|
|
||||||
openable_ratio=None, inside_emissivity=None, alpha_coefficient=None, radiative_coefficient=None,
|
|
||||||
construction_name=None):
|
|
||||||
self._conductivity = conductivity
|
|
||||||
self._frame_ratio = frame_ratio
|
|
||||||
self._g_value = g_value
|
|
||||||
self._thickness = thickness
|
|
||||||
self._back_side_solar_transmittance_at_normal_incidence = back_side_solar_transmittance_at_normal_incidence
|
|
||||||
self._front_side_solar_transmittance_at_normal_incidence = front_side_solar_transmittance_at_normal_incidence
|
|
||||||
self._overall_u_value = overall_u_value
|
|
||||||
self._openable_ratio = openable_ratio
|
|
||||||
self._inside_emissivity = inside_emissivity
|
|
||||||
self._alpha_coefficient = alpha_coefficient
|
|
||||||
self._radiative_coefficient = radiative_coefficient
|
|
||||||
self._construction_name = construction_name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def conductivity(self):
|
|
||||||
"""
|
|
||||||
Get conductivity in W/mK
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._conductivity
|
|
||||||
|
|
||||||
@property
|
|
||||||
def frame_ratio(self):
|
|
||||||
"""
|
|
||||||
Get frame ratio
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._frame_ratio
|
|
||||||
|
|
||||||
@property
|
|
||||||
def g_value(self):
|
|
||||||
"""
|
|
||||||
Get g-value, also called shgc
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._g_value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def thickness(self):
|
|
||||||
"""
|
|
||||||
Get thickness in meters
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._thickness
|
|
||||||
|
|
||||||
@property
|
|
||||||
def back_side_solar_transmittance_at_normal_incidence(self):
|
|
||||||
"""
|
|
||||||
Get back side solar transmittance at normal incidence
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._back_side_solar_transmittance_at_normal_incidence
|
|
||||||
|
|
||||||
@property
|
|
||||||
def front_side_solar_transmittance_at_normal_incidence(self):
|
|
||||||
"""
|
|
||||||
Get front side solar transmittance at normal incidence
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._front_side_solar_transmittance_at_normal_incidence
|
|
||||||
|
|
||||||
@property
|
|
||||||
def overall_u_value(self):
|
|
||||||
"""
|
|
||||||
Get overall U-value in W/m2K
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._overall_u_value
|
|
||||||
|
|
||||||
@property
|
|
||||||
def openable_ratio(self):
|
|
||||||
"""
|
|
||||||
Get openable ratio
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._openable_ratio
|
|
||||||
|
|
||||||
@property
|
|
||||||
def inside_emissivity(self):
|
|
||||||
"""
|
|
||||||
Get emissivity inside
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._inside_emissivity
|
|
||||||
|
|
||||||
@property
|
|
||||||
def alpha_coefficient(self):
|
|
||||||
"""
|
|
||||||
Get alpha coefficient
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._alpha_coefficient
|
|
||||||
|
|
||||||
@property
|
|
||||||
def radiative_coefficient(self):
|
|
||||||
"""
|
|
||||||
Get radiative coefficient
|
|
||||||
:return: float
|
|
||||||
"""
|
|
||||||
return self._radiative_coefficient
|
|
||||||
|
|
||||||
@property
|
|
||||||
def construction_name(self):
|
|
||||||
"""
|
|
||||||
Get thermal opening construction name
|
|
||||||
"""
|
|
||||||
return self._construction_name
|
|
||||||
|
|
||||||
@construction_name.setter
|
|
||||||
def construction_name(self, value):
|
|
||||||
"""
|
|
||||||
Set thermal opening construction name
|
|
||||||
"""
|
|
||||||
self._construction_name = value
|
|
|
@ -1,71 +0,0 @@
|
||||||
"""
|
|
||||||
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
|
|
||||||
Copyright © 2022 Concordia CERC group
|
|
||||||
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|
||||||
"""
|
|
||||||
|
|
||||||
from hub.imports.construction.helpers.storeys_generation import StoreysGeneration
|
|
||||||
|
|
||||||
|
|
||||||
class NrelPhysicsInterface:
|
|
||||||
"""
|
|
||||||
NrelPhysicsInterface abstract class
|
|
||||||
"""
|
|
||||||
|
|
||||||
# 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
|
|
||||||
def _create_storeys(building, archetype, divide_in_storeys):
|
|
||||||
building.average_storey_height = archetype.average_storey_height
|
|
||||||
building.storeys_above_ground = 1
|
|
||||||
thermal_zones = StoreysGeneration(building, building.internal_zones[0],
|
|
||||||
divide_in_storeys=divide_in_storeys).thermal_zones
|
|
||||||
building.internal_zones[0].thermal_zones = thermal_zones
|
|
||||||
|
|
||||||
def enrich_buildings(self):
|
|
||||||
"""
|
|
||||||
Raise not implemented error
|
|
||||||
"""
|
|
||||||
raise NotImplementedError
|
|
|
@ -1,196 +0,0 @@
|
||||||
"""
|
|
||||||
NrelPhysicsParameters import the construction and material information defined by NREL
|
|
||||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
|
||||||
Copyright © 2022 Concordia CERC group
|
|
||||||
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
||||||
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|
||||||
"""
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from hub.hub_logger import logger
|
|
||||||
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
|
|
||||||
from hub.city_model_structure.building_demand.layer import Layer
|
|
||||||
from hub.city_model_structure.building_demand.material import Material
|
|
||||||
from hub.helpers.dictionaries import Dictionaries
|
|
||||||
from hub.imports.construction.helpers.construction_helper import ConstructionHelper
|
|
||||||
from hub.imports.construction.helpers.storeys_generation import StoreysGeneration
|
|
||||||
|
|
||||||
|
|
||||||
class NrelPhysicsParameters:
|
|
||||||
"""
|
|
||||||
NrelPhysicsParameters class
|
|
||||||
"""
|
|
||||||
def __init__(self, city, base_path, divide_in_storeys=False):
|
|
||||||
self._city = city
|
|
||||||
self._path = base_path
|
|
||||||
self._divide_in_storeys = divide_in_storeys
|
|
||||||
self._climate_zone = ConstructionHelper.city_to_nrel_climate_zone(city.name)
|
|
||||||
|
|
||||||
def enrich_buildings(self):
|
|
||||||
"""
|
|
||||||
Returns the city with the construction parameters assigned to the buildings
|
|
||||||
"""
|
|
||||||
city = self._city
|
|
||||||
nrel_catalog = ConstructionCatalogFactory('nrel').catalog
|
|
||||||
for building in city.buildings:
|
|
||||||
try:
|
|
||||||
function = Dictionaries().hub_function_to_nrel_construction_function[building.function]
|
|
||||||
archetype = self._search_archetype(nrel_catalog, function, building.year_of_construction,
|
|
||||||
self._climate_zone)
|
|
||||||
except KeyError:
|
|
||||||
|
|
||||||
logger.error(f'Building {building.name} has unknown archetype for building function: {building.function} '
|
|
||||||
f'and building year of construction: {building.year_of_construction} '
|
|
||||||
f'and climate zone reference norm {self._climate_zone}\n')
|
|
||||||
sys.stderr.write(f'Building {building.name} has unknown archetype for building function: {building.function} '
|
|
||||||
f'and building year of construction: {building.year_of_construction} '
|
|
||||||
f'and climate zone reference norm {self._climate_zone}\n')
|
|
||||||
|
|
||||||
return
|
|
||||||
|
|
||||||
# if building has no thermal zones defined from geometry, and the building will be divided in storeys,
|
|
||||||
# one thermal zone per storey is assigned
|
|
||||||
if len(building.internal_zones) == 1:
|
|
||||||
if building.internal_zones[0].thermal_zones is None:
|
|
||||||
self._create_storeys(building, archetype, self._divide_in_storeys)
|
|
||||||
if self._divide_in_storeys:
|
|
||||||
for internal_zone in building.internal_zones:
|
|
||||||
for thermal_zone in internal_zone.thermal_zones:
|
|
||||||
thermal_zone.total_floor_area = thermal_zone.footprint_area
|
|
||||||
else:
|
|
||||||
number_of_storeys = int(float(building.eave_height) / float(building.average_storey_height))
|
|
||||||
thermal_zone = building.internal_zones[0].thermal_zones[0]
|
|
||||||
thermal_zone.total_floor_area = thermal_zone.footprint_area * number_of_storeys
|
|
||||||
else:
|
|
||||||
for internal_zone in building.internal_zones:
|
|
||||||
for thermal_zone in internal_zone.thermal_zones:
|
|
||||||
thermal_zone.total_floor_area = thermal_zone.footprint_area
|
|
||||||
|
|
||||||
for internal_zone in building.internal_zones:
|
|
||||||
self._assign_values(internal_zone.thermal_zones, archetype)
|
|
||||||
for thermal_zone in internal_zone.thermal_zones:
|
|
||||||
self._calculate_view_factors(thermal_zone)
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def _search_archetype(nrel_catalog, function, year_of_construction, climate_zone):
|
|
||||||
nrel_archetypes = nrel_catalog.entries('archetypes')
|
|
||||||
for building_archetype in nrel_archetypes:
|
|
||||||
construction_period_limits = building_archetype.construction_period.split(' - ')
|
|
||||||
if construction_period_limits[1] == 'PRESENT':
|
|
||||||
construction_period_limits[1] = 3000
|
|
||||||
if int(construction_period_limits[0]) <= int(year_of_construction) < int(construction_period_limits[1]):
|
|
||||||
if (str(function) == str(building_archetype.function)) and \
|
|
||||||
(climate_zone == str(building_archetype.climate_zone)):
|
|
||||||
return building_archetype
|
|
||||||
raise KeyError('archetype not found')
|
|
||||||
|
|
||||||
@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
|
|
||||||
|
|
||||||
def _assign_values(self, thermal_zones, archetype):
|
|
||||||
for thermal_zone in thermal_zones:
|
|
||||||
thermal_zone.additional_thermal_bridge_u_value = archetype.extra_loses_due_to_thermal_bridges
|
|
||||||
thermal_zone.effective_thermal_capacity = archetype.thermal_capacity
|
|
||||||
thermal_zone.indirectly_heated_area_ratio = archetype.indirect_heated_ratio
|
|
||||||
thermal_zone.infiltration_rate_system_on = archetype.infiltration_rate_for_ventilation_system_on
|
|
||||||
thermal_zone.infiltration_rate_system_off = archetype.infiltration_rate_for_ventilation_system_off
|
|
||||||
for thermal_boundary in thermal_zone.thermal_boundaries:
|
|
||||||
construction_archetype = self._search_construction_in_archetype(archetype, thermal_boundary.type)
|
|
||||||
thermal_boundary.construction_name = construction_archetype.name
|
|
||||||
try:
|
|
||||||
thermal_boundary.window_ratio = construction_archetype.window_ratio
|
|
||||||
except ValueError:
|
|
||||||
# This is the normal operation way when the windows are defined in the geometry
|
|
||||||
continue
|
|
||||||
thermal_boundary.layers = []
|
|
||||||
for layer_archetype in construction_archetype.layers:
|
|
||||||
layer = Layer()
|
|
||||||
layer.thickness = layer_archetype.thickness
|
|
||||||
material = Material()
|
|
||||||
archetype_material = layer_archetype.material
|
|
||||||
material.name = archetype_material.name
|
|
||||||
material.id = archetype_material.id
|
|
||||||
material.no_mass = archetype_material.no_mass
|
|
||||||
if archetype_material.no_mass:
|
|
||||||
material.thermal_resistance = archetype_material.thermal_resistance
|
|
||||||
else:
|
|
||||||
material.density = archetype_material.density
|
|
||||||
material.conductivity = archetype_material.conductivity
|
|
||||||
material.specific_heat = archetype_material.specific_heat
|
|
||||||
material.solar_absorptance = archetype_material.solar_absorptance
|
|
||||||
material.thermal_absorptance = archetype_material.thermal_absorptance
|
|
||||||
material.visible_absorptance = archetype_material.visible_absorptance
|
|
||||||
layer.material = material
|
|
||||||
thermal_boundary.layers.append(layer)
|
|
||||||
# The agreement is that the layers are defined from outside to inside
|
|
||||||
external_layer = construction_archetype.layers[0]
|
|
||||||
external_surface = thermal_boundary.parent_surface
|
|
||||||
external_surface.short_wave_reflectance = 1 - float(external_layer.material.solar_absorptance)
|
|
||||||
external_surface.long_wave_emittance = 1 - float(external_layer.material.solar_absorptance)
|
|
||||||
internal_layer = construction_archetype.layers[len(construction_archetype.layers) - 1]
|
|
||||||
internal_surface = thermal_boundary.internal_surface
|
|
||||||
internal_surface.short_wave_reflectance = 1 - float(internal_layer.material.solar_absorptance)
|
|
||||||
internal_surface.long_wave_emittance = 1 - float(internal_layer.material.solar_absorptance)
|
|
||||||
|
|
||||||
for thermal_opening in thermal_boundary.thermal_openings:
|
|
||||||
if construction_archetype.window is not None:
|
|
||||||
window_archetype = construction_archetype.window
|
|
||||||
thermal_opening.construction_name = window_archetype.name
|
|
||||||
thermal_opening.frame_ratio = window_archetype.frame_ratio
|
|
||||||
thermal_opening.g_value = window_archetype.g_value
|
|
||||||
thermal_opening.overall_u_value = window_archetype.overall_u_value
|
|
||||||
|
|
||||||
# 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
|
|
||||||
def _create_storeys(building, archetype, divide_in_storeys):
|
|
||||||
building.average_storey_height = archetype.average_storey_height
|
|
||||||
building.storeys_above_ground = 1
|
|
||||||
thermal_zones = StoreysGeneration(building, building.internal_zones[0],
|
|
||||||
divide_in_storeys=divide_in_storeys).thermal_zones
|
|
||||||
building.internal_zones[0].thermal_zones = thermal_zones
|
|
Loading…
Reference in New Issue
Block a user