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.energy_systems.energy_storage_system import EnergyStorageSystem
|
||||||
from hub.catalog_factories.data_models.construction.layer import Layer
|
from hub.catalog_factories.data_models.construction.layer import Layer
|
||||||
|
from hub.catalog_factories.data_models.construction.material import Material
|
||||||
|
|
||||||
class ThermalStorageSystem(EnergyStorageSystem):
|
class ThermalStorageSystem(EnergyStorageSystem):
|
||||||
""""
|
""""
|
||||||
|
@ -17,7 +17,7 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
||||||
|
|
||||||
def __init__(self, storage_id, model_name=None, manufacturer=None, storage_type=None,
|
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,
|
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)
|
super().__init__(storage_id, model_name, manufacturer, nominal_capacity, losses_ratio)
|
||||||
self._type_energy_stored = 'thermal'
|
self._type_energy_stored = 'thermal'
|
||||||
|
@ -26,6 +26,7 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
||||||
self._height = height
|
self._height = height
|
||||||
self._layers = layers
|
self._layers = layers
|
||||||
self._maximum_operating_temperature = maximum_operating_temperature
|
self._maximum_operating_temperature = maximum_operating_temperature
|
||||||
|
self._storage_medium = storage_medium
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def type_energy_stored(self):
|
def type_energy_stored(self):
|
||||||
|
@ -75,13 +76,28 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
||||||
"""
|
"""
|
||||||
return self._maximum_operating_temperature
|
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):
|
def to_dictionary(self):
|
||||||
"""Class content to dictionary"""
|
"""Class content to dictionary"""
|
||||||
_layers = None
|
_layers = None
|
||||||
|
# _medias = None
|
||||||
if self.layers is not None:
|
if self.layers is not None:
|
||||||
_layers = []
|
_layers = []
|
||||||
for _layer in self.layers:
|
for _layer in self.layers:
|
||||||
_layers.append(_layer.to_dictionary())
|
_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 = {
|
content = {
|
||||||
'Storage component':
|
'Storage component':
|
||||||
{
|
{
|
||||||
|
@ -95,7 +111,8 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
||||||
'volume [m3]': self.volume,
|
'volume [m3]': self.volume,
|
||||||
'height [m]': self.height,
|
'height [m]': self.height,
|
||||||
'layers': _layers,
|
'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
|
return content
|
||||||
|
|
|
@ -28,7 +28,8 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
path = str(path / 'north_america_systems.xml')
|
path = str(path / 'north_america_systems.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(), 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._storage_components = self._load_storage_components()
|
||||||
self._generation_components = self._load_generation_components()
|
self._generation_components = self._load_generation_components()
|
||||||
|
@ -208,6 +209,9 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
||||||
insulation_layer = Layer(None, 'insulation', insulation_material, thickness)
|
insulation_layer = Layer(None, 'insulation', insulation_material, thickness)
|
||||||
thickness = float(tes['physical_characteristics']['@tankThickness']) / 100 # from cm to m
|
thickness = float(tes['physical_characteristics']['@tankThickness']) / 100 # from cm to m
|
||||||
tank_layer = Layer(None, 'tank', tank_material, thickness)
|
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
|
# the convention is from outside to inside
|
||||||
layers = [insulation_layer, tank_layer]
|
layers = [insulation_layer, tank_layer]
|
||||||
storage_component = ThermalStorageSystem(storage_id,
|
storage_component = ThermalStorageSystem(storage_id,
|
||||||
|
@ -219,7 +223,8 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
||||||
volume,
|
volume,
|
||||||
height,
|
height,
|
||||||
layers,
|
layers,
|
||||||
maximum_operating_temperature)
|
maximum_operating_temperature,
|
||||||
|
medium)
|
||||||
storage_components.append(storage_component)
|
storage_components.append(storage_component)
|
||||||
|
|
||||||
for template in template_storages:
|
for template in template_storages:
|
||||||
|
@ -238,6 +243,9 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
||||||
tank_layer = Layer(None, 'tank', tank_material, thickness)
|
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]
|
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,
|
storage_component = ThermalStorageSystem(storage_id,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
|
@ -247,7 +255,8 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
||||||
None,
|
None,
|
||||||
height,
|
height,
|
||||||
layers,
|
layers,
|
||||||
maximum_temperature)
|
maximum_temperature,
|
||||||
|
medium)
|
||||||
storage_components.append(storage_component)
|
storage_components.append(storage_component)
|
||||||
return storage_components
|
return storage_components
|
||||||
|
|
||||||
|
@ -316,6 +325,39 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
||||||
raise ValueError(f'Material with the id = [{material_id}] not found in catalog ')
|
raise ValueError(f'Material with the id = [{material_id}] not found in catalog ')
|
||||||
return _material
|
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
|
@staticmethod
|
||||||
def _search_generation_equipment(generation_systems, generation_id):
|
def _search_generation_equipment(generation_systems, generation_id):
|
||||||
_generation_systems = []
|
_generation_systems = []
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<EnergySystemCatalog>
|
<EnergySystemCatalog>
|
||||||
<schemas_path>./schemas/</schemas_path>
|
<schemas_path>./schemas/</schemas_path>
|
||||||
<medias>
|
<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>
|
</medias>
|
||||||
<energy_generation_components>
|
<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"/>
|
<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