final_energy_system_model #60

Merged
g_gutierrez merged 113 commits from final_energy_system_model into main 2024-03-14 09:13:21 -04:00
4 changed files with 296 additions and 180 deletions
Showing only changes of commit 9b0bdf2b7e - Show all commits

View File

@ -54,7 +54,6 @@ class GenerationSystem:
self._cooling_output_curve = cooling_output_curve
self._cooling_fuel_consumption_curve = cooling_fuel_consumption_curve
self._cooling_efficiency_curve = cooling_efficiency_curve
self._storage = storage
self._auxiliary_equipment = auxiliary_equipment

View File

@ -9,10 +9,8 @@ Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
from typing import Union, List
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.energy_storage_system import EnergyStorageSystem
from hub.catalog_factories.data_models.energy_systems.distribution_system import DistributionSystem
from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves
from hub.catalog_factories.data_models.energy_systems.emission_system import EmissionSystem
@ -24,24 +22,20 @@ class System:
def __init__(self,
lod,
system_id,
system_configuration,
name,
demand_types,
generation_systems,
pv_generation_system,
distribution_system,
emission_system,
energy_storage_systems,
performance_curves):
energy_storage_systems):
self._lod = lod
self._system_id = system_id
self._system_configuration = system_configuration
self._name = name
self._demand_types = demand_types
self._distribution_system = distribution_system
self._emission_system = emission_system
self._generation_systems = generation_systems
self._pv_generation_system = pv_generation_system
self._energy_storage_systems = energy_storage_systems
self._performance_curves = performance_curves
@property
def lod(self):
@ -60,13 +54,12 @@ class System:
return self._system_id
@property
def system_configuration(self):
def name(self):
"""
Get the system configuration from ['hp_tes', 'hp_boiler_tes', 'pv_hp', 'pv_battery', 'pv', 'pv_hp_tes',
'pv_hp_battery_tes']
Get the system name
:return: string
"""
return self._system_configuration
return self._name
@property
def demand_types(self):
@ -84,14 +77,6 @@ class System:
"""
return self._generation_systems
@property
def pv_generation_system(self) -> Union[None, PvGenerationSystem]:
"""
Get pv generation system
:return: ElectricityGenerationSystem
"""
return self._pv_generation_system
@property
def distribution_system(self) -> Union[None, DistributionSystem]:
"""
@ -116,22 +101,11 @@ class System:
"""
return self._energy_storage_systems
@property
def performance_curves(self) -> Union[None, List[PerformanceCurves]]:
"""
Get the list of all performance curves associated with components
:return: PerformanceCurves
"""
return self._performance_curves
def to_dictionary(self):
"""Class content to dictionary"""
_generation_systems = []
for _generation in self.generation_systems:
_generation_systems.append(_generation.to_dictionary())
_pv_system = None
if self.pv_generation_system is not None:
_pv_system = self.pv_generation_system.to_dictionary()
_distribution_system = None
if self.distribution_system is not None:
_distribution_system = self.distribution_system.to_dictionary()
@ -140,19 +114,15 @@ class System:
_emission_system = self.emission_system.to_dictionary()
_storage_system = [_storage.to_dictionary() for _storage in
self.energy_storage_system] if self.energy_storage_system is not None else None
_performance_curves = [_curve.to_dictionary() for _curve in
self.performance_curves] if self.performance_curves is not None else None
content = {'Layer': {'id': self.id,
'name': self.system_configuration,
'name': self.name,
'level of detail': self.lod,
'demand types': self.demand_types,
'Generation system(s)': _generation_systems,
'electricity generation system': _pv_system,
'distribution system': _distribution_system,
'emission system': _emission_system,
'energy storage system': _storage_system,
'performance curves': _performance_curves
}
}
return content

View File

@ -31,137 +31,257 @@ class NorthAmericaEnergySystemCatalog(Catalog):
def __init__(self, path):
path = str(path / 'north_america_systems.xml')
with open(path, 'r', encoding='utf-8') as xml:
self._archetypes = xmltodict.parse(xml.read(), force_list=['photovoltaicModules'])
# self._generation_components = self._load_generation_components()
# print(self._generation_components)
self._archetypes = xmltodict.parse(xml.read(), force_list=['photovoltaicModules', 'templateStorages'])
self._generation_components = self._load_generation_components()
print(self._generation_components)
print(len(self._generation_components))
self._storage_components = self._load_storage_components()
print(self._storage_components)
self._systems = self._load_systems()
print(self._load_systems())
# self._systems = self._load_systems()
# print(self._load_systems())
# self._system_archetypes = self._load_system_archetypes()
def _load_generation_components(self):
generation_components = []
boilers = self._archetypes['EnergySystemCatalog']['energy_generation_components']['boilers']
heat_pumps = self._archetypes['EnergySystemCatalog']['energy_generation_components']['heatPumps']
photovoltaics = self._archetypes['EnergySystemCatalog']['energy_generation_components']['photovoltaicModules']
templates = self._archetypes['EnergySystemCatalog']['energy_generation_components']['templateGenerationEquipments']
for boiler in boilers:
boiler_id = boiler['@generation_id']
boiler_name = boiler['@name']
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_maximum_heat_output = float(boiler['@modulationRange'])
boiler_heat_efficiency = float(boiler['@nominalEfficiency'])
# 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):
# 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,...
# )
boiler_component = GenerationSystem(boiler_id,
boiler_name,
boiler_model_name,
boiler_manufacturer,
system_type,
boiler_fuel_type,
boiler_nominal_thermal_output,
None,
None,
None,
None,
boiler_heat_efficiency,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None)
generation_components.append(boiler_component)
for heat_pump in heat_pumps:
heat_pump_id = heat_pump['@generation_id']
heat_pump_name = heat_pump['@name']
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'])
cop_curve_type = heat_pump['performance_curve']['@curve_type']
parameters = heat_pump['performance_curve']['parameters']
coefficients = list(heat_pump['performance_curve']['coefficients'].values())
cop_curve = PerformanceCurves(cop_curve_type, parameters, coefficients)
# return system_configurations
heat_pump_component = GenerationSystem(heat_pump_id,
heat_pump_name,
heat_pump_model_name,
heat_pump_manufacturer,
system_type,
heat_pump_fuel_type,
heat_pump_nominal_thermal_output,
None,
None,
heat_pump_source_type,
heat_pump_supply_medium,
heat_pump_nominal_cop,
None,
None,
None,
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,
None,
None,
cop_curve,
None,
None,
None,
None,
None)
generation_components.append(heat_pump_component)
for pv in photovoltaics:
pv_id = pv['@generation_id']
pv_name = pv['@name']
pv_model_name = pv['@modelName']
pv_manufacturer = pv['@manufacturer']
pv_electricity_efficiency = pv['@nominalEfficiency']
pv_nominal_electricity_output = pv['@nominalPower']
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'])
# 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']
# 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
pv_component = PvGenerationSystem(pv_id,
pv_name,
pv_model_name,
pv_manufacturer,
pv_electricity_efficiency,
pv_nominal_electricity_output,
nominal_ambient_temperature,
nominal_cell_temperature,
nominal_radiation,
standard_test_condition_cell_temperature,
standard_test_condition_maximum_power,
cell_temperature_coefficient,
width,
height)
generation_components.append(pv_component)
for template in templates:
system_id = template['@generation_id']
system_name = template['@name']
if "Boiler" in system_name:
system_type = 'boiler'
fuel_type = template['@fuel']
heat_efficiency = float(template['@nominalEfficiency'])
source_medium = None
supply_medium = None
boiler_template = GenerationSystem(system_id,
system_name,
None,
None,
system_type,
fuel_type,
None,
None,
None,
source_medium,
supply_medium,
heat_efficiency,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None)
generation_components.append(boiler_template)
elif "Heat Pump" in system_name:
system_type = 'heat pump'
fuel_type = template['@fuel']
heat_efficiency = template['@nominalCOP']
source_medium = template['@heatSource']
supply_medium = template['@supply_medium']
heat_pump_template = GenerationSystem(system_id,
system_name,
None,
None,
system_type,
fuel_type,
None,
None,
None,
source_medium,
supply_medium,
heat_efficiency,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None,
None)
generation_components.append(heat_pump_template)
else:
electricity_efficiency = float(template['@nominalEfficiency'])
height = float(template['@height'])
width = float(template['@width'])
pv_template = PvGenerationSystem(system_id,
system_name,
None,
None,
electricity_efficiency,
None,
None,
None,
None,
None,
None,
None,
width,
height)
generation_components.append(pv_template)
return generation_components
def _load_storage_components(self):
storage_components = []
thermal_storages = self._archetypes['EnergySystemCatalog']['energy_storage_components']['thermalStorages']
template_storages = self._archetypes['EnergySystemCatalog']['energy_storage_components']['templateStorages']
for tes in thermal_storages:
storage_id = tes['@storage_id']
name = tes['@name']
@ -196,30 +316,57 @@ class NorthAmericaEnergySystemCatalog(Catalog):
layers,
maximum_operating_temperature)
storage_components.append(storage_component)
for template in template_storages:
storage_id = template['@storage_id']
name = template['@name']
maximum_temperature = template['@maxTemp']
materials = self._load_materials()
insulation_material_name = template['@insulationMaterial']
insulation_material = self._search_material(materials, insulation_material_name)
material_name = template['@tankMaterial']
tank_material = self._search_material(materials, material_name)
thickness = float(template['@insulationThickness']) / 100 # from cm to m
insulation_layer = Layer(None, 'insulation', insulation_material, thickness)
thickness = float(template['@tankThickness']) / 100 # from cm to m
tank_layer = Layer(None, 'insulation', tank_material, thickness)
# the convention is from outside to inside
layers = [insulation_layer, tank_layer]
storage_component = EnergyStorageSystem(storage_id,
name,
None,
None,
'thermal',
None,
None,
None,
None,
None,
None,
None,
layers,
maximum_temperature)
storage_components.append(storage_component)
return storage_components
# def _load_systems(self):
# systems = []
# catalog_systems = self._archetypes['encomp:EnergySystemCatalog']['energysystemconfiguration']
# for catalog_system in catalog_systems:
# system_configuration = catalog_system['@configurationName']
# demands = catalog_system['demands']
# demand_types = []
# for demand in demands:
# name = demand['@name']
# demand_types.append(name)
# _catalog_systems = []
# systems = self._archetypes['EnergySystemCatalog']['systems']['system']
# for system in systems:
# system_id = system['@id']
# name = system['@name']
# generation_components =
#
# energy_system = System(None,
# None,
# system_configuration,
# demand_types,
# system_id,
# None,
# None,
# None,
# None,
# None,
# None)
# systems.append(energy_system)
# return systems
# _catalog_systems.append(energy_system)
# return _catalog_systems
def _load_materials(self):
materials = []

View File

@ -40,12 +40,12 @@
<coefficients a="0.00109" b="0.209" c="-0.00291" d="-0.172" e="0.00102" f="8.95"/>
</performance_curve>
</heatPumps>
<templates generation_id="16" name="template Natural-Gas Boiler" nominalEfficiency="0.90"/>
<templates generation_id="17" name="template Electric Boiler" nominalEfficiency="0.95"/>
<templates generation_id="18" name="template Air-to-Water Heat Pump" fuel="Electricity" heatSource="Air" nominalCOP="3" supply_medium="water"/>
<templates generation_id="19" name="template Groundwater-to-Water Heat Pump" fuel="Electricity" heatSource="Ground" nominalCOP="3.5" supply_medium="water"/>
<templates generation_id="20" name="template Water-to-Water Heat Pump" fuel="Electricity" heatSource="Water" nominalCOP="3.5" supply_medium="water"/>
<templates generation_id="21" name="template Photovoltaic Module" nominalEfficiency="0.2" width="1.0" height="1.0"/>
<templateGenerationEquipments generation_id="16" name="template Natural-Gas Boiler" nominalEfficiency="0.90" fuel="natural gas"/>
<templateGenerationEquipments generation_id="17" name="template Electric Boiler" nominalEfficiency="0.95" fuel="electricity"/>
<templateGenerationEquipments generation_id="18" name="template Air-to-Water Heat Pump" fuel="Electricity" heatSource="Air" nominalCOP="3" supply_medium="water"/>
<templateGenerationEquipments generation_id="19" name="template Groundwater-to-Water Heat Pump" fuel="Electricity" heatSource="Ground" nominalCOP="3.5" supply_medium="water"/>
<templateGenerationEquipments generation_id="20" name="template Water-to-Water Heat Pump" fuel="Electricity" heatSource="Water" nominalCOP="3.5" supply_medium="water"/>
<templateGenerationEquipments generation_id="21" name="template Photovoltaic Module" nominalEfficiency="0.2" width="1.0" height="1.0"/>
<manufacturers manufacturer_id="1" name="Alpine" country="USA" product="Natural Gas Boiler"/>
<manufacturers manufacturer_id="2" name="Alta" country="USA" product="Natural Gas Boiler"/>
<manufacturers manufacturer_id="3" name="Aspen" country="USA" product="Natural Gas Boiler"/>
@ -59,7 +59,7 @@
<thermalStorages storage_id="3" name="Hot Water Storage Tank" modelName="HF 500" manufacturer="reflex" volume="0.5" maxTemp="95.0" insulationThickness="90.0" tankThickness="0" usesMedium="Water" insulationMaterial="Polyurethane" height="1.5" tankMaterial="Steel"/>
<thermalStorages storage_id="4" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" volume="0.5" maxTemp="95.0" insulationThickness="90.0" tankThickness="0" usesMedium="Water" insulationMaterial="Polyurethane" height="1.5" tankMaterial="Steel"/>
<thermalStorages storage_id="5" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" volume="0.5" maxTemp="95.0" insulationThickness="90.0" tankThickness="0" usesMedium="Water" insulationMaterial="Polyurethane" height="1.5" tankMaterial="Steel"/>
<templates storage_id="6" name="template Hot Water Storage Tank" maxTemp="95.0" insulationThickness="90.0" tankThickness="0" usesMedium="Water" insulationMaterial="Polyurethane" tankMaterial="Steel"/>
<templateStorages storage_id="6" name="template Hot Water Storage Tank" maxTemp="95.0" insulationThickness="90.0" tankThickness="0" usesMedium="Water" insulationMaterial="Polyurethane" tankMaterial="Steel"/>
<powerStorages/>
<manufacturers manufacturer_id="1" name="reflex" product="Storage Tank"/>
</energy_storage_components>