MATLAB Simulation of PSO Trained ANFIS MPPT for Solar PV System
- lms editor
- 2 hours ago
- 8 min read
MATLAB Simulation of PSO Trained ANFIS MPPT for Solar PV System
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
Maximum Power Point Tracking (MPPT) is an essential control technique in solar photovoltaic systems because the operating point of a PV panel changes continuously with solar irradiation, temperature, and load conditions.
PSO Trained ANFIS MPPT for Solar PV System

This MATLAB/Simulink model demonstrates a 𝐏𝐒𝐎-𝐭𝐫𝐚𝐢𝐧𝐞𝐝 𝐀𝐍𝐅𝐈𝐒 𝐌𝐏𝐏𝐓 controller for extracting maximum available power from a solar PV panel.
The proposed approach combines:
𝐀𝐍𝐅𝐈𝐒 – Adaptive Neuro-Fuzzy Inference System
𝐏𝐒𝐎 – Particle Swarm Optimization
Solar PV modeling
Boost converter control
PI-based voltage regulation
PWM switching control
Variable irradiation testing
Variable load testing
Instead of relying only on the conventional ANFIS training procedure, Particle Swarm Optimization is used to optimize the important ANFIS parameters and improve the accuracy of maximum-power-point voltage prediction.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The complete MATLAB/Simulink system consists of the following major sections:
Solar PV panel
Irradiation and temperature inputs
PSO-trained ANFIS MPPT controller
Reference PV voltage generation
Actual PV voltage measurement
PI controller
PWM generator
IGBT-based boost converter
Resistive load
Voltage, current, and power measurement blocks
Basic Power Flow
Solar PV Panel → Boost Converter → Load
The control section continuously determines the required PV operating voltage so that the panel operates close to its maximum power point.
𝐀𝐍𝐅𝐈𝐒 𝐒𝐭𝐫𝐮𝐜𝐭𝐮𝐫𝐞
ANFIS combines the learning capability of neural networks with the reasoning capability of fuzzy logic.
A typical ANFIS structure contains 𝐟𝐢𝐯𝐞 𝐥𝐚𝐲𝐞𝐫𝐬.
Layer | Main Function |
Layer 1 | Input membership functions |
Layer 2 | Fuzzy rule firing strength |
Layer 3 | Normalization of firing strength |
Layer 4 | Consequent parameter processing |
Layer 5 | Final output generation |
Among these layers, 𝐋𝐚𝐲𝐞𝐫 𝟏 and 𝐋𝐚𝐲𝐞𝐫 𝟒 contain important adjustable parameters.
Layer 1 Parameters
When Gaussian membership functions are used, the important parameters include:
Membership-function center
Membership-function spread or standard deviation
Layer 4 Parameters
Layer 4 contains the consequent parameters associated with the fuzzy rules.
These parameters must be properly tuned to obtain an accurate relationship between PV operating conditions and the required maximum-power-point voltage.
𝐖𝐡𝐲 𝐔𝐬𝐞 𝐏𝐒𝐎 𝐟𝐨𝐫 𝐀𝐍𝐅𝐈𝐒 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠?
Particle Swarm Optimization is used to search for a suitable combination of ANFIS parameters.
Instead of depending only on conventional ANFIS parameter adjustment, PSO searches through multiple candidate solutions and progressively improves them.
The optimization focuses mainly on:
Membership-function parameters
Consequent parameters
Prediction accuracy
Training error reduction
The objective of the PSO training process is to obtain an ANFIS model capable of accurately predicting the 𝐯𝐨𝐥𝐭𝐚𝐠𝐞 𝐚𝐭 𝐭𝐡𝐞 𝐦𝐚𝐱𝐢𝐦𝐮𝐦 𝐩𝐨𝐰𝐞𝐫 𝐩𝐨𝐢𝐧𝐭 under different operating conditions.
𝐃𝐚𝐭𝐚𝐬𝐞𝐭 𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐨𝐧
Before training the ANFIS model, PV operating data are generated using MATLAB.
The training dataset contains two inputs and one target output.
Parameter | Type | Description |
Solar Irradiation | Input | Available solar radiation |
Temperature | Input | PV panel operating temperature |
Vmpp | Target Output | Voltage at maximum power point |
Dataset Size
Item | Value |
Total generated samples | 1000 |
Number of ANFIS inputs | 2 |
Number of target outputs | 1 |
The generated data are stored in a MATLAB data file and subsequently used for the ANFIS optimization and training process.
𝐏𝐒𝐎-𝐁𝐚𝐬𝐞𝐝 𝐀𝐍𝐅𝐈𝐒 𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The training procedure can be summarized as follows:
Generate solar PV input-output data.
Separate irradiation and temperature as input data.
Use Vmpp as the target output.
Generate an initial fuzzy inference system.
Identify the adjustable ANFIS parameters.
Initialize the PSO population.
Evaluate the performance of each candidate solution.
Calculate the prediction error.
Update the PSO particles.
Repeat the process for the specified number of iterations.
Select the parameter combination producing minimum error.
Generate the final trained fuzzy inference system.
Save the trained FIS file.
Import the trained FIS into the Simulink MPPT controller.
𝐏𝐒𝐎 𝐎𝐩𝐭𝐢𝐦𝐢𝐳𝐚𝐭𝐢𝐨𝐧 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The PSO algorithm uses a population of particles representing possible ANFIS parameter combinations.
During every iteration:
Each particle represents one candidate solution.
The ANFIS model is evaluated using the candidate parameters.
Predicted outputs are compared with target values.
The prediction error is calculated.
Better particle positions are identified.
Particle positions and velocities are updated.
The process continues until the maximum iteration count is reached.
The best solution obtained by PSO is finally assigned to the ANFIS model.
𝐎𝐛𝐣𝐞𝐜𝐭𝐢𝐯𝐞 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧
The optimization process evaluates the difference between:
Target maximum-power-point voltage
ANFIS-predicted maximum-power-point voltage
The 𝐫𝐨𝐨𝐭 𝐦𝐞𝐚𝐧 𝐬𝐪𝐮𝐚𝐫𝐞 𝐞𝐫𝐫𝐨𝐫 (RMSE) is used as the performance indicator.
A lower RMSE indicates better agreement between the trained ANFIS prediction and the target PV data.
The PSO therefore searches for ANFIS parameters that minimize the RMSE.
𝐓𝐫𝐚𝐢𝐧𝐢𝐧𝐠 𝐏𝐞𝐫𝐟𝐨𝐫𝐦𝐚𝐧𝐜𝐞
The reported trained model achieved very small prediction errors.
Dataset | Approximate RMSE |
Training data | 4.47 × 10⁻¹⁵ |
Testing data | 5.64 × 10⁻⁵ |
These values indicate close agreement between the target data and the PSO-trained ANFIS output for the tested dataset.
𝐓𝐫𝐚𝐢𝐧𝐞𝐝 𝐅𝐈𝐒 𝐅𝐢𝐥𝐞
After completion of the PSO optimization:
The final ANFIS structure is available in the MATLAB workspace.
The trained fuzzy inference system can be inspected.
Membership functions can be viewed.
The trained system can be exported as a FIS file.
The saved FIS file can be directly loaded into the Simulink fuzzy logic controller.
This makes the trained PSO-ANFIS model suitable for integration with the PV MPPT control system.
𝐏𝐕 𝐏𝐚𝐧𝐞𝐥 𝐒𝐩𝐞𝐜𝐢𝐟𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
A 250 W solar PV module is considered in the simulation.
PV Parameter | Value |
Rated maximum power | Approximately 250 W |
Open-circuit voltage, Voc | 37.3 V |
Voltage at maximum power, Vmpp | 30.7 V |
Short-circuit current, Isc | Approximately 8.66 A |
Current at maximum power, Impp | 8.15 A |
Reference irradiation | 1000 W/m² |
Reference temperature | 25°C |
Series modules | 1 |
Parallel strings | 1 |
𝐏𝐕 𝐏𝐨𝐰𝐞𝐫 𝐚𝐭 𝐃𝐢𝐟𝐟𝐞𝐫𝐞𝐧𝐭 𝐈𝐫𝐫𝐚𝐝𝐢𝐚𝐭𝐢𝐨𝐧 𝐋𝐞𝐯𝐞𝐥𝐬
The available PV power decreases as solar irradiation decreases.
Irradiation | Maximum Power | Vmpp |
1000 W/m² | ≈250.2 W | ≈30.70 V |
800 W/m² | ≈199.9 W | ≈30.68 V |
600 W/m² | ≈149.6 W | ≈30.62 V |
400 W/m² | ≈98.97 W | ≈30.47 V |
An important observation is that the available power changes significantly with irradiation, while the maximum-power-point voltage changes comparatively less.
This makes accurate Vmpp estimation highly useful for MPPT control.
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The PSO-trained ANFIS controller receives:
Solar irradiation
PV temperature
The controller then predicts the required:
𝐕𝐦𝐩𝐩 reference
This predicted value is compared with the actual PV panel voltage.
The resulting voltage error is processed by a PI controller.
Control Sequence
Irradiation + Temperature↓PSO-Trained ANFIS↓Vmpp Reference↓Comparison with Actual PV Voltage↓PI Controller↓Duty Cycle Command↓PWM Generator↓IGBT Switching↓Boost Converter Control↓Maximum Power Extraction
𝐑𝐨𝐥𝐞 𝐨𝐟 𝐭𝐡𝐞 𝐁𝐨𝐨𝐬𝐭 𝐂𝐨𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The boost converter acts as the power-processing interface between the PV panel and load.
Its functions include:
Adjusting the PV operating point
Increasing the DC output voltage
Matching the PV source with the load
Responding to the MPPT controller
Maintaining operation near the maximum power point
The IGBT switching signal is controlled using a PWM generator.
By adjusting the duty cycle, the converter changes the effective operating condition seen by the PV panel.
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The complete working process can be understood in five stages.
1. Measure Environmental Conditions
The controller receives:
Irradiation
Temperature
2. Predict Maximum-Power Voltage
The PSO-trained ANFIS estimates the appropriate Vmpp corresponding to the operating condition.
3. Measure Actual PV Voltage
The actual terminal voltage of the PV module is continuously monitored.
4. Generate Converter Control Signal
The reference and actual voltages are compared, and the error is processed using the PI controller.
5. Adjust the Boost Converter
The PWM duty cycle is changed so that the PV voltage moves toward the predicted maximum-power-point voltage.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐓𝐞𝐬𝐭 𝟏 – 𝐋𝐨𝐚𝐝 𝐕𝐚𝐫𝐢𝐚𝐭𝐢𝐨𝐧
The first simulation evaluates the MPPT controller under changing load conditions.
For this test:
Solar irradiation is maintained near 1000 W/m².
Temperature is maintained approximately constant.
Additional load is introduced periodically.
PV voltage, current, and power are monitored.
Converter-side voltage, current, and power are observed.
Load Variation
Test Parameter | Condition |
Irradiation | Approximately 1000 W/m² |
PV rated power | Approximately 250 W |
Load variation interval | Approximately every 0.3 s |
MPPT controller | PSO-trained ANFIS |
Converter | Boost converter |
Observation
Even when the load changes:
PV power remains close to its available maximum value.
PV current adjusts according to the operating condition.
The boost converter responds to the load variation.
Short transient changes may appear during sudden switching.
The MPPT controller moves the system back toward the desired operating point.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐓𝐞𝐬𝐭 𝟐 – 𝐈𝐫𝐫𝐚𝐝𝐢𝐚𝐭𝐢𝐨𝐧 𝐕𝐚𝐫𝐢𝐚𝐭𝐢𝐨𝐧
The second simulation evaluates MPPT performance under changing solar conditions.
The irradiation is changed approximately every 2 seconds.
Irradiation | Expected PV Power |
1000 W/m² | ≈250 W |
800 W/m² | ≈200 W |
600 W/m² | ≈150 W |
400 W/m² | ≈100 W |
200 W/m² | ≈50 W |
Observation
When irradiation decreases:
PV current decreases.
Available PV power decreases.
The ANFIS controller updates the Vmpp reference.
The boost converter adjusts its operating point.
The PV system continues tracking the available maximum power.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
The simulation demonstrates the behavior of several important signals.
PV-Side Signals
PV voltage
PV current
PV power
Converter and Load-Side Signals
Boost converter output voltage
Load current
Output power
Main Performance Observations
Maximum PV power is extracted at high irradiation.
Output power follows changes in solar irradiation.
The controller responds effectively to load variations.
The ANFIS output provides the required Vmpp reference.
PSO optimization provides accurate ANFIS prediction.
The converter maintains suitable PV operation during environmental changes.
Only short transient deviations occur during sudden operating-condition changes.
𝐏𝐒𝐎-𝐀𝐍𝐅𝐈𝐒 𝐯𝐬 𝐂𝐨𝐧𝐯𝐞𝐧𝐭𝐢𝐨𝐧𝐚𝐥 𝐌𝐏𝐏𝐓
Feature | Conventional MPPT | PSO-Trained ANFIS MPPT |
Operating principle | Iterative/search based | Learned PV characteristics |
Main inputs | Usually PV voltage/current | Irradiation and temperature |
Vmpp prediction | Usually indirect | Direct prediction |
Intelligent training | No | Yes |
Parameter optimization | Limited | PSO-based |
Knowledge representation | Algorithmic | Neuro-fuzzy |
Adaptability | Depends on method | High after suitable training |
Model integration | Simple | Requires trained FIS |
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
The developed MATLAB/Simulink model offers several useful features:
𝐏𝐒𝐎-𝐨𝐩𝐭𝐢𝐦𝐢𝐳𝐞𝐝 𝐀𝐍𝐅𝐈𝐒 controller
Irradiation and temperature-based Vmpp estimation
250 W solar PV panel modeling
Boost converter implementation
PI voltage controller
PWM-based IGBT switching
Load variation testing
Irradiation variation testing
Training and testing error evaluation
Trained FIS export facility
MATLAB and Simulink integration
PV voltage, current, and power monitoring
Converter-side performance analysis
𝐀𝐝𝐯𝐚𝐧𝐭𝐚𝐠𝐞𝐬 𝐨𝐟 𝐏𝐒𝐎-𝐓𝐫𝐚𝐢𝐧𝐞𝐝 𝐀𝐍𝐅𝐈𝐒 𝐌𝐏𝐏𝐓
Accurate Vmpp Prediction
ANFIS learns the nonlinear relationship between environmental conditions and the voltage corresponding to maximum power.
Optimized ANFIS Parameters
PSO searches for suitable membership-function and consequent parameters.
Effective Irradiation Tracking
The controller responds when solar irradiation changes from high to low values.
Load Disturbance Response
The PV operating point can be maintained close to maximum power even when the load changes.
Suitable for Complex PV Characteristics
The neuro-fuzzy structure is useful for representing nonlinear PV behavior.
Easy Simulink Integration
The trained FIS can be exported and directly included inside a MATLAB/Simulink control model.
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
PSO-trained ANFIS MPPT can be studied and extended for applications such as:
Grid-connected solar PV systems
Standalone PV systems
Solar battery charging
DC microgrids
AC microgrids
Renewable-energy conversion systems
PV-powered EV charging stations
Hybrid PV-battery systems
Solar water-pumping systems
DC distribution networks
Intelligent converter control
Research on AI-based MPPT techniques
𝐖𝐡𝐚𝐭 𝐂𝐚𝐧 𝐁𝐞 𝐋𝐞𝐚𝐫𝐧𝐞𝐝 𝐟𝐫𝐨𝐦 𝐓𝐡𝐢𝐬 𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧?
This model is useful for understanding:
How PV characteristics vary with irradiation
How training data are generated from a PV model
How ANFIS uses input and target data
How fuzzy inference parameters can be optimized
How PSO can be applied to intelligent controller training
How prediction error is evaluated
How a trained FIS is exported from MATLAB
How the FIS is imported into Simulink
How Vmpp-based MPPT operates
How a boost converter regulates the PV operating point
How MPPT responds to varying loads and irradiation
𝐌𝐀𝐓𝐋𝐀𝐁/𝐒𝐢𝐦𝐮𝐥𝐢𝐧𝐤 𝐌𝐨𝐝𝐞𝐥 𝐖𝐨𝐫𝐤𝐟𝐥𝐨𝐰
A practical implementation workflow is:
Step 1: Configure the solar PV model.Step 2: Generate irradiation and temperature combinations.Step 3: Calculate the corresponding Vmpp values.Step 4: Store the PV dataset.Step 5: Generate the initial fuzzy inference structure.Step 6: Identify the ANFIS parameters to be optimized.Step 7: Initialize the PSO algorithm.Step 8: Train the ANFIS using PSO.Step 9: Evaluate training and testing errors.Step 10: Export the optimized FIS.Step 11: Import the FIS into Simulink.Step 12: Connect the ANFIS output as the Vmpp reference.Step 13: Control the boost converter through PI and PWM control.Step 14: Test the system under variable irradiation and load conditions.
𝐖𝐡𝐲 𝐓𝐡𝐢𝐬 𝐌𝐨𝐝𝐞𝐥 𝐢𝐬 𝐔𝐬𝐞𝐟𝐮𝐥
This simulation provides a clear connection between:
Solar PV Modeling + Artificial Intelligence + Optimization + Power Electronics + MPPT Control
It is particularly useful for students, researchers, and engineers who want to understand how an intelligent optimization algorithm can be used to train an ANFIS model and integrate the trained controller into a practical PV power-conversion system.
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The 𝐌𝐀𝐓𝐋𝐀𝐁 𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐨𝐟 𝐏𝐒𝐎 𝐓𝐫𝐚𝐢𝐧𝐞𝐝 𝐀𝐍𝐅𝐈𝐒 𝐌𝐏𝐏𝐓 𝐟𝐨𝐫 𝐒𝐨𝐥𝐚𝐫 𝐏𝐕 𝐒𝐲𝐬𝐭𝐞𝐦 demonstrates an intelligent method for maximum power extraction from a photovoltaic panel.
The ANFIS controller uses 𝐢𝐫𝐫𝐚𝐝𝐢𝐚𝐭𝐢𝐨𝐧 and 𝐭𝐞𝐦𝐩𝐞𝐫𝐚𝐭𝐮𝐫𝐞 as inputs and predicts the required 𝐕𝐦𝐩𝐩. Particle Swarm Optimization is used to optimize the ANFIS parameters and reduce prediction error.
When integrated with a PI-controlled boost converter, the trained controller enables the PV panel to operate close to its maximum power point during variations in both solar irradiation and load.
The simulation therefore provides a useful platform for studying 𝐏𝐒𝐎, 𝐀𝐍𝐅𝐈𝐒, 𝐌𝐏𝐏𝐓, solar PV characteristics, boost converter control, and intelligent renewable-energy systems within MATLAB/Simulink.



Comments