energy_storage_system.py is modified and inherited by thermal_storage_system.py and electrical_storage_system.py

This commit is contained in:
Saeed Ranjbar 2023-08-29 11:45:02 -04:00
parent 24a670755a
commit 644b1c9346
7 changed files with 211 additions and 141 deletions

View File

@ -56,3 +56,5 @@ class Archetype:
}
}
return content

View File

@ -69,11 +69,4 @@ class Content:
return content
def __str__(self):
"""Print content"""
_archetypes = []
for _archetype in self.archetypes:
_archetypes.append(_archetype.to_dictionary())
content = {'Archetypes': _archetypes}
return str(content)

View File

@ -0,0 +1,90 @@
"""
Energy System catalog heat generation system
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from __future__ import annotations
from hub.catalog_factories.data_models.energy_systems.energy_storage_system import EnergyStorageSystem
class ThermalStorageSystem(EnergyStorageSystem):
"""
Thermal Storage system class
"""
def __init__(self, storage_id, name, model_name, manufacturer, storage_type, rated_output_power,
nominal_efficiency, battery_voltage, depth_of_discharge, self_discharge_rate):
super().__init__(storage_id=storage_id, name=name, model_name=model_name,
manufacturer=manufacturer)
self._storage_type = storage_type
self._rated_output_power = rated_output_power
self._nominal_efficiency = nominal_efficiency
self._battery_voltage = battery_voltage
self._depth_of_discharge = depth_of_discharge
self._self_discharge_rate = self_discharge_rate
@property
def storage_type(self):
"""
Get storage type from ['lithium_ion', 'lead_acid', 'NiCd']
:return: string
"""
return self._storage_type
@property
def rated_output_power(self):
"""
Get the rated output power of storage system in kW
:return: float
"""
return self._rated_output_power
@property
def nominal_efficiency(self):
"""
Get the nominal efficiency of the storage system
:return: float
"""
return self._nominal_efficiency
@property
def battery_voltage(self):
"""
Get the battery voltage in Volt
:return: float
"""
return self._battery_voltage
@property
def depth_of_discharge(self):
"""
Get the depth of discharge as a percentage
:return: float
"""
return self._depth_of_discharge
@property
def self_discharge_rate(self):
"""
Get the self discharge rate of battery as a percentage
:return: float
"""
return self._self_discharge_rate
def to_dictionary(self):
"""Class content to dictionary"""
content = {'Storage component': {
'storage id': self.id,
'name': self.name,
'model name': self.model_name,
'manufacturer': self.manufacturer,
'storage type': self.storage_type,
'rated power [kW]': self.rated_output_power,
'nominal efficiency': self.nominal_efficiency,
'battery voltage [V]': self.battery_voltage,
'depth of discharge': self.depth_of_discharge,
}
}
return content

View File

@ -15,23 +15,12 @@ class EnergyStorageSystem:
Energy Storage System Class
"""
def __init__(self, storage_id, name, model_name, manufacturer, storage_type, volume, rated_output_power,
nominal_efficiency, battery_voltage, depth_of_discharge, self_discharge_rate, height, layers,
maximum_operating_temperature):
def __init__(self, storage_id, name, model_name, manufacturer, storage_type):
self._storage_id = storage_id
self._name = name
self._model_name = model_name
self._manufacturer = manufacturer
self._storage_type = storage_type
self._physical_volume = volume
self._rated_output_power = rated_output_power
self._nominal_efficiency = nominal_efficiency
self._battery_voltage = battery_voltage
self._depth_of_discharge = depth_of_discharge
self._self_discharge_rate = self_discharge_rate
self._height = height
self._layers = layers
self._maximum_operating_temperature = maximum_operating_temperature
@property
def id(self):
@ -73,78 +62,6 @@ class EnergyStorageSystem:
"""
return self._storage_type
@property
def physical_volume(self):
"""
Get the physical volume of the storage system in cubic meters
:return: float
"""
return self._physical_volume
@property
def rated_output_power(self):
"""
Get the rated output power of storage system in kW
:return: float
"""
return self._rated_output_power
@property
def nominal_efficiency(self):
"""
Get the nominal efficiency of the storage system
:return: float
"""
return self._nominal_efficiency
@property
def battery_voltage(self):
"""
Get the battery voltage in Volt
:return: float
"""
return self._battery_voltage
@property
def depth_of_discharge(self):
"""
Get the depth of discharge as a percentage
:return: float
"""
return self._depth_of_discharge
@property
def self_discharge_rate(self):
"""
Get the self discharge rate of battery as a percentage
:return: float
"""
return self._self_discharge_rate
@property
def height(self):
"""
Get the diameter of the storage system in meters
:return: float
"""
return self._height
@property
def layers(self) -> [Layer]:
"""
Get construction layers
:return: [layer]
"""
return self._layers
@property
def maximum_operating_temperature(self):
"""
Get maximum operating temperature of the storage system in degree Celsius
:return: float
"""
return self._maximum_operating_temperature
def to_dictionary(self):
"""Class content to dictionary"""
_layers = []
@ -155,16 +72,7 @@ class EnergyStorageSystem:
'name': self.name,
'model name': self.model_name,
'manufacturer': self.manufacturer,
'storage type': self.storage_type,
'physical volume [m3]': self.physical_volume,
'rated power [kW]': self.rated_output_power,
'nominal efficiency': self.nominal_efficiency,
'battery voltage [V]': self.battery_voltage,
'depth of discharge': self.depth_of_discharge,
'self discharge rate': self.self_discharge_rate,
'height [m]': self.height,
'layers': _layers,
'maximum operating temperature [Celsius]': self.maximum_operating_temperature
'storage type': self.storage_type
}
}
return content

View File

@ -0,0 +1,84 @@
"""
Energy System catalog heat generation system
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from __future__ import annotations
from hub.catalog_factories.data_models.construction.layer import Layer
from hub.catalog_factories.data_models.energy_systems.energy_storage_system import EnergyStorageSystem
class ThermalStorageSystem(EnergyStorageSystem):
"""
Thermal Storage system class
"""
def __init__(self, storage_id, name, model_name, manufacturer, storage_type, volume, height, layers,
maximum_operating_temperature):
super().__init__(storage_id=storage_id, name=name, model_name=model_name,
manufacturer=manufacturer, storage_type=storage_type)
self._volume = volume
self._height = height
self._layers = layers
self._maximum_operating_temperature = maximum_operating_temperature
@property
def storage_type(self):
"""
Get storage type from ['sensible', 'latent']
:return: string
"""
return self._storage_type
@property
def volume(self):
"""
Get the physical volume of the storage system in cubic meters
:return: float
"""
return self._volume
@property
def height(self):
"""
Get the diameter of the storage system in meters
:return: float
"""
return self._height
@property
def layers(self) -> [Layer]:
"""
Get construction layers
:return: [layer]
"""
return self._layers
@property
def maximum_operating_temperature(self):
"""
Get maximum operating temperature of the storage system in degree Celsius
:return: float
"""
return self._maximum_operating_temperature
def to_dictionary(self):
"""Class content to dictionary"""
_layers = []
for _layer in self.layers:
_layers.append(_layer.to_dictionary())
content = {'Storage component': {
'storage id': self.id,
'name': self.name,
'model name': self.model_name,
'manufacturer': self.manufacturer,
'storage type': self.storage_type,
'volume [m3]': self.physical_volume,
'height [m]': self.height,
'layers': _layers,
'maximum operating temperature [Celsius]': self.maximum_operating_temperature
}
}
return content

View File

@ -6,14 +6,13 @@ Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import xmltodict
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.energy_storage_system import EnergyStorageSystem
from hub.catalog_factories.data_models.energy_systems.thermal_storage_system import ThermalStorageSystem
from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves
from hub.catalog_factories.data_models.energy_systems.archetype import Archetype
from hub.catalog_factories.data_models.construction.material import Material
@ -40,7 +39,6 @@ class NorthAmericaEnergySystemCatalog(Catalog):
None,
self._storage_components)
print(self._content)
def _load_generation_components(self):
generation_components = []
boilers = self._archetypes['EnergySystemCatalog']['energy_generation_components']['boilers']
@ -135,7 +133,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
None,
None,
None,
heat_pump_minimum_heat_supply_temperature,
heat_pump_maximum_heat_supply_temperature,
heat_pump_minimum_heat_supply_temperature,
heat_pump_maximum_cooling_supply_temperature,
heat_pump_minimum_cooling_supply_temperature,
@ -291,6 +289,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
name = tes['@name']
model_name = tes['@modelName']
manufacturer = tes['@manufacturer']
storage_type = 'sensible'
volume = tes['physical_characteristics']['@volume']
height = tes['physical_characteristics']['@height']
maximum_operating_temperature = tes['@maxTemp']
@ -303,19 +302,14 @@ class NorthAmericaEnergySystemCatalog(Catalog):
insulation_layer = Layer(None, 'insulation', insulation_material, thickness)
thickness = float(tes['physical_characteristics']['@tankThickness']) / 100 # from cm to m
tank_layer = Layer(None, 'tank', tank_material, thickness)
# the convention is from outside to inside
# the convention is from outside to inside
layers = [insulation_layer, tank_layer]
storage_component = EnergyStorageSystem(storage_id,
storage_component = ThermalStorageSystem(storage_id,
name,
model_name,
manufacturer,
'thermal',
storage_type,
volume,
None,
None,
None,
None,
None,
height,
layers,
maximum_operating_temperature)
@ -324,30 +318,27 @@ class NorthAmericaEnergySystemCatalog(Catalog):
for template in template_storages:
storage_id = template['@storage_id']
name = template['@name']
storage_type = 'sensible'
maximum_temperature = template['@maxTemp']
height = template['physical_characteristics']['@height']
materials = self._load_materials()
insulation_material_id = tes['insulation']['@material_id']
insulation_material_id = template['insulation']['@material_id']
insulation_material = self._search_material(materials, insulation_material_id)
material_id = tes['physical_characteristics']['@material_id']
material_id = template['physical_characteristics']['@material_id']
tank_material = self._search_material(materials, material_id)
thickness = float(tes['insulation']['@insulationThickness']) / 100 # from cm to m
thickness = float(template['insulation']['@insulationThickness']) / 100 # from cm to m
insulation_layer = Layer(None, 'insulation', insulation_material, thickness)
thickness = float(tes['physical_characteristics']['@tankThickness']) / 100 # from cm to m
thickness = float(template['physical_characteristics']['@tankThickness']) / 100 # from cm to m
tank_layer = Layer(None, 'tank', tank_material, thickness)
# the convention is from outside to inside
# the convention is from outside to inside
layers = [insulation_layer, tank_layer]
storage_component = EnergyStorageSystem(storage_id,
storage_component = ThermalStorageSystem(storage_id,
name,
None,
None,
'thermal',
None,
None,
None,
None,
None,
None,
storage_type,
None,
height,
layers,
maximum_temperature)
storage_components.append(storage_component)

View File

@ -38,5 +38,7 @@ class TestSystemsCatalog(TestCase):
def test_north_america_systems_catalog(self):
catalog = EnergySystemsCatalogFactory('north_america').catalog
def test_montreal_catalog(self):
catalog = EnergySystemsCatalogFactory('montreal_custom').catalog
# def test_montreal_catalog(self):
# catalog = EnergySystemsCatalogFactory('montreal_custom').catalog