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
|
Code contributors: Saeed Ranjbar saeed.ranjbar@concordia.ca
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from __future__ import annotations
|
|
||||||
from typing import Union
|
from typing import Union
|
||||||
from hub.catalog_factories.data_models.energy_systems.performance_curves import PerformanceCurves
|
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_heat_supply_temperature, minimum_heat_supply_temperature,
|
||||||
maximum_cooling_supply_temperature, minimum_cooling_supply_temperature, heat_output_curve,
|
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,
|
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._system_id = system_id
|
||||||
self._name = name
|
self._name = name
|
||||||
self._model_name = model_name
|
self._model_name = model_name
|
||||||
|
@ -54,8 +53,6 @@ class GenerationSystem:
|
||||||
self._cooling_output_curve = cooling_output_curve
|
self._cooling_output_curve = cooling_output_curve
|
||||||
self._cooling_fuel_consumption_curve = cooling_fuel_consumption_curve
|
self._cooling_fuel_consumption_curve = cooling_fuel_consumption_curve
|
||||||
self._cooling_efficiency_curve = cooling_efficiency_curve
|
self._cooling_efficiency_curve = cooling_efficiency_curve
|
||||||
self._storage = storage
|
|
||||||
self._auxiliary_equipment = auxiliary_equipment
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def id(self):
|
def id(self):
|
||||||
|
@ -297,27 +294,8 @@ class GenerationSystem:
|
||||||
"""
|
"""
|
||||||
return self._cooling_efficiency_curve
|
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):
|
def to_dictionary(self):
|
||||||
"""Class content to dictionary"""
|
"""Class content to dictionary"""
|
||||||
_auxiliary_equipment = []
|
|
||||||
if self.auxiliary_equipment is not None:
|
|
||||||
_auxiliary_equipment = self.auxiliary_equipment.to_dictionary()
|
|
||||||
content = {'Energy Generation component': {
|
content = {'Energy Generation component': {
|
||||||
'id': self.id,
|
'id': self.id,
|
||||||
'name': self.name,
|
'name': self.name,
|
||||||
|
@ -348,9 +326,7 @@ class GenerationSystem:
|
||||||
'heat efficiency curve': self.heat_efficiency_curve,
|
'heat efficiency curve': self.heat_efficiency_curve,
|
||||||
'cooling output curve': self.cooling_output_curve,
|
'cooling output curve': self.cooling_output_curve,
|
||||||
'cooling fuel consumption curve': self.cooling_fuel_consumption_curve,
|
'cooling fuel consumption curve': self.cooling_fuel_consumption_curve,
|
||||||
'cooling efficiency curve': self.cooling_efficiency_curve,
|
'cooling efficiency curve': self.cooling_efficiency_curve
|
||||||
'it has storage': self.storage,
|
|
||||||
'auxiliary equipment': _auxiliary_equipment
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return content
|
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
|
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
|
from hub.catalog_factories.data_models.energy_systems.generation_system import GenerationSystem
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -25,15 +25,15 @@ class System:
|
||||||
name,
|
name,
|
||||||
demand_types,
|
demand_types,
|
||||||
generation_systems,
|
generation_systems,
|
||||||
distribution_system,
|
distribution_systems,
|
||||||
emission_system,
|
emission_systems,
|
||||||
energy_storage_systems):
|
energy_storage_systems):
|
||||||
self._lod = lod
|
self._lod = lod
|
||||||
self._system_id = system_id
|
self._system_id = system_id
|
||||||
self._name = name
|
self._name = name
|
||||||
self._demand_types = demand_types
|
self._demand_types = demand_types
|
||||||
self._distribution_system = distribution_system
|
self._distribution_systems = distribution_systems
|
||||||
self._emission_system = emission_system
|
self._emission_systems = emission_systems
|
||||||
self._generation_systems = generation_systems
|
self._generation_systems = generation_systems
|
||||||
self._energy_storage_systems = energy_storage_systems
|
self._energy_storage_systems = energy_storage_systems
|
||||||
# self._configuration = configuration
|
# self._configuration = configuration
|
||||||
|
@ -73,32 +73,32 @@ class System:
|
||||||
@property
|
@property
|
||||||
def generation_systems(self) -> List[GenerationSystem]:
|
def generation_systems(self) -> List[GenerationSystem]:
|
||||||
"""
|
"""
|
||||||
Get generation system
|
Get generation systems
|
||||||
:return: GenerationSystem
|
:return: [GenerationSystem]
|
||||||
"""
|
"""
|
||||||
return self._generation_systems
|
return self._generation_systems
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def distribution_system(self) -> Union[None, List[DistributionSystem]]:
|
def distribution_systems(self) -> Union[None, List[DistributionSystem]]:
|
||||||
"""
|
"""
|
||||||
Get distribution system
|
Get distribution systems
|
||||||
:return: DistributionSystem
|
:return: [DistributionSystem]
|
||||||
"""
|
"""
|
||||||
return self._distribution_system
|
return self._distribution_systems
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def emission_system(self) -> Union[None, List[EmissionSystem]]:
|
def emission_systems(self) -> Union[None, List[EmissionSystem]]:
|
||||||
"""
|
"""
|
||||||
Get emission system
|
Get emission systems
|
||||||
:return: EmissionSystem
|
:return: [EmissionSystem]
|
||||||
"""
|
"""
|
||||||
return self._emission_system
|
return self._emission_systems
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def energy_storage_system(self) -> Union[None, List[EnergyStorageSystem]]:
|
def energy_storage_systems(self) -> Union[None, List[EnergyStorageSystem]]:
|
||||||
"""
|
"""
|
||||||
Get energy storage system
|
Get energy storage systems
|
||||||
:return: EnergyStorageSystem
|
:return: [EnergyStorageSystem]
|
||||||
"""
|
"""
|
||||||
return self._energy_storage_systems
|
return self._energy_storage_systems
|
||||||
|
|
||||||
|
@ -107,21 +107,21 @@ class System:
|
||||||
_generation_systems = []
|
_generation_systems = []
|
||||||
for _generation in self.generation_systems:
|
for _generation in self.generation_systems:
|
||||||
_generation_systems.append(_generation.to_dictionary())
|
_generation_systems.append(_generation.to_dictionary())
|
||||||
_distribution_system = [_distribution.to_dictionary() for _distribution in
|
_distribution_systems = [_distribution.to_dictionary() for _distribution in
|
||||||
self.distribution_system] if self.distribution_system is not None else None
|
self.distribution_systems] if self.distribution_systems is not None else None
|
||||||
_emission_system = [_emission.to_dictionary() for _emission in
|
_emission_systems = [_emission.to_dictionary() for _emission in
|
||||||
self.emission_system] if self.emission_system is not None else None
|
self.emission_systems] if self.emission_systems is not None else None
|
||||||
_storage_system = [_storage.to_dictionary() for _storage in
|
_storage_systems = [_storage.to_dictionary() for _storage in
|
||||||
self.energy_storage_system] if self.energy_storage_system is not None else None
|
self.energy_storage_systems] if self.energy_storage_systems is not None else None
|
||||||
|
|
||||||
content = {'system': {'id': self.id,
|
content = {'system': {'id': self.id,
|
||||||
'name': self.name,
|
'name': self.name,
|
||||||
'level of detail': self.lod,
|
'level of detail': self.lod,
|
||||||
'demand types': self.demand_types,
|
'demand types': self.demand_types,
|
||||||
'generation system(s)': _generation_systems,
|
'generation system(s)': _generation_systems,
|
||||||
'distribution system(s)': _distribution_system,
|
'distribution system(s)': _distribution_systems,
|
||||||
'emission system(s)': _emission_system,
|
'emission system(s)': _emission_systems,
|
||||||
'energy storage system(s)': _storage_system,
|
'energy storage system(s)': _storage_systems,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return content
|
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.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
|
||||||
from hub.catalog_factories.data_models.energy_systems.archetype import Archetype
|
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):
|
class MontrealCustomCatalog(Catalog):
|
||||||
|
@ -29,7 +31,8 @@ class MontrealCustomCatalog(Catalog):
|
||||||
|
|
||||||
self._lod = float(self._archetypes['catalog']['@lod'])
|
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_distribution_equipments = self._load_distribution_equipments()
|
||||||
self._catalog_emission_equipments = self._load_emission_equipments()
|
self._catalog_emission_equipments = self._load_emission_equipments()
|
||||||
self._catalog_systems = self._load_systems()
|
self._catalog_systems = self._load_systems()
|
||||||
|
@ -40,10 +43,11 @@ class MontrealCustomCatalog(Catalog):
|
||||||
self._catalog_generation_equipments,
|
self._catalog_generation_equipments,
|
||||||
self._catalog_distribution_equipments,
|
self._catalog_distribution_equipments,
|
||||||
self._catalog_emission_equipments,
|
self._catalog_emission_equipments,
|
||||||
storages=None)
|
None)
|
||||||
|
|
||||||
def _load_generation_equipments(self):
|
def _load_generation_and_storage_equipments(self):
|
||||||
_equipments = []
|
_equipments = []
|
||||||
|
_storages = []
|
||||||
equipments = self._archetypes['catalog']['generation_equipments']['equipment']
|
equipments = self._archetypes['catalog']['generation_equipments']['equipment']
|
||||||
for equipment in equipments:
|
for equipment in equipments:
|
||||||
equipment_id = float(equipment['@id'])
|
equipment_id = float(equipment['@id'])
|
||||||
|
@ -59,7 +63,6 @@ class MontrealCustomCatalog(Catalog):
|
||||||
electricity_efficiency = None
|
electricity_efficiency = None
|
||||||
if 'electrical_efficiency' in equipment:
|
if 'electrical_efficiency' in equipment:
|
||||||
electricity_efficiency = float(equipment['electrical_efficiency'])
|
electricity_efficiency = float(equipment['electrical_efficiency'])
|
||||||
storage = literal_eval(equipment['storage'].capitalize())
|
|
||||||
generation_system = GenerationSystem(equipment_id,
|
generation_system = GenerationSystem(equipment_id,
|
||||||
name,
|
name,
|
||||||
None,
|
None,
|
||||||
|
@ -89,12 +92,19 @@ class MontrealCustomCatalog(Catalog):
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
None,
|
|
||||||
storage,
|
|
||||||
None)
|
None)
|
||||||
|
|
||||||
_equipments.append(generation_system)
|
_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):
|
def _load_distribution_equipments(self):
|
||||||
_equipments = []
|
_equipments = []
|
||||||
|
@ -156,6 +166,10 @@ class MontrealCustomCatalog(Catalog):
|
||||||
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_equipment = equipment_archetype
|
_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 = system['equipments']['distribution_id']
|
||||||
_distribution_equipment = None
|
_distribution_equipment = None
|
||||||
for equipment_archetype in self._catalog_distribution_equipments:
|
for equipment_archetype in self._catalog_distribution_equipments:
|
||||||
|
@ -171,10 +185,10 @@ class MontrealCustomCatalog(Catalog):
|
||||||
system_id,
|
system_id,
|
||||||
name,
|
name,
|
||||||
demands,
|
demands,
|
||||||
_generation_equipment,
|
[_generation_equipment],
|
||||||
_distribution_equipment,
|
[_distribution_equipment],
|
||||||
_emission_equipment,
|
[_emission_equipment],
|
||||||
energy_storage_systems=None))
|
[_storage_equipment]))
|
||||||
return _catalog_systems
|
return _catalog_systems
|
||||||
|
|
||||||
def _load_archetypes(self):
|
def _load_archetypes(self):
|
||||||
|
|
|
@ -104,7 +104,7 @@ class MontrealCustomEnergySystemParameters:
|
||||||
energy_system.generation_system = _generation_system
|
energy_system.generation_system = _generation_system
|
||||||
|
|
||||||
_distribution_system = GenericDistributionSystem()
|
_distribution_system = GenericDistributionSystem()
|
||||||
archetype_distribution_equipment = system.distribution_system
|
archetype_distribution_equipment = system.distribution_systems
|
||||||
_distribution_system.type = archetype_distribution_equipment.type
|
_distribution_system.type = archetype_distribution_equipment.type
|
||||||
_distribution_system.supply_temperature = archetype_distribution_equipment.supply_temperature
|
_distribution_system.supply_temperature = archetype_distribution_equipment.supply_temperature
|
||||||
_distribution_system.distribution_consumption_fix_flow = \
|
_distribution_system.distribution_consumption_fix_flow = \
|
||||||
|
@ -139,10 +139,10 @@ class MontrealCustomEnergySystemParameters:
|
||||||
|
|
||||||
_building_distribution_system = DistributionSystem()
|
_building_distribution_system = DistributionSystem()
|
||||||
_building_distribution_system.generic_distribution_system = \
|
_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 = EmissionSystem()
|
||||||
_building_emission_system.generic_emission_system = \
|
_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 = GenerationSystem()
|
||||||
_building_generation_system.generic_generation_system = \
|
_building_generation_system.generic_generation_system = \
|
||||||
copy.deepcopy(_generic_building_energy_system.generation_system)
|
copy.deepcopy(_generic_building_energy_system.generation_system)
|
||||||
|
|
|
@ -90,11 +90,11 @@ class TestSystemsFactory(TestCase):
|
||||||
|
|
||||||
_building_distribution_system = DistributionSystem()
|
_building_distribution_system = DistributionSystem()
|
||||||
_building_distribution_system.generic_distribution_system = (
|
_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 = EmissionSystem()
|
||||||
_building_emission_system.generic_emission_system = (
|
_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 = GenerationSystem()
|
||||||
_building_generation_system.generic_generation_system = (
|
_building_generation_system.generic_generation_system = (
|
||||||
|
|
Loading…
Reference in New Issue
Block a user