Compare commits
2 Commits
d65e372500
...
4f88ddef49
Author | SHA1 | Date | |
---|---|---|---|
4f88ddef49 | |||
537809f3c8 |
13
main.py
13
main.py
@ -13,9 +13,8 @@ from sra_engine import SraEngine
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
file_path = (Path(__file__).parent / 'data' / 'selected_building.geojson')
|
file_path = (Path(__file__).parent / 'input_files' / 'selected_building_warehouse.geojson')
|
||||||
climate_reference_city = 'Montreal'
|
climate_reference_city = 'Montreal'
|
||||||
weather_file = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw'
|
|
||||||
weather_format = 'epw'
|
weather_format = 'epw'
|
||||||
construction_format = 'nrcan'
|
construction_format = 'nrcan'
|
||||||
usage_format = 'nrcan'
|
usage_format = 'nrcan'
|
||||||
@ -23,7 +22,7 @@ try:
|
|||||||
attic_heated_case = 0
|
attic_heated_case = 0
|
||||||
basement_heated_case = 1
|
basement_heated_case = 1
|
||||||
|
|
||||||
out_path = (Path(__file__).parent / 'outputs')
|
out_path = (Path(__file__).parent / 'output_files')
|
||||||
tmp_folder = (Path(__file__).parent / 'tmp')
|
tmp_folder = (Path(__file__).parent / 'tmp')
|
||||||
|
|
||||||
print('[simulation start]')
|
print('[simulation start]')
|
||||||
@ -36,7 +35,7 @@ try:
|
|||||||
city.climate_reference_city = climate_reference_city
|
city.climate_reference_city = climate_reference_city
|
||||||
city.climate_file = (tmp_folder / f'{climate_reference_city}.cli').resolve()
|
city.climate_file = (tmp_folder / f'{climate_reference_city}.cli').resolve()
|
||||||
print(f'city created from {file_path}')
|
print(f'city created from {file_path}')
|
||||||
WeatherFactory(weather_format, city, file_name=weather_file).enrich()
|
WeatherFactory(weather_format, city).enrich()
|
||||||
print('enrich weather... done')
|
print('enrich weather... done')
|
||||||
ConstructionFactory(construction_format, city).enrich()
|
ConstructionFactory(construction_format, city).enrich()
|
||||||
print('enrich constructions... done')
|
print('enrich constructions... done')
|
||||||
@ -49,7 +48,7 @@ try:
|
|||||||
|
|
||||||
print('exporting:')
|
print('exporting:')
|
||||||
sra_file = (tmp_folder / f'{city.name}_sra.xml').resolve()
|
sra_file = (tmp_folder / f'{city.name}_sra.xml').resolve()
|
||||||
SraEngine(city, sra_file, tmp_folder, weather_file)
|
SraEngine(city, sra_file, tmp_folder)
|
||||||
print(' sra processed...')
|
print(' sra processed...')
|
||||||
|
|
||||||
MonthlyEnergyBalanceEngine(city, tmp_folder)
|
MonthlyEnergyBalanceEngine(city, tmp_folder)
|
||||||
@ -58,9 +57,9 @@ try:
|
|||||||
for building in city.buildings:
|
for building in city.buildings:
|
||||||
for energy_system in building.energy_systems:
|
for energy_system in building.energy_systems:
|
||||||
if cte.HEATING in energy_system.demand_types:
|
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]
|
energy_system.generation_system.heat_power = building.heating_peak_load[cte.YEAR][0]
|
||||||
if cte.COOLING in energy_system.demand_types:
|
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]
|
energy_system.generation_system.cooling_power = building.cooling_peak_load[cte.YEAR][0]
|
||||||
|
|
||||||
print('importing results:')
|
print('importing results:')
|
||||||
results = Results(city, out_path)
|
results = Results(city, out_path)
|
||||||
|
23
results.py
23
results.py
@ -13,12 +13,12 @@ class Results:
|
|||||||
file = 'city name: ' + self._city.name + '\n'
|
file = 'city name: ' + self._city.name + '\n'
|
||||||
array = [None] * 12
|
array = [None] * 12
|
||||||
for building in self._city.buildings:
|
for building in self._city.buildings:
|
||||||
if cte.MONTH in building.heating.keys():
|
if cte.MONTH in building.heating_demand.keys():
|
||||||
heating_results = building.heating[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} heating Wh'})
|
heating_results = building.heating_demand[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} heating Wh'})
|
||||||
else:
|
else:
|
||||||
heating_results = pd.DataFrame(array, columns=[f'{building.name} heating demand Wh'])
|
heating_results = pd.DataFrame(array, columns=[f'{building.name} heating demand Wh'])
|
||||||
if cte.MONTH in building.cooling.keys():
|
if cte.MONTH in building.cooling_demand.keys():
|
||||||
cooling_results = building.cooling[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} cooling Wh'})
|
cooling_results = building.cooling_demand[cte.MONTH].rename(columns={cte.INSEL_MEB: f'{building.name} cooling Wh'})
|
||||||
else:
|
else:
|
||||||
cooling_results = pd.DataFrame(array, columns=[f'{building.name} cooling demand Wh'])
|
cooling_results = pd.DataFrame(array, columns=[f'{building.name} cooling demand Wh'])
|
||||||
if cte.MONTH in building.lighting_electrical_demand.keys():
|
if cte.MONTH in building.lighting_electrical_demand.keys():
|
||||||
@ -54,11 +54,13 @@ class Results:
|
|||||||
dhw_consumption_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water consumption Wh'])
|
dhw_consumption_results = pd.DataFrame(array, columns=[f'{building.name} domestic hot water consumption Wh'])
|
||||||
|
|
||||||
if cte.MONTH in building.heating_peak_load.keys():
|
if cte.MONTH in building.heating_peak_load.keys():
|
||||||
heating_peak_load_results = building.heating_peak_load[cte.MONTH]
|
heating_peak_load_results = pd.DataFrame(building.heating_peak_load[cte.MONTH],
|
||||||
|
columns=[f'{building.name} heating peak load W'])
|
||||||
else:
|
else:
|
||||||
heating_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} heating peak load W'])
|
heating_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} heating peak load W'])
|
||||||
if cte.MONTH in building.cooling_peak_load.keys():
|
if cte.MONTH in building.cooling_peak_load.keys():
|
||||||
cooling_peak_load_results = building.cooling_peak_load[cte.MONTH]
|
cooling_peak_load_results = pd.DataFrame(building.cooling_peak_load[cte.MONTH],
|
||||||
|
columns=[f'{building.name} cooling peak load W'])
|
||||||
else:
|
else:
|
||||||
cooling_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} cooling peak load W'])
|
cooling_peak_load_results = pd.DataFrame(array, columns=[f'{building.name} cooling peak load W'])
|
||||||
|
|
||||||
@ -92,12 +94,11 @@ class Results:
|
|||||||
if value * appliances.density * thermal_zone.total_floor_area > peak_appliances:
|
if value * appliances.density * thermal_zone.total_floor_area > peak_appliances:
|
||||||
peak_appliances = value * appliances.density * thermal_zone.total_floor_area
|
peak_appliances = value * appliances.density * thermal_zone.total_floor_area
|
||||||
|
|
||||||
#todo:check with Pilar. Peak cannot be multiplied by 12. I deleted it. Is el. peak not saved in building?
|
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances] * 12
|
||||||
monthly_electricity_peak = [0.9 * peak_lighting + 0.7 * peak_appliances]
|
|
||||||
conditioning_peak = []
|
conditioning_peak = []
|
||||||
for i, value in enumerate(building.heating_peak_load[cte.MONTH][cte.HEATING_PEAK_LOAD]):
|
for i, value in enumerate(building.heating_peak_load[cte.MONTH]):
|
||||||
if cooling * building.cooling_peak_load[cte.MONTH][cte.COOLING_PEAK_LOAD][i] > heating * value:
|
if cooling * building.cooling_peak_load[cte.MONTH][i] > heating * value:
|
||||||
conditioning_peak.append(cooling * building.cooling_peak_load[cte.MONTH][cte.COOLING_PEAK_LOAD][i])
|
conditioning_peak.append(cooling * building.cooling_peak_load[cte.MONTH][i])
|
||||||
else:
|
else:
|
||||||
conditioning_peak.append(heating * value)
|
conditioning_peak.append(heating * value)
|
||||||
monthly_electricity_peak[i] += 0.8 * conditioning_peak[i]
|
monthly_electricity_peak[i] += 0.8 * conditioning_peak[i]
|
||||||
|
@ -7,7 +7,7 @@ from hub.imports.results_factory import ResultFactory
|
|||||||
|
|
||||||
|
|
||||||
class SraEngine:
|
class SraEngine:
|
||||||
def __init__(self, city, file_path, output_file_path, weather_file):
|
def __init__(self, city, file_path, output_file_path):
|
||||||
"""
|
"""
|
||||||
SRA class
|
SRA class
|
||||||
:param file_path: _sra.xml file path
|
:param file_path: _sra.xml file path
|
||||||
@ -16,12 +16,11 @@ class SraEngine:
|
|||||||
self._city = city
|
self._city = city
|
||||||
self._file_path = file_path
|
self._file_path = file_path
|
||||||
self._output_file_path = output_file_path
|
self._output_file_path = output_file_path
|
||||||
self._weather_file = weather_file
|
|
||||||
if platform.system() == 'Linux':
|
if platform.system() == 'Linux':
|
||||||
self._executable = 'sra'
|
self._executable = 'sra'
|
||||||
elif platform.system() == 'Windows':
|
elif platform.system() == 'Windows':
|
||||||
self._executable = 'shortwave_integer'
|
self._executable = 'shortwave_integer'
|
||||||
ExportsFactory('sra', self._city, output_file_path, weather_file=self._weather_file, weather_format='epw').export()
|
ExportsFactory('sra', self._city, output_file_path).export()
|
||||||
self._run()
|
self._run()
|
||||||
ResultFactory('sra', self._city, output_file_path).enrich()
|
ResultFactory('sra', self._city, output_file_path).enrich()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user