Skip to content

About

🚈 Next-gen railway simulation & digital twin for the Southern Railway. Equipped with autonomous multi-lane routing, live train telemetry, and smart AI-driven maintenance blocking. ⚑

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

296 Commits

Folders and files

Repository files navigation

πŸš‚ BlockTrain

AI-Powered Automatic Block Planning to Maximize Asset Availability for Train Operations on Indian Railways

Problem Statement ID: 26027 β€’ Ministry of Railways (Smart India Hackathon)

License: MIT Deployed on AWS Frontend Vercel Next.js 14 Python AI Engine PostgreSQL RDS


πŸ“Œ Executive Summary

Railway maintenance across Engineering (Civil - TMS), Signalling & Telecommunication (S&T - SMMS), and Traction Distribution (TRD - TDMS) is currently planned in isolated departmental silos. Requests for maintenance line blocks via the legacy Block Disconnection Management System (BDMS) are handled manually and sequentially.

This uncoordinated approach causes severe network congestion: a single 5 km stretch of track is often shut down three separate times in one week for three different departments, wasting vital capacity and delaying passenger and freight operations.

BlockTrain solves this crisis by deploying an intelligent, AI-driven optimization layer directly on top of BDMS. It ingests siloed maintenance feeds into a unified 39-feature tensor, evaluates composite degradation risks with machine learning, and clusters multi-department tasks into synchronized Spatial Shadow Blocksβ€”slashing weekly track downtime by 86.06% while guaranteeing 100% emergency safety precision.


🌟 Key Innovations & Differentiators

Capability Legacy BDMS (Manual) BlockTrain AI Engine
Multi-Dept Coordination 0% (Isolated Silos) 84% Optimal Concurrent Shadow Triples
Weekly Line Closures 116.0 Track-Hours Lost 16.2 Track-Hours (86.06% Downtime Cut)
Emergency Safety Recall ~60% (Subjective / Missed Flaws) 100.0% Recall & Precision (Asymmetric Loss $w=10\times$)
Schedule Generation Speed 4 – 5 Days (Paper Vetting) < 30 Seconds (Deterministic Global Optimization)
Timetable Conflict Rate High Risk of Traffic Overlap 0 Conflicts (Strict Hard Constraint vs. COA Schedule)
Field Execution Loop Manual Paper Forms & Phone Calls Auto Form T/409 (PDF/QR) + Kavach 4.0 Radio TSR

🧠 Core Architecture & AI Engine

                                  MULTI-DEPARTMENT DATA INGESTION
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚      Track (TMS)      β”‚     Signals (SMMS)     β”‚     Traction (TDMS)    β”‚
          β”‚  234 Civil Defects    β”‚  312 Switch & Signals  β”‚  224 OHE 25kV Defects  β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                      β”‚                       β”‚                        β”‚
                      β–Ό                       β–Ό                        β–Ό
      ══════════════════════════════════════════════════════════════════════════════════════
                                  39-DIMENSIONAL FEATURE TENSOR
                  (Fatigue Index, Overdue Days, GMT Tonnage, Asset Age, Risk Tier)
      ══════════════════════════════════════════════════════════════════════════════════════
                                              β”‚
                                              β–Ό
                        STAGE 1: TWO-STAGE GBDT PRIORITY ENSEMBLE
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚ 150-Tree Gradient Boosting Regressor   β”‚ 4-Class Classifier (Asymmetric Loss)   β”‚
          β”‚ Outputs Continuous MPI Score (0 - 100) β”‚ 100% Emergency Precision (Zero Flaws)  β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                              β”‚
                                              β–Ό
                        STAGE 2: SPATIAL SHADOW BLOCK OPTIMIZER
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚ Mixed-Integer Linear Programming (MILP) & Greedy Spatial Clustering (Ξ” 2.5 km)   β”‚
          β”‚ Bundles multi-department tasks into zero-conflict passenger timetable gaps     β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                              β”‚
                                              β–Ό
                             AUTOMATED FIELD EXECUTION & DISPATCH
          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
          β”‚   14-Day Rolling Schedule β”‚  Digital Form T/409     β”‚  Kavach 4.0 ATP Radio     β”‚
          β”‚   Real-time RDS Grid Sync β”‚  Printable QR Verificationβ”‚  IR-TCAS-01 TSR Packets  β”‚
          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

1. Two-Stage Stacked Machine Learning Model

  • Stage 1 (Continuous MPI Regressor): Evaluates compounding infrastructure stress using a 150-tree Gradient Boosting Regressor, generating a granular Maintenance Priority Index (MPI: 0.0 to 100.0).
  • Stage 2 (4-Tier Urgency Classifier): Enforces an Asymmetric Safety Loss Function ($\mathcal{L}{\text{asymmetric}}$ with $w{\text{Critical}} = 10.0$). A 10Γ— penalty is applied to any misclassified structural flaw, ensuring 100% precision on critical track fractures.

2. Four-Tier Slotting Framework (IRPWM Compliant)

  • Tier 1 β€” Daylight Precision Slots (11:30 AM – 02:30 PM): Utilizes midday traffic lulls for visual track inspection and USFD ultrasonic testing under natural daylight.
  • Tier 2 β€” Deep-Night Heavy Machine Corridors (01:00 AM – 04:30 AM): Dedicated to heavy mechanized operations (CSM Tamping, Ballast Cleaners, Rail Grinders).
  • Tier 3 β€” Tactical Micro-Gaps (15 – 45 Mins): Non-intrusive off-track electronic card swaps and point motor lubrication during timetable gaps.
  • Tier 4 β€” Dynamic Emergency TSR: Automated 20 km/h Temporary Speed Restriction alerts while locking the nearest emergency slot.

3. Real-World Corridor Digital Twin

The system is modeled upon ground truth data from the 60 km Southern Railway South Line (Chennai Beach MSB to Chengalpattu CGL):

  • 26 Connected Stations with exact chainages ($0.00\text{ to }59.84\text{ km}$).
  • 13 Level Crossings (LC-26 to LC-64).
  • 72 Four-Aspect Signals and 182 Point Motor Switches.

πŸ’» Tech Stack

Frontend & Dispatch Dashboard

  • Framework: Next.js 14 (App Router, Server Components)
  • Library & UI: React 19, Tailwind CSS v4, Lucide Icons
  • State Management: Zustand (Live async database synchronization)
  • Delivery: Vercel Global Edge Network

Backend & Microservices

  • Core API: Node.js, Express.js (v5.2), RESTful endpoints
  • ML Inference Microservice: Python 3.11, Zero-dependency ThreadingHTTPServer (<15ms latency)
  • Machine Learning: Scikit-Learn (GradientBoostingRegressor), Pandas, NumPy

Database, Cloud & Security

  • Database: Managed Amazon RDS PostgreSQL
  • Compute Hub: Amazon EC2 (Dockerized container services)
  • Security & Secrets: AWS Systems Manager (SSM) Parameter Store (Zero hardcoded secrets), AWS VPC Isolation, Helmet.js, Express Rate Limiting

πŸ“ Repository Structure

Block-Train/
β”œβ”€β”€ apps/
β”‚   └── api/                     # Node.js Express Backend API
β”‚       β”œβ”€β”€ src/
β”‚       β”‚   β”œβ”€β”€ core/            # Database pool & AWS RDS connectors
β”‚       β”‚   β”œβ”€β”€ routes/          # Active blocks, schedule & memo routes
β”‚       β”‚   └── scripts/         # PostgreSQL schema migration & seeds
β”‚       └── Dockerfile           # Containerized API definition
β”œβ”€β”€ frontend/                    # Next.js 14 Enterprise SaaS Console
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ rbms/            # 14-Day Rolling Block Management Grid
β”‚   β”‚   β”‚   β”œβ”€β”€ ai-planner/      # Live ML Priority Triage & Shadow Bundling
β”‚   β”‚   β”‚   β”œβ”€β”€ map/             # 26-Station Live Digital Twin & Corridor View
β”‚   β”‚   β”‚   β”œβ”€β”€ maintenance/     # Legacy Block Management View
β”‚   β”‚   β”‚   └── workers/         # Field Crew Geofencing & Dispatch
β”‚   β”‚   └── lib/
β”‚   β”‚       └── store.ts         # Global Zustand Store & RDS Sync Loop
β”œβ”€β”€ model_implementation/        # Python AI Engine & Optimization Suite
β”‚   β”œβ”€β”€ models/                  # Serialized GBDT Pipeline (.pkl)
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ ai_inference_service.py      # Microservice (Port 5001)
β”‚   β”‚   β”œβ”€β”€ train_defect_prioritizer.py  # Two-stage model training
β”‚   β”‚   β”œβ”€β”€ block_planning_optimizer.py  # Spatial Shadow-Block clustering
β”‚   β”‚   └── simulate_railway_data.py     # Chennai Beach-Chengalpattu generator
β”‚   └── data/                    # Synthesized TMS, SMMS, TDMS datasets
β”œβ”€β”€ docs/                        # Complete System Blueprints & Master Context
└── docker-compose.yml           # Multi-container local & cloud orchestrator

πŸ› οΈ Quick Start & Local Setup

Prerequisites

  • Node.js: v20.x or higher
  • Python: v3.11.x
  • Docker & Docker Compose (Optional, for full containerized stack)

1. Clone the Repository

git clone https://github.com/kevinjosh10/Block-Train.git
cd Block-Train

2. Run with Docker Compose (Recommended)

docker-compose up -d --build

3. Run Locally (Manual)

A. Start the Python AI Inference Microservice:

cd model_implementation/scripts
python ai_inference_service.py
# Server starts on http://localhost:5001

B. Start the Node.js API Backend:

cd apps/api
npm install
npm run dev
# API starts on http://localhost:5000

C. Start the Next.js Frontend:

cd frontend
npm install
npm run dev
# Web Console opens on http://localhost:3000

πŸ“œ Legal & Compliance Integration

  • Automated Form T/409: Programmatically renders statutory Disconnection and Reconnection Memos for Station Masters and Section Engineers, complete with QR-code verification.
  • Kavach 4.0 ATP Radio: Encodes temporary block boundaries into official IR-TCAS-01 Temporary Speed Restriction (TSR) packets for locomotive cab transmission.

Built for the Ministry of Railways β€’ Smart India Hackathon

Securing and Automating the Future of Indian Railways Operations

About

🚈 Next-gen railway simulation & digital twin for the Southern Railway. Equipped with autonomous multi-lane routing, live train telemetry, and smart AI-driven maintenance blocking. ⚑

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages