Skip to content

📊 Analysis Scripts

ocupation_analysis.py

Post-simulation analyzer that aggregates metrics from SUMO runs into a CSV.

Extracted metrics per run: - Inserted vehicles - Simulation end time (sim time) - Real compute time - Real-time factor and derived acceleration (sim_time / real_time) - Average edge occupancy (from edges.xml) - Teleports (if present in logs)

Environment and defaults: - SIMULATION_BASE_DIR (env var): base directory that contains results{N} folders - Default vehicle counts processed: 500, 1000, 2000, 4000, 8000, 16000 - Output: ${SIMULATION_BASE_DIR}/performance_results.csv

Expected folder layout per run:

${SIMULATION_BASE_DIR}/
  results500/
    log_500.txt
    edges.xml
  results1000/
    log_1000.txt
    edges.xml
  ...

Usage:

# Ensure SIMULATION_BASE_DIR is set (e.g., in a .env file)
export SIMULATION_BASE_DIR="/path/to/your/runs"

python ocupation_analysis.py

Notes: - Teleports are optional; if missing, they default to 0. - Occupancy is averaged across all <edge> entries in edges.xml and returned as a percentage. - CSV numeric columns are rounded to 4 decimals.

See also: - Simulation Workflow: docs/Simulation-Workflow.md - Output Files: docs/Output-Files.md