mesoLTM¶
A mesoscopic, individual-vehicle Link Transmission Model for traffic flow on
general road networks — distributed as the pip package mesoltm.
mesoltm sits in the middle of the traffic-modelling spectrum. Microscopic
models resolve car-following and lane-changing for every vehicle; macroscopic
models track only aggregate density and flow along links. A mesoscopic model
keeps the computational thrift of the macroscopic world while still following
individual vehicles — here, the discrete Link Transmission Model (LTM) advances
a triangular fundamental diagram on each link, but every unit of flow is one
vehicle with its own identity, route, and travel record.
That combination is what makes mesoltm useful: it scales to whole networks, yet
each vehicle carries a mutable, per-vehicle route you can rewrite mid-run
(for dynamic routing, access control, or reactive rerouting), plus free-form
metadata and a full trajectory for post-hoc analysis.
mesoltm is a re-implementation of the discrete LTM of de Souza, Verbas, Auld &
Tampère.1 It builds on their work, keeping the core traffic-flow
mathematics and adding general-network topologies, per-vehicle routing, plugins,
and trip metrics on top; every deliberate change is catalogued in
Deviations from the paper.
Install¶
pip install mesoltm # core (numpy + networkx)
pip install "mesoltm[plot]" # + matplotlib for plots and animations
Requires Python 3.11+. See Installation for all extras.
Quick start¶
from mesoltm import Vehicle, grid_network, ShortestPathPolicy
# A 4x4 grid where every node can be an origin or a destination.
net = grid_network(4, 4, link_length=200.0, all_nodes_od=True)
net.set_origin((0, 0), vehicles=[
Vehicle(vehicle_id=k, scheduled_departure=float(k), origin=(0, 0), destination=(3, 3))
for k in range(50)
])
sim = net.compile(time_step=1.0, total_time=400.0,
routing_policy=ShortestPathPolicy(dynamic=True))
sim.run()
print(sum(len(n.get_arrived_trips()) for n in sim.nodes), "vehicles arrived")
Continue with the Quickstart, or run a JSON scenario straight from the command line — see Running a scenario.
Where to go next¶
- The Model — the discrete LTM, the fundamental diagram, node flow resolution, and the simulation loop.
- User Guide — building networks, routing, plugins, metrics, and visualisation.
- API Reference — auto-generated from the source docstrings.
- About — how to cite
mesoltm, license, and changelog.
Citing mesoLTM
If you use mesoltm in academic or other work, please cite this repository.
A DOI is not yet registered — see Citation for the
current placeholder entry.
-
F. de Souza, O. Verbas, J. Auld, C. M. J. Tampère, "A mesoscopic link-transmission-model able to track individual vehicles", Simulation Modelling Practice and Theory 140 (2025) 103088. DOI: 10.1016/j.simpat.2025.103088. ↩