bug correction on construction catalogs
This commit is contained in:
parent
5cddbd363f
commit
59f3b548c7
|
@ -45,7 +45,8 @@ class NrelCatalog(Catalog):
|
||||||
g_value = window['shgc']
|
g_value = window['shgc']
|
||||||
overall_u_value = float(window['conductivity']['#text']) / float(window['thickness']['#text'])
|
overall_u_value = float(window['conductivity']['#text']) / float(window['thickness']['#text'])
|
||||||
name = window['@name']
|
name = window['@name']
|
||||||
_catalog_windows.append(Window(frame_ratio, g_value, overall_u_value, name))
|
window_id = window['@id']
|
||||||
|
_catalog_windows.append(Window(window_id, frame_ratio, g_value, overall_u_value, name))
|
||||||
return _catalog_windows
|
return _catalog_windows
|
||||||
|
|
||||||
def _load_materials(self):
|
def _load_materials(self):
|
||||||
|
@ -57,7 +58,7 @@ class NrelCatalog(Catalog):
|
||||||
solar_absorptance = material['solar_absorptance']['#text']
|
solar_absorptance = material['solar_absorptance']['#text']
|
||||||
thermal_absorptance = material['thermal_absorptance']['#text']
|
thermal_absorptance = material['thermal_absorptance']['#text']
|
||||||
visible_absorptance = material['visible_absorptance']['#text']
|
visible_absorptance = material['visible_absorptance']['#text']
|
||||||
no_mass = True
|
no_mass = False
|
||||||
thermal_resistance = None,
|
thermal_resistance = None,
|
||||||
conductivity = None,
|
conductivity = None,
|
||||||
density = None,
|
density = None,
|
||||||
|
@ -93,12 +94,12 @@ class NrelCatalog(Catalog):
|
||||||
for layer in construction['layers']['layer']:
|
for layer in construction['layers']['layer']:
|
||||||
layer_id = layer['@id']
|
layer_id = layer['@id']
|
||||||
layer_name = layer['@name']
|
layer_name = layer['@name']
|
||||||
material_id = layer['material']
|
material_id = layer['material'][0]
|
||||||
thickness = 0
|
thickness = 0
|
||||||
if 'thickness' in layer:
|
if 'thickness' in layer:
|
||||||
thickness = layer['thickness']['#text']
|
thickness = layer['thickness']['#text']
|
||||||
for material in self._catalog_materials:
|
for material in self._catalog_materials:
|
||||||
if material_id == material.id:
|
if str(material_id) == str(material.id):
|
||||||
layers.append(Layer(layer_id, layer_name, material, thickness))
|
layers.append(Layer(layer_id, layer_name, material, thickness))
|
||||||
break
|
break
|
||||||
_catalog_constructions.append(Construction(construction_id, construction_type, name, layers))
|
_catalog_constructions.append(Construction(construction_id, construction_type, name, layers))
|
||||||
|
@ -110,6 +111,7 @@ class NrelCatalog(Catalog):
|
||||||
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']]
|
||||||
|
name = f"{function} {archetype['@reference_standard']}"
|
||||||
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']['#text']
|
average_storey_height = archetype['average_storey_height']['#text']
|
||||||
number_of_storeys = archetype['number_of_storeys']['#text']
|
number_of_storeys = archetype['number_of_storeys']['#text']
|
||||||
|
@ -118,23 +120,33 @@ class NrelCatalog(Catalog):
|
||||||
indirect_heated_ratio = archetype['indirect_heated_ratio']['#text']
|
indirect_heated_ratio = archetype['indirect_heated_ratio']['#text']
|
||||||
infiltration_rate_for_ventilation_system_off = archetype['infiltration_rate_for_ventilation_system_off']['#text']
|
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']['#text']
|
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._catalog_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']['#text']
|
window_ratio = archetype_construction['window_ratio']['#text']
|
||||||
window = archetype_construction['window']
|
window_id = archetype_construction['window']
|
||||||
|
_construction = None
|
||||||
|
_window = None
|
||||||
|
for window in self._catalog_windows:
|
||||||
|
if window_id == window.id:
|
||||||
|
_window = window
|
||||||
|
break
|
||||||
_construction = Construction(construction.id,
|
_construction = Construction(construction.id,
|
||||||
construction.type,
|
construction.type,
|
||||||
construction.name,
|
construction.name,
|
||||||
construction.layers,
|
construction.layers,
|
||||||
window_ratio,
|
window_ratio,
|
||||||
window)
|
_window)
|
||||||
archetype_constructions.append(_construction)
|
archetype_constructions.append(_construction)
|
||||||
|
break
|
||||||
|
|
||||||
_catalog_archetypes.append(Archetype(archetype_id,
|
_catalog_archetypes.append(Archetype(archetype_id,
|
||||||
|
name,
|
||||||
function,
|
function,
|
||||||
archetype_constructions,
|
|
||||||
construction_period,
|
construction_period,
|
||||||
|
archetype_constructions,
|
||||||
average_storey_height,
|
average_storey_height,
|
||||||
number_of_storeys,
|
number_of_storeys,
|
||||||
thermal_capacity,
|
thermal_capacity,
|
||||||
|
|
|
@ -31,3 +31,11 @@ class ConstructionCatalogFactory:
|
||||||
:return: Catalog
|
:return: Catalog
|
||||||
"""
|
"""
|
||||||
return getattr(self, self._catalog_type, lambda: None)
|
return getattr(self, self._catalog_type, lambda: None)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def catalog_debug(self) -> Catalog:
|
||||||
|
"""
|
||||||
|
Enrich the city given to the class using the class given handler
|
||||||
|
:return: Catalog
|
||||||
|
"""
|
||||||
|
return NrelCatalog(self._path)
|
|
@ -5,8 +5,11 @@ Copyright © 2022 Concordia CERC group
|
||||||
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from catalog_factories.data_models.construction.construction import Construction
|
||||||
|
|
||||||
class Archetype:
|
class Archetype:
|
||||||
def __init__(self, archetype_id,
|
def __init__(self, archetype_id,
|
||||||
|
name,
|
||||||
function,
|
function,
|
||||||
construction_period,
|
construction_period,
|
||||||
constructions,
|
constructions,
|
||||||
|
@ -17,9 +20,8 @@ class Archetype:
|
||||||
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):
|
||||||
|
|
||||||
self._id = archetype_id
|
self._id = archetype_id
|
||||||
self._name = f'{function} {construction_period}'
|
self._name = name
|
||||||
self._function = function
|
self._function = function
|
||||||
self._construction_period = construction_period
|
self._construction_period = construction_period
|
||||||
self._constructions = constructions
|
self._constructions = constructions
|
||||||
|
@ -47,6 +49,7 @@ class Archetype:
|
||||||
"""
|
"""
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
|
@property
|
||||||
def function(self):
|
def function(self):
|
||||||
"""
|
"""
|
||||||
Get archetype function
|
Get archetype function
|
||||||
|
@ -54,6 +57,14 @@ class Archetype:
|
||||||
"""
|
"""
|
||||||
return self._function
|
return self._function
|
||||||
|
|
||||||
|
@property
|
||||||
|
def constructions(self) -> [Construction]:
|
||||||
|
"""
|
||||||
|
Get archetype constructions
|
||||||
|
:return: [Construction]
|
||||||
|
"""
|
||||||
|
return self._constructions
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def construction_period(self):
|
def construction_period(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -4,6 +4,9 @@ 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
|
||||||
"""
|
"""
|
||||||
|
from catalog_factories.data_models.construction.layer import Layer
|
||||||
|
from catalog_factories.data_models.construction.window import Window
|
||||||
|
|
||||||
|
|
||||||
class Construction:
|
class Construction:
|
||||||
def __init__(self, construction_id, construction_type, name, layers, window_ratio=None, window=None):
|
def __init__(self, construction_id, construction_type, name, layers, window_ratio=None, window=None):
|
||||||
|
@ -39,10 +42,26 @@ class Construction:
|
||||||
return self._name
|
return self._name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def layers(self):
|
def layers(self) -> [Layer]:
|
||||||
"""
|
"""
|
||||||
Get construction layers
|
Get construction layers
|
||||||
:return: [layer]
|
:return: [layer]
|
||||||
"""
|
"""
|
||||||
return self._layers
|
return self._layers
|
||||||
|
|
||||||
|
@property
|
||||||
|
def window_ratio(self):
|
||||||
|
"""
|
||||||
|
Get construction window ratio
|
||||||
|
:return: float
|
||||||
|
"""
|
||||||
|
return self._window_ratio
|
||||||
|
|
||||||
|
@property
|
||||||
|
def window(self) -> Window:
|
||||||
|
"""
|
||||||
|
Get construction window
|
||||||
|
:return: Window
|
||||||
|
"""
|
||||||
|
return self._window
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,21 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class Window:
|
class Window:
|
||||||
def __init__(self, frame_ratio, g_value, overall_u_value, name):
|
def __init__(self, window_id, frame_ratio, g_value, overall_u_value, name):
|
||||||
|
self._id = window_id
|
||||||
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._name = name
|
self._name = name
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
def id(self):
|
||||||
|
"""
|
||||||
|
Get window id
|
||||||
|
:return: str
|
||||||
|
"""
|
||||||
|
return self._name
|
||||||
|
@property
|
||||||
def name(self):
|
def name(self):
|
||||||
"""
|
"""
|
||||||
Get window name
|
Get window name
|
||||||
|
|
Loading…
Reference in New Issue
Block a user