Giter Site home page Giter Site logo

univofalabama-bittleresearchgroup / sumo-cf-calibration Goto Github PK

View Code? Open in Web Editor NEW
6.0 0.0 1.0 4.14 MB

Code to accompany "Calibrating Car-Following Models using SUMO-in-the-loop and Vehicle Trajectories from Roadside Radar"

License: MIT License

Python 5.00% Jupyter Notebook 95.00%
car-following car-following-model optimization sumo traffic-simulation

sumo-cf-calibration's Introduction

Calibrating Car-Following Models using SUMO-in-the-loop and Vehicle Trajectories from Roadside Radar

License: MIT

Overview

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.

Paper Figure Directory

  1. Figure 1: Not included in this repository
  2. Figure 2: Not included in this repository
  3. Figure 3: ./notebooks/post_processing.ipynb
  4. Figure 4: ./notebooks/post_processing.ipynb
  5. Figure 5: ./notebooks/post_processing.ipynb
  6. Figure 6: ./notebooks/post_processing.ipynb
  7. Figure 7: ./notebooks/post_processing.ipynb
  8. Figure 8: ./notebooks/post_processing.ipynb
  9. Figure 9: ./notebooks/post_processing.ipynb

Calibration Architecture

flowchart

Setup & Installation

Python

  1. Create a virtual environment: python3 -m venv venv
  2. Activate the virtual environment: source venv/bin/activate
  3. Install the requirements: pip install -r requirements.txt

Additional for Running SA

  1. Install SUMO and add the bin directory to your PATH environment variable.
    • Set the SUMO_HOME environment variable to the path of your SUMO installation.

Directory Structure

.
├── 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

Data Directory

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.

Running the Calibration

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:

  1. SUMO_HOME: The path to your SUMO installation
  2. PYTHONPATH: The path to ./src must be added to the PYTHONPATH environment variable.
  3. PROJECT_ROOT: The path to the root of this project. This is used to find the simulation data & set the output

Calibration Configuration

The calibration analyis is configured by two YAML files:

  1. ./config/sumo-pipelines/sumo_pipelines.yaml
    • Defines the workflow and the Metadata
  2. ./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.

Citation

< TODO >

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.