added peak loads and consumption to results of the workflow
This commit is contained in:
parent
229112387e
commit
8ec092a1ae
55
energy_systems_dimensioning.py
Normal file
55
energy_systems_dimensioning.py
Normal file
@ -0,0 +1,55 @@
|
||||
"""
|
||||
EnergySystemsDimensioning 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 EnergySystemsDimensioning:
|
||||
"""
|
||||
EnergySystemsDimensioning 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]['heating peak loads'][0]
|
||||
if cte.COOLING in _building_energy_equipment.demand_types:
|
||||
_building_generation_system.cooling_power = building.cooling_peak_load[cte.YEAR]['cooling peak loads'][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
|
18
main.py
18
main.py
@ -5,18 +5,21 @@ from hub.imports.construction_factory import ConstructionFactory
|
||||
from hub.imports.usage_factory import UsageFactory
|
||||
from hub.imports.weather_factory import WeatherFactory
|
||||
from hub.helpers.dictionaries import Dictionaries
|
||||
from hub.imports.energy_systems_factory import EnergySystemsFactory
|
||||
from results import Results
|
||||
from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
|
||||
from sra_engine import SraEngine
|
||||
from energy_systems_dimensioning import EnergySystemsDimensioning
|
||||
|
||||
|
||||
try:
|
||||
file_path = (Path(__file__).parent / 'input_files' / 'selected_building_1780.geojson')
|
||||
file_path = (Path(__file__).parent / 'input_files' / 'selected_building.geojson')
|
||||
climate_reference_city = 'Montreal'
|
||||
weather_file = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw'
|
||||
weather_format = 'epw'
|
||||
construction_format = 'nrcan'
|
||||
usage_format = 'nrcan'
|
||||
energy_systems_format = 'montreal_custom'
|
||||
attic_heated_case = 0
|
||||
basement_heated_case = 1
|
||||
|
||||
@ -43,19 +46,20 @@ try:
|
||||
print('exporting:')
|
||||
sra_file = (tmp_folder / f'{city.name}_sra.xml').resolve()
|
||||
SraEngine(city, sra_file, tmp_folder, weather_file)
|
||||
# Assign radiation to the city
|
||||
print(' sra processed...')
|
||||
|
||||
for building in city.buildings:
|
||||
building.attic_heated = attic_heated_case
|
||||
building.basement_heated = basement_heated_case
|
||||
MonthlyEnergyBalanceEngine(city, tmp_folder)
|
||||
print(' insel processed...')
|
||||
|
||||
for building in city.buildings:
|
||||
building.energy_systems_archetype_name = 'system 1 gas'
|
||||
EnergySystemsFactory(energy_systems_format, city).enrich()
|
||||
EnergySystemsDimensioning(city).enrich()
|
||||
print(' energy systems dimensioning processed...')
|
||||
|
||||
results = Results(city, out_path)
|
||||
results.print()
|
||||
|
||||
print('print results...')
|
||||
print('results printed...')
|
||||
|
||||
print('[simulation end]')
|
||||
|
||||
|
@ -15,7 +15,7 @@ class MonthlyEnergyBalanceEngine:
|
||||
self._file_path = file_path
|
||||
EnergyBuildingsExportsFactory('insel_monthly_energy_balance', self._city, self._file_path).export()
|
||||
self._run()
|
||||
ResultFactory('insel_meb', self._city, self._file_path).enrich()
|
||||
ResultFactory('insel_monthly_energy_balance', self._city, self._file_path).enrich()
|
||||
|
||||
def _run(self):
|
||||
"""
|
||||
|
35
results.py
35
results.py
@ -16,11 +16,11 @@ class Results:
|
||||
if cte.MONTH in building.heating.keys():
|
||||
heating_results = building.heating[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} heating Wh'})
|
||||
else:
|
||||
heating_results = pd.DataFrame(array, columns=[f'{building.name} heating Wh'])
|
||||
heating_results = pd.DataFrame(array, columns=[f'{building.name} heating demand Wh'])
|
||||
if cte.MONTH in building.cooling.keys():
|
||||
cooling_results = building.cooling[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} cooling Wh'})
|
||||
else:
|
||||
cooling_results = pd.DataFrame(array, columns=[f'{building.name} cooling Wh'])
|
||||
cooling_results = pd.DataFrame(array, columns=[f'{building.name} cooling demand Wh'])
|
||||
if cte.MONTH in building.lighting_electrical_demand.keys():
|
||||
lighting_results = building.lighting_electrical_demand[cte.MONTH]\
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} lighting electrical demand Wh'})
|
||||
@ -36,6 +36,30 @@ class Results:
|
||||
.rename(columns={cte.INSEL_MEB: f'{building.name} domestic hot water demand Wh'})
|
||||
else:
|
||||
dhw_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water demand Wh'])
|
||||
|
||||
if cte.MONTH in building.heating_consumption.keys():
|
||||
heating_consumption_results = pd.DataFrame(building.heating_consumption[cte.MONTH], columns=[f'{building.name} heating consumption Wh'])
|
||||
else:
|
||||
heating_consumption_results = pd.DataFrame(array, columns=[f'{building.name} heating consumption Wh'])
|
||||
if cte.MONTH in building.cooling_consumption.keys():
|
||||
cooling_consumption_results = pd.DataFrame(building.cooling_consumption[cte.MONTH], columns=[f'{building.name} cooling consumption Wh'])
|
||||
else:
|
||||
cooling_consumption_results = pd.DataFrame(array, columns=[f'{building.name} cooling consumption Wh'])
|
||||
if cte.MONTH in building.domestic_hot_water_consumption.keys():
|
||||
dhw_consumption_results = pd.DataFrame(building.domestic_hot_water_consumption[cte.MONTH], columns=[f'{building.name} domestic hot water consumption Wh'])
|
||||
else:
|
||||
dhw_consumption_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water consumption Wh'])
|
||||
|
||||
if cte.MONTH in building.heating_peak_load.keys():
|
||||
heating_peak_load_results = building.heating_peak_load[cte.MONTH]
|
||||
else:
|
||||
heating_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} heating peak load W'])
|
||||
|
||||
if cte.MONTH in building.cooling_peak_load.keys():
|
||||
cooling_peak_load_results = building.cooling_peak_load[cte.MONTH]
|
||||
else:
|
||||
cooling_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} cooling peak load W'])
|
||||
|
||||
if print_results is None:
|
||||
print_results = heating_results
|
||||
else:
|
||||
@ -44,7 +68,12 @@ class Results:
|
||||
cooling_results,
|
||||
lighting_results,
|
||||
appliances_results,
|
||||
dhw_results], axis='columns')
|
||||
dhw_results,
|
||||
heating_consumption_results,
|
||||
cooling_consumption_results,
|
||||
dhw_consumption_results,
|
||||
heating_peak_load_results,
|
||||
cooling_peak_load_results], axis='columns')
|
||||
file += '\n'
|
||||
file += f'name: {building.name}\n'
|
||||
file += f'year of construction: {building.year_of_construction}\n'
|
||||
|
Loading…
Reference in New Issue
Block a user