Calibrating Car-Following Models using SUMO-in-the-loop and Vehicle Trajectories from Roadside Radar
Code to accompany "Calibrating Car-Following Models using SUMO-in-the-loop and Vehicle Trajectories from Roadside Radar"
Trajectory pre-processing code is not included in this repository. The pre-processed trajectories are available upon request.
- Figure 1: Not included in this repository
- Figure 2: Not included in this repository
- Figure 3:
./notebooks/post_processing.ipynb
- Figure 4:
./notebooks/post_processing.ipynb
- Figure 5:
./notebooks/post_processing.ipynb
- Figure 6:
./notebooks/post_processing.ipynb
- Figure 7:
./notebooks/post_processing.ipynb
- Figure 8:
./notebooks/post_processing.ipynb
- Figure 9:
./notebooks/post_processing.ipynb
- Create a virtual environment:
python3 -m venv venv
- Activate the virtual environment:
source venv/bin/activate
- Install the requirements:
pip install -r requirements.txt
- Install SUMO and add the
bin
directory to yourPATH
environment variable.- Set the
SUMO_HOME
environment variable to the path of your SUMO installation.
- Set the
.
├── config
│ └── sumo-pipelines
│ └── ...
├── data
│ ├── processed_followers.parquet # Pre-processed follower trajectories
│ ├── leaders.parquet # smaller df describing leader follower relationships
│ └── paper_calibration_results
│ ├── calibrated_trajectories.parquet # Trajectories with calibrated car-following models
│ ├── paper_results.parquet # Results of the calibration analysis
│ ├── idm_results.parquet # Results of the IDM calibration including optimal parameters
│ ├── krauss_results.parquet # Results of the Krauss calibration including optimal parameters
│ └── w99_results.parquet # Results of the W99 calibration including optimal parameter s
├── functions
│ ├── ...
│ ├── sumo_pipelines_adapter
│ │ └── ...
│ ├── trajectory_loaders
│ │ └── ...
│ └── trajectory_processing
│ └── ...
├── notebooks
│ └── post_processing.ipynb # Post-processing of the calibration results
├── requirements.txt
└── sumo-xml
├── net.net.xml
└── route.rou.xml
The data is stored in the ./data
directory using git lfs
. You can download the data using the following command:
git lfs pull
git lfs
can be installed by following the instructions here.
Calibration is done using the sumo-pipe
command from the sumo-pipelines python library.
They use Ray to parallelize the simulations according to the above image. The number of parallel simulations can be configured using the ray start command:
ray start --head --port=6379 --num-cpus=<desired cpu num>"
All simulations rely on three environment variables. These must be set before running ray start
and sumo-pipe
:
SUMO_HOME
: The path to your SUMO installationPYTHONPATH
: The path to./src
must be added to thePYTHONPATH
environment variable.PROJECT_ROOT
: The path to the root of this project. This is used to find the simulation data & set the output
The calibration analyis is configured by two YAML files:
./config/sumo-pipelines/sumo_pipelines.yaml
- Defines the workflow and the Metadata
./config/sumo-pipelines/<car follow model>_calibration.yaml
- Defines the parameter set and calibration specifics.
The full analysis with all three car-following models can be run using the following command:
export PROJECT_ROOT=$(pwd)
export PYTHONPATH="$PYTHONPATH:$(pwd)"
export DATA_PATH="$PROJECT_ROOT/data"
ray stop
ray start --head --num-cpus=<desired cpu num>
# IDM Defaults
sumo-pipe $PROJECT_ROOT/config/sumo-pipelines/sumo_pipelines.yaml $PROJECT_ROOT/config/sumo-pipelines/idm_defaults.yaml
# W99 Defaults
sumo-pipe $PROJECT_ROOT/config/sumo-pipelines/sumo_pipelines.yaml $PROJECT_ROOT/config/sumo-pipelines/w99_defaults.yaml
# Krauss Defaults
sumo-pipe $PROJECT_ROOT/config/sumo-pipelines/sumo_pipelines.yaml $PROJECT_ROOT/config/sumo-pipelines/krauss_defaults.yaml
# IDM Calibration
sumo-pipe $PROJECT_ROOT/config/sumo-pipelines/sumo_pipelines.yaml $PROJECT_ROOT/config/sumo-pipelines/idm_calibration.yaml
# W99 Calibration
sumo-pipe $PROJECT_ROOT/config/sumo-pipelines/sumo_pipelines.yaml $PROJECT_ROOT/config/sumo-pipelines/w99_calibration.yaml
# Krauss Calibration
sumo-pipe $PROJECT_ROOT/config/sumo-pipelines/sumo_pipelines.yaml $PROJECT_ROOT/config/sumo-pipelines/krauss_calibration.yaml
# pyenv deactivate
The results of the analysis will be stored according to the Metadata.output_dir
parameter in the ./config/*.yaml
files.
< TODO >