How sjschlapbach/traffic_flow_models works
This is a Python library for highway traffic-flow simulation and analysis. Its main workflow is to construct a network from links and junctions, choose CTM or METANET, and run a time-dependent simulation with demands, boundary conditions, and turning rates. The library also provides ramp-metering controllers, calibration, performance metrics, and visualization. Paper-run and output modules form a separate research-results branch. Some internals were not sampled; links to those are shown only where the README or SOURCE INDEX supports them.
Main entry points: simulation.py Simulation · onramp.py Onramp · runs.py Paper run registry · outputs.py Result access
Components 20
Network topology
- Origin
src/traffic_flow_models/network/origin.py - Destination
src/traffic_flow_models/network/destination.py - Cell
src/traffic_flow_models/network/cell.py - Motorway link
src/traffic_flow_models/network/motorway_link.py - Onramp
src/traffic_flow_models/network/onramp.py - Offramp
src/traffic_flow_models/network/offramp.py - Junction node
src/traffic_flow_models/network/node.py - Network
src/traffic_flow_models/network/network.py
Models and simulation
- CTM model
src/traffic_flow_models/model/ctm.py - METANET model
src/traffic_flow_models/model/metanet.py - Simulation
src/traffic_flow_models/network/simulation.py
Ramp control
- Flow controller
src/traffic_flow_models/controller/flow_controller.py - ALINEA
src/traffic_flow_models/controller/alinea.py - METALINE
src/traffic_flow_models/controller/metaline.py - Custom controller
src/traffic_flow_models/controller/custom_controller.py
Calibration
- Calibrator
src/traffic_flow_models/network/calibrator.py
Paper results
- Paper run registry
paper/runs.py - Result access
paper/outputs.py - Figure styling
paper/style.py
Other components
- Library user
Connections 30
- Library user → Origin: defines demand source
README.md - Library user → Destination: defines exit
README.md - Library user → Motorway link: defines road link
README.md - Library user → Onramp: defines ramp
README.md - Library user → Offramp: defines ramp
README.md - Library user → Junction node: connects links
README.md - Library user → Network: builds network
README.md - Library user → Simulation: runs simulation
README.md - Network → Simulation: supplies topology
README.md - Library user → CTM model: selects model
README.md - Library user → METANET model: selects model
README.md - CTM model → Simulation: used by
README.md - METANET model → Simulation: used by
README.md - Cell → Motorway link: composes cells
src/traffic_flow_models/network/motorway_link.py - Destination → Offramp: used as exit
src/traffic_flow_models/network/offramp.py - Library user → ALINEA: selects controller
README.md - Library user → METALINE: selects controller
README.md - Library user → Flow controller: selects controller
- Library user → Custom controller: supplies callable
src/traffic_flow_models/controller/custom_controller.py - Onramp → ALINEA: holds controller
src/traffic_flow_models/network/onramp.py - Onramp → METALINE: holds controller
src/traffic_flow_models/network/onramp.py - Onramp → Flow controller: holds controller
src/traffic_flow_models/network/onramp.py - Onramp → Custom controller: holds controller
src/traffic_flow_models/network/onramp.py - Library user → Calibrator: calibrates parameters
README.md - Calibrator → Simulation: uses simulation
src/traffic_flow_models/network/calibrator.py - Library user → Paper run registry: runs paper scenarios
paper/runs.py - Paper run registry → Simulation: executes runs
paper/runs.py - Result access → Paper run registry: loads run data
paper/outputs.py - Library user → Result access: builds figures and tables
paper/outputs.py - Figure styling → Result access: styles figures