Skip to content

SUMO Simulation Automation

Generalized Commands for Vehicle Simulations

Route generation for N vehicles

python $SUMO_HOME/tools/randomTrips.py -n NETWORK_FILE -r OUTPUT_ROUTES_FILE --fringe-factor 2 -p DEPARTURE_INTERVAL --validate -e END_TIME
-n NETWORK_FILE : Path to the SUMO network definition file (.net.xml)
-r OUTPUT_ROUTES_FILE : Output file path where generated routes will be saved. Name should reflect vehicle count (e.g., osm.passenger.500.rou.xml)
--fringe-factor 2: Typical value 2 helps prevent congestion at city centers
-p DEPARTURE_INTERVAL : Average time between vehicle departures (seconds)
DEPARTURE_INTERVAL = END_TIME / N (where N = desired vehicle count)
--validate : Enables XML validation of generated routes
-e END_TIME: Simulation duration in seconds. Must be ≥ actual simulation time needed

Simulation Execution for N vehicles

sumo -n NETWORK_FILE -r ROUTES_FILE --additional-files VIEW_FILE --output-prefix OUTPUT_PREFIX/ --fcd-output fcd.xml --emission-output emissions.xml --edgedata-output edges.xml --duration-log.statistics --no-step-log > LOG_FILE
-n NETWORK_FILE: Same network file used in route generation
-r ROUTES_FILE: Route file generated in previous step
--additional-files VIEW_FILE: Visualization configuration file
--output-prefix OUTPUT_PREFIX/: Directory prefix for output files
--fcd-output fcd.xml: Generates vehicle trajectory data
--emission-output emissions.xml: Generates emission data
--edgedata-output edges.xml: Generates edge occupancy statistics
--duration-log.statistics: Enables simulation statistics
--no-step-log: Disables per-step logging (improves performance)

LOG_FILE: Redirects console output to log file

Complete Example for 1000 Vehicles:

python $SUMO_HOME/tools/randomTrips.py -n osm.net.xml.gz -r osm.passenger.1000.rou.xml --fringe-factor 2 -p 86.4 --validate -e 86400

sumo -n osm.net.xml.gz -r osm.passenger.1000.rou.xml --additional-files osm.view.xml --output-prefix results1000/ --fcd-output fcd.xml --emission-output emissions.xml --edgedata-output edges.xml --duration-log.statistics --no-step-log > results1000/log_1000.txt

Automated analysis pipeline

After simulation, use the analysis script:

python occupation_analysis.py

This process: log_N.txt for simulation metrics edges.xml for occupancy data

Generates consolidated performance_results.csv