ts_core.cli.ts_runner module¶
ts_runner Overview¶
ts_runner manages the startup and execution of the SUMO runtime along with data collection, traffic light control, and optimization
Software Structure and Implementation¶
Light Control¶
ts_runner will accept an argument that specifies the file and class name to import at startup. Messing with this
part of Python is tricky business.
Optimization¶
ts_runner looks for a file named optimizer_example to run
inside the optimizer_example file an OptimizerExample class is expected to exist with a function called train which is called after every simulation tick
Output¶
Output from ts_runner is directed to ``<sumo_project_dir>/output/<YYYY_MM_DD_HH_MM_SS_dddddd>/’’ which contains:
sutripinfo.xmlYYYY_MM_DD_HH_MM_SS_dddddd_ts_runner.log(Not yet implemented, writes to current dir)
Command-line arguments¶
Positional arguments¶
Argument Description sumo_config_dirSpecify the target directory from which to load config files
Optional arguments¶
Argument Description -h,--helpshow this help message and exit --guiToggle the use of the SUMO GUI --overwrite_outputOverwrite the output directory. This will remove all previous runs and regenerate the folder.
Script contents¶
-
main()[source]¶ Initializes sumo to run using given files Starts either command-line or GUI SUMO binary based on command-line arguments Orchestrates the running of the simulation, traingin the optimizer, and controlling the traffic lights
Returns: Return type: Nothing
-
make_and_set_program(program_name, phases, starting_phase=0, tl_type=0, traffic_light_ids=())[source]¶ Parameters: - program_name (Name for this program. Use this when setting the programs) –
- phases (List/tuple of Traci phase objects demoting the various phases for this program) –
- starting_phase (Integer: When this program is set, this phase ID will be active first) –
- tl_type (---DOES NOT WORK. ALWAYS STATIC--- 0: static, 1: delay_based, 2: actuated) –
- traffic_light_ids (ID of Traffic lights to set to this program. If empty, does not set any traffic lights) – Accepts String, integer, or list (of mixed strings or integers)
Returns: Return type: Traci Program object
-
make_phase(light_array, default_time, min_time=None, max_time=None)[source]¶ Parameters: - light_array (String containing the light pattern for this phase (i.e "GGrrGGrr)) –
- default_time (Number of ticks that this phase should be active) –
- min_time (Minimum number of ticks that this phase should be active) –
- max_time (maximum number of ticks that this phase should be active) –
Returns: Return type: Traci phase object with specified data