Sumo (Simulation of Urban Mobility) simulation 104— a series

Amita S.
2 min readJun 13, 2020

Creating routes starting from fringes of the map and adding source, sink and via routes

Weights can be provided as to from where the source of the vehicle routes should be and where it should end. In this case, we have to consider that that the vehicles start from north half of the map and go to a particular destination (=sink) via a particular edge.

Small python script for starting the vehicles from the northern fringe:

Python code for finding if an edge lies in the upper half of the bounding box

Create the three xml files with in the directory one for each source, sink and via routes:

Three xml files created in the working directory

Start with the source file where the starting edges are the fringes on the upper half of the bounding box created with the Python script:

Command to creating source xml file

Source file looks something like:

Source xml file for routes

Via file contains the edge the vehicle should pass through:

Via xml file

Sink file contains the sink for vehicles:

Sink xml file

Lastly, run the randomTrips python script with the follow — weights-prefix option: