# 🚀 Real-Time Turbofan PHM (AGTF30) [![Python 3.x](https://img.shields.io/badge/python-3.x-blue.svg)](https://www.python.org/) [![PyTorch](https://img.shields.io/badge/PyTorch-Framework-red.svg)](https://pytorch.org/) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE) [![Live Demo](https://img.shields.io/badge/Live-Demo-brightgreen)](https://huggingface.co/spaces/SM-Bello/PHI-Arc-Engine-PHM) This repository contains the official implementation of the **CNN-BiLSTM-Attention** prognostic framework described in: *"From Benchmark Failure to Real-Time Digital Twin: An AGTF30-Native CNN-BiLSTM-Attention Framework for Turbofan Turbine Blade Prognostics with Flight-Simulator Validation"* (Bello Sani, Ene, et al., 2026). --- ## 📊 Model Performance (Test Set) | Metric | Value | | :--- | :--- | | **Test RMSE** | **3.352 cycles** | | **R² Score** | 0.993 | | **NASA Score** | 346.38 | | **Inference Latency** | 80–120ms (CPU) | --- ## 🛠 Getting Started ### 1. Prerequisites * **FlightGear 2024.1+** * **Python 3.x** (`torch`, `numpy`, `matplotlib`, `tkinter`) * **MATLAB R2023a** (for AGTF30 simulation, if generating new datasets) ### 2. FlightGear Setup 1. Install the **A320neo** (CFM LEAP-1A) via the FlightGear Hangar. 2. Copy `a320neo_protocol.xml` to your FlightGear Protocol directory: `C:\Users\\FlightGear\Downloads\fgdata_2024_1\Protocol\` 3. Launch FlightGear with the generated command: ```bash fgfs.exe --aircraft=A320neo --airport=EDDM --generic=socket,out,10,127.0.0.1,5500,udp,a320neo_protocol ### 3. Pipeline Execution We utilize a Hub-and-Spoke Relay Architecture to ensure reliable data logging without blocking the real-time UI. 1. Step A: Start the Data Logger (Hub) # This binds to port 5500, logs raw telemetry to flightgear_phm_log.csv, and forwards packets to the Dashboard. Bash python data_logger.py 2. Step B: Start the Dashboard (Viewer) This listens on port 5501 for relayed telemetry. Bash python flightgear_phm_dashboard.py 3. 🔬 Reproducing Results (Figure 9) The flightgear_phm_log.csv generated during your flight contains the telemetry needed to reproduce the diagnostic plots. 4. Run the live dashboard, wait for calibration, and allow the Fault Injector to trigger at frame 1800. Close the dashboard to finalize the CSV file. 5. Run the visualization script: Bash python plot_fig9.py This generates fig9_health_timeseries.pdf, showing the RUL and Health % response to the injected HPT degradation. 🔗 Resources Paper Link (Coming Soon) Live Interactive Demo Dataset [(Kaggle)](https://www.kaggle.com/datasets/mohammedbellosani/agtf30-turbofan-engine-degradation-dataset) Developed by Mohammed Bello Sani | Aerospace Engineering Dept, AFIT Kaduna.