Skip to main content

Symbolic Modelling of Highway Traffic Networks with METANET

Project description

Symbolic Modelling of Highway Traffic Networks with METANET

network-example

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).

PyPI version Source Code License Python 3.9

Tests Downloads Maintainability Test Coverage Code style: black


Installation

To install the package, run

pip install sym-metanet

sym-metanet has the following dependencies

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sym_metanet-1.1.1.tar.gz (38.0 kB view hashes)

Uploaded Source

Built Distribution

sym_metanet-1.1.1-py3-none-any.whl (35.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page