Neural Network Control of Shunt Active Power Filter
Neural Network Control of Shunt Active Power Filter
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
The Neural Network Control of Shunt Active Power Filter demonstrates an intelligent power-quality improvement technique using MATLAB/Simulink. The system is designed to reduce current harmonics produced by nonlinear loads and improve the quality of the source current.

When nonlinear loads such as a three-phase rectifier with an RL load are connected to the electrical network, the load current becomes distorted. This distortion can also affect the source current and increase harmonic pollution in the power system.
A Shunt Active Power Filter (SAPF) is connected in parallel with the system to inject a compensating current. The proposed model replaces the conventional controller used in the DC-link regulation stage with a trained neural network controller, providing improved harmonic compensation. Pasted text
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The MATLAB/Simulink model mainly consists of:
Three-phase AC grid
Nonlinear load
Three-phase voltage-source inverter
DC-link capacitor
Shunt Active Power Filter
Voltage and current measurement system
Power calculation and reference-current generation
Hysteresis current controller
Neural network controller
FFT and THD analysis
The active filter is connected in parallel with the nonlinear load. Its main purpose is to generate the required compensation current so that harmonic components drawn by the nonlinear load are prevented from significantly appearing in the grid current. Pasted text
Main System Details
Parameter / Element | Description |
System type | Three-phase power system |
Load type | Nonlinear load |
Nonlinear load structure | Three-phase rectifier with RL load |
Filter | Shunt Active Power Filter |
Converter | Three-phase voltage-source inverter |
Energy-storage element | DC-link capacitor |
Grid frequency used for FFT | 50 Hz |
Conventional control | PI-based control |
Proposed control | Neural Network control |
Current control | Hysteresis current control |
𝐏𝐫𝐨𝐛𝐥𝐞𝐦 𝐖𝐢𝐭𝐡 𝐍𝐨𝐧𝐥𝐢𝐧𝐞𝐚𝐫 𝐋𝐨𝐚𝐝𝐬
Power-electronic loads do not normally draw perfectly sinusoidal current.
Typical nonlinear devices include:
Diode rectifiers
Controlled rectifiers
Variable-speed drives
Switching power converters
Industrial electronic loads
In the demonstrated system, a three-phase rectifier-based nonlinear load creates a distorted load-current waveform. The distortion is reflected toward the power source when compensation is not provided. Pasted text
Effects of Current Harmonics
High harmonic current can result in:
Distorted source current
Poor power quality
Increased system losses
Additional heating in electrical equipment
Interference with nearby loads
Increased reactive-power demand
Higher Total Harmonic Distortion (THD)
The objective of the Shunt Active Power Filter is therefore to make the source current closer to a sinusoidal waveform.
𝐒𝐡𝐮𝐧𝐭 𝐀𝐜𝐭𝐢𝐯𝐞 𝐏𝐨𝐰𝐞𝐫 𝐅𝐢𝐥𝐭𝐞𝐫
The SAPF behaves as a controlled current-compensation system.
It continuously determines the undesired current components produced by the nonlinear load and injects an appropriate compensating current at the Point of Common Coupling (PCC).
The main hardware section contains:
Three-phase inverter
DC-link capacitor
Grid connection
Coupling interface
Current measurement
Voltage measurement
The inverter is controlled so that the required compensation current is injected into the power system. Pasted text
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The complete operation can be understood in a few simple stages.
1. Measure Grid Voltage
The three-phase grid voltages are continuously measured.
These measurements are used by the control system to determine the operating condition of the network.
2. Measure Load Current
The nonlinear-load currents are measured.
Since the load contains power-electronic devices, these currents contain harmonic components.
3. Transform the Measured Quantities
The measured three-phase voltage and current signals are converted into a stationary reference frame.
This simplifies:
Active-power calculation
Reactive-power calculation
Reference-current generation
4. Determine Power Components
The controller identifies the required active and reactive power information from the measured voltage and current signals.
A low-pass filtering stage is used to separate the required components.
5. Regulate DC-Link Voltage
The voltage across the SAPF DC-link capacitor is measured and compared with its reference value.
The resulting information is used to determine the additional power required to maintain the DC-link voltage.
6. Generate Compensation Current
Using the calculated power components, the controller determines the required compensation-current reference.
7. Convert Reference Current to Three Phase
The internally calculated compensation signals are converted back into three-phase reference currents.
8. Generate Inverter Pulses
The reference currents are compared with the actual active-filter currents.
A hysteresis current controller produces the switching pulses for the voltage-source inverter.
9. Inject Compensation Current
The inverter injects the required compensating current into the grid.
As a result:
Distorted load current + compensation current → improved source current
This process allows the source current to remain approximately sinusoidal even when the load current contains significant distortion. Pasted text
𝐍𝐞𝐮𝐫𝐚𝐥 𝐍𝐞𝐭𝐰𝐨𝐫𝐤 𝐂𝐨𝐧𝐭𝐫𝐨𝐥𝐥𝐞𝐫
The important feature of this implementation is the replacement of the conventional controller in the DC-link control stage with a Neural Network controller.
The neural network learns the relationship between selected control inputs and the required controller output.
Neural Network Inputs
The demonstrated training arrangement uses information associated with:
DC-link voltage reference
DC-link voltage error
Neural Network Target
The required controller output used during training is the control signal associated with the loss-power component of the active-filter controller. Pasted text
𝐍𝐞𝐮𝐫𝐚𝐥 𝐍𝐞𝐭𝐰𝐨𝐫𝐤 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠
The neural network is trained using data collected from the MATLAB/Simulink model.
Training Procedure
Run the conventional controlled SAPF model.
Record the required input variables.
Store the controller output as target data.
Arrange the collected variables as neural-network training data.
Open the MATLAB neural-network fitting application.
Select input and target data.
Train the network.
Evaluate the regression performance.
Generate the trained neural-network block.
Insert the trained network into the SAPF controller.
Run the complete system again.
Evaluate waveform quality and THD.
The transcript reports regression values close to unity during training, indicating a strong relationship between the network outputs and the target data for the demonstrated dataset. Pasted text
Reported Neural Network Performance
Training Indicator | Reported Approximate Value |
Regression value | Around 0.98–0.99 |
Desired regression trend | Close to 1 |
Controller inputs | Reference and error signals |
Network purpose | Generate controller output |
Implementation | MATLAB neural-network block |
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The overall control sequence is:
Grid Voltage & Load Current
↓
Signal Transformation
↓
Active and Reactive Power Processing
↓
DC-Link Voltage Regulation
↓
Neural Network Controller
↓
Reference Compensation Current
↓
Three-Phase Current Reference
↓
Hysteresis Current Controller
↓
VSI Switching Pulses
↓
Compensation Current Injection
↓
Improved Source Current
This control structure combines conventional active-filter principles with a data-driven controller.
𝐂𝐨𝐧𝐯𝐞𝐧𝐭𝐢𝐨𝐧𝐚𝐥 𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐯𝐬 𝐍𝐞𝐮𝐫𝐚𝐥 𝐍𝐞𝐭𝐰𝐨𝐫𝐤 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The demonstration compares the harmonic performance of a conventional controller and the neural-network-based controller.
Feature | Conventional Controller | Neural Network Controller |
DC-link control approach | PI based | Neural Network based |
Compensation principle | Active filtering | Active filtering |
Inverter current control | Hysteresis | Hysteresis |
Nonlinear-load compensation | Yes | Yes |
Source-current improvement | Yes | Yes |
Reported THD in one FFT setting | 1.83% | 1.71% |
Reported alternate FFT value | About 4.62–4.63% | About 4.53% |
The reported simulation therefore shows a small reduction in source-current harmonic distortion when the trained neural-network controller is used. The exact THD value depends on the FFT settings and analysis method selected in MATLAB. Pasted text
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
Without Effective Compensation
The nonlinear load causes:
Highly distorted current
Significant harmonic components
Non-sinusoidal source-current behaviour
With Shunt Active Power Filter
After compensation:
Harmonic current is supplied mainly by the active filter
Grid-current distortion is reduced
Source current becomes closer to sinusoidal
Power quality improves
With Neural Network Control
The neural-network-controlled SAPF demonstrates:
Effective compensation-current generation
Stable operation of the active filter
Improved source-current waveform
Lower reported THD than the demonstrated conventional-controller case
Good neural-network regression performance
𝐓𝐇𝐃 𝐀𝐧𝐚𝐥𝐲𝐬𝐢𝐬
Total Harmonic Distortion (THD) is an important indicator for evaluating the quality of current waveforms.
MATLAB's FFT analysis tool can be used to examine:
Fundamental component
Individual harmonic orders
Harmonic magnitude
Frequency spectrum
Overall THD
For the 50 Hz analysis shown in the model, the reported neural-network-controlled result reaches approximately 1.71% THD under the selected FFT configuration, compared with approximately 1.83% for the conventional controller. Pasted text
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
MATLAB/Simulink-based implementation
Three-phase Shunt Active Power Filter
Nonlinear rectifier-load compensation
Neural Network controller
DC-link voltage control
Compensation-current reference generation
Stationary-reference-frame processing
Active and reactive power processing
Hysteresis current control
Three-phase voltage-source inverter
Source-current harmonic mitigation
FFT-based harmonic evaluation
THD comparison between control approaches
Neural-network training and Simulink integration
Suitable for understanding intelligent power-quality control
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
Neural-network-controlled Shunt Active Power Filters can be studied for applications involving:
Industrial power systems
Variable-speed-drive installations
Power-electronic loads
Distribution networks
Renewable-energy interfacing systems
Smart-grid power-quality studies
Harmonic mitigation
Reactive-power compensation
Intelligent converter control
Power-quality research
MATLAB/Simulink controller development
𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠 𝐎𝐮𝐭𝐜𝐨𝐦𝐞𝐬
By studying this model, learners can understand:
Why nonlinear loads generate harmonics
How harmonics affect grid current
How a Shunt Active Power Filter operates
How compensation currents are generated
How the DC-link capacitor is regulated
How a three-phase inverter injects compensating current
How hysteresis current control works
How neural-network training data can be obtained from Simulink
How a trained neural network can replace a conventional controller
How FFT and THD are used to evaluate power quality
𝐖𝐡𝐨 𝐂𝐚𝐧 𝐔𝐬𝐞 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥?
This topic is useful for:
Electrical engineering students
Power-electronics learners
Power-quality researchers
MATLAB/Simulink users
Research scholars
Control-system engineers
Renewable-energy researchers
Engineers studying harmonic compensation
Researchers exploring AI-based power-electronic control
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The Neural Network Control of Shunt Active Power Filter combines intelligent control with conventional power-quality compensation techniques.
A nonlinear load produces distorted current, while the Shunt Active Power Filter injects an appropriate compensating current to improve the source-current waveform. The neural network is trained using controller input-output data and is then incorporated into the MATLAB/Simulink control system.
For the demonstrated operating condition, the neural-network-based approach achieves effective harmonic compensation and shows a reduction in the reported source-current THD compared with the conventional controller. Pasted text
This simulation provides a clear platform for understanding Shunt Active Power Filters, neural-network control, harmonic compensation, inverter control, THD analysis, and intelligent power-quality improvement.



Comments