sumo-rs — Microscopic Urban Traffic Simulation (IDM, Krauss & MOBIL) in Pure Rust
sumo-rs is a high-performance Rust port of the SUMO microscopic traffic simulator that models individual vehicle acceleration, lane changing, and signalized intersections. It implements the Intelligent Driver Model (IDM), Krauss stochastic car-following, and MOBIL lane-change incentives with zero heap allocations per tick.
$ cargo add sumo-rs
Core Microscopic Traffic Algorithms
Strictly verified against Eclipse SUMO dynamics with full mathematical proofs, guaranteeing realistic car-following and zero runtime collisions.
Krauss Safe Speed Model
Implements the Krauss (1998) collision-free car-following model. Dynamically determines safe following speed \(v_{safe}\) considering driver reaction time \(\tau\), deceleration limits \(b\), and driver dawdling imperfection \(\sigma\).
Intelligent Driver Model (IDM)
Treiber, Hennecke, & Helbing (2000) non-linear continuous acceleration model. Produces human-like smooth acceleration curves, dynamic equilibrium time headways \(T\), and realistic emergency braking under acute approach rates.
MOBIL Lane-Changing Model
Minimizing Overall Braking Induced by Lane changes (Kesting et al.). Arbitrates lane changes by calculating net collective acceleration gain weighted by driver politeness \(p\), enforcing follower safety braking boundaries \(b_{safe}\) and asymmetric keep-right bias.
Intersection SPaT & Conflict Zones
NTCIP / SAE J2735 compliant Signal Phase & Timing (SPaT) multi-stage controllers. Supports unprotected left-turn yielding to oncoming straight trajectories, all-way stop FIFO arrival arbitration, and continuous spatial-temporal conflict zone reservations.
Road Network Graph Topology
Geometric graph topology with high-precision polyline lanes, internal intersection connection links, and neighbor connectivity matrices. Includes built-in Dijkstra routing across complex arbitrary networks.
Bevy 3D Game Engine Integration
Seamlessly translates 2D road lane coordinates and headings into 3D world transforms (`Vec3`, `Quat`) for Bevy entities. Perfect for open-world traffic in autonomous vehicle simulation, digital twins, and urban video games.
Algorithmic Formulations
Exact governing equations implemented in pure Rust, ensuring microscopic physical consistency.
Krauss Safe Velocity & Dawdling
Calculates the absolute maximum safe speed to guarantee avoiding rear-end impact with leading vehicle \(l\):
Where \(g = \max(0, \text{gap} - s_0)\), with driver reaction headway \(\tau\). Stochastic driver imperfection is injected via:
IDM Acceleration & Dynamic Gap
Continuous acceleration balancing free-flow cruising acceleration against braking distance:
The dynamic desired gap accounts for current speed and approaching velocity \(\Delta v = v - v_l\):
MOBIL Incentive & Safety
Ego vehicle only changes lanes if collective acceleration improves without causing excessive follower braking:
Follower deceleration is strictly guarded by the safety criterion:
Microsecond Microscopic Traffic vs. Eclipse SUMO (C++)
Extensive integration test suite and native benchmarks comparing pure Rust against upstream Eclipse SUMO. Read Full BENCHMARKS.md →
Test Suite Status 23 / 23 PASSED
Engine Performance vs. Eclipse SUMO BENCHMARK
Integrate sumo-rs in Seconds
Add to Cargo.toml and simulate multi-lane highways or signalized intersections with a few lines of Rust.
[dependencies]
sumo-rs = "0.1"
glam = "0.29"