Skip to content
Photon079Public

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

Spindl - Predictive Maintenance Digital Twin

Overview

Spindl is a comprehensive digital twin and predictive maintenance platform designed to simulate, monitor, and analyze CNC machine telemetrics. By integrating synthetic sensor data with advanced machine learning models, the system predicts remaining useful life (RUL), calculates the probability of machine failure, and provides actionable prescriptive recommendations to prevent unplanned downtime.
Checkout the Live Demo at https://spindl.streamlit.app/

Quickstart: Run Locally

To set up the Spindl digital twin environment on your local machine:

  1. Create and activate a virtual environment:

    python -m venv .venv
    # On Windows:
    .venv\Scripts\activate
    # On Mac/Linux:
    source .venv/bin/activate
  2. Install dependencies:

    pip install -r requirements.txt
  3. Train the AI Models: The dashboard requires LightGBM models which are generated from the training script.

    python train_lgbm.py
  4. Launch the Dashboard:

    streamlit run app.py

Key Features

  • Real-Time Simulation Dashboard: Monitors a streaming stream of machine telemetrics (RPM, Torque, Temperatures, Tool Wear) dynamically simulated using a noise-driven sine-wave generator to mimic actual operating conditions.
  • What-If Scenario Analyzer: Allows operators to adjust machine load parameters (e.g., spinning RPM faster, increasing torque) against a strictly locked simulated time state. This provides robust, deterministic impact comparisons of hypothetical machine configurations.
  • Batch CSV Analysis: Allows bulk processing of past machine logs. Features are automatically enriched using the internal physics engine before predictions are rolled up into an executive summary.
  • Explainable AI (XAI): Incorporates SHAP (SHapley Additive exPlanations) values to decompose real-time failure risk probabilities, displaying exactly which physical metrics are actively pushing the machine toward critical boundaries.
  • Prescriptive Rule Engine: Maps high-risk mechanical and thermal threshold breaches back to actionable operator commands, intervening against destructive conditions such as Tool Wear Failure (TWF) or Heat Dissipation Failure (HDF).

Architecture Approach

The project architecture strictly decouples the visualization interface from the predictive and simulation backend:

  • Presentation Layer: Built with Streamlit. The dashboard utilizes strict time-tick synchronization to ensure the live environment and What-If environments never drift or bleed state parameters.
  • Simulation Layer: Employs a continuous state engine managing base conditions. It handles mechanical decay across configurable user profiles (Nominal, Degrading, or Bad usage bounds).
  • Core Pipeline: Raw feature data cascades cleanly into the derivation engine, passes to the machine learning scalers, evaluated by dual target predictors, and then piped out alongside SHAP contributions.

Data Preparation and Methodology

The system builds upon the underlying framework of the AI4I 2020 Predictive Maintenance Dataset. Because mechanical failure is inherently non-linear, the dataset preparation heavily augments standard features:

  • Feature Engineering: Derived deeply correlated physical indicators including mechanical cutting power, torque-wear ratios, thermal stress delta, and comprehensive geometric tool fatigue metrics (squared, logarithmic, and cube-root tool wear curves). This expanded the feature set from 13 to 20 columns.
  • Overcoming Imbalance: Natural manufacturing failures are represented in less than 4% of the dataset. To ensure robust failure prediction, the Synthetic Minority Over-sampling Technique (SMOTE) balanced the training distribution, drastically improving the model's sensitivity.

Trained Models and Evaluation

The solution employs a multi-target inference architecture. The first model isolates binary classification (probability of immediate catastrophic failure), while the second conducts linear regression to continuously track continuous remaining life.

Two training pipelines were established and evaluated:

1. LightGBM Architecture (Primary Pipeline)

Utilizes the enriched 20-feature dataset, deploying histogram-based decision trees. The system uses an algorithmically optimized classification threshold (0.59) to maximize safe-failure detection precision without overwhelming operators with false alarms.

  • Accuracy: 98.40%
  • ROC AUC: 0.9846
  • Bad Usage F1 Score: 0.7808
  • RUL RMSE: 29.52 minutes
  • RUL R-Squared: 0.723

2. XGBoost Architecture (Baseline Pipeline)

Deployed purely on the base 13 features without polynomial engineering. It serves as a highly robust fallback structure. Despite lacking the expanded physical correlations, it achieved near-identical classification performance but suffered mild degradation in long-term regression tracking.

  • Accuracy: 96.87%
  • ROC AUC: 0.9821
  • Bad Usage F1 Score: 0.7832
  • RUL RMSE: 30.65 minutes
  • RUL R-Squared: 0.701

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages