diff --git a/catalog_factories/construction/nrel_catalog.py b/catalog_factories/construction/nrel_catalog.py index 3fc6a0d2..7014b1bb 100644 --- a/catalog_factories/construction/nrel_catalog.py +++ b/catalog_factories/construction/nrel_catalog.py @@ -45,7 +45,8 @@ class NrelCatalog(Catalog): g_value = window['shgc'] overall_u_value = float(window['conductivity']['#text']) / float(window['thickness']['#text']) 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 def _load_materials(self): @@ -57,7 +58,7 @@ class NrelCatalog(Catalog): solar_absorptance = material['solar_absorptance']['#text'] thermal_absorptance = material['thermal_absorptance']['#text'] visible_absorptance = material['visible_absorptance']['#text'] - no_mass = True + no_mass = False thermal_resistance = None, conductivity = None, density = None, @@ -93,12 +94,12 @@ class NrelCatalog(Catalog): for layer in construction['layers']['layer']: layer_id = layer['@id'] layer_name = layer['@name'] - material_id = layer['material'] + material_id = layer['material'][0] thickness = 0 if 'thickness' in layer: thickness = layer['thickness']['#text'] 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)) break _catalog_constructions.append(Construction(construction_id, construction_type, name, layers)) @@ -110,6 +111,7 @@ class NrelCatalog(Catalog): for archetype in archetypes: archetype_id = archetype['@id'] function = nrel_to_function[archetype['@building_type']] + name = f"{function} {archetype['@reference_standard']}" construction_period = reference_standard_to_construction_period[archetype['@reference_standard']] average_storey_height = archetype['average_storey_height']['#text'] number_of_storeys = archetype['number_of_storeys']['#text'] @@ -118,23 +120,33 @@ class NrelCatalog(Catalog): 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_on = archetype['infiltration_rate_for_ventilation_system_on']['#text'] + archetype_constructions = [] for archetype_construction in archetype['constructions']['construction']: for construction in self._catalog_constructions: if construction.id == archetype_construction['@id']: 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.type, construction.name, construction.layers, window_ratio, - window) + _window) archetype_constructions.append(_construction) + break + _catalog_archetypes.append(Archetype(archetype_id, + name, function, - archetype_constructions, construction_period, + archetype_constructions, average_storey_height, number_of_storeys, thermal_capacity, diff --git a/catalog_factories/construction_catalog_factory.py b/catalog_factories/construction_catalog_factory.py index 410103a8..dcc9664c 100644 --- a/catalog_factories/construction_catalog_factory.py +++ b/catalog_factories/construction_catalog_factory.py @@ -30,4 +30,12 @@ class ConstructionCatalogFactory: Enrich the city given to the class using the class given handler :return: Catalog """ - return getattr(self, self._catalog_type, lambda: None) \ No newline at end of file + 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) \ No newline at end of file diff --git a/catalog_factories/data_models/construction/archetype.py b/catalog_factories/data_models/construction/archetype.py index 44c8647e..70ab99e5 100644 --- a/catalog_factories/data_models/construction/archetype.py +++ b/catalog_factories/data_models/construction/archetype.py @@ -5,8 +5,11 @@ Copyright © 2022 Concordia CERC group Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ +from catalog_factories.data_models.construction.construction import Construction + class Archetype: def __init__(self, archetype_id, + name, function, construction_period, constructions, @@ -17,9 +20,8 @@ class Archetype: indirect_heated_ratio, infiltration_rate_for_ventilation_system_off, infiltration_rate_for_ventilation_system_on): - self._id = archetype_id - self._name = f'{function} {construction_period}' + self._name = name self._function = function self._construction_period = construction_period self._constructions = constructions @@ -47,6 +49,7 @@ class Archetype: """ return self._name + @property def function(self): """ Get archetype function @@ -54,6 +57,14 @@ class Archetype: """ return self._function + @property + def constructions(self) -> [Construction]: + """ + Get archetype constructions + :return: [Construction] + """ + return self._constructions + @property def construction_period(self): """ diff --git a/catalog_factories/data_models/construction/construction.py b/catalog_factories/data_models/construction/construction.py index 03eac115..93eef068 100644 --- a/catalog_factories/data_models/construction/construction.py +++ b/catalog_factories/data_models/construction/construction.py @@ -4,6 +4,9 @@ SPDX - License - Identifier: LGPL - 3.0 - or -later Copyright © 2022 Concordia CERC group 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: def __init__(self, construction_id, construction_type, name, layers, window_ratio=None, window=None): @@ -39,10 +42,26 @@ class Construction: return self._name @property - def layers(self): + def layers(self) -> [Layer]: """ Get construction layers :return: [layer] """ 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 + diff --git a/catalog_factories/data_models/construction/window.py b/catalog_factories/data_models/construction/window.py index 9c3a8b04..60c31a0b 100644 --- a/catalog_factories/data_models/construction/window.py +++ b/catalog_factories/data_models/construction/window.py @@ -6,13 +6,21 @@ Project Coder Guille Gutierrez guillermo.gutierrezmorote@concordia.ca """ 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._g_value = g_value self._overall_u_value = overall_u_value self._name = name @property + def id(self): + """ + Get window id + :return: str + """ + return self._name + @property def name(self): """ Get window name