fixing pv problem

This commit is contained in:
Pilar Monsalvete 2023-08-16 16:28:20 -04:00
parent e91e61741e
commit 32a40f17a6
3 changed files with 29 additions and 14 deletions

View File

@ -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.energy_systems.archetype import Archetype
from hub.catalog_factories.data_models.construction.material import Material from hub.catalog_factories.data_models.construction.material import Material
from hub.catalog_factories.data_models.construction.layer import Layer from hub.catalog_factories.data_models.construction.layer import Layer
import hub.helpers.constants as cte
class NorthAmericaEnergySystemCatalog(Catalog): class NorthAmericaEnergySystemCatalog(Catalog):
@ -30,13 +31,13 @@ class NorthAmericaEnergySystemCatalog(Catalog):
def __init__(self, path): def __init__(self, path):
path = str(path / 'Tools4CitiesESMF.xml') path = str(path / 'Tools4CitiesESMF.xml')
with open(path, 'r', encoding='utf-8') as xml: with open(path, 'r', encoding='utf-8') as xml:
self._archetypes = xmltodict.parse(xml.read()) self._archetypes = xmltodict.parse(xml.read(), force_list=['boilers', 'photovoltaicModules'])
self._systems = self._load_systems()
print(self._load_systems())
self._generation_components = self._load_generation_components() self._generation_components = self._load_generation_components()
print(self._generation_components) print(self._generation_components)
self._storage_components = self._load_storage_components() self._storage_components = self._load_storage_components()
print(self._storage_components) print(self._storage_components)
self._systems = self._load_systems()
print(self._load_systems())
# self._system_archetypes = self._load_system_archetypes() # self._system_archetypes = self._load_system_archetypes()
@ -47,19 +48,27 @@ class NorthAmericaEnergySystemCatalog(Catalog):
# None, # None,
# None, # None,
# self._storage_components) # self._storage_components)
def _load_systems(self): # def _load_systems(self):
system_configurations = [] # systems = []
configurations = self._archetypes['encomp:EnergySystemCatalog']['energysystemconfiguration'] # catalog_systems = self._archetypes['encomp:EnergySystemCatalog']['energysystemconfiguration']
for configuration in configurations: # for catalog_system in catalog_systems:
system_configurations.append(configuration['@configurationName']) # look for the demands and add it to demands[]
return system_configurations # 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): def _load_generation_components(self):
generation_components = [] generation_components = []
boilers = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['boilers'] boilers = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['boilers']
heat_pumps = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['heatPumps'] heat_pumps = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['heatPumps']
photovoltaics = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['photovoltaicModules'] photovoltaics = self._archetypes['encomp:EnergySystemCatalog']['energycomponent']['photovoltaicModules']
print(photovoltaics.keys())
for boiler in boilers: for boiler in boilers:
boiler_model_name = boiler['@modelName'] boiler_model_name = boiler['@modelName']
boiler_manufacturer = boiler['@manufacturer'] boiler_manufacturer = boiler['@manufacturer']

View File

@ -39,7 +39,15 @@
<materials name="Polyurethane" thermalConductivity="0.028"/> <materials name="Polyurethane" thermalConductivity="0.028"/>
<materials name="Steel" thermalConductivity="18.0"/> <materials name="Steel" thermalConductivity="18.0"/>
</energycomponent> </energycomponent>
<energysystemconfiguration configurationName="PvHpBoiler"/> <energysystemconfiguration configurationName="PvHpBoiler">
<demands type="Heating"/>
<demands type="Domestic Hot Water"/>
<demands type="Electricity"/>
<components Name="VirtualBoiler"/>
<components Name="VirtualPV"/>
<components Name="VirtualHPair"/>
</energysystemconfiguration>
<energysystemconfiguration configurationName="hpTesBoiler"/> <energysystemconfiguration configurationName="hpTesBoiler"/>
<energysystemconfiguration configurationName="hpTes"/> <energysystemconfiguration configurationName="hpTes"/>
</encomp:EnergySystemCatalog> </encomp:EnergySystemCatalog>

View File

@ -17,8 +17,7 @@ class GeometryFactory:
GeometryFactory class GeometryFactory class
""" """
def __init__(self, file_type, def __init__(self, file_type,
path=None, path,
data_frame=None,
aliases_field=None, aliases_field=None,
height_field=None, height_field=None,
year_of_construction_field=None, year_of_construction_field=None,
@ -27,7 +26,6 @@ class GeometryFactory:
self._file_type = '_' + file_type.lower() self._file_type = '_' + file_type.lower()
validate_import_export_type(GeometryFactory, file_type) validate_import_export_type(GeometryFactory, file_type)
self._path = path self._path = path
self._data_frame = data_frame
self._aliases_field = aliases_field self._aliases_field = aliases_field
self._height_field = height_field self._height_field = height_field
self._year_of_construction_field = year_of_construction_field self._year_of_construction_field = year_of_construction_field