Skip to content

AureClai/stream-python

Repository files navigation

🇺🇸 🇫🇷 🇪🇸 🇨🇳 🇯🇵 🇵🇹

forthebadge made-with-python Open Source? Yes! Join the chat at https://gitter.im/FaradayRF/Lobby

Event-Based Mesoscopic Traffic Simulator

What is Stream?

Stream is a mesoscopic traffic simulation tool, that is, a tool whose level of resolution is intermediate between microscopic and macroscopic levels. It also considers vehicles rather than a flow, but merely calculates the passing times of vehicles at the nodes of the road network, rather than calculating all its positions at fixed time steps. The advantages of this resolution method are (i) reduced computing times compared to microscopic, (ii) a reduced number of parameters with clear physical meaning facilitating the parameterization process compared to microscopic, (iii) a wide diversity of use cases far less restrictive than the macroscopic one.

Main Features

  • Event-based mesoscopic calculation core
  • Upstream and shortest path static assignment
  • Limited management * of different vehicle classes
  • Complex node management
  • Traffic light intersection management
  • Specific lane management (reserved and auxiliary lanes)
  • Dynamic regulation during simulation

Contact

The main contribution is made by the Cerema East-Central Department. If you have any questions, please send an email to the following address: aurelien.clairais@cerema.fr

Installation

Stream works under Anaconda for Python 3.9. With Anaconda, the use of virtual environments is recommended:

$ conda create --name myenv
$ conda activate myenv

The installation is done via cloning the directory followed by installing the package with pip.

1. Clone the Directory

$ git clone https://github.com/AureClai/stream-python
$ cd stream-python

2. (optional) Switch Branch (if developing on a branch other than master)

$ git checkout the_branch

3. Install

$ pip install .

Usage

Command Line Usage

$ stream -i file_of_inputs.npy

From here, a new result folder has been created in the folder containing the input file with the simulation results associated with the date and time in .npy format. If a results folder has been pointed (see stream --help on command line), the results will be saved in this folder.

Usage via a Python Script

from stream.main import run_simulation_from_inputs
import numpy as np

# Import the input file
Inputs = np.load("path_to_the_inputs_file.npy", allow_pickle=True).item()
Simulation = run_simulation_from_inputs(Inputs)

Here, the results are created in the form of a dictionary in the Simulation variable.

Usage via the Graphic Interface

$ stream-gui

Use QStream to Design Scenarios

The QGIS extension https://gitlab.cerema.fr/Stream/qstream allows:

  • scenario definition
  • analysis features

Bugs

No known bugs. If you witness a bug, please open an "issue".

License

Cecill-B.

TODO

  1. Implementation of visualization tools with the Python dash library from Plotly
  2. Management of variable output capacity
  3. Several assignment modes
  4. Dynamic speed regulation
  5. Access regulation
  6. Management of other types of input/output formats