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.2.tar.gz (37.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sym_metanet-1.1.2-py3-none-any.whl (35.3 kB view details)

Uploaded Python 3

File details

Details for the file sym_metanet-1.1.2.tar.gz.

File metadata

  • Download URL: sym_metanet-1.1.2.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for sym_metanet-1.1.2.tar.gz
Algorithm Hash digest
SHA256 f2c6c3c044fbfa258de09bd60ee3ea5aba4479ea026b6b4336b81c07457bfd85
MD5 f9a9f7522218fa19ad4e1c5856f942f3
BLAKE2b-256 a306db5dc0454344abe48096ef7fd5e423cccf02c0b50d1f44e022836325e904

See more details on using hashes here.

File details

Details for the file sym_metanet-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: sym_metanet-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 35.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for sym_metanet-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 73b9979a818cca8244b6ec2386bf03abffd592b7f7c7864ffa6f6a0d570280c3
MD5 1180530f7a2783b09b55d0b13967a8f2
BLAKE2b-256 c22d20639fa15611f06356d1c71013eb7277da16c7a9d3d19b27039cdbcc3102

See more details on using hashes here.

Supported by

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