Merge remote-tracking branch 'origin/main'

This commit is contained in:
Oriol Gavalda 2023-06-07 17:02:01 -04:00
commit 8f533114c6
2 changed files with 8 additions and 59 deletions

View File

@ -1,56 +0,0 @@
"""
EnergySystemsSizing enriches the city buildings energy systems
with the parameters related to the systems dimensioning
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2023 Concordia CERC group
Project Coder Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
import copy
import hub.helpers.constants as cte
from hub.city_model_structure.energy_systems.energy_system import EnergySystem
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
class EnergySystemsSizing:
"""
EnergySystemsSizing class
"""
def __init__(self, city):
self._city = city
def enrich(self):
energy_systems_connection = self._city.energy_systems_connection_table
for building in self._city.buildings:
_building_energy_systems = []
energy_systems = energy_systems_connection['Energy System Type'] \
.where(energy_systems_connection['Building'] == building.name)
for energy_system in energy_systems:
_generic_building_energy_systems = self._city.generic_energy_systems[energy_system]
for _generic_building_energy_system in _generic_building_energy_systems:
_building_energy_equipment = EnergySystem()
_building_energy_equipment.demand_types = _generic_building_energy_system.demand_types
_building_distribution_system = DistributionSystem()
_building_distribution_system.generic_distribution_system = \
copy.deepcopy(_generic_building_energy_system.distribution_system)
_building_emission_system = EmissionSystem()
_building_emission_system.generic_emission_system = \
copy.deepcopy(_generic_building_energy_system.emission_system)
_building_generation_system = GenerationSystem()
_building_generation_system.generic_generation_system = \
copy.deepcopy(_generic_building_energy_system.generation_system)
if cte.HEATING in _building_energy_equipment.demand_types:
_building_generation_system.heat_power = building.heating_peak_load[cte.YEAR][cte.HEATING_PEAK_LOAD][0]
if cte.COOLING in _building_energy_equipment.demand_types:
_building_generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][cte.COOLING_PEAK_LOAD][0]
_building_energy_equipment.generation_system = _building_generation_system
_building_energy_equipment.distribution_system = _building_distribution_system
_building_energy_equipment.emission_system = _building_emission_system
_building_energy_systems.append(_building_energy_equipment)
building.energy_systems = _building_energy_systems

11
main.py
View File

@ -6,10 +6,10 @@ from hub.imports.usage_factory import UsageFactory
from hub.imports.weather_factory import WeatherFactory from hub.imports.weather_factory import WeatherFactory
from hub.helpers.dictionaries import Dictionaries from hub.helpers.dictionaries import Dictionaries
from hub.imports.energy_systems_factory import EnergySystemsFactory from hub.imports.energy_systems_factory import EnergySystemsFactory
import hub.helpers.constants as cte
from results import Results from results import Results
from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
from sra_engine import SraEngine from sra_engine import SraEngine
from energy_systems_sizing import EnergySystemsSizing
try: try:
@ -55,9 +55,14 @@ try:
MonthlyEnergyBalanceEngine(city, tmp_folder) MonthlyEnergyBalanceEngine(city, tmp_folder)
print(' insel processed...') print(' insel processed...')
EnergySystemsSizing(city).enrich() for building in city.buildings:
print(' energy systems dimensioning processed...') for energy_system in building.energy_systems:
if cte.HEATING in energy_system.demand_types:
energy_system.generation_system.heat_power = building.heating_peak_load[cte.YEAR][cte.HEATING_PEAK_LOAD][0]
if cte.COOLING in energy_system.demand_types:
energy_system.generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][cte.COOLING_PEAK_LOAD][0]
print('importing results:')
results = Results(city, out_path) results = Results(city, out_path)
results.print() results.print()
print('results printed...') print('results printed...')