Merge remote-tracking branch 'origin/master'

This commit is contained in:
Pilar 2022-04-12 09:29:09 -04:00
commit 58108b3bf0
24 changed files with 135 additions and 598 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/data/energy_systems/heat_pumps/*.csv /data/energy_systems/heat_pumps/*.csv
/data/energy_systems/heat_pumps/*.insel /data/energy_systems/heat_pumps/*.insel
.DS_Store .DS_Store
__pycache__/

View File

@ -11,7 +11,6 @@ class Catalog:
Catalogs base class not implemented instance of the Catalog base class, catalog_factories will inherit from this class. Catalogs base class not implemented instance of the Catalog base class, catalog_factories will inherit from this class.
""" """
@property
def names(self, category=None): def names(self, category=None):
""" """
Base property to return the catalog entries names Base property to return the catalog entries names

View File

@ -21,6 +21,10 @@ nrel_to_function = {
'large hotel': cte.LARGE_HOTEL 'large hotel': cte.LARGE_HOTEL
} }
nrcan_to_function = {
'residential': cte.RESIDENTIAL,
}
reference_standard_to_construction_period = { reference_standard_to_construction_period = {
'ASHRAE 90.1_2004': '2004 - 2009', 'ASHRAE 90.1_2004': '2004 - 2009',
'ASHRAE 189.1_2009': '2009 - PRESENT' 'ASHRAE 189.1_2009': '2009 - PRESENT'

View File

@ -1,5 +1,5 @@
""" """
Greenery catalog Nrel construction catalog
SPDX - License - Identifier: LGPL - 3.0 - or -later SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
@ -14,7 +14,8 @@ from catalog_factories.data_models.construction.layer import Layer
from catalog_factories.data_models.construction.construction import Construction from catalog_factories.data_models.construction.construction import Construction
from catalog_factories.data_models.construction.content import Content from catalog_factories.data_models.construction.content import Content
from catalog_factories.data_models.construction.archetype import Archetype from catalog_factories.data_models.construction.archetype import Archetype
from catalog_factories.construction.construction_helpers import nrel_to_function, reference_standard_to_construction_period from catalog_factories.construction.construction_helpers import nrel_to_function
from catalog_factories.construction.construction_helpers import reference_standard_to_construction_period
class NrelCatalog(Catalog): class NrelCatalog(Catalog):
@ -22,41 +23,52 @@ class NrelCatalog(Catalog):
archetypes_path = str(Path(path / 'us_archetypes.xml').resolve()) archetypes_path = str(Path(path / 'us_archetypes.xml').resolve())
constructions_path = str(Path(path / 'us_constructions.xml').resolve()) constructions_path = str(Path(path / 'us_constructions.xml').resolve())
with open(constructions_path) as xml: with open(constructions_path) as xml:
self._constructions = xmltodict.parse(xml.read(), force_list=('material', 'window', 'construction')) self._constructions = xmltodict.parse(xml.read(), force_list=('material', 'window', 'construction', 'layer'))
with open(archetypes_path) as xml: with open(archetypes_path) as xml:
self._archetypes = xmltodict.parse(xml.read(), force_list=('archetype', 'construction')) self._archetypes = xmltodict.parse(xml.read(), force_list=('archetype', 'construction'))
self._catalog_windows = [] self._catalog_windows = self._load_windows()
self._catalog_materials = [] self._catalog_materials = self._load_materials()
self._catalog_constructions = [] self._catalog_constructions = self._load_constructions()
self._catalog_archetypes = [] self._catalog_archetypes = self._load_archetypes()
# store the full catalog data model in self._content
self._content = Content(self._catalog_archetypes,
self._catalog_constructions,
self._catalog_materials,
self._catalog_windows)
def _load_windows(self):
_catalog_windows = []
windows = self._constructions['library']['windows']['window'] windows = self._constructions['library']['windows']['window']
for window in windows: for window in windows:
frame_ratio = window['frame_ratio'] frame_ratio = window['frame_ratio']['#text']
g_value = window['shgc'] g_value = window['shgc']
overall_u_value = float(window['conductivity']) / float(window['thickness']) overall_u_value = float(window['conductivity']['#text']) / float(window['thickness']['#text'])
construction_name = window['@name'] name = window['@name']
self._catalog_windows.append(Window(frame_ratio, g_value, overall_u_value, construction_name)) _catalog_windows.append(Window(frame_ratio, g_value, overall_u_value, name))
return _catalog_windows
def _load_materials(self):
_catalog_materials = []
materials = self._constructions['library']['materials']['material'] materials = self._constructions['library']['materials']['material']
for material in materials: for material in materials:
material_id = material['@id'] material_id = material['@id']
name = material['@name'] name = material['@name']
solar_absorptance = material['solar_absorptance'] solar_absorptance = material['solar_absorptance']['#text']
thermal_absorptance = material['thermal_absorptance'] thermal_absorptance = material['thermal_absorptance']['#text']
visible_absorptance = material['visible_absorptance'] visible_absorptance = material['visible_absorptance']['#text']
no_mass = True no_mass = True
thermal_resistance = None, thermal_resistance = None,
conductivity = None, conductivity = None,
density = None, density = None,
specific_heat = None specific_heat = None
if material['no_mass'] == 'true': if 'no_mass' in material and material['no_mass'] == 'true':
no_mass = True no_mass = True
thermal_resistance = material['thermal_resistance'] thermal_resistance = material['thermal_resistance']['#text']
else: else:
conductivity = material['conductivity'] conductivity = material['conductivity']['#text']
density = material['density'] density = material['density']['#text']
specific_heat = material['specific_heat'] specific_heat = material['specific_heat']['#text']
_material = Material(material_id, _material = Material(material_id,
name, name,
solar_absorptance, solar_absorptance,
@ -67,8 +79,11 @@ class NrelCatalog(Catalog):
conductivity, conductivity,
density, density,
specific_heat) specific_heat)
self._catalog_materials.append(_material) _catalog_materials.append(_material)
return _catalog_materials
def _load_constructions(self):
_catalog_constructions = []
constructions = self._constructions['library']['constructions']['construction'] constructions = self._constructions['library']['constructions']['construction']
for construction in constructions: for construction in constructions:
construction_id = construction['@id'] construction_id = construction['@id']
@ -77,32 +92,37 @@ class NrelCatalog(Catalog):
layers = [] layers = []
for layer in construction['layers']['layer']: for layer in construction['layers']['layer']:
layer_id = layer['@id'] layer_id = layer['@id']
name = layer['@name'] layer_name = layer['@name']
material_id = layer['material'] material_id = layer['material']
thickness = layer['thickness'] thickness = 0
for material in self._materials: if 'thickness' in layer:
thickness = layer['thickness']['#text']
for material in self._catalog_materials:
if material_id == material.id: if material_id == material.id:
layers.append(Layer(layer_id, name, material, thickness)) layers.append(Layer(layer_id, layer_name, material, thickness))
break break
self._catalog_constructions.append(Construction(construction_id, construction_type, name, layers)) _catalog_constructions.append(Construction(construction_id, construction_type, name, layers))
return _catalog_constructions
def _load_archetypes(self):
_catalog_archetypes = []
archetypes = self._archetypes['archetypes']['archetype'] archetypes = self._archetypes['archetypes']['archetype']
for archetype in archetypes: for archetype in archetypes:
archetype_id = archetype['@id'] archetype_id = archetype['@id']
function = nrel_to_function[archetype['@building_type']] function = nrel_to_function[archetype['@building_type']]
construction_period = reference_standard_to_construction_period[archetype['reference_standard']] construction_period = reference_standard_to_construction_period[archetype['@reference_standard']]
average_storey_height = archetype['average_storey_height'] average_storey_height = archetype['average_storey_height']['#text']
number_of_storeys = archetype['number_of_storeys'] number_of_storeys = archetype['number_of_storeys']['#text']
thermal_capacity = archetype['thermal_capacity'] thermal_capacity = archetype['thermal_capacity']['#text']
extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_to_thermal_bridges'] extra_loses_due_to_thermal_bridges = archetype['extra_loses_due_to_thermal_bridges']['#text']
indirect_heated_ratio = archetype['indirect_heated_ratio'] indirect_heated_ratio = archetype['indirect_heated_ratio']['#text']
infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off'] infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off']['#text']
infiltration_rate_for_ventilation_system_on = archetype['infiltration_rate_for_ventilation_system_on'] infiltration_rate_for_ventilation_system_on = archetype['infiltration_rate_for_ventilation_system_on']['#text']
archetype_constructions = [] archetype_constructions = []
for archetype_construction in archetype['constructions']['construction']: for archetype_construction in archetype['constructions']['construction']:
for construction in self._constructions: for construction in self._catalog_constructions:
if construction.id == archetype_construction['@id']: if construction.id == archetype_construction['@id']:
window_ratio = archetype_construction['window_ratio'] window_ratio = archetype_construction['window_ratio']['#text']
window = archetype_construction['window'] window = archetype_construction['window']
_construction = Construction(construction.id, _construction = Construction(construction.id,
construction.type, construction.type,
@ -111,7 +131,7 @@ class NrelCatalog(Catalog):
window_ratio, window_ratio,
window) window)
archetype_constructions.append(_construction) archetype_constructions.append(_construction)
self._catalog_archetypes.append(Archetype(archetype_id, _catalog_archetypes.append(Archetype(archetype_id,
function, function,
archetype_constructions, archetype_constructions,
construction_period, construction_period,
@ -122,14 +142,8 @@ class NrelCatalog(Catalog):
indirect_heated_ratio, indirect_heated_ratio,
infiltration_rate_for_ventilation_system_off, infiltration_rate_for_ventilation_system_off,
infiltration_rate_for_ventilation_system_on)) infiltration_rate_for_ventilation_system_on))
return _catalog_archetypes
# store the full catalog data model in self._content
self._content = Content(self._catalog_archetypes,
self._catalog_constructions,
self._catalog_materials,
self._catalog_windows)
@property
def names(self, category=None): def names(self, category=None):
""" """
Get the catalog elements names Get the catalog elements names
@ -200,4 +214,3 @@ class NrelCatalog(Catalog):
if entry.name.lower() == name.lower(): if entry.name.lower() == name.lower():
return entry return entry
raise IndexError(f"{name} doesn't exists in the catalog") raise IndexError(f"{name} doesn't exists in the catalog")
pass

View File

@ -8,7 +8,6 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
from pathlib import Path from pathlib import Path
from typing import TypeVar from typing import TypeVar
from catalog_factories.construction.nrel_catalog import NrelCatalog from catalog_factories.construction.nrel_catalog import NrelCatalog
from catalog_factories.construction.nrcan_catalog import NrcanCatalog
Catalog = TypeVar('Catalog') Catalog = TypeVar('Catalog')
class ConstructionCatalogFactory: class ConstructionCatalogFactory:
@ -18,18 +17,13 @@ class ConstructionCatalogFactory:
self._catalog_type = '_' + file_type.lower() self._catalog_type = '_' + file_type.lower()
self._path = base_path self._path = base_path
@property
def _nrel(self): def _nrel(self):
""" """
Retrieve NREL catalog Retrieve NREL catalog
""" """
return NrelCatalog(self._path) return NrelCatalog(self._path)
def _nrcan(self):
"""
Retrieve NRCAN catalog
"""
return NrcanCatalog(self._city, self._base_path)
@property @property
def catalog(self) -> Catalog: def catalog(self) -> Catalog:
""" """

View File

@ -46,18 +46,3 @@ class Construction:
""" """
return self._layers return self._layers
@property
def window_ratio(self):
"""
Get construction window ratio (only when used as archetype construction)
:return: (0..1) or None
"""
return self._window_ratio
@property
def window(self):
"""
Get construction window (only when used as archetype construction)
:return: window or None
"""
return self._window

View File

@ -6,11 +6,19 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
class Window: class Window:
def __init__(self, frame_ratio, g_value, overall_u_value, construction_name): def __init__(self, frame_ratio, g_value, overall_u_value, name):
self._frame_ratio = frame_ratio self._frame_ratio = frame_ratio
self._g_value = g_value self._g_value = g_value
self._overall_u_value = overall_u_value self._overall_u_value = overall_u_value
self._construction_name = construction_name self._name = name
@property
def name(self):
"""
Get window name
:return: str
"""
return self._name
@property @property
def frame_ratio(self): def frame_ratio(self):
@ -35,11 +43,3 @@ class Window:
:return: float :return: float
""" """
return self._overall_u_value return self._overall_u_value
@property
def construction_name(self):
"""
Get thermal opening construction name
:return: str
"""
return self._construction_name

View File

@ -33,6 +33,7 @@ class Building(CityObject):
self._roof_type = None self._roof_type = None
self._internal_zones = None self._internal_zones = None
self._shell = None self._shell = None
self._human_readable_name = None
self._type = 'building' self._type = 'building'
self._heating = dict() self._heating = dict()
self._cooling = dict() self._cooling = dict()
@ -322,3 +323,11 @@ class Building(CityObject):
if usage_zone.thermal_control is not None: if usage_zone.thermal_control is not None:
return True return True
return False return False
@property
def human_readable_name(self):
return self._human_readable_name
@human_readable_name.setter
def human_readable_name(self, value):
self._human_readable_name = value

View File

@ -45,14 +45,6 @@ class CityObject:
""" """
return self._name return self._name
@name.setter
def name(self, value):
"""
Set city object name
:return: str
"""
self._name = value
@property @property
def lod(self) -> int: def lod(self) -> int:
""" """

View File

@ -1,165 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<archetypes reference_library_building_type="us_library">
<archetype id="1" function="residential" periodOfConstruction="2011-2020">
<constructions>
<construction id="1" type="roof"/>
<construction id="9" type="wall">
<window_ratio units="-">0.2</window_ratio>
<window>33</window>
</construction>
<construction id="17" type="basement_wall"/>
<construction id="25" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.1</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="2" function="residential" periodOfConstruction="2001-2010">
<constructions>
<construction id="2" type="roof"/>
<construction id="10" type="wall">
<window_ratio units="-">0.2</window_ratio>
<window>34</window>
</construction>
<construction id="18" type="basement_wall"/>
<construction id="26" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.1</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="3" function="residential" periodOfConstruction="1996-2000">
<constructions>
<construction id="3" type="roof"/>
<construction id="11" type="wall">
<window_ratio units="-">0.2</window_ratio>
<window>34</window>
</construction>
<construction id="19" type="basement_wall"/>
<construction id="27" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.1</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="4" function="residential" periodOfConstruction="1984-1995">
<constructions>
<construction id="4" type="roof"/>
<construction id="12" type="wall">
<window_ratio units="-">0.2</window_ratio>
<window>34</window>
</construction>
<construction id="20" type="basement_wall"/>
<construction id="28" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.1</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.5</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="5" function="residential" periodOfConstruction="1978-1983">
<constructions>
<construction id="5" type="roof"/>
<construction id="13" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="21" type="basement_wall"/>
<construction id="29" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.1</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="6" function="residential" periodOfConstruction="1961-1977">
<constructions>
<construction id="6" type="roof"/>
<construction id="14" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="22" type="basement_wall"/>
<construction id="30" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.05</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="7" function="residential" periodOfConstruction="1946-1960">
<constructions>
<construction id="7" type="roof"/>
<construction id="15" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="23" type="basement_wall"/>
<construction id="31" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.05</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="8" function="residential" periodOfConstruction="1900-1945">
<constructions>
<construction id="8" type="roof"/>
<construction id="16" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="24" type="basement_wall"/>
<construction id="32" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.05</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
<archetype id="9" building_type="office/workshop" periodOfConstruction="2011-2021">
<constructions>
<construction id="8" type="roof"/>
<construction id="16" type="wall">
<window_ratio units="-">0.13</window_ratio>
<window>34</window>
</construction>
<construction id="24" type="basement_wall"/>
<construction id="32" type="floor"/>
</constructions>
<average_storey_height units="m">3</average_storey_height>
<number_of_storeys units="-">1</number_of_storeys>
<thermal_capacity units="kJ/K m2">90</thermal_capacity>
<extra_loses_due_to_thermal_bridges units="W/K m2">0.05</extra_loses_due_to_thermal_bridges>
<indirect_heated_ratio units="-">0.15</indirect_heated_ratio>
<infiltration_rate_for_ventilation_system_off units="ACH">0.3</infiltration_rate_for_ventilation_system_off>
<infiltration_rate_for_ventilation_system_on units="ACH">0</infiltration_rate_for_ventilation_system_on>
</archetype>
</archetypes>

View File

@ -1,156 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<library name="us_library">
<windows>
<window type="window" id="33" name="global">
<shgc>0.46</shgc>
<g_value>0.46</g_value>
<frame_ratio units="-">0.3</frame_ratio>
<overall_u_value units="W/m2 K">1.8</overall_u_value>
</window>
<window type="window" id="34" name="global">
<shgc>0.52</shgc>
<g_value>0.52</g_value>
<frame_ratio units="-">0.3</frame_ratio>
<overall_u_value units="W/m2 K">2.7</overall_u_value>
</window>
<window type="window" id="35" name="global">
<shgc>0.52</shgc>
<g_value>0.52</g_value>
<frame_ratio units="-">0.3</frame_ratio>
<overall_u_value units="W/m2 K">0.8</overall_u_value>
</window>
</windows>
<constructions>
<construction type="roof" id="1" name="ceiling under attic_post 2010">
<overall_u_value units="W/m2 K">0.18</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="2" name="ceiling under attic_2001-2010">
<overall_u_value units="W/m2 K">0.17</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="3" name="ceiling under attic_1996-2000">
<overall_u_value units="W/m2 K">0.17</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="4" name="ceiling under attic_1984-1995">
<overall_u_value units="W/m2 K">0.253</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="5" name="ceiling under attic_1978-1983">
<overall_u_value units="W/m2 K">0.253</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="6" name="ceiling under attic_1961-1977">
<overall_u_value units="W/m2 K">0.253</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="7" name="ceiling under attic_1946-1960">
<overall_u_value units="W/m2 K">0.253</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="roof" id="8" name="ceiling under attic_before 1946">
<overall_u_value units="W/m2 K">0.26</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#wall above grade
<construction type="wall" id="9" name="wall above grade_post 2010">
<overall_u_value units="W/m2 K">0.3</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="10" name="wall above grade_2001-2010">
<overall_u_value units="W/m2 K">0.30</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="11" name="wall above grade_1996-2000">
<overall_u_value units="W/m2 K">0.32</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="12" name="wall above grade_1984-1995">
<overall_u_value units="W/m2 K">0.327</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="13" name="wall above grade_1978-1983">
<overall_u_value units="W/m2 K">0.327</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="14" name="wall above grade_1961-1977">
<overall_u_value units="W/m2 K">0.364</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="15" name="wall above grade_1946-1960">
<overall_u_value units="W/m2 K">0.411</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
<construction type="wall" id="16" name="wall above grade_before 1946">
<overall_u_value units="W/m2 K">0.411</overall_u_value>
<outside_solar_absorptance units="-">0.7</outside_solar_absorptance>
<shortwave_reflectance units="-">0.3</shortwave_reflectance>
</construction>
#wall below grade
<construction type="basement_wall" id="17" name="wall below grade_post 2010">
<overall_u_value units="W/m2 K">0.512</overall_u_value>
</construction>
<construction type="basement_wall" id="18" name="wall below grade_2001-2010">
<overall_u_value units="W/m2 K">0.512</overall_u_value>
</construction>
<construction type="basement_wall" id="19" name="wall below grade_1996-2000">
<overall_u_value units="W/m2 K">0.67</overall_u_value>
</construction>
<construction type="basement_wall" id="20" name="wall below grade_1984-1995">
<overall_u_value units="W/m2 K">0.848</overall_u_value>
</construction>
<construction type="basement_wall" id="21" name="wall below grade_1978-1983">
<overall_u_value units="W/m2 K">1.048</overall_u_value>
</construction>
<construction type="basement_wall" id="22" name="wall below grade_1961-1977">
<overall_u_value units="W/m2 K">1.154</overall_u_value>
</construction>
<construction type="basement_wall" id="23" name="wall below grade_1946-1960">
<overall_u_value units="W/m2 K">1.243</overall_u_value>
</construction>
<construction type="basement_wall" id="24" name="wall below grade_before 1946">
<overall_u_value units="W/m2 K">1.425</overall_u_value>
</construction>
#slab on grade
<construction type="floor" id="25" name="slab on grade_post 2010">
<overall_u_value units="W/m2 K">0.512</overall_u_value>
</construction>
<construction type="floor" id="26" name="slab on grade_2001-2010">
<overall_u_value units="W/m2 K">0.67</overall_u_value>
</construction>
<construction type="floor" id="27" name="slab on grade_1996-2000">
<overall_u_value units="W/m2 K">0.67</overall_u_value>
</construction>
<construction type="floor" id="28" name="slab on grade_1984-1995">
<overall_u_value units="W/m2 K">0.848</overall_u_value>
</construction>
<construction type="floor" id="29" name="slab on grade_1978-1983">
<overall_u_value units="W/m2 K">0.848</overall_u_value>
</construction>
<construction type="floor" id="30" name="slab on grade_1961-1977">
<overall_u_value units="W/m2 K">1.05</overall_u_value>
</construction>
<construction type="floor" id="31" name="slab on grade_1946-1960">
<overall_u_value units="W/m2 K">1.154</overall_u_value>
</construction>
<construction type="floor" id="32" name="slab on grade_before 1946">
<overall_u_value units="W/m2 K">1.154</overall_u_value>
</construction>
</constructions>
</library>

View File

@ -27,7 +27,7 @@ class AirSourceHPExport(HeatPumpExport):
template_path = (base_path / tmp_file) template_path = (base_path / tmp_file)
super().__init__(base_path, city, output_path, template_path) super().__init__(base_path, city, output_path, template_path)
def _extract_model_coff(self, hp_model: str, data_type='heat') -> Union[Tuple[List, List], None]: def _extract_model_coff(self, hp_model: str, data_type='heat') -> Union[List, None]:
""" """
Extracts heat pump coefficient data for a specific Extracts heat pump coefficient data for a specific
model. e.g 012, 140 model. e.g 012, 140

View File

@ -1,83 +0,0 @@
"""
CaPhysicsParameters import the construction and material information for Canada
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import sys
from imports.construction.helpers.construction_helper import ConstructionHelper
from imports.construction.nrel_physics_interface import NrelPhysicsInterface
class CaPhysicsParameters(NrelPhysicsInterface):
"""
CaPhysicsParameters class
"""
def __init__(self, city, base_path):
super().__init__(base_path, 'ca_constructions_reduced.xml', 'ca_archetypes_reduced.xml')
self._city = city
def enrich_buildings(self):
"""
Returns the city with the construction parameters assigned to the buildings
:return: None
"""
city = self._city
# it is assumed that all buildings have the same archetypes' keys
for building in city.buildings:
try:
archetype = self._search_archetype(ConstructionHelper.nrcan_from_libs_function(building.function),
building.year_of_construction)
except KeyError:
sys.stderr.write(f'Building {building.name} has unknown archetype for building function: '
f'{ConstructionHelper.nrcan_from_libs_function(building.function)} '
f'and building year of construction: {building.year_of_construction}\n')
return
# if building has no thermal zones defined from geometry, 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._assign_values(building.internal_zones, archetype)
for internal_zone in building.internal_zones:
for thermal_zone in internal_zone.thermal_zones:
self._calculate_view_factors(thermal_zone)
def _search_archetype(self, function, year_of_construction):
for building_archetype in self._building_archetypes:
a_ft = str(building_archetype.archetype_keys['@function'])
a_pc = str(building_archetype.archetype_keys['@periodOfConstruction'])
a_yc1 = int(a_pc.split(sep='-')[0])
a_yc2 = int(a_pc.split(sep='-')[1])
if a_ft == str(function):
if a_yc1 <= int(year_of_construction) <= a_yc2:
return building_archetype
return None
def _assign_values(self, internal_zones, archetype):
for internal_zone in internal_zones:
for thermal_zone in internal_zone.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.thermal_boundaries:
construction_type = ConstructionHelper.nrcan_construction_types[thermal_boundary.type]
thermal_boundary_archetype = self._search_construction_in_archetype(archetype, construction_type)
thermal_boundary.u_value = thermal_boundary_archetype.overall_u_value
thermal_boundary.outside_solar_absorptance = thermal_boundary_archetype.outside_solar_absorptance
thermal_boundary.construction_name = thermal_boundary_archetype.construction_name
try:
thermal_boundary.window_ratio = thermal_boundary_archetype.window_ratio
except ValueError:
# This is the normal operation way when the windows are defined in the geometry
continue
if thermal_boundary.thermal_openings is not None:
for thermal_opening in thermal_boundary.thermal_openings:
if thermal_boundary_archetype.thermal_opening_archetype is not None:
thermal_opening_archetype = thermal_boundary_archetype.thermal_opening_archetype
thermal_opening.frame_ratio = thermal_opening_archetype.frame_ratio
thermal_opening.g_value = thermal_opening_archetype.g_value
thermal_opening.overall_u_value = thermal_opening_archetype.overall_u_value

View File

@ -71,42 +71,6 @@ class ConstructionHelper:
cte.ROOF: 'roof' cte.ROOF: 'roof'
} }
# NRCAN
_function_to_nrcan = {
cte.RESIDENTIAL: 'residential',
cte.SINGLE_FAMILY_HOUSE: 'residential',
cte.MULTI_FAMILY_HOUSE: 'residential',
cte.ROW_HOSE: 'residential',
cte.MID_RISE_APARTMENT: 'residential',
cte.HIGH_RISE_APARTMENT: 'residential',
cte.SMALL_OFFICE: cte.SMALL_OFFICE,
cte.MEDIUM_OFFICE: cte.MEDIUM_OFFICE,
cte.LARGE_OFFICE: cte.LARGE_OFFICE,
cte.PRIMARY_SCHOOL: cte.PRIMARY_SCHOOL,
cte.SECONDARY_SCHOOL: cte.SECONDARY_SCHOOL,
cte.STAND_ALONE_RETAIL: cte.STAND_ALONE_RETAIL,
cte.HOSPITAL: cte.HOSPITAL,
cte.OUT_PATIENT_HEALTH_CARE: cte.OUT_PATIENT_HEALTH_CARE,
cte.STRIP_MALL: cte.STRIP_MALL,
cte.SUPERMARKET: cte.SUPERMARKET,
cte.WAREHOUSE: cte.WAREHOUSE,
cte.QUICK_SERVICE_RESTAURANT: cte.QUICK_SERVICE_RESTAURANT,
cte.FULL_SERVICE_RESTAURANT: cte.FULL_SERVICE_RESTAURANT,
cte.SMALL_HOTEL: cte.SMALL_HOTEL,
cte.LARGE_HOTEL: cte.LARGE_HOTEL
}
nrcan_window_types = [cte.WINDOW]
nrcan_construction_types = {
cte.WALL: 'wall',
cte.GROUND_WALL: 'basement_wall',
cte.GROUND: 'floor',
cte.ATTIC_FLOOR: 'attic floor',
cte.INTERIOR_SLAB: 'floor',
cte.ROOF: 'roof'
}
@staticmethod @staticmethod
def nrel_from_libs_function(function): def nrel_from_libs_function(function):
""" """
@ -154,15 +118,3 @@ class ConstructionHelper:
""" """
reference_city = ConstructionHelper.city_to_reference_city(city) reference_city = ConstructionHelper.city_to_reference_city(city)
return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city] return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city]
@staticmethod
def nrcan_from_libs_function(function):
"""
Get NREL function from the given internal function key
:param function: str
:return: str
"""
try:
return ConstructionHelper._function_to_nrcan[function]
except KeyError:
sys.stderr.write('Error: keyword not found.\n')

View File

@ -6,7 +6,6 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
""" """
from pathlib import Path from pathlib import Path
from imports.construction.us_physics_parameters import UsPhysicsParameters from imports.construction.us_physics_parameters import UsPhysicsParameters
from imports.construction.ca_physics_parameters import CaPhysicsParameters
class ConstructionFactory: class ConstructionFactory:
@ -26,19 +25,9 @@ class ConstructionFactory:
""" """
UsPhysicsParameters(self._city, self._base_path).enrich_buildings() UsPhysicsParameters(self._city, self._base_path).enrich_buildings()
def _nrcan(self):
"""
Enrich the city by using NRCAN information
:alert: NRCAN handler only contains simplified construction information (residential)
"""
CaPhysicsParameters(self._city, self._base_path).enrich_buildings()
def enrich(self): def enrich(self):
""" """
Enrich the city given to the class using the class given handler Enrich the city given to the class using the class given handler
:return: None :return: None
""" """
getattr(self, self._handler, lambda: None)() getattr(self, self._handler, lambda: None)()
def _enrich_debug(self):
self._nrel()

View File

@ -22,7 +22,7 @@ class AirSourceHeatPumpParameters:
def __init__(self, city, base_path): def __init__(self, city, base_path):
self._city = city self._city = city
self._base_path = (base_path / 'heat_pumps/Air source.xlsx') self._base_path = (base_path / 'heat_pumps/air_source.xlsx')
def _read_file(self) -> Dict: def _read_file(self) -> Dict:
""" """

View File

@ -0,0 +1,33 @@
"""
TestConstructionCatalog
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from unittest import TestCase
from catalog_factories.construction_catalog_factory import ConstructionCatalogFactory
class TestConstructionCatalog(TestCase):
def test_nrel_catalog(self):
catalog = ConstructionCatalogFactory('nrel').catalog
catalog_categories = catalog.names()
constructions = catalog.names('constructions')
windows = catalog.names('windows')
materials = catalog.names('materials')
self.assertTrue(len(constructions['constructions']), 24)
self.assertTrue(len(windows['windows']), 4)
self.assertTrue(len(materials['materials']), 19)
with self.assertRaises(ValueError):
catalog.names('unknown')
# retrieving all the entries should not raise any exceptions
for category in catalog_categories:
for value in catalog_categories[category]:
catalog.get_entry(value)
with self.assertRaises(IndexError):
catalog.get_entry('unknown')

View File

@ -168,36 +168,6 @@ class TestConstructionFactory(TestCase):
for building in city.buildings: for building in city.buildings:
self.assertRaises(Exception, lambda: self._internal_function(function_format, building.function)) self.assertRaises(Exception, lambda: self._internal_function(function_format, building.function))
def test_city_with_construction_reduced_library(self):
"""
Enrich the city with the construction reduced library and verify it
"""
file = 'one_building_in_kelowna.gml'
city = self._get_citygml(file)
for building in city.buildings:
building.function = GeometryHelper.libs_function_from_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.assertIsNone(thermal_boundary.outside_thermal_absorptance, 'outside_thermal_absorptance is not none')
self.assertIsNone(thermal_boundary.outside_visible_absorptance, 'outside_visible_absorptance is not none')
self.assertIsNone(thermal_boundary.layers, 'layers is not none')
self._check_thermal_openings(thermal_boundary)
for thermal_opening in thermal_boundary.thermal_openings:
self.assertIsNone(thermal_opening.conductivity, 'thermal_opening conductivity is not none')
self.assertIsNone(thermal_opening.thickness, 'thermal opening thickness is not none')
self.assertIsNone(thermal_opening.front_side_solar_transmittance_at_normal_incidence,
'thermal opening front_side_solar_transmittance_at_normal_incidence is not none')
self.assertIsNone(thermal_opening.back_side_solar_transmittance_at_normal_incidence,
'thermal opening back_side_solar_transmittance_at_normal_incidence is not none')
def test_city_with_construction_extended_library(self): def test_city_with_construction_extended_library(self):
""" """
Enrich the city with the construction information and verify it Enrich the city with the construction information and verify it

View File

@ -90,7 +90,7 @@ class TestGeometryFactory(TestCase):
UsageFactory(usage_key, city).enrich() UsageFactory(usage_key, city).enrich()
def _test_hft(self, file): def _test_hft(self, file):
_construction_keys = ['nrel', 'nrcan'] _construction_keys = ['nrel']
_usage_keys = ['ca', 'comnet', 'hft'] _usage_keys = ['ca', 'comnet', 'hft']
for construction_key in _construction_keys: for construction_key in _construction_keys:
for usage_key in _usage_keys: for usage_key in _usage_keys:

View File

@ -12,7 +12,7 @@ from catalog_factories.greenery_catalog_factory import GreeneryCatalogFactory
class TestGreeneryCatalog(TestCase): class TestGreeneryCatalog(TestCase):
def test_catalog(self): def test_catalog(self):
catalog = GreeneryCatalogFactory('nrel').catalog_debug catalog = GreeneryCatalogFactory('nrel').catalog
catalog_categories = catalog.names() catalog_categories = catalog.names()
vegetations = catalog.names('vegetations') vegetations = catalog.names('vegetations')
plants = catalog.names('plants') plants = catalog.names('plants')

View File

@ -47,8 +47,8 @@ class TestLifeCycleAssessment(TestCase):
city_file = "../unittests/tests_data/C40_Final.gml" city_file = "../unittests/tests_data/C40_Final.gml"
city = GeometryFactory('citygml', city_file).city city = GeometryFactory('citygml', city_file).city
LifeCycleAssessment('material', city).enrich() LifeCycleAssessment('material', city).enrich()
for material in city.materials: for material in city.lca_materials:
self.assertTrue(len(city.materials) > 0) self.assertTrue(len(city.lca_materials) > 0)