Compare commits

..

No commits in common. "56c84ad39988c8cb2a6c230bcbaee0b6bc3046fa" and "b7c2bbae96f82ebf9d3e71924b9d3259fac1cfe1" have entirely different histories.

5 changed files with 18 additions and 28 deletions

View File

@ -69,11 +69,4 @@ class Content:
return 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

@ -9,8 +9,7 @@ Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
from typing import Union, List from typing import Union, List
from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem
from hub.catalog_factories.data_models.energy_systems.thermal_storage_system import ThermalStorageSystem from hub.catalog_factories.data_models.energy_systems.energy_storage_system import EnergyStorageSystem
from hub.catalog_factories.data_models.energy_systems.electrical_storage_system import ElectricalStorageSystem
from hub.catalog_factories.data_models.energy_systems.distribution_system import DistributionSystem from hub.catalog_factories.data_models.energy_systems.distribution_system import DistributionSystem
from hub.catalog_factories.data_models.energy_systems.emission_system import EmissionSystem from hub.catalog_factories.data_models.energy_systems.emission_system import EmissionSystem
@ -96,7 +95,7 @@ class System:
return self._emission_systems return self._emission_systems
@property @property
def energy_storage_systems(self) -> Union[None, List[ThermalStorageSystem], List[ElectricalStorageSystem]]: def energy_storage_systems(self) -> Union[None, List[EnergyStorageSystem]]:
""" """
Get energy storage systems Get energy storage systems
:return: [EnergyStorageSystem] :return: [EnergyStorageSystem]

View File

@ -67,11 +67,9 @@ class ThermalStorageSystem(EnergyStorageSystem):
def to_dictionary(self): def to_dictionary(self):
"""Class content to dictionary""" """Class content to dictionary"""
_layers = None _layers = []
if self.layers is not None: for _layer in self.layers:
_layers = [] _layers.append(_layer.to_dictionary())
for _layer in self.layers:
_layers.append(_layer.to_dictionary())
content = {'Storage component': { content = {'Storage component': {
'storage id': self.id, 'storage id': self.id,
'name': self.name, 'name': self.name,

View File

@ -162,33 +162,33 @@ class MontrealCustomCatalog(Catalog):
name = system['name'] name = system['name']
demands = system['demands']['demand'] demands = system['demands']['demand']
generation_equipment = system['equipments']['generation_id'] generation_equipment = system['equipments']['generation_id']
_generation_equipments = None _generation_equipment = None
for equipment_archetype in self._catalog_generation_equipments: for equipment_archetype in self._catalog_generation_equipments:
if int(equipment_archetype.id) == int(generation_equipment): if int(equipment_archetype.id) == int(generation_equipment):
_generation_equipments = [equipment_archetype] _generation_equipment = equipment_archetype
_storage_equipments = None _storage_equipment = None
for equipment_archetype in self._catalog_storage_equipments: for equipment_archetype in self._catalog_storage_equipments:
if int(equipment_archetype.id) == int(generation_equipment): if int(equipment_archetype.id) == int(generation_equipment):
_storage_equipments = [equipment_archetype] _storage_equipment = equipment_archetype
distribution_equipment = system['equipments']['distribution_id'] distribution_equipment = system['equipments']['distribution_id']
_distribution_equipments = None _distribution_equipment = None
for equipment_archetype in self._catalog_distribution_equipments: for equipment_archetype in self._catalog_distribution_equipments:
if int(equipment_archetype.id) == int(distribution_equipment): if int(equipment_archetype.id) == int(distribution_equipment):
_distribution_equipments = [equipment_archetype] _distribution_equipment = equipment_archetype
emission_equipment = system['equipments']['dissipation_id'] emission_equipment = system['equipments']['dissipation_id']
_emission_equipments = None _emission_equipment = None
for equipment_archetype in self._catalog_emission_equipments: for equipment_archetype in self._catalog_emission_equipments:
if int(equipment_archetype.id) == int(emission_equipment): if int(equipment_archetype.id) == int(emission_equipment):
_emission_equipments = [equipment_archetype] _emission_equipment = equipment_archetype
_catalog_systems.append(System(self._lod, _catalog_systems.append(System(self._lod,
system_id, system_id,
name, name,
demands, demands,
_generation_equipments, [_generation_equipment],
_distribution_equipments, [_distribution_equipment],
_emission_equipments, [_emission_equipment],
_storage_equipments)) [_storage_equipment]))
return _catalog_systems return _catalog_systems
def _load_archetypes(self): def _load_archetypes(self):

View File

@ -38,7 +38,7 @@ class NorthAmericaEnergySystemCatalog(Catalog):
None, None,
None, None,
self._storage_components) self._storage_components)
print(self._content)
def _load_generation_components(self): def _load_generation_components(self):
generation_components = [] generation_components = []
boilers = self._archetypes['EnergySystemCatalog']['energy_generation_components']['boilers'] boilers = self._archetypes['EnergySystemCatalog']['energy_generation_components']['boilers']