Skip to content

About

Repository for Transit Intelligence

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

FlowSync 2.0: Next-Gen Commuter & Transit Intelligence Platform

A closed-loop smart transportation digital twin and multimodal intelligence system built on the Apple Maps (iOS) Design System with dynamic Dark Mode, an Adaptive Traffic Signal Management System (ATCS), and microscopic Intelligent Driver Model (IDM) car-following dynamics across Delhi NCR.


🚦 Adaptive Traffic Signal Management System (ATCS)

                     ADAPTIVE TRAFFIC SIGNAL CONTROL (ATCS)
                                       │
    ┌──────────────────────────────────┼──────────────────────────────────┐
    ▼                                  ▼                                  ▼
Multi-Phase Timing Physics      Dynamic Optimization Engine         ITE Clearance Intervals
• Green (g), Yellow (y)         • Adaptive Max-Pressure Balancing   • Kinematic Yellow: ty = t_r + v/(2a)
• All-Red Clearance (r_all)     • Webster's Minimum Delay Model     • Clearance All-Red: r = (W + L)/v
• Opposing Red (R)              • 4-Corridor Green-Wave Offsets     • Transit & CATS 108 Preemption

1. Dynamic Signal Timing Physics & Formulas

  • Webster's Optimum Minimum-Delay Cycle Formula: $$C_0 = \frac{1.5 L + 5}{1 - Y}$$

    • $L = 2 \times (\text{Yellow} + \text{All-Red}) = 2 \times (3.5\text{s} + 1.8\text{s}) = 10.6\text{s}$ (Total Lost Time per cycle).
    • $Y = \sum \frac{q_i}{s_i}$ (Sum of directional approach flow ratios against saturation flow rate $s \approx 1800\text{ vph/lane}$).
    • Computes optimal green splits: $g_i = (C_0 - L) \times \frac{y_i}{Y}$.
  • Adaptive Max-Pressure Queue Balancing: Allocates green split durations directly proportional to real-time approach queues ($Q_{\text{NS}}$ vs. $Q_{\text{EW}}$) detected by the IDM vehicle tracking engine: $$g_{\text{NS}} = \max\left(g_{\min}, , \min\left(g_{\max}, , \text{allocatable} \times \frac{Q_{\text{NS}}}{Q_{\text{NS}} + Q_{\text{EW}}}\right)\right)$$

  • ITE Kinematic Yellow Change & All-Red Clearance Intervals: $$\tau_y = t_{\text{reaction}} + \frac{v_{\text{approach}}}{2 \cdot a_{\text{comfort}}} \quad \approx 3.0\text{s} - 4.5\text{s}$$ $$r_{\text{all}} = \frac{W_{\text{intersection}} + L_{\text{vehicle}}}{v_{\text{approach}}} \quad \approx 1.5\text{s} - 2.5\text{s}$$

  • Coordinated Arterial Green-Wave Corridors: Synchronizes signal offsets ($t_{\text{offset}} = \frac{\Delta d}{v_{\text{progression}}}$) along 4 major Delhi corridors:

    1. Inner Ring Road Arterial: Dhaula Kuan $\rightarrow$ AIIMS $\rightarrow$ South Ext $\rightarrow$ Lajpat Nagar ($48\text{ km/h}$)
    2. Central Delhi Spine: Connaught Place $\rightarrow$ ITO $\rightarrow$ Pragati Maidan $\rightarrow$ Akshardham ($42\text{ km/h}$)
    3. South Delhi Tech Corridor: AIIMS $\rightarrow$ Hauz Khas/IIT $\rightarrow$ Nehru Place $\rightarrow$ Okhla ($45\text{ km/h}$)
    4. West Delhi Spine: Punjabi Bagh $\rightarrow$ Rajouri Garden $\rightarrow$ Janakpuri $\rightarrow$ Dwarka ($46\text{ km/h}$)

🎨 Apple Maps (iOS) Design System & Dark Mode

                         APPLE MAPS (iOS) DUAL THEME
                                       │
    ┌──────────────────────────────────┼──────────────────────────────────┐
    ▼                                  ▼                                  ▼
Parchment Cream Canvas          Dynamic Dark Mode                  SF Pro & iOS System Roles
• Warm #F6F1E6 land tones       • Cool Charcoal Canvas (#000000)   • Display, Text & Compact
• Soft #B9D9EB water            • Warm Dark Land (#2A2826)         • Tabular figures (0.4 mi · 2 min)
• Voyager agency styling        • Bright Maps Blue (#409CFF)       • Maps Blue & System Red
  • Parchment Cartography (#F6F1E6): Warm cream-paper terrain, soft blue water, and clean slate roads.
  • Apple Maps Dark Mode (#000000 & #2A2826): Dynamic toggle with instant CartoDB Dark Matter / Voyager tile switching, dark frosted cards (#1C1C1E), high-contrast text, and brightened #409CFF Maps Blue for nocturnal legibility.
  • Translucent .regularMaterial Surfaces: Floating glassmorphism search cards, modal sheets, and the top-right circular controls stack (Dark Mode, Layers, Locate, Compass).
  • Interactive ATCS Console: 3-lamp vertical signal head housings (🔴 Red, 🟡 Yellow, 🟢 Green), real-time countdown meters, and live timing sliders.

🚀 Quick Start & Local Execution

1. Install Dependencies

python -m pip install -r requirements.txt

2. Run Automated Verification Tests

python tests/test_flowsync.py

3. Start FlowSync 2.0 Server Locally

Double-click run.bat or execute in terminal:

python -m uvicorn backend.main:app --host 127.0.0.1 --port 8000

Open http://127.0.0.1:8000 in your browser.


🌐 Deploy to GitHub & Vercel (Production Cloud)

1. Push to GitHub (Public Repository)

# 1. Create a public repository on GitHub (e.g. flowsync-2.0)
# 2. Add your GitHub repository as remote:
git remote add origin https://github.com/<YOUR_GITHUB_USERNAME>/flowsync-2.0.git
git branch -M main
git push -u origin main

2. Deploy to Vercel

  1. Go to vercel.com/new.
  2. Select "Import Git Repository" $\rightarrow$ choose flowsync-2.0.
  3. Vercel automatically detects vercel.json and builds the Python Serverless function at api/index.py.
  4. Click Deploy. Your app will be live globally on your Vercel URL!

📁 Project Structure

├── api/
│   └── index.py         # Vercel Serverless Function entry point
├── backend/
│   ├── network.py       # 42-node Delhi graph topology & 112 arterial corridors
│   ├── emissions.py     # VT-Micro kinematic emission & idling physics
│   ├── signals.py       # ATCS Multi-Color Signal Controller & Green-Wave sync
│   ├── routing.py       # BPR capacity routing & multimodal comparison
│   ├── ai_engine.py     # Spatio-temporal graph ML congestion forecaster
│   ├── simulator.py     # IDM microscopic simulator with ATCS queue feedback
│   └── main.py          # FastAPI REST API & WebSocket hub
├── frontend/
│   ├── index.html       # Apple Maps iOS styled UI & ATCS Console
│   ├── app.js           # 60 FPS Canvas renderer & ATCS controller
│   └── styles.css       # iOS Design System & 3-lamp signal head styling
├── tests/
│   └── test_flowsync.py # Full verification suite with ATCS & IDM physics tests
├── vercel.json          # Vercel deployment configuration
├── requirements.txt     # Python dependencies
├── .gitignore           # Git ignore configuration
├── PROJECT.md           # Master documentation & full code repository
├── README.md            # Comprehensive project overview & guide
└── run.bat              # One-click Windows launch script

📄 Complete Codebase & Master Specs

For the complete technical specification, design equations, and exact full source code of every module, refer to PROJECT.md.

About

Repository for Transit Intelligence

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages