nrel interface

This commit is contained in:
pilar 2021-01-05 15:01:36 -05:00
parent 96fa465d42
commit cb2be1382c
15 changed files with 586 additions and 115 deletions

View File

@ -2,153 +2,178 @@
<library name="us_library">
<windows>
<window type="window" id="1" name="global">
<shgc>0.46</shgc> OR <g_value>0.5</g_value>
<shgc>0.46</shgc>
<g_value>0.5</g_value>
<frame_ratio units="-">0</frame_ratio>
<overall_uvalue units="W/m2 K">0.555</overall_uvalue>
<overall_u_value units="W/m2 K">0.555</overall_u_value>
</window>
<window type="window" id="2" name="global">
<shgc>0.52</shgc> OR <g_value>0.5</g_value>
<shgc>0.52</shgc>
<g_value>0.5</g_value>
<frame_ratio units="-">0</frame_ratio>
<overall_uvalue units="W/m2 K">2.702</overall_uvalue>
<overall_u_value units="W/m2 K">2.702</overall_u_value>
</window>
</windows>
<constructions>
#ceiling under attic
<construction type="roof" id="1" name="ceiling under attic_post 2010">
<overall_uvalue units="W/m2 K">0.115</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.115</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_uvalue units="W/m2 K">0.157</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.157</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_uvalue units="W/m2 K">0.185</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.185</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_uvalue units="W/m2 K">0.199</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.199</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_uvalue units="W/m2 K">0.245</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.245</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_uvalue units="W/m2 K">0.225</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.225</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_uvalue units="W/m2 K">0.259</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.259</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_uvalue units="W/m2 K">0.301</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.301</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="1" name="wall above grade_post 2010">
<overall_uvalue units="W/m2 K">0.324</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.324</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="2" name="wall above grade_2001-2010">
<overall_uvalue units="W/m2 K">0.285</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.285</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="3" name="wall above grade_1996-2000">
<overall_uvalue units="W/m2 K">0.355</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.355</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="4" name="wall above grade_1984-1995">
<overall_uvalue units="W/m2 K">0.411</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.411</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="5" name="wall above grade_1978-1983">
<overall_uvalue units="W/m2 K">0.546</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.546</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="6" name="wall above grade_1961-1977">
<overall_uvalue units="W/m2 K">0.432</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.432</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="7" name="wall above grade_1946-1960">
<overall_uvalue units="W/m2 K">0.579</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.579</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="wall" id="8" name="wall above grade_before 1946">
<overall_uvalue units="W/m2 K">0.664</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.664</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#wall below grade
<construction type="basement_wall" id="1" name="wall below grade_post 2010">
<overall_uvalue units="W/m2 K">0.335</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.335</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="2" name="wall below grade_2001-2010">
<overall_uvalue units="W/m2 K">0.312</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.312</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="3" name="wall below grade_1996-2000">
<overall_uvalue units="W/m2 K">0.408</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.408</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="4" name="wall below grade_1984-1995">
<overall_uvalue units="W/m2 K">0.510</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.510</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="5" name="wall below grade_1978-1983">
<overall_uvalue units="W/m2 K">0.645</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.645</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="6" name="wall below grade_1961-1977">
<overall_uvalue units="W/m2 K">1.204</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.204</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="7" name="wall below grade_1946-1960">
<overall_uvalue units="W/m2 K">1.449</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.449</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="basement_wall" id="8" name="wall below grade_before 1946">
<overall_uvalue units="W/m2 K">2.083</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">2.083</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
#slab on grade
<construction type="floor" id="1" name="slab on grade_post 2010">
<overall_uvalue units="W/m2 K">0.510</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">0.510</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="2" name="slab on grade_2001-2010">
<overall_uvalue units="W/m2 K">1.428</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="3" name="slab on grade_1996-2000">
<overall_uvalue units="W/m2 K">1.428</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="4" name="slab on grade_1984-1995">
<overall_uvalue units="W/m2 K">1.428</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="5" name="slab on grade_1978-1983">
<overall_uvalue units="W/m2 K">1.428</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">1.428</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="6" name="slab on grade_1961-1977">
<overall_uvalue units="W/m2 K">3.333</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">3.333</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="7" name="slab on grade_1946-1960">
<overall_uvalue units="W/m2 K">5</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">5</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
<construction type="floor" id="8" name="slab on grade_before 1946">
<overall_uvalue units="W/m2 K">5</overall_uvalue>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance> OR <shortwave_reflectance units="-">0.2</shortwave_reflectance>
<overall_u_value units="W/m2 K">5</overall_u_value>
<outside_solar_absorptance units="-">0.8</outside_solar_absorptance>
<shortwave_reflectance units="-">0.2</shortwave_reflectance>
</construction>
</constructions>
</library>

View File

@ -5,6 +5,7 @@ Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@conc
"""
from factories.physics_feeders.us_new_york_city_physics_parameters import UsNewYorkCityPhysicsParameters
from factories.physics_feeders.us_physics_parameters import UsPhysicsParameters
from factories.physics_feeders.ca_physics_parameters import CaPhysicsParameters
from pathlib import Path
@ -25,7 +26,7 @@ class PhysicsFactory:
UsPhysicsParameters(self._city, self._base_path)
def _ca(self):
raise NotImplementedError
CaPhysicsParameters(self._city, self._base_path)
def _de(self):
raise NotImplementedError

View File

@ -0,0 +1,18 @@
"""
CaPhysicsParameters import the construction and material information for Canada
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
from factories.physics_feeders.nrel_interface import NrelInterface
class CaPhysicsParameters(NrelInterface):
"""
CaPhysicsParameters class
"""
def __init__(self, city, base_path):
self._city = city
# todo: define climate zones for Canada and substitute this default value by a function that selects the correct one
self._climate_zone = 'Summerland'
# super().__init__(base_path, 'us_constructions.xml', 'us_archetypes.xml')
super().__init__(base_path, 'ca_constructions_reduced.xml', 'ca_archetypes_reduced.xml')

View File

@ -1,8 +1,10 @@
"""
UsBasePhysicParameters, model the us archetypes and material, used by UsNewYorkCityPhysicsParameters and
UsPhysicsParameters as base class
CercBasePhysicParameters, reads the archetypes and materials following the format defined within the CERC team
and models them
It is used by many specific-region classes as base class
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import xmltodict
@ -11,20 +13,21 @@ from city_model_structure.attributes.material import Material
from factories.physics_feeders.helpers.us_to_library_types import UsToLibraryTypes
class UsBasePhysicsParameters:
class CercBasePhysicsParameters:
"""
UsBasePhysicsParameters class
CercBasePhysicsParameters class
"""
def __init__(self, climate_zone, buildings, function_to_type, base_path):
def __init__(self, climate_zone, buildings, function_to_type, base_path, constructions_file='us_constructions.xml',
archetypes_file='us_archetypes.xml'):
self._climate_zone = climate_zone
self._buildings = buildings
# load US Library
path = str(base_path / 'us_constructions.xml')
# load construction Library, CERC format
path = str(base_path / constructions_file)
with open(path) as xml:
self._library = xmltodict.parse(xml.read(), force_list='layer')
# load US Archetypes
path = str(base_path / 'us_archetypes.xml')
# load archetypes Library, CERC format
path = str(base_path / archetypes_file)
with open(path) as xml:
self._archetypes = xmltodict.parse(xml.read(), force_list='layer')
for building in self._buildings:
@ -54,7 +57,7 @@ class UsBasePhysicsParameters:
thermal_zone.infiltration_rate_system_on = archetype['infiltration_rate_for_ventilation_system_on']['#text']
for thermal_boundary in thermal_zone.bounded:
construction_type = UsToLibraryTypes.construction_types[thermal_boundary.type]
construction = UsBasePhysicsParameters._search_construction_in_archetype(archetype, construction_type)
construction = self._search_construction_in_archetype(archetype, construction_type)
construction_id = construction['@id']
c_lib = self._search_construction_type('construction', construction_id)

View File

@ -0,0 +1,81 @@
from typing import List
from factories.physics_feeders.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype
class NrelBuildingArchetype:
"""
NrelBuildingArchetype class
"""
def __init__(self, archetype_keys, average_storey_height, storeys_above_ground, effective_thermal_capacity,
additional_thermal_bridge_u_value, indirectly_heated_area_ratio, infiltration_rate_system_off,
infiltration_rate_system_on, thermal_boundary_archetypes):
self._archetype_keys = archetype_keys
self._average_storey_height = average_storey_height
self._storeys_above_ground = storeys_above_ground
self._effective_thermal_capacity = effective_thermal_capacity
self._additional_thermal_bridge_u_value = additional_thermal_bridge_u_value
self._indirectly_heated_area_ratio = indirectly_heated_area_ratio
self._infiltration_rate_system_off = infiltration_rate_system_off
self._infiltration_rate_system_on = infiltration_rate_system_on
self._thermal_boundary_archetypes = thermal_boundary_archetypes
@property
def archetype_keys(self) -> List[str]:
"""
:return:
"""
return self._archetype_keys
@property
def average_storey_height(self):
return self._average_storey_height
@property
def storeys_above_ground(self):
return self._storeys_above_ground
@property
def effective_thermal_capacity(self):
"""
:return:
"""
return self._effective_thermal_capacity
@property
def additional_thermal_bridge_u_value(self):
"""
:return:
"""
return self._additional_thermal_bridge_u_value
@property
def indirectly_heated_area_ratio(self):
"""
:return:
"""
return self._indirectly_heated_area_ratio
@property
def infiltration_rate_system_off(self):
"""
:return:
"""
return self._infiltration_rate_system_off
@property
def infiltration_rate_system_on(self):
"""
:return:
"""
return self._infiltration_rate_system_on
@property
def thermal_boundary_archetypes(self) -> List[NrelThermalBoundaryArchetype]:
return self._thermal_boundary_archetypes

View File

@ -0,0 +1,56 @@
class NrelLayerArchetype:
"""
NrelLayerArchetype class
"""
def __init__(self, name, solar_absorptance, thermal_absorptance, visible_absorptance, thickness=None,
conductivity=None, specific_heat=None, density=None, no_mass=False, thermal_resistance=None):
self._thickness = thickness
self._conductivity = conductivity
self._specific_heat = specific_heat
self._density = density
self._solar_absorptance = solar_absorptance
self._thermal_absorptance = thermal_absorptance
self._visible_absorptance = visible_absorptance
self._no_mass = no_mass
self._name = name
self._thermal_resistance = thermal_resistance
@property
def thickness(self):
return self._thickness
@property
def conductivity(self):
return self._conductivity
@property
def specific_heat(self):
return self._specific_heat
@property
def density(self):
return self._density
@property
def solar_absorptance(self):
return self._solar_absorptance
@property
def thermal_absorptance(self):
return self._thermal_absorptance
@property
def visible_absorptance(self):
return self._visible_absorptance
@property
def no_mass(self) -> bool:
return self._no_mass
@property
def name(self):
return self._name
@property
def thermal_resistance(self):
return self._thermal_resistance

View File

@ -0,0 +1,90 @@
from typing import List
from factories.physics_feeders.data_classes.nrel_layer_archetype import NrelLayerArchetype
from factories.physics_feeders.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype
class NrelThermalBoundaryArchetype:
"""
NrelThermalBoundaryArchetype class
"""
def __init__(self, boundary_type, window_ratio, construction_name, layers, thermal_openings,
outside_solar_absorptance=None, outside_thermal_absorptance=None, outside_visible_absorptance=None,
overall_u_value=None):
self._boundary_type = boundary_type
self._outside_solar_absorptance = outside_solar_absorptance
self._outside_thermal_absorptance = outside_thermal_absorptance
self._outside_visible_absorptance = outside_visible_absorptance
self._window_ratio = window_ratio
self._construction_name = construction_name
self._overall_u_value = overall_u_value
self._layers = layers
self._thermal_openings = thermal_openings
@property
def boundary_type(self):
"""
:return:
"""
return self._boundary_type
@property
def outside_solar_absorptance(self):
"""
:return:
"""
return self._outside_solar_absorptance
@property
def outside_thermal_absorptance(self):
"""
:return:
"""
return self._outside_thermal_absorptance
@property
def outside_visible_absorptance(self):
"""
:return:
"""
return self._outside_visible_absorptance
@property
def window_ratio(self):
"""
:return:
"""
return self._window_ratio
@property
def construction_name(self):
"""
:return:
"""
return self._construction_name
@property
def layers(self) -> List[NrelLayerArchetype]:
"""
:return:
"""
return self._layers
@property
def thermal_openings(self) -> List[NrelThermalOpeningArchetype]:
"""
:return:
"""
return self._thermal_openings
@property
def overall_u_value(self):
return self._overall_u_value

View File

@ -0,0 +1,47 @@
class NrelThermalOpeningArchetype:
"""
NrelThermalOpeningArchetype class
"""
def __init__(self, conductivity=None, frame_ratio=None, g_value=None, thickness=None,
back_side_solar_transmittance_at_normal_incidence=None,
front_side_solar_transmittance_at_normal_incidence=None, shgc=None, overall_u_value=None):
self._conductivity = conductivity
self._frame_ratio = frame_ratio
self._g_value = g_value
self._thickness = thickness
self._back_side_solar_transmittance_at_normal_incidence = back_side_solar_transmittance_at_normal_incidence
self._front_side_solar_transmittance_at_normal_incidence = front_side_solar_transmittance_at_normal_incidence
self._shgc = shgc
self._overall_u_value = overall_u_value
@property
def conductivity(self):
return self._conductivity
@property
def frame_ratio(self):
return self._frame_ratio
@property
def g_value(self):
return self._g_value
@property
def thickness(self):
return self._thickness
@property
def back_side_solar_transmittance_at_normal_incidence(self):
return self._back_side_solar_transmittance_at_normal_incidence
@property
def front_side_solar_transmittance_at_normal_incidence(self):
return self._front_side_solar_transmittance_at_normal_incidence
@property
def shgc(self):
return self._shgc
@property
def overall_u_value(self):
return self._overall_u_value

View File

@ -65,7 +65,7 @@ class UsToLibraryTypes:
:param city: str
:return: str
"""
# ToDo: Dummy function that need to be implemented
# ToDo: Dummy function that needs to be implemented
reference_city = 'Baltimore'
if city is not None:
reference_city = 'Baltimore'

View File

@ -0,0 +1,143 @@
"""
Nrel-based interface, it reads format defined within the CERC team based on NREL structure
and enriches the city with archetypes and materials
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Pilar Monsalvete pilar_monsalvete@yahoo.es
"""
import xmltodict
from factories.physics_feeders.data_classes.nrel_building_achetype import NrelBuildingArchetype
from factories.physics_feeders.data_classes.nrel_thermal_boundary_archetype import NrelThermalBoundaryArchetype
from factories.physics_feeders.data_classes.nrel_thermal_opening_archetype import NrelThermalOpeningArchetype
from factories.physics_feeders.data_classes.nrel_layer_archetype import NrelLayerArchetype
class NrelInterface:
"""
NrelInterface abstract class
"""
def __init__(self, base_path, constructions_file='us_constructions.xml',
archetypes_file='us_archetypes.xml'):
# load construction Library, CERC-NREL format
path = str(base_path / constructions_file)
with open(path) as xml:
self._library = xmltodict.parse(xml.read(), force_list='layer')
# load archetypes Library, CERC-NREL format
path = str(base_path / archetypes_file)
with open(path) as xml:
self._archetypes = xmltodict.parse(xml.read(), force_list='layer')
# todo: I don't need this here
# it is assumed that all buildings have the same archetypes' keys
keys = []
archetype = self._archetypes['archetypes']['archetype'][0]
for key, value in archetype.items():
if key[0] == '@':
keys.append(key)
building_archetypes = []
for archetype in self._archetypes['archetypes']['archetype']:
archetype_keys = []
for key, value in archetype.items():
if key[0] == '@':
archetype_keys.append([key, value])
average_storey_height = archetype['average_storey_height']['#text']
storeys_above_ground = archetype['number_of_storeys']['#text']
effective_thermal_capacity = archetype['thermal_capacity']['#text']
additional_thermal_bridge_u_value = archetype['extra_loses_due_to_thermal_bridges']['#text']
indirectly_heated_area_ratio = archetype['indirect_heated_ratio']['#text']
infiltration_rate_system_off = archetype['infiltration_rate_for_ventilation_system_off']['#text']
infiltration_rate_system_on = archetype['infiltration_rate_for_ventilation_system_on']['#text']
thermal_boundary_archetypes = []
for construction in archetype['constructions']['construction']:
construction_type = construction['@type']
construction_id = construction['@id']
c_lib = self._search_construction_type('construction', construction_id)
construction_name = c_lib['@name']
layers = []
if 'layers' in c_lib:
for current_layer in c_lib['layers']['layer']:
material_lib = self._search_construction_type('material', current_layer['material'])
name = material_lib['@name']
solar_absorptance = material_lib['solar_absorptance']['#text']
thermal_absorptance = material_lib['thermal_absorptance']['#text']
visible_absorptance = material_lib['visible_absorptance']['#text']
no_mass = 'no_mass' in material_lib
if no_mass:
thermal_resistance = material_lib['thermal_resistance']['#text']
layer = NrelLayerArchetype(name, solar_absorptance, thermal_absorptance, visible_absorptance,
no_mass=no_mass, thermal_resistance=thermal_resistance)
else:
thickness = current_layer['thickness']['#text']
conductivity = material_lib['conductivity']['#text']
specific_heat = material_lib['specific_heat']['#text']
density = material_lib['density']['#text']
layer = NrelLayerArchetype(name, solar_absorptance, thermal_absorptance, visible_absorptance,
thickness = thickness, conductivity = conductivity,
specific_heat = specific_heat, density = density)
layers.append(layer)
thermal_openings = []
window_ratio = 0
if 'window' in construction and construction['window'] is not None:
window_ratio = construction['window_ratio']['#text']
w_lib = self._search_construction_type('window', construction['window'])
frame_ratio = w_lib['frame_ratio']['#text']
if 'conductivity' in w_lib:
conductivity = w_lib['conductivity']['#text']
thickness = w_lib['thickness']['#text']
g_value = w_lib['solar_transmittance_at_normal_incidence']['#text']
back_side_solar_transmittance_at_normal_incidence = \
w_lib['back_side_solar_transmittance_at_normal_incidence']['#text']
front_side_solar_transmittance_at_normal_incidence = \
w_lib['front_side_solar_transmittance_at_normal_incidence']['#text']
opening = NrelThermalOpeningArchetype(conductivity=conductivity, frame_ratio=frame_ratio, g_value=g_value,
thickness=thickness,
back_side_solar_transmittance_at_normal_incidence=
back_side_solar_transmittance_at_normal_incidence,
front_side_solar_transmittance_at_normal_incidence=
front_side_solar_transmittance_at_normal_incidence)
else:
overall_u_value = w_lib['overall_u_value']['#text']
g_value = w_lib['g_value']
opening = NrelThermalOpeningArchetype(frame_ratio=frame_ratio, g_value=g_value,
overall_u_value=overall_u_value)
thermal_openings.append(opening)
if 'outside_thermal_absorptance' in c_lib:
outside_solar_absorptance = c_lib['outside_solar_absorptance']['#text']
outside_thermal_absorptance = c_lib['outside_thermal_absorptance']['#text']
outside_visible_absorptance = c_lib['outside_visible_absorptance']['#text']
thermal_boundary_archetype = NrelThermalBoundaryArchetype(construction_type, window_ratio, construction_name,
layers, thermal_openings, outside_solar_absorptance,
outside_thermal_absorptance,
outside_visible_absorptance)
else:
if 'overall_u_value' in c_lib:
overall_u_value = c_lib['overall_u_value']['#text']
outside_solar_absorptance = c_lib['outside_solar_absorptance']['#text']
thermal_boundary_archetype = NrelThermalBoundaryArchetype(construction_type, window_ratio,
construction_name, layers, thermal_openings,
outside_solar_absorptance=
outside_solar_absorptance,
overall_u_value=overall_u_value)
else:
thermal_boundary_archetype = NrelThermalBoundaryArchetype(construction_type, window_ratio,
construction_name, layers, thermal_openings)
thermal_boundary_archetypes.append(thermal_boundary_archetype)
building_archetype = NrelBuildingArchetype(archetype_keys, average_storey_height, storeys_above_ground,
effective_thermal_capacity, additional_thermal_bridge_u_value,
indirectly_heated_area_ratio, infiltration_rate_system_off,
infiltration_rate_system_on, thermal_boundary_archetypes)
building_archetypes.append(building_archetype)
print(building_archetypes[0].archetype_keys)
def _search_construction_type(self, construction_type, construction_id):
for c_lib in self._library['library'][construction_type + 's'][construction_type]:
if construction_id == c_lib['@id']:
return c_lib
raise Exception('Archetype definition contains elements that does not exist in the library')

View File

@ -4,10 +4,10 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from factories.physics_feeders.helpers.us_pluto_to_function import UsPlutoToFunction as pf
from factories.physics_feeders.us_base_physics_parameters import UsBasePhysicsParameters
from factories.physics_feeders.cerc_base_physics_parameters import CercBasePhysicsParameters
class UsNewYorkCityPhysicsParameters(UsBasePhysicsParameters):
class UsNewYorkCityPhysicsParameters(CercBasePhysicsParameters):
"""
UsNewYorkCityPhysicsParameters class
"""

View File

@ -4,10 +4,10 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
"""
from factories.physics_feeders.helpers.us_to_library_types import UsToLibraryTypes
from factories.physics_feeders.us_base_physics_parameters import UsBasePhysicsParameters
from factories.physics_feeders.cerc_base_physics_parameters import CercBasePhysicsParameters
class UsPhysicsParameters(UsBasePhysicsParameters):
class UsPhysicsParameters(CercBasePhysicsParameters):
"""
UsPhysicsParameters class
"""

View File

@ -1,5 +1,5 @@
"""
UsBaseUsageParameters base class to model the usage properties for a building in NYC and US
CercBaseUsageParameters base class to model the usage properties for a building in NYC and US
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2020 Project Author Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
Contributors Pilar Monsalvete pilar_monsalvete@yahoo.es

View File

@ -57,3 +57,10 @@ class TestPhysicsFactory(TestCase):
self.assertIsNotNone(thermal_boundary.outside_solar_absorptance, 'outside_solar_absorptance is none')
self.assertIsNotNone(thermal_boundary.window_ratio, 'window_ratio is none')
self.assertIsNotNone(thermal_boundary.layers, 'layers is none')
def test_nrel_interface(self):
city = self._get_citygml()
# todo: extended library
# PhysicsFactory('us', self._nyc_with_physics)
# reduced library
PhysicsFactory('ca', self._nyc_with_physics)