Overview
The fault simulation system allows you to inject controlled anomalies into sensor data streams for testing and validation. This is crucial for:- Testing ML models without physical equipment damage
- Validating alert thresholds across different severity levels
- Training operators on anomaly response
- Demonstrating system capabilities to stakeholders
Fault injection is non-destructive — it modifies the data stream in memory but does not persist to InfluxDB (except as normal sensor events). Stop injection to return to live data.
Fault Types
The system supports four distinct fault patterns based on real-world industrial failures:SPIKE
Pattern: Sharp voltage/current surges
Mechanism: Adds random transient spikes (±20-50%) to signals
Real-World: Inrush current, grid instability, motor start
Detection: Both models detect via
Mechanism: Adds random transient spikes (±20-50%) to signals
Real-World: Inrush current, grid instability, motor start
Detection: Both models detect via
peak_to_peak and spike countDRIFT
Pattern: Gradual baseline shift
Mechanism: Linearly increases mean values over time
Real-World: Bearing wear, insulation degradation
Detection: Both models via rolling mean features
Mechanism: Linearly increases mean values over time
Real-World: Bearing wear, insulation degradation
Detection: Both models via rolling mean features
JITTER
Pattern: Normal mean, high variance
Mechanism: Adds Gaussian noise with 5× std deviation
Real-World: Loose connections, mechanical resonance
Detection: Batch model only (legacy model blind)
Mechanism: Adds Gaussian noise with 5× std deviation
Real-World: Loose connections, mechanical resonance
Detection: Batch model only (legacy model blind)
DEFAULT
Pattern: General combined fault
Mechanism: Mix of drift + moderate noise
Real-World: Multiple concurrent issues
Detection: Both models via general feature deviation
Mechanism: Mix of drift + moderate noise
Real-World: Multiple concurrent issues
Detection: Both models via general feature deviation
Severity Levels
Each fault type can be injected at three severity levels, targeting specific risk classifications:| Severity | Target Health | Target Risk | Damage Rate | Time to Critical |
|---|---|---|---|---|
| MILD | 50-74 | MODERATE | ~0.001/s | ~15 minutes |
| MEDIUM | 25-49 | HIGH | ~0.003/s | ~5 minutes |
| SEVERE | 0-24 | CRITICAL | ~0.005/s | ~3 minutes |
Severity Calibration Details
Severity Calibration Details
MILD (Score Target: 0.70-0.80)
- Vibration: +15% above baseline
- Voltage: ±5% fluctuation
- Power factor: -0.03 (0.92 → 0.89)
- Current: +10% above baseline
- Vibration: +35% above baseline
- Voltage: ±10% fluctuation
- Power factor: -0.08 (0.92 → 0.84)
- Current: +25% above baseline
- Vibration: +60% above baseline
- Voltage: ±20% fluctuation
- Power factor: -0.15 (0.92 → 0.77)
- Current: +50% above baseline
Fault Injection API
Inject Fault
Start injecting a specific fault pattern:fault_type(required):SPIKE,DRIFT,JITTER, orDEFAULTseverity(required):MILD,MEDIUM, orSEVERE
Stop Fault
Return to live sensor data:Check Injection Status
Query current fault state:Fault Pattern Implementation
SPIKE Fault
Adds random transient surges to voltage and current:voltage_std, current_p2p, and current_std features.
DRIFT Fault
Gradually increases baseline values:vibration_mean, current_mean, and efficiency score degradation.
JITTER Fault
Adds high-variance noise while maintaining normal mean:- Healthy: vibration_mean = 0.12g, vibration_std = 0.015g
- Jitter (MEDIUM): vibration_mean = 0.12g, vibration_std = 0.075g (5× increase)
DEFAULT Fault
General fault combining drift + noise:Testing Workflow
End-to-End Validation
- Start Calibration to train on healthy data
- Verify LOW risk state (health 75-100)
- Inject MILD DRIFT → expect MODERATE risk (health 50-74) within 30 seconds
- Inject MEDIUM SPIKE → expect HIGH risk (health 25-49) within 20 seconds
- Inject SEVERE JITTER → expect CRITICAL risk (health 0-24) within 15 seconds
- Stop Fault → health should stabilize (DI remains, but damage rate → 0)
- Purge System → DI resets to 0.0, health → 100
Automated Testing Script
Dashboard Integration
Fault Control Panel
The React dashboard provides a visual fault injection interface:- Dropdown for fault type selection
- Slider or buttons for severity (🟡 MILD, 🟠 MEDIUM, 🔴 SEVERE)
- “Inject Fault” button (disabled during calibration)
- “Stop Fault” button (red, enabled only when injection active)
- Live status indicator showing active fault + duration
Benchmark Results
Jitter Detection Comparison
Tested with MEDIUM JITTER (vibration_std = 5× baseline):| Model | Detection Time | Peak Anomaly Score | Risk Level Reached |
|---|---|---|---|
| Legacy (v2) | ❌ Never | 0.32 (MODERATE) | MODERATE (false negative) |
| Batch (v3) | ✅ 3 seconds | 0.89 (HIGH) | HIGH (correct) |
vibration_intensity_rms which is:
vibration_std and vibration_p2p:
Severity Calibration Accuracy
Tested with 100 injection cycles (30s each):| Fault Type | Severity | Target Health | Actual Health | Accuracy |
|---|---|---|---|---|
| DRIFT | MILD | 50-74 | 62 ± 8 | ✅ 92% |
| SPIKE | MEDIUM | 25-49 | 38 ± 11 | ✅ 88% |
| JITTER | SEVERE | 0-24 | 12 ± 6 | ✅ 95% |
| DEFAULT | MILD | 50-74 | 58 ± 10 | ✅ 90% |
Variance is expected due to:
- Random noise in fault patterns
- Cumulative DI from previous tests
- Real-time damage rate fluctuations
POST /system/purge between tests.Safety & Limitations
Best Practices
✅ DO:- Purge before each test cycle
- Start with MILD severity
- Monitor DI and damage rate
- Stop faults before switching types
- Document fault injection in operator logs
- Inject multiple faults simultaneously (undefined behavior)
- Run SEVERE faults for > 60 seconds (health → 0)
- Inject during calibration (will corrupt baseline)
- Forget to stop faults (backend persists state across restarts)
Source Code Reference
Key implementation files:- Fault Patterns:
backend/generator/generator.py:200-350- SPIKE/DRIFT/JITTER/DEFAULT logic - Injection API:
backend/api/system_routes.py:inject_fault()- HTTP endpoint - Fault Config:
backend/generator/config.py- Severity mappings and NASA/IMS patterns - Dashboard Controls:
frontend/src/components/SystemControlPanel/- UI integration
Next Steps
Health Assessment
Understand how fault injection affects DI, health, and RUL
Reporting
Generate reports documenting fault injection test results