added S to some lists, updated montreal_custom_catalog.py to new catalog classes and removed __future__ from those classes that didn't need it
This commit is contained in:
parent
7810f8f91d
commit
8763523d3b
|
@ -6,7 +6,6 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
|||
Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Union
|
||||
from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves
|
||||
|
||||
|
@ -23,7 +22,7 @@ class GenerationSystem:
|
|||
maximum_heat_supply_temperature, minimum_heat_supply_temperature,
|
||||
maximum_cooling_supply_temperature, minimum_cooling_supply_temperature, heat_output_curve,
|
||||
heat_fuel_consumption_curve, heat_efficiency_curve, cooling_output_curve, cooling_fuel_consumption_curve,
|
||||
cooling_efficiency_curve, storage, auxiliary_equipment):
|
||||
cooling_efficiency_curve):
|
||||
self._system_id = system_id
|
||||
self._name = name
|
||||
self._model_name = model_name
|
||||
|
@ -54,8 +53,6 @@ class GenerationSystem:
|
|||
self._cooling_output_curve = cooling_output_curve
|
||||
self._cooling_fuel_consumption_curve = cooling_fuel_consumption_curve
|
||||
self._cooling_efficiency_curve = cooling_efficiency_curve
|
||||
self._storage = storage
|
||||
self._auxiliary_equipment = auxiliary_equipment
|
||||
|
||||
@property
|
||||
def id(self):
|
||||
|
@ -297,27 +294,8 @@ class GenerationSystem:
|
|||
"""
|
||||
return self._cooling_efficiency_curve
|
||||
|
||||
@property
|
||||
def storage(self):
|
||||
"""
|
||||
Get boolean storage exists
|
||||
:return: bool
|
||||
"""
|
||||
return self._storage
|
||||
|
||||
@property
|
||||
def auxiliary_equipment(self) -> Union[None, GenerationSystem]:
|
||||
"""
|
||||
Get auxiliary_equipment
|
||||
:return: GenerationSystem
|
||||
"""
|
||||
return self._auxiliary_equipment
|
||||
|
||||
def to_dictionary(self):
|
||||
"""Class content to dictionary"""
|
||||
_auxiliary_equipment = []
|
||||
if self.auxiliary_equipment is not None:
|
||||
_auxiliary_equipment = self.auxiliary_equipment.to_dictionary()
|
||||
content = {'Energy Generation component': {
|
||||
'id': self.id,
|
||||
'name': self.name,
|
||||
|
@ -348,9 +326,7 @@ class GenerationSystem:
|
|||
'heat efficiency curve': self.heat_efficiency_curve,
|
||||
'cooling output curve': self.cooling_output_curve,
|
||||
'cooling fuel consumption curve': self.cooling_fuel_consumption_curve,
|
||||
'cooling efficiency curve': self.cooling_efficiency_curve,
|
||||
'it has storage': self.storage,
|
||||
'auxiliary equipment': _auxiliary_equipment
|
||||
'cooling efficiency curve': self.cooling_efficiency_curve
|
||||
}
|
||||
}
|
||||
return content
|
||||
|
|
|
@ -6,7 +6,6 @@ Project Coder Saeed Ranjbar saeed.ranjbar@concordia.ca
|
|||
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem
|
||||
|
||||
|
||||
|
|
|
@ -25,15 +25,15 @@ class System:
|
|||
name,
|
||||
demand_types,
|
||||
generation_systems,
|
||||
distribution_system,
|
||||
emission_system,
|
||||
distribution_systems,
|
||||
emission_systems,
|
||||
energy_storage_systems):
|
||||
self._lod = lod
|
||||
self._system_id = system_id
|
||||
self._name = name
|
||||
self._demand_types = demand_types
|
||||
self._distribution_system = distribution_system
|
||||
self._emission_system = emission_system
|
||||
self._distribution_systems = distribution_systems
|
||||
self._emission_systems = emission_systems
|
||||
self._generation_systems = generation_systems
|
||||
self._energy_storage_systems = energy_storage_systems
|
||||
# self._configuration = configuration
|
||||
|
@ -73,32 +73,32 @@ class System:
|
|||
@property
|
||||
def generation_systems(self) -> List[GenerationSystem]:
|
||||
"""
|
||||
Get generation system
|
||||
:return: GenerationSystem
|
||||
Get generation systems
|
||||
:return: [GenerationSystem]
|
||||
"""
|
||||
return self._generation_systems
|
||||
|
||||
@property
|
||||
def distribution_system(self) -> Union[None, List[DistributionSystem]]:
|
||||
def distribution_systems(self) -> Union[None, List[DistributionSystem]]:
|
||||
"""
|
||||
Get distribution system
|
||||
:return: DistributionSystem
|
||||
Get distribution systems
|
||||
:return: [DistributionSystem]
|
||||
"""
|
||||
return self._distribution_system
|
||||
return self._distribution_systems
|
||||
|
||||
@property
|
||||
def emission_system(self) -> Union[None, List[EmissionSystem]]:
|
||||
def emission_systems(self) -> Union[None, List[EmissionSystem]]:
|
||||
"""
|
||||
Get emission system
|
||||
:return: EmissionSystem
|
||||
Get emission systems
|
||||
:return: [EmissionSystem]
|
||||
"""
|
||||
return self._emission_system
|
||||
return self._emission_systems
|
||||
|
||||
@property
|
||||
def energy_storage_system(self) -> Union[None, List[EnergyStorageSystem]]:
|
||||
def energy_storage_systems(self) -> Union[None, List[EnergyStorageSystem]]:
|
||||
"""
|
||||
Get energy storage system
|
||||
:return: EnergyStorageSystem
|
||||
Get energy storage systems
|
||||
:return: [EnergyStorageSystem]
|
||||
"""
|
||||
return self._energy_storage_systems
|
||||
|
||||
|
@ -107,21 +107,21 @@ class System:
|
|||
_generation_systems = []
|
||||
for _generation in self.generation_systems:
|
||||
_generation_systems.append(_generation.to_dictionary())
|
||||
_distribution_system = [_distribution.to_dictionary() for _distribution in
|
||||
self.distribution_system] if self.distribution_system is not None else None
|
||||
_emission_system = [_emission.to_dictionary() for _emission in
|
||||
self.emission_system] if self.emission_system is not None else None
|
||||
_storage_system = [_storage.to_dictionary() for _storage in
|
||||
self.energy_storage_system] if self.energy_storage_system is not None else None
|
||||
_distribution_systems = [_distribution.to_dictionary() for _distribution in
|
||||
self.distribution_systems] if self.distribution_systems is not None else None
|
||||
_emission_systems = [_emission.to_dictionary() for _emission in
|
||||
self.emission_systems] if self.emission_systems is not None else None
|
||||
_storage_systems = [_storage.to_dictionary() for _storage in
|
||||
self.energy_storage_systems] if self.energy_storage_systems is not None else None
|
||||
|
||||
content = {'system': {'id': self.id,
|
||||
'name': self.name,
|
||||
'level of detail': self.lod,
|
||||
'demand types': self.demand_types,
|
||||
'generation system(s)': _generation_systems,
|
||||
'distribution system(s)': _distribution_system,
|
||||
'emission system(s)': _emission_system,
|
||||
'energy storage system(s)': _storage_system,
|
||||
'distribution system(s)': _distribution_systems,
|
||||
'emission system(s)': _emission_systems,
|
||||
'energy storage system(s)': _storage_systems,
|
||||
}
|
||||
}
|
||||
return content
|
||||
|
|
|
@ -14,6 +14,8 @@ from hub.catalog_factories.data_models.energy_systems.generation_system import G
|
|||
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.archetype import Archetype
|
||||
from hub.catalog_factories.data_models.energy_systems.thermal_storage_system import ThermalStorageSystem
|
||||
from hub.catalog_factories.data_models.energy_systems.electrical_storage_system import ElectricalStorageSystem
|
||||
|
||||
|
||||
class MontrealCustomCatalog(Catalog):
|
||||
|
@ -29,7 +31,8 @@ class MontrealCustomCatalog(Catalog):
|
|||
|
||||
self._lod = float(self._archetypes['catalog']['@lod'])
|
||||
|
||||
self._catalog_generation_equipments = self._load_generation_equipments()
|
||||
self._catalog_generation_equipments, self._catalog_storage_equipments = \
|
||||
self._load_generation_and_storage_equipments()
|
||||
self._catalog_distribution_equipments = self._load_distribution_equipments()
|
||||
self._catalog_emission_equipments = self._load_emission_equipments()
|
||||
self._catalog_systems = self._load_systems()
|
||||
|
@ -40,10 +43,11 @@ class MontrealCustomCatalog(Catalog):
|
|||
self._catalog_generation_equipments,
|
||||
self._catalog_distribution_equipments,
|
||||
self._catalog_emission_equipments,
|
||||
storages=None)
|
||||
None)
|
||||
|
||||
def _load_generation_equipments(self):
|
||||
def _load_generation_and_storage_equipments(self):
|
||||
_equipments = []
|
||||
_storages = []
|
||||
equipments = self._archetypes['catalog']['generation_equipments']['equipment']
|
||||
for equipment in equipments:
|
||||
equipment_id = float(equipment['@id'])
|
||||
|
@ -59,7 +63,6 @@ class MontrealCustomCatalog(Catalog):
|
|||
electricity_efficiency = None
|
||||
if 'electrical_efficiency' in equipment:
|
||||
electricity_efficiency = float(equipment['electrical_efficiency'])
|
||||
storage = literal_eval(equipment['storage'].capitalize())
|
||||
generation_system = GenerationSystem(equipment_id,
|
||||
name,
|
||||
None,
|
||||
|
@ -89,12 +92,19 @@ class MontrealCustomCatalog(Catalog):
|
|||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
storage,
|
||||
None)
|
||||
|
||||
_equipments.append(generation_system)
|
||||
return _equipments
|
||||
storage = literal_eval(equipment['storage'].capitalize())
|
||||
if storage:
|
||||
if equipment_type == 'electricity generator':
|
||||
storage_system = ElectricalStorageSystem(equipment_id, None, None, None, 'electrical', None, None, None, None,
|
||||
None, None, None)
|
||||
else:
|
||||
storage_system = ThermalStorageSystem(equipment_id, None, None, None, 'thermal', None, None, None, None, None,
|
||||
None)
|
||||
_storages.append(storage_system)
|
||||
|
||||
return _equipments, _storages
|
||||
|
||||
def _load_distribution_equipments(self):
|
||||
_equipments = []
|
||||
|
@ -156,6 +166,10 @@ class MontrealCustomCatalog(Catalog):
|
|||
for equipment_archetype in self._catalog_generation_equipments:
|
||||
if int(equipment_archetype.id) == int(generation_equipment):
|
||||
_generation_equipment = equipment_archetype
|
||||
_storage_equipment = None
|
||||
for equipment_archetype in self._catalog_storage_equipments:
|
||||
if int(equipment_archetype.id) == int(generation_equipment):
|
||||
_storage_equipment = equipment_archetype
|
||||
distribution_equipment = system['equipments']['distribution_id']
|
||||
_distribution_equipment = None
|
||||
for equipment_archetype in self._catalog_distribution_equipments:
|
||||
|
@ -171,10 +185,10 @@ class MontrealCustomCatalog(Catalog):
|
|||
system_id,
|
||||
name,
|
||||
demands,
|
||||
_generation_equipment,
|
||||
_distribution_equipment,
|
||||
_emission_equipment,
|
||||
energy_storage_systems=None))
|
||||
[_generation_equipment],
|
||||
[_distribution_equipment],
|
||||
[_emission_equipment],
|
||||
[_storage_equipment]))
|
||||
return _catalog_systems
|
||||
|
||||
def _load_archetypes(self):
|
||||
|
|
|
@ -104,7 +104,7 @@ class MontrealCustomEnergySystemParameters:
|
|||
energy_system.generation_system = _generation_system
|
||||
|
||||
_distribution_system = GenericDistributionSystem()
|
||||
archetype_distribution_equipment = system.distribution_system
|
||||
archetype_distribution_equipment = system.distribution_systems
|
||||
_distribution_system.type = archetype_distribution_equipment.type
|
||||
_distribution_system.supply_temperature = archetype_distribution_equipment.supply_temperature
|
||||
_distribution_system.distribution_consumption_fix_flow = \
|
||||
|
@ -139,10 +139,10 @@ class MontrealCustomEnergySystemParameters:
|
|||
|
||||
_building_distribution_system = DistributionSystem()
|
||||
_building_distribution_system.generic_distribution_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.distribution_system)
|
||||
copy.deepcopy(_generic_building_energy_system.distribution_systems)
|
||||
_building_emission_system = EmissionSystem()
|
||||
_building_emission_system.generic_emission_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.emission_system)
|
||||
copy.deepcopy(_generic_building_energy_system.emission_systems)
|
||||
_building_generation_system = GenerationSystem()
|
||||
_building_generation_system.generic_generation_system = \
|
||||
copy.deepcopy(_generic_building_energy_system.generation_system)
|
||||
|
|
|
@ -90,11 +90,11 @@ class TestSystemsFactory(TestCase):
|
|||
|
||||
_building_distribution_system = DistributionSystem()
|
||||
_building_distribution_system.generic_distribution_system = (
|
||||
copy.deepcopy(_generic_building_energy_system.distribution_system)
|
||||
copy.deepcopy(_generic_building_energy_system.distribution_systems)
|
||||
)
|
||||
_building_emission_system = EmissionSystem()
|
||||
_building_emission_system.generic_emission_system = (
|
||||
copy.deepcopy(_generic_building_energy_system.emission_system)
|
||||
copy.deepcopy(_generic_building_energy_system.emission_systems)
|
||||
)
|
||||
_building_generation_system = GenerationSystem()
|
||||
_building_generation_system.generic_generation_system = (
|
||||
|
|
Loading…
Reference in New Issue
Block a user