2024-03-12 13:32:47 -04:00
|
|
|
import json
|
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-02-06 16:52:33 -05:00
|
|
|
from matsim import Matsim
|
2024-02-14 14:27:10 -05:00
|
|
|
from matsim_visualizer import MatsimVisualizer
|
2024-01-15 12:31:41 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
try:
|
2024-03-12 13:32:47 -04:00
|
|
|
file_path = (Path(__file__).parent / 'input_files' / 'summerschool_all_buildings.geojson')
|
2024-01-26 12:36:53 -05:00
|
|
|
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')
|
|
|
|
city = GeometryFactory('geojson',
|
|
|
|
path=file_path,
|
2024-03-12 13:32:47 -04:00
|
|
|
height_field='citygml_me',
|
2024-01-26 12:36:53 -05:00
|
|
|
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()
|
|
|
|
|
2024-02-16 11:48:17 -05:00
|
|
|
Matsim(city, 'output_files').export()
|
|
|
|
MatSimEngine('output_files/Montreal_config.xml').run()
|
2024-01-26 12:36:53 -05:00
|
|
|
|
2024-03-05 15:14:36 -05:00
|
|
|
visualizer = MatsimVisualizer(
|
|
|
|
'output_files/Montreal',
|
|
|
|
'output_files',
|
2024-03-12 13:32:47 -04:00
|
|
|
(3854635.608067, 6040255.047194, 3855550.392442, 6039416.667303),
|
|
|
|
True
|
2024-03-05 15:14:36 -05:00
|
|
|
)
|
2024-02-14 14:27:10 -05:00
|
|
|
visualizer.visualize()
|
2024-02-01 14:35:55 -05:00
|
|
|
|
2024-01-26 12:36:53 -05:00
|
|
|
except Exception as ex:
|
|
|
|
print('error: ', ex)
|
|
|
|
print('[simulation abort]')
|
2024-03-12 13:32:47 -04:00
|
|
|
|
|
|
|
|