forked from s_ranjbar/city_retrofit
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
11f78ccb89
commit
673cbac77a
|
@ -87,16 +87,14 @@ class ThermalStorageSystem(EnergyStorageSystem):
|
|||
def to_dictionary(self):
|
||||
"""Class content to dictionary"""
|
||||
_layers = None
|
||||
# _medias = 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())
|
||||
if self.storage_medium is not None:
|
||||
_medias = self.storage_medium.to_dictionary()
|
||||
|
||||
content = {
|
||||
'Storage component':
|
||||
|
|
|
@ -29,7 +29,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
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', 'medias'])
|
||||
force_list=['photovoltaicModules', 'templateStorages', 'demand'])
|
||||
|
||||
self._storage_components = self._load_storage_components()
|
||||
self._generation_components = self._load_generation_components()
|
||||
|
@ -209,9 +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)
|
||||
media = self._load_media()
|
||||
media_id = tes['medium']['@medium_id']
|
||||
medium = self._search_media(media, media_id)
|
||||
# the convention is from outside to inside
|
||||
layers = [insulation_layer, tank_layer]
|
||||
storage_component = ThermalStorageSystem(storage_id,
|
||||
|
@ -243,9 +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)
|
||||
media = self._load_media()
|
||||
media_id = template['medium']['@medium_id']
|
||||
medium = self._search_media(media, media_id)
|
||||
storage_component = ThermalStorageSystem(storage_id,
|
||||
None,
|
||||
None,
|
||||
|
@ -325,16 +325,16 @@ 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,
|
||||
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,
|
||||
|
@ -344,19 +344,19 @@ class NorthAmericaEnergySystemCatalog(Catalog):
|
|||
thermal_conductivity,
|
||||
density,
|
||||
specific_heat)
|
||||
medias.append(media)
|
||||
return medias
|
||||
media.append(medium)
|
||||
return media
|
||||
|
||||
@staticmethod
|
||||
def _search_medias(medias, media_id):
|
||||
_media = None
|
||||
for media in medias:
|
||||
if int(media.id) == int(media_id):
|
||||
_media = media
|
||||
def _search_media(media, medium_id):
|
||||
_medium = None
|
||||
for medium in media:
|
||||
if int(medium.id) == int(medium_id):
|
||||
_medium = medium
|
||||
break
|
||||
if _media is None:
|
||||
raise ValueError(f'media with the id = [{media_id}] not found in catalog ')
|
||||
return _media
|
||||
if _medium is None:
|
||||
raise ValueError(f'media with the id = [{medium_id}] not found in catalog ')
|
||||
return _medium
|
||||
|
||||
@staticmethod
|
||||
def _search_generation_equipment(generation_systems, generation_id):
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<EnergySystemCatalog>
|
||||
<schemas_path>./schemas/</schemas_path>
|
||||
<medias>
|
||||
<media media_id="1" media_name="Water" density="981.0" heatCapacity="4180.0" thermalConductivity="0.6" evaporationTemperature="100.0"/>
|
||||
</medias>
|
||||
<media>
|
||||
<medium medium_id="1" medium_name="Water" density="981.0" heatCapacity="4180.0" thermalConductivity="0.6" evaporationTemperature="100.0"/>
|
||||
</media>
|
||||
<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="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">
|
||||
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
|
||||
<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 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"/>
|
||||
<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 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"/>
|
||||
<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 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"/>
|
||||
<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 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"/>
|
||||
<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>
|
||||
<templateStorages storage_id="6" name="template Hot Water Storage Tank" maxTemp="95.0">
|
||||
<insulation material_id="1" insulationMaterial="Polyurethane" insulationThickness="90.0"/>
|
||||
<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>
|
||||
<manufacturers manufacturer_id="1" name="reflex" product="Storage Tank"/>
|
||||
</energy_storage_components>
|
||||
|
|
Loading…
Reference in New Issue
Block a user