Skip to content

skaurbagga/Train_throughput

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

This **README** is designed to give your **SIH 2025** judges and collaborators a professional overview of the **IntelliRail** project. It highlights the technical complexity of your "Digital Twin" approach while providing clear setup instructions.

---

# ๐Ÿš† IntelliRail: AI-Powered Precise Train Traffic Control

**IntelliRail** is a high-performance "Digital Twin" system designed to maximize railway section throughput. Built for the **Smart India Hackathon (SIH) 2025 (Problem Statement #25022)**, it replaces static, rigid scheduling with a dynamic, AI-driven controller that safely compresses headway gaps to increase track capacity.

---

## ๐Ÿš€ Key Features

* **AI-Optimized Scheduling:** Uses **Google OR-Tools** to calculate mathematically optimal entry gaps (headway) between trains.
* **Predictive Risk Analysis:** A **PyTorch GRU model** analyzes real-time telemetry to predict congestion risks before they cause delays.
* **Real-Time Visualization:** A live **React dashboard** powered by **WebSockets** showing a side-by-side comparison of AI-Optimized vs. Standard tracks.
* **Historical Benchmarking:** Integrated **PostgreSQL** database to track and graph long-term efficiency trends using **Chart.js**.
* **Physics-Based Simulation:** Built on **SimPy** to ensure all movements obey realistic acceleration, braking, and safety interlocking rules.

---

## ๐Ÿ› ๏ธ Tech Stack

### **Backend (Python)**
| Component | Technology | Role |
| :--- | :--- | :--- |
| **API Framework** | **FastAPI** | Orchestration & High-speed WebSocket streaming. |
| **Optimization** | **Google OR-Tools** | Constraint Programming for gap optimization. |
| **Simulation** | **SimPy** | Discrete Event Simulation for train physics. |
| **AI/ML Engine** | **PyTorch (GRU)** | Time-series prediction for congestion risk. |
| **Database** | **PostgreSQL** | Storage for telemetry and run history. |

### **Frontend (React)**
| Component | Technology | Role |
| :--- | :--- | :--- |
| **UI Framework** | **React.js** | Modular, state-driven dashboard. |
| **Visuals** | **Chart.js / CSS3** | Real-time graphs and track animations. |
| **Communication** | **WebSockets** | Low-latency bi-directional data flow. |

---

## ๐Ÿ“ Project Structure

```bash
IntelliRail/
โ”œโ”€โ”€ backend/
โ”‚   โ”œโ”€โ”€ main.py            # FastAPI entry point & WebSocket logic
โ”‚   โ”œโ”€โ”€ simulation.py      # SimPy train & track physics logic
โ”‚   โ”œโ”€โ”€ optimizer.py       # Google OR-Tools scheduling logic
โ”‚   โ”œโ”€โ”€ ai_model.py        # PyTorch GRU architecture & prediction
โ”‚   โ”œโ”€โ”€ database.py        # PostgreSQL connection & queries
โ”‚   โ””โ”€โ”€ seed_data.py       # Script to populate historical data
โ””โ”€โ”€ frontend/
    โ”œโ”€โ”€ src/
    โ”‚   โ”œโ”€โ”€ App.jsx        # Main dashboard logic & state management
    โ”‚   โ”œโ”€โ”€ App.css        # Industrial SCADA-themed styling
    โ”‚   โ””โ”€โ”€ components/    # (Optional) Modular UI components
    โ””โ”€โ”€ package.json       # Frontend dependencies
```

---

## โš™๏ธ Installation & Setup

### **1. Prerequisites**
* Python 3.10+
* Node.js & npm
* PostgreSQL (Running on port 5432)

### **2. Backend Setup**
```bash
cd backend
pip install fastapi uvicorn simpy ortools torch psycopg2-binary
# Ensure your PostgreSQL database 'intellirail' is created
python seed_data.py  # Seed the database with initial trends
uvicorn main:app --reload
```

### **3. Frontend Setup**
```bash
cd frontend
npm install
npm run dev
```

---

## ๐Ÿง  How It Works: The Logic Flow

1.  **Input:** The user initiates a simulation from the dashboard.
2.  **Optimize:** `optimizer.py` calculates the tightest safe schedule for the requested trains.
3.  **Simulate:** `simulation.py` launches the trains. If a train slows down, the physics engine updates the telemetry.
4.  **Predict:** `ai_model.py` receives live telemetry via the backend. If it detects a "congestion signature," the **Risk Score** spikes.
5.  **Visualize:** Data is pushed through a **WebSocket** to the React UI, updating the train positions and graphs in real-time.

---

## ๐Ÿ”ฎ Future Roadmap

* **Multi-Priority Routing:** Dynamic prioritization for Express vs. Freight trains.
* **Environmental Awareness:** Adjusting safety buffers based on real-time weather data (rain/fog).
* **Decentralized Control:** Transitioning to an autonomous multi-agent system for individual train-to-train communication.

---

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors