A comprehensive prototype demonstrating Vehicle-to-Vehicle (V2V) communication for intelligent traffic management, comparing smart V2V-enabled vehicles with legacy non-V2V vehicles.
V2V Communication - Real-time data exchange between smart vehicles
AI-Powered Traffic Optimization - Machine learning for intelligent speed recommendations
Collision Detection & Avoidance - Predictive collision prevention for V2V vehicles
Emergency Vehicle Priority - Automatic path clearing (V2V vehicles only)
Smart Traffic Lights - Adaptive signal control
Real-time Dashboard - Live visualization and comparison
V2V vs Non-V2V Comparison
- Side-by-side performance metrics
- Collision avoidance effectiveness
- Emergency vehicle response
- Traffic flow efficiency
- Speed optimization
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ MOTHER SERVER (Cloud) โ
โ - Central data processing โ
โ - AI-based traffic optimization โ
โ - V2V message routing โ
โ - Collision detection & prevention โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โฒ โ
โ โ
โโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโ
โ โ
โโโโโโโโโโโผโโโโโโโโโโโ โโโโโโโโโโโผโโโโโโโโโโโ
โ V2V-ENABLED โ โ NON-V2V VEHICLES โ
โ VEHICLES โ โ (Legacy) โ
โ โ Smart routing โ โ โ No coordination โ
โ โ Collision avoid โ โ โ No warnings โ
โ โ Emergency aware โ โ โ No V2V data โ
โโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโโโโ
โ EMERGENCY โ
โ VEHICLES โ
โ ๐ Priority mode โ
โโโโโโโโโโโโโโโโโโโโโโ
- Receive real-time data from nearby vehicles
- Get AI-optimized speed recommendations
- Avoid collisions through predictive analysis
- Automatically yield to emergency vehicles
- Coordinate for smoother traffic flow
- Operate independently without vehicle coordination
- No collision warnings or avoidance
- Cannot detect emergency vehicles until very close
- Less efficient routing
- Higher accident risk
- Broadcast priority alerts
- V2V vehicles automatically clear path
- Non-V2V vehicles don't receive alerts
- Demonstrates V2V safety advantage
- Python 3.8 or higher
- pip package manager
cd "c:\Users\drvij\Desktop\MuLearn Scet\Microv2"
pip install -r requirements.txtOpen a terminal and run:
cd backend/mother_server
python app.pyYou should see:
๐ฆ V2V Traffic Management System - Mother Server
๐ก Server running on http://localhost:5000
Open a new terminal and run:
cd dashboard
streamlit run app.pyThe dashboard will automatically open in your browser at http://localhost:8501
Open a third terminal and run:
cd vehicles
python vehicle_simulator.pyThe simulation runs with:
- 8 V2V-enabled vehicles (smart, coordinated)
- 8 Non-V2V vehicles (legacy, uncoordinated)
- 2 Emergency vehicles (V2V-enabled with priority)
Edit vehicles/vehicle_simulator.py at the bottom:
simulator = TrafficSimulator(
num_v2v_vehicles=10, # Change number of smart vehicles
num_non_v2v_vehicles=5, # Change number of legacy vehicles
num_emergency=2 # Change number of emergency vehicles
)-
Emergency Vehicle Alerts
- V2V vehicles: Stop and yield immediately when emergency vehicle is 150m+ away
- Non-V2V vehicles: No alert, potential conflicts
-
Collision Avoidance
- V2V vehicles: Predictive braking, near-miss avoidance
- Non-V2V vehicles: Reactive only, potential collisions
-
Traffic Flow
- V2V vehicles: Coordinated speeds, smooth flow
- Non-V2V vehicles: Independent speeds, stop-and-go
- Total vehicles (V2V vs Non-V2V count)
- Emergency vehicle status
- Real-time counts
-
V2V Vehicles:
- Average speed
- Traffic efficiency
- Accidents prevented
- Near misses avoided
- Emergency vehicle yields
-
Non-V2V Vehicles:
- Average speed
- Traffic efficiency
- Accidents occurred
- Emergency conflicts
- No collision avoidance
- Speed increase percentage (V2V vs Non-V2V)
- Efficiency gains
- Safety improvements
- Emergency response comparison
- ๐ Red stars = Emergency vehicles
- ๐ต Blue circles = V2V-enabled vehicles
- โซ Gray X's = Non-V2V vehicles
- Collision events (avoided vs occurred)
- Emergency vehicle interactions
- Near-miss incidents
# High emergency vehicle density
simulator = TrafficSimulator(
num_v2v_vehicles=15,
num_non_v2v_vehicles=15,
num_emergency=5 # More emergencies
)Expected Result: V2V vehicles clear path, Non-V2V vehicles cause delays
# High vehicle density
simulator = TrafficSimulator(
num_v2v_vehicles=20,
num_non_v2v_vehicles=5,
num_emergency=1
)Expected Result: V2V vehicles coordinate efficiently, maintain flow
# Mostly non-V2V vehicles
simulator = TrafficSimulator(
num_v2v_vehicles=5,
num_non_v2v_vehicles=20,
num_emergency=2
)Expected Result: More collisions, poor emergency response
The system tracks and displays:
- โ Accidents prevented
- โ Near misses avoided
- โ Emergency stops (coordinated)
- โ Higher average speed
- โ Better traffic flow efficiency
- โ Collisions occurred
- โ Emergency conflicts
- โ No predictive avoidance
- โ Lower average speed
- โ Lower traffic efficiency
POST /api/vehicle/register
Body: {
"vehicle_id": "V001",
"location": {"x": 100, "y": 200},
"destination": {"x": 500, "y": 600},
"type": "normal",
"v2v_enabled": true
}
POST /api/vehicle/update
Body: {
"vehicle_id": "V001",
"location": {"x": 105, "y": 205},
"speed": 50,
"heading": 45,
"v2v_enabled": true
}
POST /api/emergency/alert
Body: {
"vehicle_id": "EMG01",
"location": {"x": 300, "y": 400}
}
GET /api/metrics
Returns: V2V vs Non-V2V comparison data
GET /api/comparison
Returns: Detailed comparison and improvements
This prototype demonstrates:
-
Safety Benefits of V2V
- Collision avoidance
- Emergency vehicle priority
- Predictive warnings
-
Traffic Efficiency
- Coordinated speed management
- Reduced congestion
- Smoother flow
-
AI Integration
- Real-time decision making
- Predictive analytics
- Optimal routing
-
Cloud Infrastructure
- Centralized data processing
- Scalable architecture
- Real-time communication
- WebSocket for real-time updates
- REST API for data exchange
- 1-second update interval
- 150m communication radius
- Collision prediction algorithm
- Speed optimization based on traffic density
- Emergency vehicle priority routing
- Traffic light coordination
- Predictive analysis using heading and speed
- Distance-based risk assessment
- Multi-vehicle coordination
- Real-time warnings
- Machine learning for traffic prediction
- Real GPS integration
- Mobile app interface
- Weather condition factors
- Road infrastructure integration
- Multi-intersection coordination
- Historical data analysis
- Route optimization algorithms
# Check if port 5000 is in use
netstat -ano | findstr :5000
# Kill the process if needed
taskkill /PID <PID> /F- Ensure mother server is running
- Check browser console for errors
- Verify server URL is correct
- Make sure vehicle_simulator.py is running
- Check terminal for connection errors
- Verify server is accessible
MIT License - Feel free to use for educational and research purposes
Built for MuLearn SCET - Traffic Management System Prototype
Ready to see the difference V2V makes?
Run all three components and watch the dashboard to see V2V-enabled vehicles outperform legacy vehicles in safety, efficiency, and emergency response! ๐ฆ๐โจ