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
|
|
|
|
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
2021-06-10 08:29:24 -04:00
|
|
|
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
|
|
|
|
from imports.construction.helpers.construction_helper import ConstructionHelper
|
2021-01-07 19:46:52 -05:00
|
|
|
from city_model_structure.attributes.layer import Layer
|
|
|
|
from city_model_structure.attributes.material import Material
|
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
|
|
|
|
"""
|
2020-06-04 12:47:48 -04:00
|
|
|
def __init__(self, city, base_path):
|
2020-05-18 13:25:08 -04:00
|
|
|
self._city = city
|
2021-05-27 17:20:06 -04:00
|
|
|
self._climate_zone = ConstructionHelper.city_to_nrel_climate_zone(city.name)
|
2021-01-07 19:46:52 -05:00
|
|
|
super().__init__(base_path, 'us_constructions.xml', 'us_archetypes.xml')
|
|
|
|
|
|
|
|
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
|
|
|
:return:
|
|
|
|
"""
|
|
|
|
city = self._city
|
|
|
|
# it is assumed that all buildings have the same archetypes' keys
|
|
|
|
for building in city.buildings:
|
2021-05-27 17:20:06 -04:00
|
|
|
building_type = ConstructionHelper.nrel_from_function(building.function)
|
2021-01-07 19:46:52 -05:00
|
|
|
if building_type is None:
|
|
|
|
return
|
|
|
|
archetype = self._search_archetype(building_type,
|
2021-05-27 17:20:06 -04:00
|
|
|
ConstructionHelper.yoc_to_nrel_standard(building.year_of_construction),
|
2021-01-07 19:46:52 -05:00
|
|
|
self._climate_zone)
|
|
|
|
if archetype is None:
|
|
|
|
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}\n')
|
|
|
|
continue
|
|
|
|
self._assign_values(building, archetype)
|
|
|
|
|
|
|
|
def _search_archetype(self, building_type, standard, climate_zone):
|
|
|
|
for building_archetype in self._building_archetypes:
|
|
|
|
a_yc = str(building_archetype.archetype_keys['@reference_standard'])
|
|
|
|
a_bt = str(building_archetype.archetype_keys['@building_type'])
|
|
|
|
a_cz = str(building_archetype.archetype_keys['@climate_zone'])
|
|
|
|
if (a_yc == str(standard)) and (a_bt == str(building_type)) and (a_cz == str(climate_zone)):
|
|
|
|
return building_archetype
|
|
|
|
return None
|
|
|
|
|
|
|
|
def _assign_values(self, building, archetype):
|
|
|
|
building.average_storey_height = archetype.average_storey_height
|
|
|
|
building.storeys_above_ground = archetype.storeys_above_ground
|
|
|
|
for thermal_zone in building.thermal_zones:
|
|
|
|
thermal_zone.additional_thermal_bridge_u_value = archetype.additional_thermal_bridge_u_value
|
|
|
|
thermal_zone.effective_thermal_capacity = archetype.effective_thermal_capacity
|
|
|
|
thermal_zone.indirectly_heated_area_ratio = archetype.indirectly_heated_area_ratio
|
|
|
|
thermal_zone.infiltration_rate_system_on = archetype.infiltration_rate_system_on
|
|
|
|
thermal_zone.infiltration_rate_system_off = archetype.infiltration_rate_system_off
|
|
|
|
for thermal_boundary in thermal_zone.bounded:
|
2021-05-27 17:20:06 -04:00
|
|
|
construction_type = ConstructionHelper.nrel_construction_types[thermal_boundary.type]
|
2021-01-07 19:46:52 -05:00
|
|
|
thermal_boundary_archetype = self._search_construction_in_archetype(archetype, construction_type)
|
|
|
|
if thermal_boundary_archetype.outside_solar_absorptance is not None:
|
|
|
|
thermal_boundary.outside_solar_absorptance = thermal_boundary_archetype.outside_solar_absorptance
|
|
|
|
thermal_boundary.outside_thermal_absorptance = thermal_boundary_archetype.outside_thermal_absorptance
|
|
|
|
thermal_boundary.outside_visible_absorptance = thermal_boundary_archetype.outside_visible_absorptance
|
|
|
|
thermal_boundary.construction_name = thermal_boundary_archetype.construction_name
|
|
|
|
thermal_boundary.window_ratio = thermal_boundary_archetype.window_ratio
|
|
|
|
for layer_archetype in thermal_boundary_archetype.layers:
|
|
|
|
layer = Layer()
|
|
|
|
layer.thickness = layer_archetype.thickness
|
|
|
|
material = Material()
|
|
|
|
material.name = layer_archetype.name
|
|
|
|
material.no_mass = layer_archetype.no_mass
|
|
|
|
material.density = layer_archetype.density
|
|
|
|
material.conductivity = layer_archetype.conductivity
|
|
|
|
material.specific_heat = layer_archetype.specific_heat
|
|
|
|
material.solar_absorptance = layer_archetype.solar_absorptance
|
|
|
|
material.thermal_absorptance = layer_archetype.thermal_absorptance
|
|
|
|
material.visible_absorptance = layer_archetype.visible_absorptance
|
|
|
|
material.thermal_resistance = layer_archetype.thermal_resistance
|
|
|
|
layer.material = material
|
|
|
|
for thermal_opening in thermal_boundary.thermal_openings:
|
|
|
|
if thermal_boundary_archetype.thermal_opening is not None:
|
|
|
|
thermal_opening_archetype = thermal_boundary_archetype.thermal_opening
|
|
|
|
thermal_opening.frame_ratio = thermal_opening_archetype.frame_ratio
|
|
|
|
thermal_opening.g_value = thermal_opening_archetype.g_value
|
|
|
|
thermal_opening.conductivity = thermal_opening_archetype.conductivity
|
|
|
|
thermal_opening.thickness = thermal_opening_archetype.thickness
|
|
|
|
thermal_opening.back_side_solar_transmittance_at_normal_incidence = \
|
|
|
|
thermal_opening_archetype.back_side_solar_transmittance_at_normal_incidence
|
|
|
|
thermal_opening.front_side_solar_transmittance_at_normal_incidence = \
|
|
|
|
thermal_opening_archetype.front_side_solar_transmittance_at_normal_incidence
|