Symbolic Modelling of Highway Traffic Networks with METANET
Project description
Symbolic Modelling of Highway Traffic Networks with METANET
sym-metanet is a Python package to model traffic networks with the METANET framework, a collection of tools to mathematically model the macroscopic behaviour of traffic in highway systems (see [1] and [2] for more details).
Installation
To install the package, run
pip install sym-metanet
sym-metanet has the following dependencies
- Python 3.8 or higher
- NetworkX
and optionally
For playing around with the source code instead, run
git clone https://github.com/FilippoAiraldi/sym-metanet.git
Usage
In METANET, a highway network is represented as a directed graph whose edges are stretches of highways, a.k.a. links. Each link bridges between nodes (that have no physical meaning), which in turn can host origins (sources of traffic flow) and destinations (sinks of flow). For instance, to create a very simple network consisting of a single link connecting an origin to a destination, we can do as follows:
import sym_metanet as metanet
...
N1 = metanet.Node(name="N1")
N2 = metanet.Node(name="N2")
L1 = metanet.Link(segments, lanes, L, rho_max, rho_crit, v_free, a, name="L1")
O1 = metanet.Origin(C[0], name="O1")
D3 = metanet.Destination(name="D3")
net = metanet.Network().add_path(origin=O1, path=(N1, L1, N2, L2, N3), destination=D3)
Once the network is built, we can validate it and use, e.g., CasADi, to symbolically construct a function that represents the dynamics governing this network (according to METANET).
net.is_valid(raises=True)
T = 10 / 3600 # sampling time
metanet.engines.use("casadi", sym_type="SX")
F = metanet.engine.to_function(net=net, T=T)
Function F
can be then used to simulate the state transitions of the network in the context of, e.g., highway traffic control (see [2] for more details).
Examples
Our examples folder contains an example on how to get started with this package.
Extensions
This code is symbolic-engine-agnostic, in the sense that it does not rely on a particular implementation of the underlying engine for symbolic computations. In other words, it is relatively easy to create a new engine for modelling networks with a new specific symbolic library (e.g., SimPy) by implementing the abstract class sym_metanet.engines.core.EngineBase
. An engine implemented in CasADi is already shipped but requires the symbolic library to be installed. Additionally, the engine is also implemented in NumPy (does not allow symbolic computations though).
License
The repository is provided under the MIT License. See the LICENSE file included with this repository.
Author
Filippo Airaldi, PhD Candidate [f.airaldi@tudelft.nl | filippoairaldi@gmail.com]
Delft Center for Systems and Control in Delft University of Technology
Copyright (c) 2023 Filippo Airaldi.
Copyright notice: Technische Universiteit Delft hereby disclaims all copyright interest in the program “sym-metanet” (Symbolic Modelling of Highway Traffic Networks with METANET) written by the Author(s). Prof. Dr. Ir. Fred van Keulen, Dean of 3mE.
References
[1] A. Messmer and Papageorgiou, “METANET: a macroscopic simulation program for motorway networks,” Traffic Engineering and Control, vol. 31, pp. 466–470, 1990.
[2] Hegyi, A., 2004. Model predictive control for integrating traffic control measures. Netherlands TRAIL Research School.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sym_metanet-1.1.1.tar.gz
.
File metadata
- Download URL: sym_metanet-1.1.1.tar.gz
- Upload date:
- Size: 38.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87c0ba5e75715e9c0bc08e890220ba60220b26ecb3917f3d597666e0c87e73bc |
|
MD5 | e540673f4d091888b925a81adcdfe4df |
|
BLAKE2b-256 | ab2922211b71b9d6c039af54243fc23df642319c370a8b1ef406a71fe5dd5d07 |
File details
Details for the file sym_metanet-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: sym_metanet-1.1.1-py3-none-any.whl
- Upload date:
- Size: 35.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ac16cf41a8bd99b3dc3368534832c48c4b662473f060c166ad9d6829475ab20 |
|
MD5 | eaab51abe68cc8ab2066b4d4e25cc529 |
|
BLAKE2b-256 | 19d8710a411ed172bc7ae34339fefae332ca13254f57e4937995fac6fd4d8cfd |