2024-01-26 12:36:53 -05:00
|
|
|
from pathlib import Path
|
2024-01-15 12:31:41 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
from hub.imports.geometry_factory import GeometryFactory
|
|
|
|
from hub.imports.construction_factory import ConstructionFactory
|
|
|
|
from hub.imports.usage_factory import UsageFactory
|
|
|
|
from hub.helpers.dictionaries import Dictionaries
|
2024-01-15 12:31:41 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
from matsim_engine import MatSimEngine
|
2024-01-15 12:31:41 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
try:
|
|
|
|
file_path = (Path(__file__).parent / 'input_files' / 'summerschool_all_buildings.geojson')
|
|
|
|
construction_format = 'nrcan'
|
|
|
|
usage_format = 'nrcan'
|
|
|
|
energy_systems_format = 'montreal_custom'
|
2024-01-15 12:31:41 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
out_path = (Path(__file__).parent / 'output_files')
|
|
|
|
tmp_folder = (Path(__file__).parent / 'tmp')
|
2024-01-15 12:31:41 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
print('[simulation start]')
|
|
|
|
city = GeometryFactory('geojson',
|
|
|
|
path=file_path,
|
|
|
|
height_field='citygml_me',
|
|
|
|
year_of_construction_field='ANNEE_CONS',
|
|
|
|
function_field='CODE_UTILI',
|
|
|
|
function_to_hub=Dictionaries().montreal_function_to_hub_function).city
|
2024-01-15 12:31:41 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
print(f'city created from {file_path}')
|
|
|
|
ConstructionFactory(construction_format, city).enrich()
|
|
|
|
print('enrich constructions... done')
|
|
|
|
UsageFactory(usage_format, city).enrich()
|
|
|
|
print('enrich usage... done')
|
|
|
|
|
|
|
|
MatSimEngine(city, 'output_files')
|
|
|
|
|
|
|
|
except Exception as ex:
|
|
|
|
print('error: ', ex)
|
|
|
|
print('[simulation abort]')
|