MATLAB Simulation of UPQC for Power Quality Mitigation using Ant Colony Optimized Fuzzy Control
- lms editor
- 2 days ago
- 7 min read
MATLAB Simulation of UPQC for Power Quality Mitigation using Ant Colony Optimized Fuzzy Control
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
UPQC for Power Quality Mitigation using Ant Colony Optimized Fuzzy Control

Power-quality disturbances such as voltage sag, voltage swell, current harmonics, and poor load-voltage regulation can affect the performance of electrical equipment and industrial power systems.
This MATLAB/Simulink model demonstrates a Unified Power Quality Conditioner (UPQC) controlled using an Ant Colony Optimization-based fuzzy control technique.
The proposed system combines:
A series active power filter
A shunt active power filter
A common DC-link capacitor
A fuzzy PID-based controller
An Ant Colony Optimization algorithm
Multiple error-performance indices
Grid-current harmonic analysis
The primary purpose of the system is to maintain the load voltage near its rated value while reducing the harmonic distortion caused by a nonlinear load.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The simulated power system contains a programmable three-phase grid, a nonlinear load, and a UPQC connected between the source and the load.
System component | Purpose |
Programmable grid | Produces normal voltage, voltage sag, and voltage swell conditions |
Nonlinear load | Introduces current harmonics into the power system |
Series active filter | Compensates voltage sag and voltage swell |
Shunt active filter | Reduces source-current harmonics and regulates the DC-link voltage |
DC-link capacitor | Provides a common energy-storage link between both active filters |
Injection transformer | Injects the compensating voltage into the supply line |
Fuzzy controller | Generates the required control action |
Ant Colony Optimization | Determines improved fuzzy-controller parameters |
FFT analysis | Measures the harmonic spectrum and grid-current THD |
The nonlinear load is formed using a three-phase rectifier with an RL load. Without adequate compensation, this load produces a distorted current waveform with a THD of approximately 22.24%.
𝐌𝐚𝐢𝐧 𝐒𝐲𝐬𝐭𝐞𝐦 𝐏𝐚𝐫𝐚𝐦𝐞𝐭𝐞𝐫𝐬
Parameter | Value or description |
Simulation platform | MATLAB/Simulink |
Power-conditioning device | Unified Power Quality Conditioner |
Supply system | Three-phase programmable grid |
Load type | Three-phase rectifier with RL load |
Initial nonlinear-load THD | Approximately 22.24% |
Active-filter arrangement | Series APF and shunt APF |
Energy-storage element | Common DC-link capacitor |
Controller | Fuzzy PID-based controller |
Optimization method | Ant Colony Optimization |
Demonstration iterations | 10 iterations |
Optimized grid-current THD | Approximately 2.44% |
THD target | Less than 5% |
𝐔𝐏𝐐𝐂 𝐂𝐨𝐧𝐟𝐢𝐠𝐮𝐫𝐚𝐭𝐢𝐨𝐧
The UPQC integrates two active power filters through a common DC link.
𝐒𝐞𝐫𝐢𝐞𝐬 𝐀𝐜𝐭𝐢𝐯𝐞 𝐏𝐨𝐰𝐞𝐫 𝐅𝐢𝐥𝐭𝐞𝐫
The series active filter is connected to the supply line through an injection transformer.
Its main functions include:
Detecting disturbances in the grid voltage
Generating a suitable compensating voltage
Injecting the compensation voltage into the line
Maintaining the load voltage during voltage sag
Opposing the excessive grid voltage during voltage swell
Improving the voltage supplied to the nonlinear load
𝐒𝐡𝐮𝐧𝐭 𝐀𝐜𝐭𝐢𝐯𝐞 𝐏𝐨𝐰𝐞𝐫 𝐅𝐢𝐥𝐭𝐞𝐫
The shunt active filter is connected in parallel with the power system.
Its main functions include:
Compensating the harmonic current demanded by the nonlinear load
Making the source current more sinusoidal
Regulating the common DC-link voltage
Supplying the active-filter losses
Supporting coordinated operation of the complete UPQC
𝐂𝐨𝐦𝐦𝐨𝐧 𝐃𝐂-𝐋𝐢𝐧𝐤 𝐂𝐚𝐩𝐚𝐜𝐢𝐭𝐨𝐫
The common DC-link capacitor connects the series and shunt converters.
It performs the following functions:
Stores energy required for compensation
Enables power exchange between the two converters
Supports series-voltage injection
Maintains stable operation of both active filters
Provides the DC voltage required by the converter switching system
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The operation of the proposed UPQC system can be understood through the following stages.
1. Grid and load operation
The programmable grid supplies power to the nonlinear load. Different grid-voltage conditions are introduced to test the compensation capability.
2. Power-quality disturbance creation
The programmable source generates:
Normal voltage
Voltage sag
Voltage swell
At the same time, the rectifier-based nonlinear load produces harmonic current.
3. Voltage disturbance detection
The control system measures the grid voltage and compares it with the required load-voltage reference.
4. Series-voltage compensation
The series converter generates an appropriate compensation voltage. This voltage is injected through the series transformer to correct the disturbed supply voltage.
5. Harmonic-current compensation
The shunt converter generates a compensating current that opposes the harmonic component of the nonlinear-load current.
6. DC-link voltage regulation
The fuzzy control system regulates the common DC-link voltage so that both converters receive sufficient energy for compensation.
7. Optimized controller operation
Ant Colony Optimization adjusts selected fuzzy-controller parameters to reduce the control error and grid-current harmonic distortion.
8. Performance analysis
The corrected load voltage, injected voltage, source current, harmonic spectrum, and THD are evaluated after optimization.
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The proposed system uses a fuzzy PID-based control structure for DC-link voltage regulation.
The fuzzy controller includes:
A proportional-derivative fuzzy control section
A separate integral-control section
Input scaling factors
Output scaling factors
Tunable membership-function parameters
Tunable rule-related parameters
The fuzzy proportional-derivative section responds quickly to changes in the control error, while the integral section helps reduce the steady-state error.
𝐅𝐮𝐳𝐳𝐲 𝐂𝐨𝐧𝐭𝐫𝐨𝐥𝐥𝐞𝐫 𝐏𝐚𝐫𝐚𝐦𝐞𝐭𝐞𝐫𝐬
Parameter group | Function |
Error scaling factor, Ke | Scales the controller error input |
Change-in-error scaling factor, Kce | Scales the rate of change of error |
Output scaling factor, Ku | Adjusts the magnitude of the fuzzy-controller output |
Membership parameters | Determine the shape and location of fuzzy membership functions |
Rule-related parameters | Influence the output associated with the fuzzy rules |
Integral-control parameter | Supports steady-state DC-link voltage regulation |
A total of six tunable parameters are considered in the optimization process. These parameters represent fuzzy scaling, membership-function, rule-base, and control variables used in the implemented system
𝐀𝐧𝐭 𝐂𝐨𝐥𝐨𝐧𝐲 𝐎𝐩𝐭𝐢𝐦𝐢𝐳𝐚𝐭𝐢𝐨𝐧
Ant Colony Optimization is used to search for improved fuzzy-controller parameters.
The optimization process follows these stages:
An initial population of possible controller parameters is generated.
Each parameter set is transferred to the Simulink model.
The system is simulated using the selected controller values.
Error indices and grid-current THD are measured.
A combined cost value is calculated.
The best-performing parameter combination is identified.
The ant-search process updates the candidate solutions.
The procedure continues until the maximum iteration is reached.
The final optimized parameters are assigned to the fuzzy controller.
The Simulink model is executed again to obtain the final results.
Only 10 iterations are used in the demonstration to show the optimization procedure quickly. A larger number of iterations can be used for a more extensive search.
𝐎𝐛𝐣𝐞𝐜𝐭𝐢𝐯𝐞 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧𝐬
The optimization does not depend on only one performance indicator. Several error indices and the grid-current THD are considered.
Performance index | Purpose |
IAE | Measures the accumulated absolute control error |
ITAE | Gives more importance to errors that continue for a longer duration |
ISE | Gives a larger penalty to high-magnitude errors |
RMSE | Indicates the average magnitude of the control deviation |
Grid-current THD | Measures current waveform distortion |
The combined evaluation helps the algorithm find controller parameters that provide:
Faster voltage regulation
Reduced steady-state error
Lower oscillations
Improved transient response
Lower grid-current harmonic distortion
𝐎𝐩𝐭𝐢𝐦𝐢𝐳𝐚𝐭𝐢𝐨𝐧 𝐒𝐞𝐭𝐭𝐢𝐧𝐠𝐬
Optimization item | Demonstration setting |
Algorithm | Ant Colony Optimization |
Number of tunable variables | 6 |
Demonstration iterations | 10 |
Suggested detailed study | 100 to 500 iterations |
Suggested independent trials | 50 to 100 trials |
Main harmonic objective | Grid-current THD |
Additional objectives | IAE, ITAE, ISE, and RMSE |
Multiple independent trials are useful because optimization algorithms may produce slightly different results during different executions. The best controller solution can be selected after comparing the final costs from all trials.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐌𝐨𝐝𝐞𝐬
Operating condition | UPQC response |
Normal grid voltage | Maintains normal load operation and compensates load-current harmonics |
Voltage sag | Series APF injects the missing voltage component |
Voltage swell | Series APF injects an opposing compensation voltage |
Nonlinear load operation | Shunt APF supplies the harmonic compensation current |
DC-link voltage variation | Fuzzy controller restores and maintains the reference voltage |
Harmonic current condition | Source current becomes more sinusoidal |
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
The optimized UPQC improves both voltage quality and current quality.
𝐋𝐨𝐚𝐝-𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐂𝐨𝐦𝐩𝐞𝐧𝐬𝐚𝐭𝐢𝐨𝐧
During voltage sag and voltage swell:
The grid voltage becomes lower or higher than the rated value.
The series converter produces the required injection voltage.
The compensation voltage is applied through the transformer.
The load voltage is maintained at approximately 1 per unit.
The connected load receives a regulated voltage despite the source disturbance.
𝐒𝐨𝐮𝐫𝐜𝐞-𝐂𝐮𝐫𝐫𝐞𝐧𝐭 𝐈𝐦𝐩𝐫𝐨𝐯𝐞𝐦𝐞𝐧𝐭
The nonlinear load initially draws a distorted current.
After UPQC compensation:
The shunt filter supplies the harmonic component.
The grid supplies mainly the fundamental current component.
The source-current waveform becomes nearly sinusoidal.
The current harmonic content is significantly reduced.
𝐓𝐇𝐃 𝐏𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞
Performance quantity | Value |
Nonlinear-load THD | Approximately 22.24% |
Compensated grid-current THD | Approximately 2.44% |
Common harmonic limit used for comparison | 5% |
Final condition | THD below 5% |
The FFT analysis reports a compensated grid-current THD of approximately 2.44%, showing effective harmonic mitigation under the simulated condition.
𝐏𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞 𝐂𝐨𝐦𝐩𝐚𝐫𝐢𝐬𝐨𝐧
Condition | Before compensation | After optimized UPQC compensation |
Load-voltage response | Affected by grid sag and swell | Maintained near the rated value |
Source-current waveform | Distorted due to nonlinear load | Nearly sinusoidal |
Harmonic distortion | High | Reduced |
Grid-current THD | Influenced by 22.24% nonlinear-load distortion | Approximately 2.44% |
DC-link regulation | Requires suitable controller tuning | Controlled using optimized fuzzy parameters |
Controller parameters | Manually selected or initial values | Tuned using Ant Colony Optimization |
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
Complete three-phase UPQC simulation in MATLAB/Simulink
Programmable voltage sag and voltage swell creation
Series active filter for voltage compensation
Shunt active filter for harmonic-current compensation
Common DC-link capacitor arrangement
Fuzzy PID-based DC-link voltage control
Ant Colony Optimization-based parameter tuning
Six tunable fuzzy-control parameters
Multiple-objective performance evaluation
IAE, ITAE, ISE, RMSE, and THD analysis
Nonlinear rectifier load with approximately 22.24% THD
Optimized grid-current THD of approximately 2.44%
FFT-based harmonic spectrum evaluation
Visualization of grid voltage, load voltage, and injected voltage
Iteration-wise best-cost monitoring
Suitable structure for controller-comparison studies
𝐁𝐞𝐧𝐞𝐟𝐢𝐭𝐬 𝐨𝐟 𝐀𝐂𝐎-𝐁𝐚𝐬𝐞𝐝 𝐅𝐮𝐳𝐳𝐲 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The combination of fuzzy logic and Ant Colony Optimization offers several benefits:
Reduced dependency on manual controller tuning
Improved search for scaling-factor values
Better coordination between series and shunt filters
Improved DC-link voltage response
Reduced transient and steady-state control error
Lower current harmonic distortion
Flexible objective-function selection
Adaptability for different loads and disturbance conditions
Convenient comparison with PI, PID, or conventional fuzzy controllers
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
This UPQC control concept can be studied for:
Industrial distribution systems
Power-electronic load compensation
Renewable-energy-integrated distribution networks
Smart-grid power-quality improvement
Microgrid voltage and current conditioning
Commercial buildings with nonlinear loads
Data centres and sensitive electronic loads
Electric-vehicle charging infrastructure
Variable-speed drive systems
Laboratory studies of voltage sag and swell
Harmonic mitigation research
Optimization-based controller comparison
𝐖𝐡𝐨 𝐂𝐚𝐧 𝐔𝐬𝐞 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥?
The model is suitable for:
Electrical engineering students
Power-electronics learners
Power-quality researchers
MATLAB/Simulink users
Control-system engineers
Microgrid researchers
Optimization-algorithm developers
Engineers studying active power filters
Researchers comparing intelligent controllers
𝐏𝐨𝐬𝐬𝐢𝐛𝐥𝐞 𝐅𝐮𝐭𝐮𝐫𝐞 𝐄𝐱𝐭𝐞𝐧𝐬𝐢𝐨𝐧𝐬
The simulation can be extended by including:
Longer ACO optimization runs
Statistical comparison over multiple trials
Comparison with PSO, GA, GWO, or other algorithms
Conventional PI and fuzzy-controller benchmarking
Different voltage-sag and voltage-swell depths
Unbalanced grid-voltage conditions
Variable nonlinear-load conditions
Source-frequency variation
Measurement noise
Parameter uncertainty
Real-time controller implementation
Hardware-in-the-loop testing
Experimental UPQC validation
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The MATLAB simulation demonstrates an effective UPQC-based power-quality mitigation system using an Ant Colony Optimized fuzzy controller.
The series active filter compensates voltage sag and swell, while the shunt active filter reduces the current harmonics produced by the nonlinear load. The common DC-link voltage is regulated through a fuzzy PID-based control structure whose parameters are tuned using Ant Colony Optimization.
Under the simulated operating condition, the source-current THD is reduced to approximately 2.44%, which is below the selected 5% comparison level. The load voltage is also maintained near 1 per unit during grid-voltage disturbances.
This model provides a useful platform for understanding UPQC operation, intelligent fuzzy control, optimization-based parameter tuning, harmonic mitigation, and power-quality analysis in MATLAB/Simulink.



Comments