added nrcan catalog

This commit is contained in:
Pilar 2023-02-22 08:31:14 -05:00
parent 8469674b18
commit 536a3fe414
12 changed files with 7040 additions and 8837 deletions

View File

@ -38,7 +38,7 @@ class Archetype:
def id(self): def id(self):
""" """
Get archetype id Get archetype id
:return: int :return: str
""" """
return self._id return self._id
@ -85,7 +85,7 @@ class Archetype:
@property @property
def average_storey_height(self): def average_storey_height(self):
""" """
Get archetype average storey height Get archetype average storey height in m
:return: float :return: float
""" """
return self._average_storey_height return self._average_storey_height
@ -93,23 +93,23 @@ class Archetype:
@property @property
def thermal_capacity(self): def thermal_capacity(self):
""" """
Get archetype thermal capacity Get archetype thermal capacity in J/m3K
:return: int :return: float
""" """
return self._thermal_capacity return self._thermal_capacity
@property @property
def extra_loses_due_to_thermal_bridges(self): def extra_loses_due_to_thermal_bridges(self):
""" """
Get archetype extra loses due to thermal bridges Get archetype extra loses due to thermal bridges in W/m2K
:return: int :return: float
""" """
return self._extra_loses_due_to_thermal_bridges return self._extra_loses_due_to_thermal_bridges
@property @property
def indirect_heated_ratio(self): def indirect_heated_ratio(self):
""" """
Get archetype indirect heat ratio Get archetype indirect heated area ratio
:return: float :return: float
""" """
return self._indirect_heated_ratio return self._indirect_heated_ratio
@ -117,7 +117,7 @@ class Archetype:
@property @property
def infiltration_rate_for_ventilation_system_off(self): def infiltration_rate_for_ventilation_system_off(self):
""" """
Get archetype infiltration rate for ventilation system off Get archetype infiltration rate for ventilation system off in ACH
:return: float :return: float
""" """
return self._infiltration_rate_for_ventilation_system_off return self._infiltration_rate_for_ventilation_system_off
@ -125,7 +125,7 @@ class Archetype:
@property @property
def infiltration_rate_for_ventilation_system_on(self): def infiltration_rate_for_ventilation_system_on(self):
""" """
Get archetype infiltration rate for ventilation system on Get archetype infiltration rate for ventilation system on in ACH
:return: float :return: float
""" """
return self._infiltration_rate_for_ventilation_system_on return self._infiltration_rate_for_ventilation_system_on

View File

@ -21,7 +21,7 @@ class Construction:
def id(self): def id(self):
""" """
Get construction id Get construction id
:return: int :return: str
""" """
return self._id return self._id

View File

@ -17,7 +17,7 @@ class Layer:
def id(self): def id(self):
""" """
Get layer id Get layer id
:return: int :return: str
""" """
return self._id return self._id

View File

@ -32,7 +32,7 @@ class Material:
def id(self): def id(self):
""" """
Get material id Get material id
:return: int :return: str
""" """
return self._id return self._id

View File

@ -28,7 +28,7 @@ class Material:
def id(self): def id(self):
""" """
Get material id Get material id
:return: int :return: str
""" """
return self._id return self._id
@ -36,9 +36,9 @@ class Material:
def id(self, value): def id(self, value):
""" """
Set material id Set material id
:param value: int :param value: str
""" """
self._id = int(value) self._id = value
@property @property
def name(self): def name(self):

View File

@ -120,7 +120,7 @@ class ThermalZone:
@property @property
def effective_thermal_capacity(self) -> Union[None, float]: def effective_thermal_capacity(self) -> Union[None, float]:
""" """
Get thermal zone effective thermal capacity in J/m2K Get thermal zone effective thermal capacity in J/m3K
:return: None or float :return: None or float
""" """
return self._effective_thermal_capacity return self._effective_thermal_capacity
@ -128,7 +128,7 @@ class ThermalZone:
@effective_thermal_capacity.setter @effective_thermal_capacity.setter
def effective_thermal_capacity(self, value): def effective_thermal_capacity(self, value):
""" """
Set thermal zone effective thermal capacity in J/m2K Set thermal zone effective thermal capacity in J/m3K
:param value: float :param value: float
""" """
if value is not None: if value is not None:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -71,9 +71,10 @@ class InselMonthlyEnergyBalance(Insel):
internal_zone = building.internal_zones[0] internal_zone = building.internal_zones[0]
thermal_zone = internal_zone.thermal_zones[0] thermal_zone = internal_zone.thermal_zones[0]
parameters.append(f'{thermal_zone.indirectly_heated_area_ratio} % BP(6) Indirectly heated area ratio') parameters.append(f'{thermal_zone.indirectly_heated_area_ratio} % BP(6) Indirectly heated area ratio')
parameters.append(f'{thermal_zone.effective_thermal_capacity / 3600} % BP(7) Effective heat capacity (Wh/m2K)') parameters.append(f'{thermal_zone.effective_thermal_capacity / 3600 / building.average_storey_height}'
f' % BP(7) Effective heat capacity (Wh/m2K)')
parameters.append(f'{thermal_zone.additional_thermal_bridge_u_value} ' parameters.append(f'{thermal_zone.additional_thermal_bridge_u_value} '
f'% BP(8) Additional U-value for heat bridge (Wh/m2K)') f'% BP(8) Additional U-value for heat bridge (W/m2K)')
parameters.append('1 % BP(9) Usage type (0=standard, 1=IWU)') parameters.append('1 % BP(9) Usage type (0=standard, 1=IWU)')
# ZONES AND SURFACES # ZONES AND SURFACES

View File

@ -47,6 +47,10 @@ class ConstructionHelper:
cte.ROOF: 'roof' cte.ROOF: 'roof'
} }
_reference_city_to_nrcan_climate_zone = {
'Montreal': '6'
}
@staticmethod @staticmethod
def yoc_to_nrel_standard(year_of_construction): def yoc_to_nrel_standard(year_of_construction):
""" """
@ -68,9 +72,9 @@ class ConstructionHelper:
:return: str :return: str
""" """
# todo: Dummy function that needs to be implemented # todo: Dummy function that needs to be implemented
reference_city = 'Baltimore' reference_city = 'Montreal'
if city is not None: if city is not None:
reference_city = 'Baltimore' reference_city = 'Montreal'
return reference_city return reference_city
@staticmethod @staticmethod
@ -80,5 +84,15 @@ class ConstructionHelper:
:param city: str :param city: str
:return: str :return: str
""" """
reference_city = ConstructionHelper.city_to_reference_city(city) reference_city = 'Baltimore'
return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city] return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city]
@staticmethod
def city_to_nrcan_climate_zone(city):
"""
City name to NRCAN climate zone
:param city: str
:return: str
"""
reference_city = ConstructionHelper.city_to_reference_city(city)
return ConstructionHelper._reference_city_to_nrcan_climate_zone[reference_city]

View File

@ -4,8 +4,10 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
""" """
import math
import sys import sys
import hub.helpers.constants as cte
from hub.catalog_factories.construction_catalog_factory import ConstructionCatalogFactory 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.layer import Layer
from hub.city_model_structure.building_demand.material import Material from hub.city_model_structure.building_demand.material import Material
@ -22,25 +24,23 @@ class NrcanPhysicsParameters:
self._city = city self._city = city
self._path = base_path self._path = base_path
self._divide_in_storeys = divide_in_storeys self._divide_in_storeys = divide_in_storeys
self._climate_zone = ConstructionHelper.city_to_nrel_climate_zone(city.name) self._climate_zone = ConstructionHelper.city_to_nrcan_climate_zone(city.name)
def enrich_buildings(self): def enrich_buildings(self):
""" """
Returns the city with the construction parameters assigned to the buildings Returns the city with the construction parameters assigned to the buildings
""" """
city = self._city city = self._city
canel_catalog = ConstructionCatalogFactory('nrcan').catalog nrcan_catalog = ConstructionCatalogFactory('nrcan').catalog
for building in city.buildings: for building in city.buildings:
try: try:
function = Dictionaries().hub_function_to_nrcan_construction_function[building.function] function = Dictionaries().hub_function_to_nrcan_construction_function[building.function]
archetype = self._search_archetype(canel_catalog, function, building.year_of_construction, archetype = self._search_archetype(nrcan_catalog, function, building.year_of_construction, self._climate_zone)
self._climate_zone)
except KeyError: except KeyError:
sys.stderr.write(f'Building {building.name} has unknown construction archetype for building function: ' sys.stderr.write(f'Building {building.name} has unknown construction archetype for building function: '
f'{building.function} and building year of construction: {building.year_of_construction} ' f'{building.function} and building year of construction: {building.year_of_construction} '
f'and climate zone reference norm {self._climate_zone}\n') f'and climate zone {self._climate_zone}\n')
return return
# if building has no thermal zones defined from geometry, and the building will be divided in storeys, # if building has no thermal zones defined from geometry, and the building will be divided in storeys,
# one thermal zone per storey is assigned # one thermal zone per storey is assigned
if len(building.internal_zones) == 1: if len(building.internal_zones) == 1:
@ -65,12 +65,10 @@ class NrcanPhysicsParameters:
self._calculate_view_factors(thermal_zone) self._calculate_view_factors(thermal_zone)
@staticmethod @staticmethod
def _search_archetype(nrel_catalog, function, year_of_construction, climate_zone): def _search_archetype(nrcan_catalog, function, year_of_construction, climate_zone):
nrel_archetypes = nrel_catalog.entries('archetypes') nrcan_archetypes = nrcan_catalog.entries('archetypes')
for building_archetype in nrel_archetypes: for building_archetype in nrcan_archetypes:
construction_period_limits = building_archetype.construction_period.split(' - ') 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 int(construction_period_limits[0]) <= int(year_of_construction) < int(construction_period_limits[1]):
if (str(function) == str(building_archetype.function)) and \ if (str(function) == str(building_archetype.function)) and \
(climate_zone == str(building_archetype.climate_zone)): (climate_zone == str(building_archetype.climate_zone)):
@ -96,7 +94,21 @@ class NrcanPhysicsParameters:
construction_archetype = self._search_construction_in_archetype(archetype, thermal_boundary.type) construction_archetype = self._search_construction_in_archetype(archetype, thermal_boundary.type)
thermal_boundary.construction_name = construction_archetype.name thermal_boundary.construction_name = construction_archetype.name
try: try:
thermal_boundary.window_ratio = construction_archetype.window_ratio thermal_boundary.window_ratio = 0
if thermal_boundary.type == cte.WALL or thermal_boundary.type == cte.ROOF:
if construction_archetype.window is not None:
if math.pi / 4 <= thermal_boundary.parent_surface.azimuth < 3 * math.pi / 4:
thermal_boundary.window_ratio = \
float(construction_archetype.window_ratio['east']) / 100
elif 3 * math.pi / 4 <= thermal_boundary.parent_surface.azimuth < 5 * math.pi / 4:
thermal_boundary.window_ratio = \
float(construction_archetype.window_ratio['south']) / 100
elif 5 * math.pi / 4 <= thermal_boundary.parent_surface.azimuth < 7 * math.pi / 4:
thermal_boundary.window_ratio = \
float(construction_archetype.window_ratio['west']) / 100
else:
thermal_boundary.window_ratio = \
float(construction_archetype.window_ratio['north']) / 100
except ValueError: except ValueError:
# This is the normal operation way when the windows are defined in the geometry # This is the normal operation way when the windows are defined in the geometry
continue continue

View File

@ -113,8 +113,6 @@ class TestConstructionFactory(TestCase):
self.assertTrue(len(thermal_zone.thermal_boundaries) > 0, 'thermal_zone thermal_boundaries not defined') self.assertTrue(len(thermal_zone.thermal_boundaries) > 0, 'thermal_zone thermal_boundaries not defined')
self.assertIsNotNone(thermal_zone.additional_thermal_bridge_u_value, 'additional_thermal_bridge_u_value is none') self.assertIsNotNone(thermal_zone.additional_thermal_bridge_u_value, 'additional_thermal_bridge_u_value is none')
self.assertIsNotNone(thermal_zone.effective_thermal_capacity, 'thermal_zone effective_thermal_capacity is none') self.assertIsNotNone(thermal_zone.effective_thermal_capacity, 'thermal_zone effective_thermal_capacity is none')
self.assertIsNotNone(thermal_zone.indirectly_heated_area_ratio,
'thermal_zone indirectly_heated_area_ratio is none')
self.assertIsNotNone(thermal_zone.infiltration_rate_system_off, self.assertIsNotNone(thermal_zone.infiltration_rate_system_off,
'thermal_zone infiltration_rate_system_off is none') 'thermal_zone infiltration_rate_system_off is none')
self.assertIsNotNone(thermal_zone.infiltration_rate_system_on, 'thermal_zone infiltration_rate_system_on is none') self.assertIsNotNone(thermal_zone.infiltration_rate_system_on, 'thermal_zone infiltration_rate_system_on is none')
@ -153,7 +151,7 @@ class TestConstructionFactory(TestCase):
def _check_thermal_openings(self, thermal_boundary): def _check_thermal_openings(self, thermal_boundary):
for thermal_opening in thermal_boundary.thermal_openings: for thermal_opening in thermal_boundary.thermal_openings:
self.assertIsNotNone(thermal_opening.id, 'thermal opening id is not none') self.assertIsNotNone(thermal_opening.id, 'thermal opening id is not none')
self.assertIsNotNone(thermal_opening.construction_name, 'thermal opening construction is not none') self.assertIsNotNone(thermal_opening.construction_name, 'thermal opening construction is none')
self.assertIsNotNone(thermal_opening.area, 'thermal opening area is not none') self.assertIsNotNone(thermal_opening.area, 'thermal opening area is not none')
self.assertIsNotNone(thermal_opening.frame_ratio, 'thermal opening frame_ratio is none') self.assertIsNotNone(thermal_opening.frame_ratio, 'thermal opening frame_ratio is none')
self.assertIsNotNone(thermal_opening.g_value, 'thermal opening g_value is none') self.assertIsNotNone(thermal_opening.g_value, 'thermal opening g_value is none')
@ -176,10 +174,64 @@ class TestConstructionFactory(TestCase):
""" """
Enrich the city with the construction information and verify it Enrich the city with the construction information and verify it
""" """
file = 'one_building_in_kelowna.gml'
city = self._get_citygml(file)
for building in city.buildings:
building.year_of_construction = 1980
building.function = self._internal_function('hft', building.function)
ConstructionFactory('nrcan', city).enrich()
self._check_buildings(city)
for building in city.buildings:
for internal_zone in building.internal_zones:
self._check_thermal_zones(internal_zone)
for thermal_zone in internal_zone.thermal_zones:
self._check_thermal_boundaries(thermal_zone)
for thermal_boundary in thermal_zone.thermal_boundaries:
self.assertIsNotNone(thermal_boundary.layers, 'layers is none')
self._check_thermal_openings(thermal_boundary)
self._check_surfaces(thermal_boundary)
file = 'pluto_building.gml' file = 'pluto_building.gml'
city = self._get_citygml(file) city = self._get_citygml(file)
for building in city.buildings: for building in city.buildings:
building.year_of_construction = 2005 building.year_of_construction = 1980
building.function = self._internal_function('pluto', building.function)
ConstructionFactory('nrcan', city).enrich()
self._check_buildings(city)
for building in city.buildings:
for internal_zone in building.internal_zones:
self._check_thermal_zones(internal_zone)
for thermal_zone in internal_zone.thermal_zones:
self._check_thermal_boundaries(thermal_zone)
for thermal_boundary in thermal_zone.thermal_boundaries:
self.assertIsNotNone(thermal_boundary.layers, 'layers is none')
self._check_thermal_openings(thermal_boundary)
self._check_surfaces(thermal_boundary)
file = 'one_building_in_kelowna.gml'
city = self._get_citygml(file)
for building in city.buildings:
building.year_of_construction = 2006
building.function = self._internal_function('hft', building.function)
ConstructionFactory('nrel', city).enrich()
self._check_buildings(city)
for building in city.buildings:
for internal_zone in building.internal_zones:
self._check_thermal_zones(internal_zone)
for thermal_zone in internal_zone.thermal_zones:
self._check_thermal_boundaries(thermal_zone)
for thermal_boundary in thermal_zone.thermal_boundaries:
self.assertIsNotNone(thermal_boundary.layers, 'layers is none')
self._check_thermal_openings(thermal_boundary)
self._check_surfaces(thermal_boundary)
file = 'pluto_building.gml'
city = self._get_citygml(file)
for building in city.buildings:
building.year_of_construction = 2006
building.function = self._internal_function('pluto', building.function) building.function = self._internal_function('pluto', building.function)
ConstructionFactory('nrel', city).enrich() ConstructionFactory('nrel', city).enrich()
@ -194,6 +246,50 @@ class TestConstructionFactory(TestCase):
self._check_thermal_openings(thermal_boundary) self._check_thermal_openings(thermal_boundary)
self._check_surfaces(thermal_boundary) self._check_surfaces(thermal_boundary)
file = 'one_building_in_kelowna.gml'
city = self._get_citygml(file)
for building in city.buildings:
building.year_of_construction = 1980
building.function = self._internal_function('hft', building.function)
ConstructionFactory('nrcan', city).enrich()
self._check_buildings(city)
for building in city.buildings:
for internal_zone in building.internal_zones:
self._check_thermal_zones(internal_zone)
for thermal_zone in internal_zone.thermal_zones:
self._check_thermal_boundaries(thermal_zone)
for thermal_boundary in thermal_zone.thermal_boundaries:
self.assertIsNotNone(thermal_boundary.layers, 'layers is none')
self._check_thermal_openings(thermal_boundary)
self._check_surfaces(thermal_boundary)
file_path = (self._example_path / 'concordia.geojson').resolve()
self._city = GeometryFactory('geojson',
path=file_path,
height_field='citygml_me',
year_of_construction_field='ANNEE_CONS',
function_field='LIBELLE_UT',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
for building in city.buildings:
building.year_of_construction = 1980
building.function = self._internal_function('pluto', building.function)
ConstructionFactory('nrcan', city).enrich()
self._check_buildings(city)
for building in city.buildings:
for internal_zone in building.internal_zones:
self._check_thermal_zones(internal_zone)
for thermal_zone in internal_zone.thermal_zones:
self._check_thermal_boundaries(thermal_zone)
for thermal_boundary in thermal_zone.thermal_boundaries:
self.assertIsNotNone(thermal_boundary.layers, 'layers is none')
self._check_thermal_openings(thermal_boundary)
self._check_surfaces(thermal_boundary)
def test_archetype_not_found(self): def test_archetype_not_found(self):
file = 'pluto_building.gml' file = 'pluto_building.gml'
city = self._get_citygml(file) city = self._get_citygml(file)