changed all the singular names to plural and turned distribution and emission systems into lists

This commit is contained in:
Saeed Ranjbar 2023-10-05 13:18:57 -04:00
parent cbda6ce13d
commit ca48d6448b
5 changed files with 55 additions and 53 deletions

View File

@ -706,11 +706,11 @@ class Building(CityObject):
if self.energy_systems is None: if self.energy_systems is None:
return self._distribution_systems_electrical_consumption return self._distribution_systems_electrical_consumption
for energy_system in self.energy_systems: for energy_system in self.energy_systems:
emission_system = energy_system.emission_system.generic_emission_system emission_system = energy_system.emission_systems.generic_emission_system
parasitic_energy_consumption = 0 parasitic_energy_consumption = 0
if emission_system is not None: if emission_system is not None:
parasitic_energy_consumption = emission_system.parasitic_energy_consumption parasitic_energy_consumption = emission_system.parasitic_energy_consumption
distribution_system = energy_system.distribution_system.generic_distribution_system distribution_system = energy_system.distribution_systems.generic_distribution_system
consumption_variable_flow = distribution_system.distribution_consumption_variable_flow consumption_variable_flow = distribution_system.distribution_consumption_variable_flow
for demand_type in energy_system.demand_types: for demand_type in energy_system.demand_types:
if demand_type.lower() == cte.HEATING.lower(): if demand_type.lower() == cte.HEATING.lower():
@ -744,7 +744,9 @@ class Building(CityObject):
if self.energy_systems is None: if self.energy_systems is None:
return None return None
for energy_system in self.energy_systems: for energy_system in self.energy_systems:
generation_systems = energy_system.generation_system generation_systems = energy_system.generation_systems
print(generation_systems)
print(type(generation_systems))
for demand_type in energy_system.demand_types: for demand_type in energy_system.demand_types:
if demand_type.lower() == consumption_type.lower(): if demand_type.lower() == consumption_type.lower():
if consumption_type in (cte.HEATING, cte.DOMESTIC_HOT_WATER): if consumption_type in (cte.HEATING, cte.DOMESTIC_HOT_WATER):
@ -786,8 +788,8 @@ class Building(CityObject):
if self.energy_systems is None: if self.energy_systems is None:
return self._onsite_electrical_production return self._onsite_electrical_production
for energy_system in self.energy_systems: for energy_system in self.energy_systems:
if energy_system.generation_system.generic_generation_system.type == cte.PHOTOVOLTAIC: if energy_system.generation_systems.generic_generation_system.type == cte.PHOTOVOLTAIC:
_efficiency = energy_system.generation_system.generic_generation_system.electricity_efficiency _efficiency = energy_system.generation_systems.generic_generation_system.electricity_efficiency
self._onsite_electrical_production = {} self._onsite_electrical_production = {}
for _key in self.roofs[0].global_irradiance.keys(): for _key in self.roofs[0].global_irradiance.keys():
_results = [0 for _ in range(0, len(self.roofs[0].global_irradiance[_key]))] _results = [0 for _ in range(0, len(self.roofs[0].global_irradiance[_key]))]

View File

@ -23,12 +23,12 @@ class EnergySystem:
def __init__(self): def __init__(self):
self._name = None self._name = None
self._demand_types = None self._demand_types = None
self._generation_system = None self._generation_systems = None
self._distribution_system = None self._distribution_systems = None
self._emission_system = None self._emission_systems = None
self._connected_city_objects = None self._connected_city_objects = None
self._control_system = None self._control_system = None
self._energy_storage_system = None self._energy_storage_systems = None
@property @property
def name(self): def name(self):
@ -63,52 +63,52 @@ class EnergySystem:
self._demand_types = value self._demand_types = value
@property @property
def generation_system(self) -> List[GenerationSystem]: def generation_systems(self) -> List[GenerationSystem]:
""" """
Get generation systems Get generation systems
:return: GenerationSystem :return: GenerationSystem
""" """
return self._generation_system return self._generation_systems
@generation_system.setter @generation_systems.setter
def generation_system(self, value): def generation_systems(self, value):
""" """
Set generation system Set generation system
:param value: GenerationSystem :param value: GenerationSystem
""" """
self._generation_system = value self._generation_systems = value
@property @property
def distribution_system(self) -> Union[None, DistributionSystem]: def distribution_systems(self) -> Union[None, List[DistributionSystem]]:
""" """
Get distribution system Get distribution system
:return: DistributionSystem :return: DistributionSystem
""" """
return self._distribution_system return self._distribution_systems
@distribution_system.setter @distribution_systems.setter
def distribution_system(self, value): def distribution_systems(self, value):
""" """
Set distribution system Set distribution system
:param value: DistributionSystem :param value: DistributionSystem
""" """
self._distribution_system = value self._distribution_systems = value
@property @property
def emission_system(self) -> Union[None, EmissionSystem]: def emission_systems(self) -> Union[None, List[EmissionSystem]]:
""" """
Get emission system Get emission system
:return: EmissionSystem :return: EmissionSystem
""" """
return self._emission_system return self._emission_systems
@emission_system.setter @emission_systems.setter
def emission_system(self, value): def emission_systems(self, value):
""" """
Set emission system Set emission system
:param value: EmissionSystem :param value: EmissionSystem
""" """
self._emission_system = value self._emission_systems = value
@property @property
def connected_city_objects(self) -> Union[None, List[CityObject]]: def connected_city_objects(self) -> Union[None, List[CityObject]]:
@ -143,17 +143,17 @@ class EnergySystem:
self._control_system = value self._control_system = value
@property @property
def energy_storage_system(self) -> Union[None, List[ThermalStorageSystem], List[ElectricalStorageSystem]]: def energy_storage_systems(self) -> Union[None, List[ThermalStorageSystem], List[ElectricalStorageSystem]]:
""" """
Get energy storage systems Get energy storage systems
:return: [EnergyStorageSystem] :return: [EnergyStorageSystem]
""" """
return self._energy_storage_system return self._energy_storage_systems
@energy_storage_system.setter @energy_storage_systems.setter
def energy_storage_system(self, value): def energy_storage_systems(self, value):
""" """
Set storage system Set storage system
:param value: [EnergyStorageSystem] :param value: [EnergyStorageSystem]
""" """
self._energy_storage_system = value self._energy_storage_systems = value

View File

@ -86,7 +86,7 @@ class MontrealCustomEnergySystemParameters:
energy_system.name = system.name energy_system.name = system.name
energy_system.demand_types = _hub_demand_types energy_system.demand_types = _hub_demand_types
_generation_system = GenericGenerationSystem() _generation_system = GenericGenerationSystem()
archetype_generation_equipment = system.generation_system archetype_generation_equipment = system.generation_systems
_type = system.name _type = system.name
_generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[ _generation_system.type = Dictionaries().montreal_system_to_hub_energy_generation_system[
_type] _type]
@ -145,11 +145,11 @@ class MontrealCustomEnergySystemParameters:
copy.deepcopy(_generic_building_energy_system.emission_systems) 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_systems)
_building_energy_equipment.generation_system = _building_generation_system _building_energy_equipment.generation_systems = _building_generation_system
_building_energy_equipment.distribution_system = _building_distribution_system _building_energy_equipment.distribution_systems = _building_distribution_system
_building_energy_equipment.emission_system = _building_emission_system _building_energy_equipment.emission_systems = _building_emission_system
_building_energy_systems.append(_building_energy_equipment) _building_energy_systems.append(_building_energy_equipment)
building.energy_systems = _building_energy_systems building.energy_systems = _building_energy_systems

View File

@ -154,21 +154,21 @@ class NorthAmericaCustomEnergySystemParameters:
_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_systems)
_building_storage_system = ThermalStorageSystem() _building_storage_system = ThermalStorageSystem()
_building_storage_system.generic_storage_system = \ _building_storage_system.generic_storage_system = \
copy.deepcopy(_generic_building_energy_system.energy_storage_system) copy.deepcopy(_generic_building_energy_system.energy_storage_systems)
_building_energy_equipment.generation_system = _building_generation_system _building_energy_equipment.generation_systems = _building_generation_system
_building_energy_equipment.distribution_system = _building_distribution_system _building_energy_equipment.distribution_systems = _building_distribution_system
_building_energy_equipment.emission_system = _building_emission_system _building_energy_equipment.emission_systems = _building_emission_system
_building_energy_equipment.energy_storage_system = _building_storage_system _building_energy_equipment.energy_storage_systems = _building_storage_system
_building_energy_systems.append(_building_energy_equipment) _building_energy_systems.append(_building_energy_equipment)
building.energy_systems = _building_energy_systems building.energy_systems = _building_energy_systems

View File

@ -98,15 +98,15 @@ class TestSystemsFactory(TestCase):
) )
_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_systems)
) )
if cte.HEATING in _building_energy_equipment.demand_types: if cte.HEATING in _building_energy_equipment.demand_types:
_building_generation_system.heat_power = building.heating_peak_load[cte.YEAR][0] _building_generation_system.heat_power = building.heating_peak_load[cte.YEAR][0]
if cte.COOLING in _building_energy_equipment.demand_types: if cte.COOLING in _building_energy_equipment.demand_types:
_building_generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][0] _building_generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][0]
_building_energy_equipment.generation_system = _building_generation_system _building_energy_equipment.generation_systems = _building_generation_system
_building_energy_equipment.distribution_system = _building_distribution_system _building_energy_equipment.distribution_systems = _building_distribution_system
_building_energy_equipment.emission_system = _building_emission_system _building_energy_equipment.emission_systems = _building_emission_system
_building_energy_systems.append(_building_energy_equipment) _building_energy_systems.append(_building_energy_equipment)
building.energy_systems = _building_energy_systems building.energy_systems = _building_energy_systems
@ -161,27 +161,27 @@ 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 = (
copy.deepcopy(_generic_building_energy_system.generation_system) copy.deepcopy(_generic_building_energy_system.generation_systems)
) )
_building_storage_system = ThermalStorageSystem() _building_storage_system = ThermalStorageSystem()
_building_storage_system.generic_storage_system = \ _building_storage_system.generic_storage_system = \
copy.deepcopy(_generic_building_energy_system.energy_storage_system) copy.deepcopy(_generic_building_energy_system.energy_storage_systems)
if cte.HEATING in _building_energy_equipment.demand_types: if cte.HEATING in _building_energy_equipment.demand_types:
_building_generation_system.heat_power = building.heating_peak_load[cte.YEAR][0] _building_generation_system.heat_power = building.heating_peak_load[cte.YEAR][0]
if cte.COOLING in _building_energy_equipment.demand_types: if cte.COOLING in _building_energy_equipment.demand_types:
_building_generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][0] _building_generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][0]
_building_energy_equipment.generation_system = _building_generation_system _building_energy_equipment.generation_systems = _building_generation_system
_building_energy_equipment.distribution_system = _building_distribution_system _building_energy_equipment.distribution_systems = _building_distribution_system
_building_energy_equipment.emission_system = _building_emission_system _building_energy_equipment.emission_systems = _building_emission_system
_building_energy_systems.append(_building_energy_equipment) _building_energy_systems.append(_building_energy_equipment)
building.energy_systems = _building_energy_systems building.energy_systems = _building_energy_systems