added storage_medium attribute to thermal_storage_system.py to enable us use water thermodynamic characteristics in the modelling
This commit is contained in:
parent
57c7a76529
commit
11f78ccb89
|
@ -8,7 +8,7 @@ Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
|
|||
|
||||
from hub.catalog_factories.data_models.energy_systems.energy_storage_system import EnergyStorageSystem
|
||||
from hub.catalog_factories.data_models.construction.layer import Layer
|
||||
|
||||
from hub.catalog_factories.data_models.construction.material import Material
|
||||
|
||||
class ThermalStorageSystem(EnergyStorageSystem):
|
||||
""""
|
||||
|
@ -17,7 +17,7 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
|||
|
||||
def __init__(self, storage_id, model_name=None, manufacturer=None, storage_type=None,
|
||||
nominal_capacity=None, losses_ratio=None, volume=None, height=None, layers=None,
|
||||
maximum_operating_temperature=None):
|
||||
maximum_operating_temperature=None, storage_medium=None):
|
||||
|
||||
super().__init__(storage_id, model_name, manufacturer, nominal_capacity, losses_ratio)
|
||||
self._type_energy_stored = 'thermal'
|
||||
|
@ -26,6 +26,7 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
|||
self._height = height
|
||||
self._layers = layers
|
||||
self._maximum_operating_temperature = maximum_operating_temperature
|
||||
self._storage_medium = storage_medium
|
||||
|
||||
@property
|
||||
def type_energy_stored(self):
|
||||
|
@ -75,13 +76,28 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
|||
"""
|
||||
return self._maximum_operating_temperature
|
||||
|
||||
@property
|
||||
def storage_medium(self) -> Material:
|
||||
"""
|
||||
Get thermodynamic characteristics of the storage medium
|
||||
:return: [material
|
||||
"""
|
||||
return self._storage_medium
|
||||
|
||||
def to_dictionary(self):
|
||||
"""Class content to dictionary"""
|
||||
_layers = None
|
||||
# _medias = None
|
||||
if self.layers is not None:
|
||||
_layers = []
|
||||
for _layer in self.layers:
|
||||
_layers.append(_layer.to_dictionary())
|
||||
|
||||
# if self.storage_medium is not None:
|
||||
# _medias = []
|
||||
# for _media in self.storage_medium:
|
||||
# _medias.append(_media.to_dictionary())
|
||||
|
||||
content = {
|
||||
'Storage component':
|
||||
{
|
||||
|
@ -95,7 +111,8 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
|||
'volume [m3]': self.volume,
|
||||
'height [m]': self.height,
|
||||
'layers': _layers,
|
||||
'maximum operating temperature [Celsius]': self.maximum_operating_temperature
|
||||
'maximum operating temperature [Celsius]': self.maximum_operating_temperature,
|
||||
'storage_medium': self.storage_medium.to_dictionary()
|
||||
}
|
||||
}
|
||||
return content
|
||||
|
|
|
@ -28,7 +28,8 @@ 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', 'templateStorages', 'demand'])
|
||||
self._archetypes = xmltodict.parse(xml.read(),
|
||||
force_list=['photovoltaicModules', 'templateStorages', 'demand', 'medias'])
|
||||
|
||||
self._storage_components = self._load_storage_components()
|
||||
self._generation_components = self._load_generation_components()
|
||||
|
@ -208,6 +209,9 @@ 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)
|
||||
medias = self._load_medias()
|
||||
media_id = tes['medium']['@media_id']
|
||||
medium = self._search_medias(medias, media_id)
|
||||
# the convention is from outside to inside
|
||||
layers = [insulation_layer, tank_layer]
|
||||
storage_component = ThermalStorageSystem(storage_id,
|
||||
|
@ -219,7 +223,8 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
volume,
|
||||
height,
|
||||
layers,
|
||||
maximum_operating_temperature)
|
||||
maximum_operating_temperature,
|
||||
medium)
|
||||
storage_components.append(storage_component)
|
||||
|
||||
for template in template_storages:
|
||||
|
@ -238,6 +243,9 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
tank_layer = Layer(None, 'tank', tank_material, thickness)
|
||||
# the convention is from outside to inside
|
||||
layers = [insulation_layer, tank_layer]
|
||||
medias = self._load_medias()
|
||||
media_id = template['medium']['@media_id']
|
||||
medium = self._search_medias(medias, media_id)
|
||||
storage_component = ThermalStorageSystem(storage_id,
|
||||
None,
|
||||
None,
|
||||
|
@ -247,7 +255,8 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
None,
|
||||
height,
|
||||
layers,
|
||||
maximum_temperature)
|
||||
maximum_temperature,
|
||||
medium)
|
||||
storage_components.append(storage_component)
|
||||
return storage_components
|
||||
|
||||
|
@ -316,6 +325,39 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
raise ValueError(f'Material with the id = [{material_id}] not found in catalog ')
|
||||
return _material
|
||||
|
||||
def _load_medias(self):
|
||||
medias = []
|
||||
_medias = self._archetypes['EnergySystemCatalog']['medias']
|
||||
for _media in _medias:
|
||||
media_id = _media['media']['@media_id']
|
||||
name = _media['media']['@media_name']
|
||||
density = _media['media']['@density']
|
||||
thermal_conductivity = _media['media']['@thermalConductivity']
|
||||
specific_heat = _media['media']['@heatCapacity']
|
||||
media = Material(media_id,
|
||||
name,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
False,
|
||||
None,
|
||||
thermal_conductivity,
|
||||
density,
|
||||
specific_heat)
|
||||
medias.append(media)
|
||||
return medias
|
||||
|
||||
@staticmethod
|
||||
def _search_medias(medias, media_id):
|
||||
_media = None
|
||||
for media in medias:
|
||||
if int(media.id) == int(media_id):
|
||||
_media = media
|
||||
break
|
||||
if _media is None:
|
||||
raise ValueError(f'media with the id = [{media_id}] not found in catalog ')
|
||||
return _media
|
||||
|
||||
@staticmethod
|
||||
def _search_generation_equipment(generation_systems, generation_id):
|
||||
_generation_systems = []
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<EnergySystemCatalog>
|
||||
<schemas_path>./schemas/</schemas_path>
|
||||
<medias>
|
||||
<media media_id="1" media_name="Water" density="981.0" heatCapacity="4180.0" evaporationTemperature="100.0"/>
|
||||
<media media_id="1" media_name="Water" density="981.0" heatCapacity="4180.0" thermalConductivity="0.6" evaporationTemperature="100.0"/>
|
||||
</medias>
|
||||
<energy_generation_components>
|
||||
<boilers generation_id="1" name="Natural-Gas Boiler" modelName="ALP080B" manufacturer="Alpine" installedThermalPower="21.0" minimumHeatOutput="4.7" maximumHeatOutput="23.5" modulationRange="0.88" nominalEfficiency="0.95" combi="true" fuel="natural gas"/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user