Transformer Fault Detection
This model is created using Aargus-DIY Visual Inspection Tool. A tabular machine-learning model for early detection of electrical power transformer faults using SCADA sensor data (voltage, current, power, power factor, oil/winding temperature, and alarm indicators). The model flags an at-risk condition whenever the Oil Temperature Alarm (OTI_A), Oil Temperature Trip (OTI_T), or Magnetic Oil Gauge Alarm (MOG_A) is active, enabling predictive maintenance instead of reactive repair.
Overview
This model performs automated health monitoring of power transformers, replacing manual alarm-log review with a fast, consistent classifier trained on merged sensor telemetry.
Target: Binary fault flag β 1 if any of OTI_A, OTI_T, or MOG_A is triggered, else 0
Methodology
- Data Ingestion β Five SCADA sources (
CurrentVoltage.csv,Overview.csv,Power.csv,PowerFactor.csv,TotalPower.csv) merged onDeviceTimeStampinto a single time-indexed table. - Exploratory Data Analysis β Missing-value checks, descriptive statistics, correlation heatmaps, and long-term/weekly trend plots for key health indicators (OTI, WTI, ATI, OLI).
- Feature Engineering β Time-based features (
hour,dayofweek,month,is_weekend) added; alarm columns excluded from the feature set to avoid target leakage. - Model Training β Three classifiers trained and compared: Random Forest, XGBoost, and Logistic Regression (with feature scaling), using an 80/20 stratified train-test split.
- Validation β Precision, recall, F1-score, ROC-AUC, and confusion matrix on the held-out test set.
Performance
Test Set Results (5,859 samples, 408 positive / fault instances)
| Model | Precision | Recall | F1-Score | ROC-AUC |
|---|---|---|---|---|
| XGBoost (best) | 0.998 | 0.993 | 0.995 | 0.996 |
| Random Forest | 0.995 | 0.990 | 0.993 | 0.995 |
| Logistic Regression | 0.831 | 0.973 | 0.896 | 0.979 |
Best Model: XGBoost Classifier (selected by highest F1-score)
Note: Logistic Regression trades precision for higher recall β useful if the priority is catching every possible fault at the cost of more false alarms. Tree-based models (XGBoost, Random Forest) give the best overall balance.
Usage
Installation
pip install xgboost scikit-learn pandas joblib
Load the model and predict
import joblib
import pandas as pd
# Load the trained model
model = joblib.load("transformer_xgb_model.pkl")
# feature_columns should match the training feature set
# (sensor readings + engineered time features: hour, dayofweek, month, is_weekend)
new_data = pd.read_csv("your_sensor_readings.csv")
predictions = model.predict(new_data)
probabilities = model.predict_proba(new_data)[:, 1]
print(predictions) # 0 = normal, 1 = fault risk
print(probabilities) # fault probability
For the Logistic Regression variant, also load and apply
transformer_lr_scaler.pkl(StandardScaler) to the features before calling.predict().
Input Features
Voltage (VL1βVL31), current (IL1βIL3, INUT), power (WL1βWL3, KW, KVA, KVAR, KWH), power factor (PFL1βPFL3), oil/winding/ambient temperature (OTI, WTI, ATI), oil level (OLI), plus engineered time features (hour, dayofweek, month, is_weekend).
Use Case
Predictive maintenance for power transformers β enables early, automated detection of overheating and oil-level faults from live SCADA telemetry, reducing unplanned downtime and manual monitoring effort in industrial/utility settings.
Built With
- Aargus DIY Visual Inspection Tool
- scikit-learn (Random Forest, Logistic Regression)
- XGBoost
- pandas / NumPy
- Matplotlib / Seaborn (EDA)
License
This project is licensed under the Apache 2.0 License.