2020-06-09 14:07:47 -04:00
|
|
|
"""
|
|
|
|
UsPhysicsParameters import the construction and material information for US
|
|
|
|
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
2022-04-08 09:35:33 -04:00
|
|
|
Copyright © 2022 Concordia CERC group
|
|
|
|
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|
|
|
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
2020-06-09 14:07:47 -04:00
|
|
|
"""
|
2021-01-07 19:46:52 -05:00
|
|
|
import sys
|
|
|
|
|
2021-06-03 15:56:59 -04:00
|
|
|
from imports.construction.nrel_physics_interface import NrelPhysicsInterface
|
2022-04-26 19:14:12 -04:00
|
|
|
from catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
|
2021-08-06 12:28:20 -04:00
|
|
|
from city_model_structure.building_demand.layer import Layer
|
|
|
|
from city_model_structure.building_demand.material import Material
|
2022-04-19 15:49:41 -04:00
|
|
|
from imports.construction.helpers.construction_helper import ConstructionHelper
|
2020-05-18 13:25:08 -04:00
|
|
|
|
|
|
|
|
2021-01-07 19:52:06 -05:00
|
|
|
class UsPhysicsParameters(NrelPhysicsInterface):
|
2020-06-11 15:45:11 -04:00
|
|
|
"""
|
|
|
|
UsPhysicsParameters class
|
|
|
|
"""
|
2022-04-26 18:39:42 -04:00
|
|
|
def __init__(self, city, base_path, divide_in_storeys=False):
|
2020-05-18 13:25:08 -04:00
|
|
|
self._city = city
|
2022-04-19 15:49:41 -04:00
|
|
|
self._path = base_path
|
2022-04-26 18:39:42 -04:00
|
|
|
self._divide_in_storeys = divide_in_storeys
|
2021-05-27 17:20:06 -04:00
|
|
|
self._climate_zone = ConstructionHelper.city_to_nrel_climate_zone(city.name)
|
2022-04-19 15:49:41 -04:00
|
|
|
super().__init__()
|
2021-01-07 19:46:52 -05:00
|
|
|
|
|
|
|
def enrich_buildings(self):
|
|
|
|
"""
|
2021-05-26 18:17:23 -04:00
|
|
|
Returns the city with the construction parameters assigned to the buildings
|
2021-01-07 19:46:52 -05:00
|
|
|
"""
|
2022-04-19 16:20:41 -04:00
|
|
|
# todo: erase
|
2021-01-07 19:46:52 -05:00
|
|
|
city = self._city
|
|
|
|
for building in city.buildings:
|
2022-03-17 18:49:44 -04:00
|
|
|
try:
|
2022-04-28 14:34:23 -04:00
|
|
|
print(building.function, building.year_of_construction, self._climate_zone)
|
2022-04-19 15:49:41 -04:00
|
|
|
archetype = self._search_archetype(building.function, building.year_of_construction, self._climate_zone)
|
2022-03-17 18:49:44 -04:00
|
|
|
except KeyError:
|
2021-01-07 19:46:52 -05:00
|
|
|
sys.stderr.write(f'Building {building.name} has unknown archetype for building function: {building.function} '
|
2022-04-28 14:34:23 -04:00
|
|
|
f'and building year of construction: {building.year_of_construction} '
|
|
|
|
f'and climate zone reference norm {self._climate_zone}\n')
|
2022-03-17 18:49:44 -04:00
|
|
|
return
|
2021-08-27 17:20:24 -04:00
|
|
|
|
2022-03-08 19:19:52 -05:00
|
|
|
# if building has no thermal zones defined from geometry, one thermal zone per storey is assigned
|
2022-03-17 18:49:44 -04:00
|
|
|
if len(building.internal_zones) == 1:
|
|
|
|
if building.internal_zones[0].thermal_zones is None:
|
2022-04-26 18:39:42 -04:00
|
|
|
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
|
2022-03-08 19:19:52 -05:00
|
|
|
|
2022-03-24 16:51:01 -04:00
|
|
|
for internal_zone in building.internal_zones:
|
2022-04-26 18:39:42 -04:00
|
|
|
self._assign_values(internal_zone.thermal_zones, archetype)
|
2022-03-24 16:51:01 -04:00
|
|
|
for thermal_zone in internal_zone.thermal_zones:
|
|
|
|
self._calculate_view_factors(thermal_zone)
|
2021-01-07 19:46:52 -05:00
|
|
|
|
2022-04-26 19:14:12 -04:00
|
|
|
@staticmethod
|
|
|
|
def _search_archetype(function, year_of_construction, climate_zone):
|
|
|
|
nrel_catalog = ConstructionCatalogFactory('nrel').catalog
|
2022-04-28 14:34:23 -04:00
|
|
|
print(nrel_catalog.names)
|
2022-04-26 19:14:12 -04:00
|
|
|
nrel_archetypes = nrel_catalog.entries('archetypes')
|
2022-04-28 14:34:23 -04:00
|
|
|
for nrel_archetype in nrel_archetypes:
|
|
|
|
print(nrel_archetype.name)
|
2022-04-19 15:49:41 -04:00
|
|
|
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
|
2022-04-26 18:39:42 -04:00
|
|
|
if int(construction_period_limits[0]) <= int(year_of_construction) < int(construction_period_limits[1]):
|
2022-04-19 15:49:41 -04:00
|
|
|
if (str(function) == str(building_archetype.function)) and \
|
|
|
|
(climate_zone == str(building_archetype.climate_zone)):
|
|
|
|
return building_archetype
|
|
|
|
return None
|
|
|
|
|
|
|
|
@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
|
2021-01-07 19:46:52 -05:00
|
|
|
return None
|
|
|
|
|
2022-04-26 18:39:42 -04:00
|
|
|
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 = layer_archetype.name
|
|
|
|
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]
|
|
|
|
thermal_boundary.outside_solar_absorptance = external_layer.material.solar_absorptance
|
|
|
|
thermal_boundary.outside_thermal_absorptance = external_layer.material.thermal_absorptance
|
|
|
|
thermal_boundary.outside_visible_absorptance = external_layer.material.visible_absorptance
|
2022-04-19 15:49:41 -04:00
|
|
|
|
2022-04-26 18:39:42 -04:00
|
|
|
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
|