TrafficTwin — Urban Traffic Digital Twin Simulator

🚦
Smart City

An urban traffic simulation using the Nagel-Schreckenberg cellular automata model with real-time canvas visualization, congestion heatmaps, and traffic analytics.

Live Preview

Interactive preview — open in full window for the best experience

Technology Stack

Python 3.10FastAPICellular AutomataCanvas APISQLAlchemyDocker

Key Features

  • Nagel-Schreckenberg Model — Realistic cellular automata with acceleration and random braking
  • Grid Road Network — Configurable grid with roads and auto-generated intersections
  • Traffic Lights — Configurable green/yellow/red cycle durations per intersection
  • Real-Time Canvas — Animated rendering with vehicle tracking
  • Congestion Heatmap — Dynamic overlay using kernel-based density estimation
  • Traffic Analytics — Throughput, density, flow rate, and congestion zones
  • Simulation Presets — Light traffic, rush hour, and accident scenarios
  • Urban Dark Theme — Map-like styling with responsive dashboard

About This Project

Fully open source (MIT License), containerized with Docker, and includes a CI/CD pipeline via GitHub Actions. Demonstrates production-grade Python development with comprehensive test coverage, clean architecture, and professional deployment.