Neural network based fault detection, location and classification in microgrid
- lms editor
- 1 day ago
- 8 min read
Neural network based fault detection, location and classification in microgrid
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
Modern microgrids combine renewable energy, battery storage, conventional generation, utility-grid support, and different types of electrical loads. Because several energy sources and converters operate together, fast and accurate fault identification becomes important for reliable microgrid operation.
Neural network based fault detection, location and classification in microgrid

This MATLAB/Simulink model demonstrates a neural-network-based fault detection, fault classification, and fault location system for a microgrid.
The proposed simulation is designed to identify:
Whether a fault has occurred
Which type of fault is present
The approximate fault location in kilometers
Fault behavior under different transmission/distribution-line locations
Microgrid power response during the simulated condition
The model combines MATLAB/Simulink, electrical measurements, fault simulation, data collection, and trained neural networks into a single fault-analysis platform.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The simulated microgrid contains renewable generation, energy storage, conventional generation, AC/DC loads, and a connection to the main utility grid.
Main Microgrid Components
Component | Function |
Solar PV system | Renewable power generation |
Battery energy storage system | Stores and supplies electrical energy |
Diesel power plant | Provides additional generation support |
Main grid | Utility-grid connection |
AC load | Represents alternating-current demand |
DC load | Represents direct-current demand |
Distribution/transmission line | Used for creating faults at selected locations |
Measurement system | Measures voltage, current, and zero-sequence quantities |
Neural networks | Detect, classify, and locate faults |
A 10 km electrical line is considered between the grid and microgrid sections. Faults can be introduced at different points along this line to generate the training and testing datasets.
𝐌𝐢𝐜𝐫𝐨𝐠𝐫𝐢𝐝 𝐅𝐚𝐮𝐥𝐭 𝐃𝐞𝐭𝐞𝐜𝐭𝐢𝐨𝐧 𝐂𝐨𝐧𝐜𝐞𝐩𝐭
When a fault occurs on the line, electrical quantities measured at the point of common coupling change significantly.
The model observes quantities such as:
Phase-A voltage
Phase-B voltage
Phase-C voltage
Phase-A current
Phase-B current
Phase-C current
Zero-sequence voltage
Zero-sequence current
These measurements are processed by trained neural networks to determine the condition of the microgrid.
The complete analysis is divided into three major tasks:
Fault detection
Fault classification
Fault location estimation
𝐅𝐚𝐮𝐥𝐭 𝐓𝐲𝐩𝐞𝐬 𝐂𝐨𝐧𝐬𝐢𝐝𝐞𝐫𝐞𝐝
Different symmetrical and unsymmetrical faults can be simulated to generate a comprehensive training dataset.
Fault Category | Examples |
Normal condition | No fault |
Single line-to-ground | AG, BG, CG |
Double line-to-ground | ABG, ACG, BCG |
Line-to-line | AB, AC, BC |
Three-phase fault | ABC |
Three-phase-to-ground | ABCG |
This enables the neural network to learn the characteristic electrical response associated with different faults.
𝐍𝐞𝐮𝐫𝐚𝐥 𝐍𝐞𝐭𝐰𝐨𝐫𝐤 𝐒𝐭𝐫𝐮𝐜𝐭𝐮𝐫𝐞
Instead of using only one neural network for every operation, the simulation uses multiple neural-network models for specialized tasks.
Neural Network 1 – Fault Detection and Classification
This network analyzes the three-phase electrical measurements.
Typical inputs include:
(V_a)
(V_b)
(V_c)
(I_a)
(I_b)
(I_c)
The output is represented using an encoded logical pattern that allows the system to identify the corresponding fault category.
The network determines whether the system is:
Operating normally
Experiencing an AG fault
Experiencing a BG fault
Experiencing a CG fault
Experiencing an ABG fault
Experiencing an ACG fault
Experiencing a BCG fault
Experiencing an AB fault
Experiencing an AC fault
Experiencing a BC fault
Experiencing an ABC fault
Experiencing an ABCG fault
Neural Network 2 – Ground-Fault Location
A separate neural network is used to estimate the location of faults involving ground.
Important inputs include:
Zero-sequence voltage
Zero-sequence current
This network is particularly useful for locating:
Line-to-ground faults
Double line-to-ground faults
Its output represents the estimated distance of the fault along the line.
Neural Network 3 – Other Fault Location Estimation
Another neural network is used for locating fault categories where zero-sequence quantities may not provide the same useful information.
It is intended for cases such as:
Line-to-line faults
Three-phase faults
Three-phase-to-ground fault conditions
The trained network receives the selected voltage-related measurements and estimates the fault distance.
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The overall fault-analysis process can be understood in the following sequence.
Step 1 – Operate the Microgrid
The MATLAB/Simulink model operates with:
Solar PV generation
Battery storage
Diesel generation
Grid connection
AC loads
DC loads
Step 2 – Create a Fault
A selected electrical fault is introduced on the 10 km line.
The fault position can be changed by modifying the line section before and after the fault point.
For example:
Line Configuration | Approximate Fault Position |
9 km + 1 km | 9 km from the grid side |
5 km + 5 km | 5 km |
1 km + 9 km | 1 km from the selected reference side |
Changing these distances creates different training and testing conditions.
Step 3 – Measure Electrical Signals
Voltage and current information is collected from the microgrid.
Measurements include:
Three-phase voltage
Three-phase current
Zero-sequence voltage
Zero-sequence current
These measurements form the input dataset used for neural-network training.
Step 4 – Generate Target Data
For every simulated fault, the corresponding target value is stored.
The target information represents:
Normal condition
Fault category
Fault code
Fault distance
The fault code is used for classification, while the distance value is used for fault-location training.
Step 5 – Train the Neural Networks
The collected input and target datasets are supplied to the MATLAB Neural Network training environment.
The transcript demonstrates the MATLAB command:
nnstart
The fitting application can then be used to configure and train the neural network.
𝐍𝐞𝐮𝐫𝐚𝐥 𝐍𝐞𝐭𝐰𝐨𝐫𝐤 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The training procedure is straightforward and suitable for students learning MATLAB-based machine learning.
Training sequence
Collect the electrical input dataset.
Create the corresponding target dataset.
Open the MATLAB Neural Network application using nnstart.
Select the fitting tool.
Assign the collected input data.
Assign the target data.
Divide the dataset into training, validation, and testing portions.
Select the required number of hidden neurons.
Start neural-network training.
Check the regression performance.
Generate the trained Simulink neural-network block.
Integrate the trained network into the microgrid model.
Dataset Division Used
Dataset Portion | Percentage |
Training | 70% |
Validation | 15% |
Testing | 15% |
This division allows the neural network to learn from most of the available data while retaining separate samples for validation and testing.
𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐏𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞
After training, the regression plot can be checked to evaluate how well the neural-network outputs follow the target values.
A regression value approaching 1 indicates better agreement between the predicted and expected values.
For practical training, the demonstrated workflow aims for a regression result approximately in the range of:
0.90 to 1.00
If the result is poor, the network can be retrained by adjusting:
Hidden neurons
Training samples
Input features
Dataset size
Data distribution
𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐃𝐚𝐭𝐚 𝐒𝐜𝐞𝐧𝐚𝐫𝐢𝐨𝐬
Multiple fault locations are simulated so that the neural network can learn how electrical measurements change with distance.
Case | Fault Location Used for Data Generation |
Case 1 | 10 km |
Case 2 | 5 km |
Case 3 | 1 km |
The same procedure can be repeated for different fault categories.
This creates a diverse dataset containing both fault type and fault-distance information.
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The intelligent protection strategy can be summarized into three parallel decisions.
Fault Detection
The first stage decides whether the microgrid is operating normally or experiencing a fault.
Fault Classification
After detecting an abnormal condition, the neural-network output determines the corresponding fault category.
Fault Location
Once the fault type is known, the appropriate location-estimation neural network predicts where the fault occurred on the line.
This structure helps separate the classification problem from the fault-distance estimation problem.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐒𝐜𝐞𝐧𝐚𝐫𝐢𝐨
During the demonstrated MATLAB simulation, a double line-to-ground fault is introduced.
The fault begins at approximately:
Parameter | Value |
Total line length | 10 km |
Fault initiation time | 0.1 s |
First tested location | About 9 km |
Second tested location | About 5 km |
The neural-network system is then observed for both classification and location estimation.
𝐒𝐢𝐦𝐮𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
Case 1 – Fault Near 9 km
The fault is created near the 9 km location.
The neural network successfully identifies the fault as a double line-to-ground fault, specifically the demonstrated ABG fault condition.
The estimated fault location settles close to the actual position.
Parameter | Result |
Actual fault location | 9 km |
Estimated location | Approximately 9.2–9.4 km |
Detected fault | ABG |
Fault detection | Successful |
The small difference between actual and predicted location demonstrates the neural network's ability to estimate the fault position from measured electrical signals.
Case 2 – Fault Near 5 km
The line configuration is then changed to create the fault near 5 km.
The predicted distance is again close to the actual fault location.
Parameter | Result |
Actual fault location | 5 km |
Estimated location | Approximately 4.4–4.6 km |
Fault detection | Successful |
Fault classification | Successful |
These results demonstrate that the trained neural-network system can identify faults at multiple positions rather than operating only for a single predefined location.
𝐏𝐨𝐰𝐞𝐫 𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐞 𝐌𝐨𝐧𝐢𝐭𝐨𝐫𝐢𝐧𝐠
In addition to fault detection, several scopes are included to monitor the operating behavior of the microgrid.
The displayed quantities include:
Grid power
Solar PV power
Battery power
Diesel-generator power
AC load power
Battery measurements
DC load response
This allows the user to observe both protection-system behavior and overall microgrid power response during the same simulation.
𝐖𝐡𝐲 𝐔𝐬𝐞 𝐍𝐞𝐮𝐫𝐚𝐥 𝐍𝐞𝐭𝐰𝐨𝐫𝐤𝐬 𝐟𝐨𝐫 𝐌𝐢𝐜𝐫𝐨𝐠𝐫𝐢𝐝 𝐅𝐚𝐮𝐥𝐭 𝐀𝐧𝐚𝐥𝐲𝐬𝐢𝐬?
Traditional fault-detection methods often depend on predefined thresholds or manually derived signal relationships.
A neural-network approach can learn complex relationships directly from simulated fault data.
Potential advantages include:
Fast identification of abnormal conditions
Ability to distinguish multiple fault categories
Fault-distance prediction
Learning from nonlinear electrical behavior
Adaptability to different operating conditions
Easy integration with MATLAB/Simulink
Suitable for testing intelligent protection concepts
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
Neural-network-based fault detection
Automatic fault classification
Fault location estimation in kilometers
10 km microgrid line model
Multiple fault positions
Multiple symmetrical and unsymmetrical fault types
Three-phase voltage and current measurement
Zero-sequence voltage and current analysis
Multiple neural networks for specialized tasks
MATLAB neural-network training integration
70/15/15 training, validation, and testing division
Simulink-compatible trained neural-network blocks
Grid, solar PV, battery, diesel, AC load, and DC load integration
Real-time visualization through Simulink scopes
Power-response monitoring during faults
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
This MATLAB simulation concept can be useful in:
Microgrid protection studies
Smart-grid fault analysis
Distribution-system protection
Renewable-energy-integrated grids
Intelligent protection-system development
Neural-network-based relay research
Fault classification algorithm evaluation
Fault-location method development
MATLAB/Simulink learning
Power-system automation research
Machine-learning applications in electrical engineering
Smart energy-management and protection studies
𝐖𝐡𝐨 𝐂𝐚𝐧 𝐔𝐬𝐞 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥?
The model is suitable for:
Electrical engineering students
Power-system researchers
Microgrid researchers
MATLAB/Simulink learners
Renewable-energy engineers
Protection engineers
Machine-learning researchers
Smart-grid engineers
Academic laboratories
Engineers studying intelligent fault diagnosis
𝐌𝐚𝐣𝐨𝐫 𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠 𝐎𝐮𝐭𝐜𝐨𝐦𝐞𝐬
By studying this simulation, users can understand:
How faults are introduced in a Simulink microgrid
How voltage and current signals change during faults
Why zero-sequence quantities are useful for ground faults
How fault datasets can be generated automatically
How MATLAB neural networks are trained
How classification targets are prepared
How separate networks can be used for different tasks
How fault distance can be predicted
How trained neural networks are integrated into Simulink
How microgrid power flows respond during fault conditions
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐒𝐮𝐦𝐦𝐚𝐫𝐲
Item | Description |
Platform | MATLAB/Simulink |
Main technique | Neural network |
System | Grid-connected microgrid |
Line length | 10 km |
Renewable source | Solar PV |
Energy storage | Battery |
Additional generation | Diesel power plant |
Loads | AC and DC loads |
Fault initiation | Around 0.1 s |
Fault detection | Neural-network based |
Fault classification | Encoded neural-network output |
Fault location | Neural-network estimation |
Training split | 70% / 15% / 15% |
Example fault | ABG |
Example 1 | 9 km actual, about 9.2–9.4 km estimated |
Example 2 | 5 km actual, about 4.4–4.6 km estimated |
𝐊𝐞𝐲 𝐁𝐞𝐧𝐞𝐟𝐢𝐭𝐬
The major strength of this model is that fault analysis is not limited to simply detecting an abnormal condition.
It combines three important protection functions:
Detection → Classification → Location
As a result, the system can provide more meaningful information for intelligent microgrid protection.
Instead of only indicating that a fault exists, the model attempts to determine what fault occurred and where it occurred.
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The neural network based fault detection, location and classification in microgrid using MATLAB/Simulink demonstrates an intelligent approach for analyzing electrical faults in a renewable-energy-integrated power system.
The developed microgrid includes solar PV, battery storage, diesel generation, AC and DC loads, and utility-grid integration. Different faults are created along a 10 km line, while three-phase voltage, current, and zero-sequence measurements are collected for neural-network training.
Separate neural networks are used for fault classification and fault-location estimation, allowing the model to handle several fault categories and operating conditions.
Simulation examples show that a fault created near 9 km can be estimated at approximately 9.2–9.4 km, while a fault near 5 km can be estimated at approximately 4.4–4.6 km. The model also successfully demonstrates classification of an ABG double line-to-ground fault.
Overall, the simulation provides a clear platform for studying artificial-intelligence-based microgrid protection, fault diagnosis, and fault-location techniques in MATLAB/Simulink.



Comments