Schedule appliances added

First trial of adding factor to change from multizone to unizone. Commented.
This commit is contained in:
Oriol Gavalda 2023-03-24 08:10:45 -04:00
parent effdad4437
commit 06e31847a5

90
main.py
View File

@ -10,56 +10,56 @@ from monthly_energy_balance_engine import MonthlyEnergyBalanceEngine
from sra_engine import SraEngine from sra_engine import SraEngine
try: #try:
file_path = (Path(__file__).parent / 'input_files' / 'neighbours.geojson') file_path = (Path(__file__).parent / 'input_files' / 'neighbours.geojson')
climate_reference_city = 'Montreal' climate_reference_city = 'Montreal'
weather_file = 'CAN_PQ_Montreal.Intl.AP.716270_CWEC.epw' 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'
attic_heated_case = 0 attic_heated_case = 0
basement_heated_case = 1 basement_heated_case = 1
out_path = (Path(__file__).parent / 'output_files') 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]')
city = GeometryFactory('geojson', city = GeometryFactory('geojson',
path=file_path, path=file_path,
height_field='citygml_me', height_field='citygml_me',
year_of_construction_field='ANNEE_CONS', year_of_construction_field='ANNEE_CONS',
function_field='CODE_UTILI', function_field='CODE_UTILI',
function_to_hub=Dictionaries().montreal_function_to_hub_function).city function_to_hub=Dictionaries().montreal_function_to_hub_function).city
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, file_name=weather_file).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')
UsageFactory(usage_format, city).enrich() UsageFactory(usage_format, city).enrich()
print('enrich usage... done') print('enrich usage... done')
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, weather_file)
# Assign radiation to the city # Assign radiation to the city
print(' sra processed...') print(' sra processed...')
for building in city.buildings: for building in city.buildings:
building.attic_heated = attic_heated_case building.attic_heated = attic_heated_case
building.basement_heated = basement_heated_case building.basement_heated = basement_heated_case
MonthlyEnergyBalanceEngine(city, tmp_folder) MonthlyEnergyBalanceEngine(city, tmp_folder)
print(' insel processed...') print(' insel processed...')
results = Results(city, out_path) results = Results(city, out_path)
results.print() results.print()
print('print results...') print('print results...')
print('[simulation end]') print('[simulation end]')
except Exception as ex: #except Exception as ex:
print(ex) # print(ex)
print('error: ', ex) # print('error: ', ex)
print('[simulation abort]') # print('[simulation abort]')