Run model
Essential run model Notebook example¶
Import the RunController from tm2py root, and provide as inputs:
- a list of config files in .toml format, which describe the model settings; by convention this is split into a "scenario_config.toml" with a few run / operational parameters, and a "model_config.toml" with most of the model details
- the run directory (if not specified this is the directory of the first config file provided)
In [1]:
Copied!
import os
from tm2py import RunController
controller = RunController(
[
os.path.join("..", "examples", "scenario_config.toml"),
os.path.join("..", "examples", "model_config.toml"),
],
run_dir=os.path.join("..", "examples", "UnionCity"),
)
import os
from tm2py import RunController
controller = RunController(
[
os.path.join("..", "examples", "scenario_config.toml"),
os.path.join("..", "examples", "model_config.toml"),
],
run_dir=os.path.join("..", "examples", "UnionCity"),
)
The example scenario data can be downloaded:
In [3]:
Copied!
from tm2py import get_example
get_example(root_dir=os.path.join("..", ""))
from tm2py import get_example
get_example(root_dir=os.path.join("..", ""))
Out[3]:
'..\\examples\\UnionCity'
Run the model via controller.run():
In [4]:
Copied!
controller.run()
controller.run()
26-Apr-2022 (14:13:30): Start iteration 0 26-Apr-2022 (14:13:30): Start prepare network attributes and modes 26-Apr-2022 (14:13:37): End prepare network attributes and modes 26-Apr-2022 (14:13:37): Start Highway assignment and skims 26-Apr-2022 (14:13:37): Start Highway assignment for period ea 26-Apr-2022 (14:13:37): Set ul1 to 0 for background traffic 26-Apr-2022 (14:13:37): Start Creating skim matrices 26-Apr-2022 (14:13:37): End Creating skim matrices 26-Apr-2022 (14:13:37): Start Run SOLA assignment with path analyses 26-Apr-2022 (14:13:38): End Run SOLA assignment with path analyses 26-Apr-2022 (14:13:38): End Highway assignment for period ea 26-Apr-2022 (14:13:38): Start Highway assignment for period am 26-Apr-2022 (14:13:38): Set ul1 to 0 for background traffic 26-Apr-2022 (14:13:38): Start Creating skim matrices 26-Apr-2022 (14:13:38): End Creating skim matrices 26-Apr-2022 (14:13:38): Start Run SOLA assignment with path analyses 26-Apr-2022 (14:13:39): End Run SOLA assignment with path analyses 26-Apr-2022 (14:13:39): End Highway assignment for period am 26-Apr-2022 (14:13:39): Start Highway assignment for period md 26-Apr-2022 (14:13:39): Set ul1 to 0 for background traffic 26-Apr-2022 (14:13:39): Start Creating skim matrices 26-Apr-2022 (14:13:39): End Creating skim matrices 26-Apr-2022 (14:13:39): Start Run SOLA assignment with path analyses 26-Apr-2022 (14:13:40): End Run SOLA assignment with path analyses 26-Apr-2022 (14:13:40): End Highway assignment for period md 26-Apr-2022 (14:13:40): Start Highway assignment for period pm 26-Apr-2022 (14:13:40): Set ul1 to 0 for background traffic 26-Apr-2022 (14:13:40): Start Creating skim matrices 26-Apr-2022 (14:13:40): End Creating skim matrices 26-Apr-2022 (14:13:40): Start Run SOLA assignment with path analyses 26-Apr-2022 (14:13:40): End Run SOLA assignment with path analyses 26-Apr-2022 (14:13:41): End Highway assignment for period pm 26-Apr-2022 (14:13:41): Start Highway assignment for period ev 26-Apr-2022 (14:13:41): Set ul1 to 0 for background traffic 26-Apr-2022 (14:13:41): Start Creating skim matrices 26-Apr-2022 (14:13:41): End Creating skim matrices 26-Apr-2022 (14:13:41): Start Run SOLA assignment with path analyses 26-Apr-2022 (14:13:41): End Run SOLA assignment with path analyses 26-Apr-2022 (14:13:41): End Highway assignment for period ev 26-Apr-2022 (14:13:41): End Highway assignment and skims 26-Apr-2022 (14:13:41): Start SkimMAZCosts run 26-Apr-2022 (14:13:41): Start SkimMAZCosts _prepare_network 26-Apr-2022 (14:13:41): End SkimMAZCosts _prepare_network 26-Apr-2022 (14:13:42): End SkimMAZCosts run
In [ ]:
Copied!