File size: 3,514 Bytes
0a0c7f8
 
 
 
 
 
21ff955
0a0c7f8
21ff955
0a0c7f8
 
 
 
 
21ff955
0a0c7f8
0f65ab8
0a0c7f8
 
 
 
a700bd7
0a0c7f8
 
21ff955
 
a700bd7
21ff955
 
 
a700bd7
21ff955
0a0c7f8
 
a700bd7
 
 
 
 
 
 
 
0a0c7f8
 
 
21ff955
 
0a0c7f8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21ff955
 
 
 
0a0c7f8
 
21ff955
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
---
license: mit
tags:
- aerospace
- physics-informed-neural-network
- pinn
- pytorch
- surrogate-model
- alrithm
library_name: pytorch
---

# 🚀 ALRITHM-Astro

**ALRITHM-Astro** is an AI-powered Aerospace Engineering Copilot designed to simulate rocket flight dynamics and predict Maximum Dynamic Pressure (Max Q). It combines a custom-trained Physics-Informed Neural Network (PINN) with a natural language interface.

🔗 **[Try the Live Demo Here](https://godela-web.vercel.app)**

## 🏛️ Powered by Alrithm
This project is fundamentally built upon and inspired by the vision of **[Alrithm](https://alrithmapi.vercel.app)**. 

- **Data Source:** The current model version is trained on a specific subset of the **`alr-aerospace-platform-0.2`** dataset (targeting the `max_q_kpa` quantity), fetched via the official Alrithm API.
- **Philosophy:** Alrithm provides rigorously verified, high-fidelity aerospace data. ALRITHM-Astro serves as a demonstration of how developers can leverage Alrithm's verified data streams to build real-time, physics-informed AI applications.

## ✨ Features
- **Natural Language Processing:** Understands complex aerospace queries using Groq's LLMs (`openai/gpt-oss-120b`).
- **Physics-Informed Prediction:** Calculates Max Q with high precision using a custom PyTorch Neural Network.
- **Interactive 3D Visualization:** Renders the rocket's 3D trajectory in real-time using Plotly.js.
- **Full-Stack Architecture:** FastAPI backend (Render) + Vanilla JS frontend (Vercel).

## 🧠 Model Details (Version 0.2 - Max Q Specialist)
- **Architecture:** Multi-Layer Perceptron (MLP) with 256 hidden units and SiLU activation.
- **Input Features:** 13 engineered physical features (e.g., Burnout Velocity, Thrust-to-Weight Ratio, Mass Ratio).
- **Output:** Maximum Dynamic Pressure (`max_q_kpa`).
- **Training:** 5-Fold Cross-Validation (Fine-tuned specifically on the `max_q_kpa` subset of the Alrithm dataset).

> ⚠️ **Current Limitation:** This `v0.2` model is a **Single-Task** surrogate model. It is currently specialized only for `max_q_kpa`. It has *not yet* been trained on the entire 4600+ dataset across all task types.

## 🗺️ Roadmap (Next Steps)
- [x] **Phase 1:** Build the End-to-End Pipeline (Data -> Neural Network -> FastAPI -> Vercel).
- [x] **Phase 2:** Train a Single-Task Model for `max_q_kpa`.
- [ ] **Phase 3:** Implement **Multi-Task Learning (MTL)** using the full 4600+ `alr-aerospace-platform-0.2` dataset to predict all quantities (Apogee, Burnout Speed, etc.) simultaneously.

## 🛠️ How to use this model

You can load this model directly using PyTorch:

```python
import torch
import torch.nn as nn

class PureMLPModel_Deep(nn.Module):
    def __init__(self, in_dim=13, hidden=256):
        super().__init__()
        self.net = nn.Sequential(
            nn.Linear(in_dim, hidden), nn.SiLU(),
            nn.Linear(hidden, hidden), nn.SiLU(),
            nn.Linear(hidden, hidden), nn.SiLU(),
            nn.Linear(hidden, 1),
        )
    def forward(self, x):
        return self.net(x).squeeze(-1)

# 1. Load the ALRITHM-Astro model weights
checkpoint = torch.load("alrithm_astro_model.pth", map_location="cpu")

# 2. Initialize the architecture and load weights
model = PureMLPModel_Deep()
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()

# 3. Retrieve the scalers for data normalization
scaler_x = checkpoint['scaler_x']
scaler_y = checkpoint['scaler_y']

print("✅ ALRITHM-Astro model loaded successfully!")