A real-time F1 race strategy system powered by Modular's hybrid HPC engine and AI reasoning.
📚 Full Documentation: See docs/ directory
⚡ Quick Start: See docs/QUICK_START.md
- Sensing Layer - Collects and streams telemetry data (lap times, tire temps, weather, etc.)
- Thinking Layer - Simulation engine using Modular's hybrid compute (edge/cloud) for Monte Carlo scenarios
- Explaining Layer - AI co-strategist that interprets simulation outputs and provides natural language recommendations
Telemetry → Digital Twin → Mojo Simulation → MAX LLM → Python Middleware → WebSocket Dashboard
- Python 3.12+
- Modular Mojo installed
- Virtual environment activated
# Clone the repository
git clone <repository-url>
cd digital-twin
# Activate virtual environment
source .venv/digital-twin/bin/activate
# Install dependencies
pip install -r requirements.txtpython validate_system.pyChecks all components are working correctly.
python test_max_integration.pyTests AI strategy recommendations with MAX LLM.
python run_tests.py --category integrationpython -m uvicorn twin_system.api_server:app --host 0.0.0.0 --port 8000The F1 Race Twin Edge system provides:
- Real-time Digital Twins: CarTwin and FieldTwin state modeling
- Live Telemetry Processing: WebSocket/UDP telemetry ingestion
- AI Strategy Recommendations: MAX LLM-powered pit strategy advice (Urgent/Moderate/Optional)
- HPC Simulation: Hybrid edge/cloud compute for Monte Carlo simulations
- REST API: High-performance API for external dashboard integration
- State Persistence: Auto-save every 5 seconds with recovery
To use the AI strategist with MAX:
- Start MAX server:
export HF_TOKEN="your-huggingface-token"
max serve --model modularai/Llama-3.1-8B-Instruct-GGUFWait for: 🚀 Server ready on http://0.0.0.0:8000
- The system will automatically connect to
http://localhost:8000/v1
The system includes a Mojo simulation kernel for high-performance race strategy computation. The simulation runs Monte Carlo scenarios to predict optimal pit strategies.
digital-twin/
├── src/
│ ├── twin_model.py # Digital twin implementation
│ ├── simulate_strategy.mojo # Mojo simulation kernel
│ ├── hpc_orchestrator.py # Main orchestration layer
│ ├── ai_strategist.py # AI strategy recommendations
│ ├── telemetry_feed.py # Telemetry data generation
│ └── dashboard.py # Streamlit dashboard
├── shared/
│ └── latest_state.json # Live state file
├── test_system.py # System integration tests
├── run_system.py # Main startup script
└── requirements.txt # Python dependencies
Run the comprehensive test suite:
python test_system.pyThis tests:
- Digital Twin functionality
- Telemetry feed generation
- AI strategist (with fallback to rule-based)
- Mojo simulation availability
- HPC orchestrator
- Full system integration
- Real-time race state modeling
- Tire degradation prediction
- Fuel consumption tracking
- Performance delta calculation
- Urgent: Critical decisions (pit now, safety car response)
- Moderate: Strategic adjustments (tire management, fuel saving)
- Optional: Long-term planning (end-of-race strategy)
- Edge: Local simulation for low-latency decisions
- Cloud: Modular cloud compute for high-depth parallel simulations
- WebSocket streaming for high-performance updates
- Python middleware for fine-grained control
- Live dashboard with auto-refresh
- Start the system:
python run_system.py - Open dashboard: Navigate to http://localhost:8501
- Watch live updates: Telemetry flows through the system
- View recommendations: AI strategist provides real-time advice
- Monitor performance: Track system metrics and response times
- Real F1 telemetry integration (FastF1 API)
- Advanced weather modeling
- Multi-car strategy optimization
- Historical data analysis
- Machine learning model training
- Alan - Systems Architect / HPC Lead
- Abi - Telemetry & Digital Twin Developer
- Chaithu - AI Strategist
- Akhil - Frontend Developer
This project is developed for the HackTX hackathon.