From 32a40f17a6552c65a923fd436d0ae7504b889993 Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Wed, 16 Aug 2023 16:28:20 -0400 Subject: [PATCH] fixing pv problem --- .../north_america_energy_system_catalog.py | 29 ++++++++++++------- hub/data/energy_systems/Tools4CitiesESMF.xml | 10 ++++++- hub/imports/geometry_factory.py | 4 +-- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py b/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py index b703945e..150df075 100644 --- a/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py +++ b/hub/catalog_factories/energy_systems/north_america_energy_system_catalog.py @@ -20,6 +20,7 @@ from hub.catalog_factories.data_models.energy_systems.performance_curves import from hub.catalog_factories.data_models.energy_systems.archetype import Archetype from hub.catalog_factories.data_models.construction.material import Material from hub.catalog_factories.data_models.construction.layer import Layer +import hub.helpers.constants as cte class NorthAmericaEnergySystemCatalog(Catalog): @@ -30,13 +31,13 @@ class NorthAmericaEnergySystemCatalog(Catalog): def __init__(self, path): path = str(path / 'Tools4CitiesESMF.xml') with open(path, 'r', encoding='utf-8') as xml: - self._archetypes = xmltodict.parse(xml.read()) - self._systems = self._load_systems() - print(self._load_systems()) + self._archetypes = xmltodict.parse(xml.read(), force_list=['boilers', 'photovoltaicModules']) self._generation_components = self._load_generation_components() print(self._generation_components) self._storage_components = self._load_storage_components() print(self._storage_components) + self._systems = self._load_systems() + print(self._load_systems()) # self._system_archetypes = self._load_system_archetypes() @@ -47,19 +48,27 @@ class NorthAmericaEnergySystemCatalog(Catalog): # None, # None, # self._storage_components) - def _load_systems(self): - system_configurations = [] - configurations = self._archetypes['encomp:EnergySystemCatalog']['energysystemconfiguration'] - for configuration in configurations: - system_configurations.append(configuration['@configurationName']) - return system_configurations +# def _load_systems(self): +# systems = [] +# catalog_systems = self._archetypes['encomp:EnergySystemCatalog']['energysystemconfiguration'] +# for catalog_system in catalog_systems: + # look for the demands and add it to demands[] + # look for the components in self._generation_systems and add them to generation_systems[] + # same with emission and distribution and storage +# System(None, +# None, +# catalog_system['@configurationName'], +# demands, +# generation_systems,... +# ) + +# return system_configurations def _load_generation_components(self): generation_components = [] boilers = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['boilers'] heat_pumps = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['heatPumps'] photovoltaics = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['photovoltaicModules'] - print(photovoltaics.keys()) for boiler in boilers: boiler_model_name = boiler['@modelName'] boiler_manufacturer = boiler['@manufacturer'] diff --git a/hub/data/energy_systems/Tools4CitiesESMF.xml b/hub/data/energy_systems/Tools4CitiesESMF.xml index d1a18651..0f79b6e2 100644 --- a/hub/data/energy_systems/Tools4CitiesESMF.xml +++ b/hub/data/energy_systems/Tools4CitiesESMF.xml @@ -39,7 +39,15 @@ - + + + + + + + + + diff --git a/hub/imports/geometry_factory.py b/hub/imports/geometry_factory.py index 3e6ca0b3..7adf8197 100644 --- a/hub/imports/geometry_factory.py +++ b/hub/imports/geometry_factory.py @@ -17,8 +17,7 @@ class GeometryFactory: GeometryFactory class """ def __init__(self, file_type, - path=None, - data_frame=None, + path, aliases_field=None, height_field=None, year_of_construction_field=None, @@ -27,7 +26,6 @@ class GeometryFactory: self._file_type = '_' + file_type.lower() validate_import_export_type(GeometryFactory, file_type) self._path = path - self._data_frame = data_frame self._aliases_field = aliases_field self._height_field = height_field self._year_of_construction_field = year_of_construction_field