GitHub - ToniAdreal/predictive-maintenance-rul: Remaining-useful-life prediction mini-system for digital-twin predictive maintenance (synthetic run-to-failure data, health index, degradation model) — independent reproduction, pure Python · GitHub
Skip to content

About

Remaining-useful-life prediction mini-system for digital-twin predictive maintenance (synthetic run-to-failure data, health index, degradation model) — independent reproduction, pure Python

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

predictive-maintenance-rul

A small remaining-useful-life (RUL) prediction mini-system for a digital-twin / predictive-maintenance setting: a synthetic run-to-failure data generator, sensor feature extraction, a composite health index, a degradation-model RUL estimator, and an honest evaluation against a naive baseline. Pure Python 3 standard library — no numpy, pandas, or scikit-learn.

What this is (and is not)

This project is an independent educational reconstruction, written from scratch for learning and portfolio purposes. It re-implements, in toy form, the standard RUL pipeline — run-to-failure data → health index → degradation model → remaining-life estimate — of the kind used in digital-twin / predictive-maintenance research-assistant work.

  • All data is synthetic, generated by this project's own generator from a simple cumulative-damage simulation. No real equipment data is used, and no original research code is included.
  • It is not affiliated with any university, employer, or research group, and it makes no claim about any real machine or dataset.
  • Every number reported below is the real output of running the code in this repository on the seeded synthetic fleet. Nothing is inflated: the naive baseline is reported alongside the model so the comparison can be checked.

Method

  1. Synthetic run-to-failure generator (src/generator.py). Each unit accumulates damage per cycle at a unit-specific base rate scaled by an operating-regime load factor (regimes switch every 15–30 cycles). Failure is the first cycle where cumulative damage reaches 1.0, so the true RUL at every cycle is known exactly. Three sensor channels (temperature, vibration, pressure) are smooth functions of damage plus a regime offset and Gaussian noise. A fixed seed makes the whole fleet deterministic.

  2. Features (src/features.py). Trailing rolling means and least-squares rolling slopes, plus a composite health index: each channel is converted to a z-score against its own early-life baseline (first 10 cycles), flipped by the channel's damage direction, clipped at zero, and averaged into a degradation index DI >= 0; the health index is HI = 1 / (1 + DI), in (0, 1].

  3. RUL estimator (src/estimator.py). A power-law degradation model DI(t) ≈ exp(a_unit) · t^p. The exponent p and the failure level are learned from a training fleet of run-to-failure units: p is the median per-unit log–log slope (pooled across the fleet, then held fixed), and the failure threshold is the median health index at failure. For a new unit, only its scale a_unit is fitted from its observed prefix, and the failure cycle is solved analytically. Prefixes without enough degradation signal fall back to the baseline.

  4. Naive baseline. Predicts the unit lives exactly the fleet-average life: RUL = mean_life − age, using no per-unit information.

Results

Evaluation: 40 seeded units (seed=42), alternating train/test split. At 50% / 70% / 90% of each test unit's true life, each estimator sees only the prefix up to that checkpoint. Errors in cycles:

Life fraction Model RMSE Model MAE Baseline RMSE Baseline MAE
50% 30.3 23.3 42.9 35.7
70% 30.3 23.4 42.9 35.7
90% 27.4 21.0 32.9 26.7

Pooled across checkpoints, RMSE is 29.4 cycles for the model vs 39.9 cycles for the baseline (mean train-fleet life ≈ 198.7 cycles; learned failure threshold HI ≈ 0.0271; pooled degradation exponent ≈ 1.392). The model beats the baseline at every checkpoint, but the margin is modest — about a 26% RMSE reduction — which is the honest result for this signal-to-noise level, not a state-of-the-art claim.

Reproduce with python run_evaluation.py (numbers are deterministic for the fixed seed).

How to run

Requires Python 3.10+; standard library only.

python run_evaluation.py        # or: python -m src.evaluate
python -m unittest discover     # run the test suite (17 tests)

Limitations

  • The data is synthetic and generated by a known, simple damage process; real sensor data is messier, multi-modal, and rarely labelled with exact failure times. Nothing here transfers quantitatively to real equipment.
  • The generator's sensor functions are monotone in damage by construction, which flatters any health-index approach.
  • The estimator assumes a single power-law degradation regime per unit and a fleet-shared exponent; units that change degradation mechanism mid-life would break it.
  • Checkpoints and the train/test split are fixed and small (20 test units); results would move somewhat with a different seed or fleet.

Structure

run_evaluation.py     entry point: prints the evaluation table
src/
  generator.py        synthetic run-to-failure fleet (seeded, deterministic)
  features.py         rolling mean/slope, composite health index
  estimator.py        power-law degradation RUL model + naive baseline
  evaluate.py         checkpoint evaluation, model vs baseline
tests/
  test_generator.py   determinism, known failure times, shapes
  test_features.py    hand-computed rolling features, health-index trend
  test_estimator.py   learned parameters, fallback, model vs baseline
  test_evaluate.py    evaluation smoke run

License

MIT — see LICENSE.

About

Remaining-useful-life prediction mini-system for digital-twin predictive maintenance (synthetic run-to-failure data, health index, degradation model) — independent reproduction, pure Python

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages