48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
import gzip
|
|
|
|
import json
|
|
import shutil
|
|
from pathlib import Path
|
|
|
|
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
|
|
|
|
from matsim_engine import MatSimEngine
|
|
from matsim import Matsim
|
|
from matsim_visualizer import MatsimVisualizer
|
|
|
|
try:
|
|
file_path = (Path(__file__).parent / 'input_files' / 'summerschool_all_buildings.geojson')
|
|
construction_format = 'nrcan'
|
|
usage_format = 'nrcan'
|
|
energy_systems_format = 'montreal_custom'
|
|
|
|
out_path = (Path(__file__).parent / 'output_files')
|
|
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
|
|
ConstructionFactory(construction_format, city).enrich()
|
|
UsageFactory(usage_format, city).enrich()
|
|
|
|
Matsim(city, 'output_files').export()
|
|
MatSimEngine('output_files/Montreal_config.xml').run()
|
|
|
|
visualizer = MatsimVisualizer(
|
|
'output_files/Montreal',
|
|
'output_files',
|
|
(3853903.627142, 6041373.293774, 3856702.336973, 6038057.730141),
|
|
True
|
|
)
|
|
visualizer.visualize()
|
|
|
|
except Exception as ex:
|
|
print('error: ', ex)
|
|
print('[simulation abort]')
|
|
|
|
|