From e91e61741edf834d363931e5933daf1ce0048962 Mon Sep 17 00:00:00 2001 From: Saeed Ranjbar Date: Wed, 16 Aug 2023 15:58:49 -0400 Subject: [PATCH] add generation and config --- .../energy_systems/pv_generation_system.py | 15 ++- .../north_america_energy_system_catalog.py | 127 ++++++++++++++++-- hub/data/energy_systems/Tools4CitiesESMF.xml | 24 ++-- 3 files changed, 142 insertions(+), 24 deletions(-) diff --git a/hub/catalog_factories/data_models/energy_systems/pv_generation_system.py b/hub/catalog_factories/data_models/energy_systems/pv_generation_system.py index a258b4b9..47a2507f 100644 --- a/hub/catalog_factories/data_models/energy_systems/pv_generation_system.py +++ b/hub/catalog_factories/data_models/energy_systems/pv_generation_system.py @@ -17,8 +17,9 @@ class PvGenerationSystem(GenerationSystem): """ def __init__(self, nominal_ambient_temperature, nominal_cell_temperature, nominal_radiation, - standard_test_condition_cell_temperature, standard_test_condition_maximum_power, width, height, - model_name, manufacturer, electricity_efficiency, nominal_electricity_output): + standard_test_condition_cell_temperature, standard_test_condition_maximum_power, + cell_temperature_coefficient, width, height, model_name, manufacturer, electricity_efficiency, + nominal_electricity_output): super(GenerationSystem, self).__init__(model_name=model_name, manufacturer=manufacturer, system_type='pv', fuel_type='renewable', nominal_thermal_output=None, modulation_range=None, source_types=None, heat_efficiency=None, cooling_efficiency=None, @@ -29,6 +30,7 @@ class PvGenerationSystem(GenerationSystem): self._nominal_radiation = nominal_radiation self._standard_test_condition_cell_temperature = standard_test_condition_cell_temperature self._standard_test_condition_maximum_power = standard_test_condition_maximum_power + self._cell_temperature_coefficient = cell_temperature_coefficient self._width = width self._height = height @@ -72,6 +74,14 @@ class PvGenerationSystem(GenerationSystem): """ return self._standard_test_condition_maximum_power + @property + def cell_temperature_coefficient(self): + """ + Get cell temperature coefficient of PV module + :return: float + """ + return self._cell_temperature_coefficient + @property def width(self): """ @@ -102,6 +112,7 @@ class PvGenerationSystem(GenerationSystem): 'nominal radiation [W/m2]': self.nominal_radiation, 'standard test condition cell temperature [Celsius]': self.standard_test_condition_cell_temperature, 'standard test condition maximum power [kW]': self.standard_test_condition_maximum_power, + 'cell temperature coefficient':self.cell_temperature_coefficient, 'width': self.width, 'height': self.height, } 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 86d8f215..b703945e 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 @@ -12,6 +12,7 @@ from hub.catalog_factories.catalog import Catalog from hub.catalog_factories.data_models.energy_systems.system import System from hub.catalog_factories.data_models.energy_systems.content import Content from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem +from hub.catalog_factories.data_models.energy_systems.pv_generation_system import PvGenerationSystem from hub.catalog_factories.data_models.energy_systems.distribution_system import DistributionSystem from hub.catalog_factories.data_models.energy_systems.energy_emission_system import EnergyEmissionSystem from hub.catalog_factories.data_models.energy_systems.energy_storage_system import EnergyStorageSystem @@ -25,23 +26,129 @@ class NorthAmericaEnergySystemCatalog(Catalog): """ North america energy system catalog class """ + 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() -# self._generation_components = self._load_generation_components() + self._systems = self._load_systems() + print(self._load_systems()) + self._generation_components = self._load_generation_components() + print(self._generation_components) self._storage_components = self._load_storage_components() print(self._storage_components) -# self._system_archetypes = self._load_system_archetypes() - # store the full catalog data model in self._content -# self._content = Content(self._system_archetypes, -# self._systems, -# self._generation_components, -# None, -# None, -# self._storage_components) + # self._system_archetypes = self._load_system_archetypes() + + # store the full catalog data model in self._content + # self._content = Content(self._system_archetypes, + # self._systems, + # self._generation_components, + # 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_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'] + system_type = 'boiler' + boiler_fuel_type = boiler['@fuel'] + boiler_nominal_thermal_output = float(boiler['@installedThermalPower']) + boiler_modulation_range = float(boiler['@modulationRange']) + boiler_heat_efficiency = float(boiler['@nominalEfficiency']) + + boiler_component = GenerationSystem(boiler_model_name, + boiler_manufacturer, + system_type, + boiler_fuel_type, + boiler_nominal_thermal_output, + boiler_modulation_range, + None, + None, + boiler_heat_efficiency, + None, + None, + None, + None, + None, + None, + None, + None, + None) + generation_components.append(boiler_component) + for heat_pump in heat_pumps: + heat_pump_model_name = heat_pump['@modelName'] + heat_pump_manufacturer = heat_pump['@manufacturer'] + system_type = 'heat pump' + heat_pump_fuel_type = heat_pump['@fuel'] + heat_pump_nominal_thermal_output = float(heat_pump['@installedThermalPower']) + heat_pump_modulation_range = float(heat_pump['@modulationRange']) + heat_pump_source_type = heat_pump['@heatSource'] + heat_pump_supply_medium = heat_pump['@supply_medium'] + heat_pump_nominal_cop = float(heat_pump['@nominalCOP']) + heat_pump_maximum_heating_temperature = float(heat_pump['@maxHeatingSupTemperature']) + heat_pump_minimum_heating_temperature = float(heat_pump['@minHeatingSupTemperature']) + heat_pump_maximum_cooling_temperature = float(heat_pump['@maxCoolingSupTemperature']) + heat_pump_minimum_cooling_temperature = float(heat_pump['@minCoolingSupTemperature']) + + heat_pump_component = GenerationSystem(heat_pump_model_name, + heat_pump_manufacturer, + system_type, + heat_pump_fuel_type, + heat_pump_nominal_thermal_output, + heat_pump_modulation_range, + heat_pump_source_type, + heat_pump_supply_medium, + heat_pump_nominal_cop, + None, + None, + None, + None, + None, + heat_pump_maximum_heating_temperature, + heat_pump_minimum_heating_temperature, + heat_pump_maximum_cooling_temperature, + heat_pump_minimum_cooling_temperature) + generation_components.append(heat_pump_component) + for pv in photovoltaics: + nominal_ambient_temperature = float(pv['@nominalAmbientTemperature']) + nominal_cell_temperature = float(pv['@nominalCellTemperature']) + nominal_radiation = float(pv['@nominalRadiation']) + standard_test_condition_cell_temperature = float(pv['@STCCellTemperature']) + standard_test_condition_maximum_power = float(pv['@STCMaxPower']) + cell_temperature_coefficient = float(pv['@CellTemperatureCoefficient']) + width = float(pv['@width']) + height = float(pv['@height']) + pv_model_name = pv['@modelName'] + pv_manufacturer = pv['@manufacturer'] + pv_electricity_efficiency = pv['@nominalEfficiency'] + pv_nominal_electricity_output = pv['@nominalPower'] + pv_component = PvGenerationSystem(nominal_ambient_temperature, + nominal_cell_temperature, + nominal_radiation, + standard_test_condition_cell_temperature, + standard_test_condition_maximum_power, + cell_temperature_coefficient, + width, + height, + pv_model_name, + pv_manufacturer, + pv_electricity_efficiency, + pv_nominal_electricity_output) + generation_components.append(pv_component) + return generation_components def _load_storage_components(self): storage_components = [] diff --git a/hub/data/energy_systems/Tools4CitiesESMF.xml b/hub/data/energy_systems/Tools4CitiesESMF.xml index 6ee58c84..d1a18651 100644 --- a/hub/data/energy_systems/Tools4CitiesESMF.xml +++ b/hub/data/energy_systems/Tools4CitiesESMF.xml @@ -2,18 +2,18 @@ - - - - - - - - - - - - + + + + + + + + + + + +