Skip to main content

DLSim4GMNS

CI PyPI Python License Docs

A physics-gated space-time-event freeway simulator on GMNS — predict density, let the fundamental diagram give speed and flow so q = k·v holds by construction, and a built-in physics gate validates every state. One pipeline runs on any GMNS network: a corridor, a whole region, or a new city built from OpenStreetMap.

Part of the ASU Trans-AI Lab GMNS toolchain alongside osm2gmns, Path4GMNS, and Vol2Timing.

Positioning (read this first)

DLSim4GMNS is a GMNS-first, freeway-and-corridor-oriented dynamic traffic simulator for MPO-scale workflow automation — fast enough for repeated scenario testing, physically constrained enough for planning credibility, and simple enough to run from standard GMNS networks without heavy microsimulation setup.

It is not a replacement for full microscopic simulators such as SUMO/VISSIM/Aimsun; it complements them for fast, reproducible, GMNS-native corridor and MPO scenario work. Use DLSim4GMNS to go from a GMNS network to a decision-ready scenario report; use SUMO for detailed microscopic, multimodal, or signal-control simulation.

→ docs/design_rationale.md · docs/benchmark_protocol.md · docs/positioning_vs_sumo.md · docs/assumptions.md

Install

pip install DLSim4GMNS               # core (numpy, pandas)
pip install "DLSim4GMNS[odme]"       # + dynamic ODME (scipy)
pip install "DLSim4GMNS[osm]"        # + OSMnx/Boeing transfer networks

Quickstart

import dlsim4gmns as dl

out = dl.run()                       # bundled sample corridor
print(out["gate"])                   # True — physics gate passed
print(out["state"].head())           # density-canonical state: q = k*v exact

or the CLI on any GMNS folder (node.csv, link.csv):

dlsim4gmns path/to/network           # load -> simulate -> physics gate

The MPO workflow (dr)

The workflow spine — GMNS network + dynamic OD demand → physics-checked dynamic state → report (see docs/demonstration_levels.md):

dr validate  examples/merge_bottleneck        # network/scenario complete + physical
dr run       examples/merge_bottleneck        # -> out/link_state.csv, bottleneck_report.csv, ...
dr calibrate examples/merge_bottleneck --observed 6473   # 1-parameter ODME
dr report    examples/merge_bottleneck/out    # -> out/scenario_report.md
dr field     examples/data/i210e_field        # validate REAL corridor data + rank bottlenecks

Level-2 field testbed (examples/data/i210e_field/): the real I-210E freeway (73 links, Caltrans PeMS, public). The validated result is that the density-canonical model predicts observed speed from observed density (via a per-link-calibrated triangular FD) to ~7% MAPE — a genuine model-vs-field test. (q = k·v also holds to ~100%, but that is internal consistency, not validation: PeMS density is derived as flow/speed, so the identity holds by construction.) The bottleneck ranking recovers the recurring I-210E congestion. See examples/06_corridor_i210e.py.

The Level-1 oracle (examples/merge_bottleneck/) is a 1-2-3 merge where a downstream incident forms a queue that spills back upstream — the whole causal chain (demand → capped discharge → queue → speed drop → spillback → travel time → ODME recovery), every state passing the physics gate. The freeway-junction toolkit (examples/freeway_junction/) adds an off-ramp diverge and a ramp meter (lane-proportional merge, non-blocking off-ramp, time-dependent metering — see docs/assumptions.md). Both run on the pure-Python engine (any platform) and match the native C++ engine bit-for-bit.

The four-step GMNS workflow

  1. Network — build a GMNS network (osm2gmns from OpenStreetMap, or your own).
  2. Load — dl.read_network(dir) → nodes, links, and the per-link fundamental diagram.
  3. Simulate — dl.simulate(net) → a density-canonical state {speed, flow, density}.
  4. Validate — dl.validate(state, fd) → the physics gate (q=k·v, FD-feasible, …).

What's inside

Module Purpose
dlsim4gmns.fd triangular fundamental diagram; q = k·v exact; speed→density inversion
dlsim4gmns.gmns GMNS node/link readers; FD from link attributes
dlsim4gmns.dynamics Newell KW dynamic loading — corridor + freeway-junction (merge/diverge) engine
dlsim4gmns.scenario scenario driver: GMNS + dynamic OD + incidents/meters → physics-checked state
dlsim4gmns.native the same engine in C++ (libdlsim), ctypes-loaded; bit-identical to Python
dlsim4gmns.control Simulator — step-and-observe control interface (the TraCI analog)
dlsim4gmns.field Level-2 field testbed: load real corridor data, validate physics, FD calibration
dlsim4gmns.validator the physics gate (G0 schema, G1 q=k·v/FD-feasible)
dlsim4gmns.odme dynamic ODME (Flow-Through-Tensor / GLS) — [odme] extra
dlsim4gmns.dr the dr MPO workflow CLI (validate / run / calibrate / compare / report / field)
dlsim4gmns.simulator, .pipeline light density-canonical reference producer + one-shot pipeline

Scope of v0.1.0 (be honest). The Newell kinematic-wave dynamic loader is real and resolves queues, spillback, lane-proportional merges, off-ramp diverges, and ramp meters — shipped in both pure Python and a native C++ backend (libdlsim), verified bit-identical, and validated on a real corridor (I-210E, 7% speed MAPE). It is not the full research STE kernel (movement-level signals, OpenMP determinism, the Chicago-Regional 39k-link stage runner) — that separate C++ codebase is referenced by the six xfail stubs in test_M3_backend.py, which carry its analytic values. See docs/assumptions.md for exactly what the engine models, and RELEASE_PLAN.md for the roadmap.

Each feature is a runnable test (tests/features/) with a real assertion, plus a figure. Full map: FEATURES.md.

Fundamental diagram q = k·v

The whole thesis in one figure: predict density, and the FD gives speed and flow so q = k·v holds exactly. Space-time heatmap, network map, and ODME-fit plots are in examples/figures/.

Examples & data

examples/ has runnable scripts; examples/data/ieee_sample/ is a real corridor from the IEEE Big-Data TrafficFlowBench-CA competition (I-10E GMNS network). Run:

python examples/01_quickstart.py          # load -> simulate -> gate
python examples/04_merge_bottleneck.py    # Level-1 oracle: merge + incident causal chain
python examples/05_freeway_junction.py    # merge + off-ramp diverge + ramp meter
python examples/06_corridor_i210e.py      # Level-2: real I-210E, physics-validated
pytest                                     # the full suite (45 pass, 6 xfail = STE stage runner)

Documentation & citation

API reference (HTML): https://asu-trans-ai-lab.github.io/DLSim4GMNS/dlsim4gmns.html — auto-built from docstrings by pdoc and published to GitHub Pages on every push (.github/workflows/docs.yml; build locally with pip install -e ".[docs]" && pdoc dlsim4gmns -o site).

Design & method docs: docs/. Based on the Qu & Zhou (2017) space-time-event framework. Data samples are research-derived from public Caltrans PeMS + OpenStreetMap/GMNS. Apache-2.0. Contributions welcome — see RELEASE_PLAN.md.

Metadata

Release files for DLSim4GMNS 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for DLSim4GMNS 0.1.0
File Size Uploaded Provenance Actions
dlsim4gmns-0.1.0.tar.gz 446.7 kB With provenance Details for dlsim4gmns-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for DLSim4GMNS 0.1.0
File Interpreter ABI Platform Actions
dlsim4gmns-0.1.0-py3-none-any.whl Python 3 none any Details for dlsim4gmns-0.1.0-py3-none-any.whl

Total release size: 652.3 kB

Release files / dlsim4gmns-0.1.0.tar.gz

Download URL dlsim4gmns-0.1.0.tar.gz
Size 446.7 kB
Tags Source
SHA-256 checksum
How to use checksums
350006d712d3db7824ebc59058c55739d37861f186269fce9f9f1a423b6d9c91
BLAKE2b-256 checksum
How to use checksums
d37764a281190579607be82ba37c665b0e252bb8e6fe6030eea4754a29fa8abc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.

Transparency log

Release files / dlsim4gmns-0.1.0-py3-none-any.whl

Download URL dlsim4gmns-0.1.0-py3-none-any.whl
Size 205.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f65bca688085c675c70a636112062fa52d735c9a86734442087ebc2ba86a914a
BLAKE2b-256 checksum
How to use checksums
9c0f0844488795b432aa55bc22514a3ef0158b473dfb9d907d18be2b72074cd4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.

Transparency log

Security for DLSim4GMNS 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dlsim4gmns-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 6, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page