An end-to-end Single Bus Fault Detection and Localization Engine for medium-voltage (MV) power distribution networks. By pairing a custom Deep Neural Network (DNN) for baseline normal state prediction with specialized Random Forests (Yggdrasil Decision Forests), Gridifix isolates real-time grid anomalies and pinpoints single-bus fault locations with extreme precision.
To maximize throughput, the architecture replaces traditional, computationally heavy non-linear Newton-Raphson solvers with a highly optimized, custom Distribution Linear Power Flow (DLPF) solver written natively in Python.
The repository includes built-in experiment tracking via MLflow to monitor, log, and version pipeline runs, dataset artifacts, and trained models.
-
High-Speed DLPF Solver: Native Python implementation of a Distribution Linear Power Flow solver, accelerating voltage-magnitude computations well beyond conventional non-linear Newton-Raphson methods.
-
Hybrid Deep Learning + RF Topology: * Keras DNN: Models standard, non-faulted grid behaviors to predict expected bus voltages, angles, and line power flows.
-
Residual Analytics Engine: Computes real-time spatial deviations (residuals) between live measurements and neural network baselines to isolate anomalous footprints.
-
Yggdrasil Decision Forests: Dual-stage classification models that handle instant fault detection and precise single-bus line localization.
-
Automated Data Synthesizer: Built-in simulation pipeline leveraging
pandapowerto auto-generate comprehensive training profiles (21k+ synthetic healthy and faulted states). -
Maturity & Experiment MLOps: Integrated tracking engine using MLflow (
mlflow.dbbackend) to record metrics, hyperparameter adjustments, and model weights across training iterations.
Configure your runtime environment utilizing Conda to isolate core machine learning and grid simulation binaries.
Create a clean Python 3.11 environment:
conda create -n gridifix_py311 python=3.11 pip -y
Activate the newly created isolated environment:
conda activate gridifix_py311
Clone the repository, navigate into the root directory, and install the required core packages:
pip install -r requirements.txt
To execute the automated end-to-end data generation, training, and validation pipeline, trigger the primary entry script:
python src/main.pyUse MLFlow to validate and track the model performance and results in real time. To do so, start the MLFLow local server with:
mlflow server --port 5000Gridifix leverages MLflow for robust experiment tracking and model validation. Below are the training profiles and metric convergence charts extracted from a 100-step execution snapshot (run: bemused-fly-207).
Both core loss metrics demonstrate steady convergence with no divergence or overfitting signs, proving the training pipeline's stability over the 21k synthetic samples.
| Training & Validation Loss | Training & Validation MAE |
|---|---|
![]() Training Loss Convergence |
![]() Training Mean Absolute Error (MAE) |
![]() Validation Loss Convergence |
![]() Validation Mean Absolute Error (MAE) |
At step 100, the standalone test-set benchmarks confirm structural precision for spatial residual mapping:
- Final Validation Loss:
0.08 - Final Validation MAE:
0.12
gridifix/
├── datasets/ # Simulated and baseline grid topologies
├── docs/assets/ # Architecture diagrams and documentation media
├── mlruns/1/ # MLflow experiment runs and artifact tracking logs
├── models/ # Serialized DNN models and Decision Forest weights
├── src/
│ ├── data-synthesis/ # pandapower generation scripts (21k sample pipeline)
│ ├── dlpf-solver/ # Distribution Linear Power Flow solver implementation
│ ├── results/ # Evaluation outputs, metrics, and visualization curves
│ ├── dermodelling.py # Keras DNN baseline architecture & residual processing
│ └── main.py # Application orchestration and pipeline entry point
├── .gitignore # Target build file ignores
├── fault_detection_dataset.csv # Base synthetic dataset file
├── LICENSE # APACHE 2.0 License
├── mlflow.db # SQLite relational database storage for MLflow runs
├── requirements.txt # Framework dependencies (Keras, YDF, pandapower, mlflow)
└── README.md # System documentation
Contributions maximizing solver speed, expanding MV topologies, or optimizing the classification layer are highly welcome.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the APACHE 2.0 License. See LICENSE for more information.






