modified the place where the energy systems are created

This commit is contained in:
Pilar Monsalvete 2023-06-01 13:39:29 -04:00
parent 22c4f362fe
commit 11b38eaa4c
2 changed files with 40 additions and 22 deletions

View File

@ -7,7 +7,6 @@ Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
from typing import Union, List
from hub.city_model_structure.energy_systems.generic_energy_system import GenericEnergySystem
from hub.city_model_structure.energy_systems.generation_system import GenerationSystem
from hub.city_model_structure.energy_systems.distribution_system import DistributionSystem
from hub.city_model_structure.energy_systems.emission_system import EmissionSystem
@ -20,7 +19,8 @@ class EnergySystem:
EnergySystem class
"""
def __init__(self):
self._generic_energy_system = None
self._name = None
self._demand_types = None
self._generation_system = None
self._distribution_system = None
self._emission_system = None
@ -28,20 +28,36 @@ class EnergySystem:
self._control_system = None
@property
def generic_energy_system(self) -> GenericEnergySystem:
def name(self):
"""
Get associated generic_energy_system
:return: GenericEnergySystem
Get energy system name
:return: str
"""
return self._generic_energy_system
return self._name
@generic_energy_system.setter
def generic_energy_system(self, value):
@name.setter
def name(self, value):
"""
Set associated generic_energy_system
:param value: GenericEnergySystem
Set energy system name
:param value:
"""
self._generic_energy_system = value
self._name = value
@property
def demand_types(self):
"""
Get demand able to cover from [Heating, Cooling, Domestic Hot Water, Electricity]
:return: [string]
"""
return self._demand_types
@demand_types.setter
def demand_types(self, value):
"""
Set demand able to cover from [Heating, Cooling, Domestic Hot Water, Electricity]
:param value: [string]
"""
self._demand_types = value
@property
def generation_system(self) -> GenerationSystem:

View File

@ -53,8 +53,9 @@ class MontrealCustomEnergySystemParameters:
continue
_energy_systems_connection_table, _generic_energy_systems \
= self._create_generic_systems(archetype, building, archetype_name,
= self._create_generic_systems(archetype, building,
_energy_systems_connection_table, _generic_energy_systems)
city.energy_systems_connection_table = _energy_systems_connection_table
city.generic_energy_systems = _generic_energy_systems
@ -69,21 +70,21 @@ class MontrealCustomEnergySystemParameters:
raise KeyError('archetype not found')
@staticmethod
def _create_generic_systems(archetype, building, archetype_name,
def _create_generic_systems(archetype, building,
_energy_systems_connection_table, _generic_energy_systems):
building_systems = []
data = [archetype_name, building.name]
data = [archetype.name, building.name]
_energy_systems_connection_table.loc[len(_energy_systems_connection_table)] = data
for equipment in archetype.systems:
for system in archetype.systems:
energy_system = GenericEnergySystem()
_hub_demand_types = []
for demand_type in equipment.demand_types:
for demand_type in system.demand_types:
_hub_demand_types.append(Dictionaries().montreal_demand_type_to_hub_energy_demand_type[demand_type])
energy_system.name = archetype_name
energy_system.name = system.name
energy_system.demand_types = _hub_demand_types
_generation_system = GenericGenerationSystem()
archetype_generation_equipment = equipment.generation_system
_type = str(equipment.name).split('_')[0]
archetype_generation_equipment = system.generation_system
_type = str(system.name).split('_')[0]
_generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[
_type]
_generation_system.fuel_type = archetype_generation_equipment.fuel_type
@ -99,7 +100,7 @@ class MontrealCustomEnergySystemParameters:
energy_system.generation_system = _generation_system
_distribution_system = GenericDistributionSystem()
archetype_distribution_equipment = equipment.distribution_system
archetype_distribution_equipment = system.distribution_system
_distribution_system.type = archetype_distribution_equipment.type
_distribution_system.supply_temperature = archetype_distribution_equipment.supply_temperature
_distribution_system.distribution_consumption_fix_flow = \
@ -111,8 +112,8 @@ class MontrealCustomEnergySystemParameters:
energy_system.distribution_system = _distribution_system
building_systems.append(energy_system)
if archetype_name not in _generic_energy_systems:
_generic_energy_systems[archetype_name] = building_systems
if archetype.name not in _generic_energy_systems:
_generic_energy_systems[archetype.name] = building_systems
return _energy_systems_connection_table, _generic_energy_systems
@ -127,6 +128,7 @@ class MontrealCustomEnergySystemParameters:
_generic_building_energy_systems = city.generic_energy_systems[energy_system]
for _generic_building_energy_system in _generic_building_energy_systems:
_building_energy_equipment = EnergySystem()
_building_energy_equipment.name = _generic_building_energy_system.name
_building_energy_equipment.demand_types = _generic_building_energy_system.demand_types
_building_distribution_system = DistributionSystem()