forked from s_ranjbar/city_retrofit
remove nrcan construction library and fix some unit tests
This commit is contained in:
parent
3e03ca6f08
commit
a273c38a45
|
@ -21,6 +21,10 @@ nrel_to_function = {
|
|||
'large hotel': cte.LARGE_HOTEL
|
||||
}
|
||||
|
||||
nrcan_to_function = {
|
||||
'residential': cte.RESIDENTIAL,
|
||||
}
|
||||
|
||||
reference_standard_to_construction_period = {
|
||||
'ASHRAE 90.1_2004': '2004 - 2009',
|
||||
'ASHRAE 189.1_2009': '2009 - PRESENT'
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Greenery catalog
|
||||
Nrel construction catalog
|
||||
SPDX - License - Identifier: LGPL - 3.0 - or -later
|
||||
Copyright © 2022 Concordia CERC group
|
||||
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.content import Content
|
||||
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):
|
||||
|
@ -213,4 +214,3 @@ class NrelCatalog(Catalog):
|
|||
if entry.name.lower() == name.lower():
|
||||
return entry
|
||||
raise IndexError(f"{name} doesn't exists in the catalog")
|
||||
pass
|
||||
|
|
|
@ -8,7 +8,6 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|||
from pathlib import Path
|
||||
from typing import TypeVar
|
||||
from catalog_factories.construction.nrel_catalog import NrelCatalog
|
||||
# from catalog_factories.construction.nrcan_catalog import NrcanCatalog
|
||||
Catalog = TypeVar('Catalog')
|
||||
|
||||
class ConstructionCatalogFactory:
|
||||
|
@ -25,13 +24,6 @@ class ConstructionCatalogFactory:
|
|||
"""
|
||||
return NrelCatalog(self._path)
|
||||
|
||||
@property
|
||||
def _nrcan(self):
|
||||
"""
|
||||
Retrieve NRCAN catalog
|
||||
"""
|
||||
# return NrcanCatalog(self._city, self._base_path)
|
||||
|
||||
@property
|
||||
def catalog(self) -> Catalog:
|
||||
"""
|
||||
|
|
|
@ -46,18 +46,3 @@ class Construction:
|
|||
"""
|
||||
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
|
||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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
|
|
@ -71,42 +71,6 @@ class ConstructionHelper:
|
|||
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
|
||||
def nrel_from_libs_function(function):
|
||||
"""
|
||||
|
@ -153,16 +117,4 @@ class ConstructionHelper:
|
|||
:return: str
|
||||
"""
|
||||
reference_city = ConstructionHelper.city_to_reference_city(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')
|
||||
return ConstructionHelper._reference_city_to_nrel_climate_zone[reference_city]
|
|
@ -6,7 +6,6 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
|||
"""
|
||||
from pathlib import Path
|
||||
from imports.construction.us_physics_parameters import UsPhysicsParameters
|
||||
from imports.construction.ca_physics_parameters import CaPhysicsParameters
|
||||
|
||||
|
||||
class ConstructionFactory:
|
||||
|
@ -26,19 +25,9 @@ class ConstructionFactory:
|
|||
"""
|
||||
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):
|
||||
"""
|
||||
Enrich the city given to the class using the class given handler
|
||||
:return: None
|
||||
"""
|
||||
getattr(self, self._handler, lambda: None)()
|
||||
|
||||
def _enrich_debug(self):
|
||||
self._nrel()
|
||||
getattr(self, self._handler, lambda: None)()
|
|
@ -22,7 +22,7 @@ class AirSourceHeatPumpParameters:
|
|||
|
||||
def __init__(self, city, base_path):
|
||||
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:
|
||||
"""
|
||||
|
|
|
@ -168,36 +168,6 @@ class TestConstructionFactory(TestCase):
|
|||
for building in city.buildings:
|
||||
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):
|
||||
"""
|
||||
Enrich the city with the construction information and verify it
|
||||
|
|
|
@ -90,7 +90,7 @@ class TestGeometryFactory(TestCase):
|
|||
UsageFactory(usage_key, city).enrich()
|
||||
|
||||
def _test_hft(self, file):
|
||||
_construction_keys = ['nrel', 'nrcan']
|
||||
_construction_keys = ['nrel']
|
||||
_usage_keys = ['ca', 'comnet', 'hft']
|
||||
for construction_key in _construction_keys:
|
||||
for usage_key in _usage_keys:
|
||||
|
|
|
@ -47,8 +47,8 @@ class TestLifeCycleAssessment(TestCase):
|
|||
city_file = "../unittests/tests_data/C40_Final.gml"
|
||||
city = GeometryFactory('citygml', city_file).city
|
||||
LifeCycleAssessment('material', city).enrich()
|
||||
for material in city.materials:
|
||||
self.assertTrue(len(city.materials) > 0)
|
||||
for material in city.lca_materials:
|
||||
self.assertTrue(len(city.lca_materials) > 0)
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user