Compare commits

...

2 Commits

3 changed files with 72 additions and 15 deletions

View File

@ -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,26 @@ 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 = self.storage_medium.to_dictionary()
content = { content = {
'Storage component': 'Storage component':
{ {
@ -95,7 +109,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

View File

@ -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'])
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)
media = self._load_media()
media_id = tes['medium']['@medium_id']
medium = self._search_media(media, 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]
media = self._load_media()
media_id = template['medium']['@medium_id']
medium = self._search_media(media, 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_media(self):
media = []
_media = [self._archetypes['EnergySystemCatalog']['media']['medium']]
for _medium in _media:
medium_id = _medium['@medium_id']
name = _medium['@medium_name']
density = _medium['@density']
thermal_conductivity = _medium['@thermalConductivity']
specific_heat = _medium['@heatCapacity']
medium = Material(medium_id,
name,
None,
None,
None,
False,
None,
thermal_conductivity,
density,
specific_heat)
media.append(medium)
return media
@staticmethod
def _search_media(media, medium_id):
_medium = None
for medium in media:
if int(medium.id) == int(medium_id):
_medium = medium
break
if _medium is None:
raise ValueError(f'media with the id = [{medium_id}] not found in catalog ')
return _medium
@staticmethod @staticmethod
def _search_generation_equipment(generation_systems, generation_id): def _search_generation_equipment(generation_systems, generation_id):
_generation_systems = [] _generation_systems = []

View File

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<EnergySystemCatalog> <EnergySystemCatalog>
<schemas_path>./schemas/</schemas_path> <schemas_path>./schemas/</schemas_path>
<medias> <media>
<media media_id="1" media_name="Water" density="981.0" heatCapacity="4180.0" evaporationTemperature="100.0"/> <medium medium_id="1" medium_name="Water" density="981.0" heatCapacity="4180.0" thermalConductivity="0.6" evaporationTemperature="100.0"/>
</medias> </media>
<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"/>
<boilers generation_id="2" name="Natural-Gas Boiler" modelName="ALP105B" manufacturer="Alpine" installedThermalPower="28.0" minimumHeatOutput="6.15" maximumHeatOutput="30.8" modulationRange="0.88" nominalEfficiency="0.95" combi="true" fuel="natural gas"/> <boilers generation_id="2" name="Natural-Gas Boiler" modelName="ALP105B" manufacturer="Alpine" installedThermalPower="28.0" minimumHeatOutput="6.15" maximumHeatOutput="30.8" modulationRange="0.88" nominalEfficiency="0.95" combi="true" fuel="natural gas"/>
@ -73,32 +73,32 @@
<thermalStorages storage_id="1" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" maxTemp="95.0"> <thermalStorages storage_id="1" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" maxTemp="95.0">
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/> <insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
<physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/> <physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/>
<medium media_id="1" usesMedium="Water"/> <medium medium_id="1" usesMedium="Water"/>
</thermalStorages> </thermalStorages>
<thermalStorages storage_id="2" name="Hot Water Storage Tank" modelName="HF 300" manufacturer="reflex" maxTemp="95.0"> <thermalStorages storage_id="2" name="Hot Water Storage Tank" modelName="HF 300" manufacturer="reflex" maxTemp="95.0">
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/> <insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
<physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.6"/> <physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.6"/>
<medium media_id="1" usesMedium="Water"/> <medium medium_id="1" usesMedium="Water"/>
</thermalStorages> </thermalStorages>
<thermalStorages storage_id="3" name="Hot Water Storage Tank" modelName="HF 500" manufacturer="reflex" maxTemp="95.0"> <thermalStorages storage_id="3" name="Hot Water Storage Tank" modelName="HF 500" manufacturer="reflex" maxTemp="95.0">
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/> <insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
<physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/> <physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/>
<medium media_id="1" usesMedium="Water"/> <medium medium_id="1" usesMedium="Water"/>
</thermalStorages> </thermalStorages>
<thermalStorages storage_id="4" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" maxTemp="95.0"> <thermalStorages storage_id="4" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" maxTemp="95.0">
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/> <insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
<physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/> <physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/>
<medium media_id="1" usesMedium="Water"/> <medium medium_id="1" usesMedium="Water"/>
</thermalStorages> </thermalStorages>
<thermalStorages storage_id="5" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" maxTemp="95.0"> <thermalStorages storage_id="5" name="Hot Water Storage Tank" modelName="HF 200" manufacturer="reflex" maxTemp="95.0">
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/> <insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
<physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/> <physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel" volume="0.5"/>
<medium media_id="1" usesMedium="Water"/> <medium medium_id="1" usesMedium="Water"/>
</thermalStorages> </thermalStorages>
<templateStorages storage_id="6" name="template Hot Water Storage Tank" maxTemp="95.0"> <templateStorages storage_id="6" name="template Hot Water Storage Tank" maxTemp="95.0">
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/> <insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
<physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel"/> <physical_characteristics material_id="2" tankThickness="0" height="1.5" tankMaterial="Steel"/>
<medium media_id="1" usesMedium="Water"/> <medium medium_id="1" usesMedium="Water"/>
</templateStorages> </templateStorages>
<manufacturers manufacturer_id="1" name="reflex" product="Storage Tank"/> <manufacturers manufacturer_id="1" name="reflex" product="Storage Tank"/>
</energy_storage_components> </energy_storage_components>