MATLAB Implementation of ANFIS Based MPPT for Solar PV System
- lms editor
- 12 minutes ago
- 9 min read
MATLAB Implementation of ANFIS Based MPPT for Solar PV System
𝐈𝐧𝐭𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧
Maximum Power Point Tracking (MPPT) is an important part of a solar photovoltaic (PV) system because the available PV power changes continuously with solar irradiance, temperature, and operating conditions.
ANFIS Based MPPT for Solar PV System

This MATLAB/Simulink implementation uses an Adaptive Neuro-Fuzzy Inference System (ANFIS) to determine the reference voltage corresponding to the maximum power point of a solar PV panel.
The developed system combines:
Solar PV modeling
ANFIS-based MPPT
PI voltage control
PWM pulse generation
DC–DC boost converter
Variable irradiance testing
Sudden load-change testing
The main objective is to verify whether the ANFIS MPPT controller can maintain the PV panel close to its maximum power point when environmental conditions or load conditions change.
𝐖𝐡𝐚𝐭 𝐈𝐬 𝐀𝐍𝐅𝐈𝐒?
ANFIS stands for Adaptive Neuro-Fuzzy Inference System.
It combines the learning capability of a neural network with the decision-making capability of a fuzzy inference system.
In simple terms:
The fuzzy system provides membership functions and rules.
The neural-network learning mechanism adjusts the internal parameters.
Training data are used to establish the relationship between inputs and the required output.
A hybrid learning algorithm is used to improve the ANFIS model.
For this MPPT application, ANFIS learns the relationship between:
Inputs
Solar irradiance
PV temperature
Output
Reference voltage at the maximum power point, Vmp
This reference is then used by the converter control system to operate the PV array near its maximum available power.
𝐀𝐍𝐅𝐈𝐒 𝐒𝐭𝐫𝐮𝐜𝐭𝐮𝐫𝐞
The ANFIS architecture consists of several processing layers.
Layer | Main Function |
Input Layer | Receives irradiance and temperature |
Layer 1 | Membership function processing |
Layer 2 | Fuzzy rule activation |
Layer 3 | Rule normalization |
Layer 4 | Consequent/output processing |
Layer 5 | Produces the final ANFIS output |
The parameters of the ANFIS network are adjusted during training so that its predicted output closely follows the desired maximum-power-point voltage.
𝐖𝐡𝐲 𝐔𝐬𝐞 𝐀𝐍𝐅𝐈𝐒 𝐟𝐨𝐫 𝐒𝐨𝐥𝐚𝐫 𝐌𝐏𝐏𝐓?
The maximum power point of a PV panel does not remain constant.
It changes mainly because of:
Variations in solar irradiance
Variations in temperature
Changes in connected load
Dynamic operating conditions
ANFIS is suitable for MPPT because it can learn the nonlinear relationship between environmental conditions and the desired PV operating point.
In this implementation, the controller directly estimates the maximum-power-point voltage reference, which is then used by the converter controller.
𝐒𝐲𝐬𝐭𝐞𝐦 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰
The MATLAB/Simulink system consists of the following major sections:
250 W solar PV panel
Irradiance input
Temperature input
PV voltage and current measurement
ANFIS MPPT controller
PI controller
PWM generator
DC–DC boost converter
Variable resistive load
Output voltage, current, and power measurements
The basic control path is:
Irradiance + Temperature → ANFIS → Vmp Reference → Voltage Error → PI Controller → Duty Cycle → PWM Generator → Boost Converter
The boost converter then changes the PV operating point according to the duty cycle generated by the controller.
𝐌𝐚𝐢𝐧 𝐒𝐲𝐬𝐭𝐞𝐦 𝐏𝐚𝐫𝐚𝐦𝐞𝐭𝐞𝐫𝐬
Parameter | Value / Range |
PV panel rating | 250 W |
Standard irradiance | 1000 W/m² |
Standard temperature | 25°C |
Training temperature range | 15°C to 35°C |
Training irradiance range | 0 to 1000 W/m² |
Number of training data points | 1000 |
ANFIS inputs | Irradiance and temperature |
ANFIS output | Voltage at maximum power point |
Input membership functions | 3 for each input |
Membership function type | Triangular |
Training method | Hybrid learning |
Training iterations | 100 |
Reported training error | Approximately 3.73 × 10⁻⁷ |
The very small reported training error indicates close agreement between the generated training data and the trained ANFIS response.
𝐖𝐨𝐫𝐤𝐢𝐧𝐠 𝐏𝐫𝐨𝐜𝐞𝐬𝐬
The complete implementation can be understood in five main stages.
1. Generate Solar PV Training Data
Before ANFIS can be used as an MPPT controller, suitable training data must be generated.
The data-generation program considers PV parameters such as:
Short-circuit current
Current at maximum power point
Open-circuit voltage
Voltage at maximum power point
Current temperature coefficient
Voltage temperature coefficient
Solar irradiance
PV temperature
Random operating conditions are generated over the selected irradiance and temperature ranges.
For every operating condition, the corresponding maximum-power-point parameters are obtained.
In this implementation, the required ANFIS output is the voltage at maximum power point.
2. Prepare ANFIS Input and Output Data
The training dataset contains:
Input 1: Irradiance
Input 2: Temperature
Target output: Maximum-power-point voltage
A total of 1000 operating samples are generated for training.
This allows ANFIS to learn how the optimum PV voltage changes with irradiance and temperature.
3. Configure the ANFIS Model
The generated data are loaded into the MATLAB neuro-fuzzy system designer.
The initial fuzzy inference system is created using grid partitioning.
The configuration described in the implementation uses:
Two inputs
Three membership functions for irradiance
Three membership functions for temperature
Triangular membership functions
Hybrid learning algorithm
100 training iterations
After training, the ANFIS model is tested against the available data.
The predicted and target responses are shown to closely overlap.
4. Export the Trained ANFIS Model
Once training is completed successfully, the fuzzy inference system is exported and saved.
The trained ANFIS model is then incorporated into the MATLAB/Simulink control system.
Inside Simulink, it receives:
Irradiance
Temperature
and generates:
Reference maximum-power-point voltage
5. Control the Boost Converter
The reference voltage generated by ANFIS is compared with the measured PV voltage.
The resulting voltage error is processed by a PI controller.
The PI controller produces the required converter duty-cycle command.
The control sequence is therefore:
ANFIS Vmp Reference → PV Voltage Comparison → PI Controller → Duty Cycle → PWM → IGBT Switching
The switching pulses operate the boost converter and adjust the PV operating point toward maximum power.
𝐂𝐨𝐧𝐭𝐫𝐨𝐥 𝐒𝐭𝐫𝐚𝐭𝐞𝐠𝐲
The proposed implementation uses a relatively simple control arrangement.
𝐀𝐍𝐅𝐈𝐒 𝐌𝐏𝐏𝐓
The ANFIS block determines the required Vmp reference based on:
Current irradiance
Current PV temperature
𝐕𝐨𝐥𝐭𝐚𝐠𝐞 𝐅𝐞𝐞𝐝𝐛𝐚𝐜𝐤
The actual PV voltage is continuously measured.
It is compared with the ANFIS reference voltage.
𝐏𝐈 𝐂𝐨𝐧𝐭𝐫𝐨𝐥
The difference between the desired and measured PV voltage is processed through the PI controller.
Its output controls the converter duty ratio.
𝐏𝐖𝐌 𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐨𝐧
The duty-cycle command is passed to the PWM generator.
The resulting switching pulse drives the converter semiconductor switch.
𝐁𝐨𝐨𝐬𝐭 𝐂𝐨𝐧𝐯𝐞𝐫𝐭𝐞𝐫
The boost converter adjusts the electrical operating point of the PV panel so that maximum available power can be extracted.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐓𝐞𝐬𝐭 𝐂𝐚𝐬𝐞𝐬
Two major operating conditions are considered to evaluate the ANFIS MPPT controller.
Test Case 1
Changing solar irradiance with fixed load
Test Case 2
Changing load with fixed solar irradiance and temperature
These two cases evaluate whether the controller remains effective during environmental and electrical disturbances.
𝐓𝐞𝐬𝐭 𝐂𝐚𝐬𝐞 𝟏: 𝐕𝐚𝐫𝐢𝐚𝐛𝐥𝐞 𝐒𝐨𝐥𝐚𝐫 𝐈𝐫𝐫𝐚𝐝𝐢𝐚𝐧𝐜𝐞
For the first test, the load is maintained while solar irradiance is varied.
The irradiance sequence discussed in the simulation is:
Irradiance | Approx. Expected Maximum PV Power |
1000 W/m² | 250 W |
800 W/m² | 200 W |
600 W/m² | 150 W |
400 W/m² | Lower according to PV characteristic |
200 W/m² | Lower according to PV characteristic |
The irradiance is changed approximately every 0.2 s.
𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐞 𝐚𝐭 𝟏𝟎𝟎𝟎 𝐖/𝐦²
At an irradiance of 1000 W/m², the PV panel is expected to generate approximately 250 W around its maximum power point.
The simulation shows the ANFIS MPPT controller operating the PV panel close to this value.
The corresponding PV characteristic indicates approximately:
Maximum-power-point voltage: 30.7 V
Maximum power: 250.2 W
This confirms that the controller successfully identifies and maintains the required operating region.
𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐞 𝐚𝐭 𝟖𝟎𝟎 𝐖/𝐦²
When solar irradiance decreases from 1000 W/m² to 800 W/m², the available PV power also decreases.
The expected maximum power is approximately 199.9 W.
The simulation output settles close to 200 W, showing that the ANFIS MPPT controller responds to the irradiance reduction.
𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐞 𝐚𝐭 𝟔𝟎𝟎 𝐖/𝐦²
At 600 W/m², the expected PV maximum power is approximately 149.6 W.
The simulated PV power is maintained close to 150 W.
This indicates that the controller continues tracking the maximum power point when irradiance decreases further.
𝐃𝐮𝐭𝐲-𝐂𝐲𝐜𝐥𝐞 𝐕𝐚𝐫𝐢𝐚𝐭𝐢𝐨𝐧
The duty cycle does not remain constant when irradiance changes.
Instead, the PI and ANFIS controllers adjust it according to the required PV operating voltage.
This variation allows the boost converter to continuously reposition the PV operating point.
𝐓𝐞𝐬𝐭 𝐂𝐚𝐬𝐞 𝟐: 𝐒𝐮𝐝𝐝𝐞𝐧 𝐋𝐨𝐚𝐝 𝐕𝐚𝐫𝐢𝐚𝐭𝐢𝐨𝐧
The second test examines the performance of the controller when the load changes while solar conditions remain fixed.
The operating conditions are:
Parameter | Value |
Irradiance | 1000 W/m² |
Temperature | 25°C |
Expected maximum PV power | ≈250.2 W |
Initial load resistance | 20 Ω |
Additional load resistance | 30 Ω |
Further load resistance | 40 Ω |
First load-change instant | ≈0.3 s |
At these solar conditions, the PV system should continue operating near 250 W, even when the electrical load changes.
𝐋𝐨𝐚𝐝-𝐂𝐡𝐚𝐧𝐠𝐞 𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐞
Before the load variation:
PV power remains close to 250 W
The duty cycle is approximately 0.55
When an additional load is introduced:
A temporary disturbance appears.
The MPPT controller responds automatically.
The converter duty cycle changes.
PV power returns toward the maximum-power operating level.
The duty-cycle response changes approximately from the 0.55–0.58 region toward about 0.63 following the load disturbance.
This demonstrates that the ANFIS controller can adapt the converter command to changing load conditions.
𝐒𝐢𝐦𝐮𝐥𝐚𝐭𝐢𝐨𝐧 𝐑𝐞𝐬𝐮𝐥𝐭𝐬
The simulation demonstrates two important capabilities of the ANFIS MPPT controller.
Under Changing Irradiance
At 1000 W/m², approximately 250 W is extracted.
At 800 W/m², approximately 200 W is extracted.
At 600 W/m², approximately 150 W is extracted.
The duty cycle changes with irradiance.
The controller follows the corresponding maximum-power operating point.
Under Changing Load
Irradiance remains at 1000 W/m².
Temperature remains at 25°C.
The target PV maximum power remains approximately 250 W.
Load switching causes a temporary disturbance.
The controller modifies the duty cycle.
PV power returns close to its maximum-power value.
𝐑𝐞𝐬𝐮𝐥𝐭 𝐒𝐮𝐦𝐦𝐚𝐫𝐲
Test Condition | Controller Response |
Irradiance decreases | ANFIS updates the Vmp reference |
1000 W/m² | PV power ≈250 W |
800 W/m² | PV power ≈200 W |
600 W/m² | PV power ≈150 W |
Sudden load addition | Temporary power disturbance |
After load variation | MPPT restores operation near maximum power |
Converter duty ratio | Automatically adjusted |
ANFIS training | Very low reported training error |
𝐏𝐕 𝐈-𝐕 𝐚𝐧𝐝 𝐏-𝐕 𝐂𝐡𝐚𝐫𝐚𝐜𝐭𝐞𝐫𝐢𝐬𝐭𝐢𝐜𝐬
The PV panel characteristics are also analyzed at different irradiance levels.
The simulation considers irradiance conditions including:
1000 W/m²
800 W/m²
600 W/m²
400 W/m²
200 W/m²
Lower irradiance conditions
At a fixed temperature of 25°C, decreasing irradiance mainly reduces the available PV current and maximum power.
The P-V characteristic confirms that:
Higher irradiance produces higher maximum power.
Lower irradiance reduces the peak of the P-V curve.
The required operating point changes with environmental conditions.
ANFIS uses the irradiance and temperature inputs to estimate the appropriate maximum-power-point voltage for these changing operating conditions.
𝐊𝐞𝐲 𝐅𝐞𝐚𝐭𝐮𝐫𝐞𝐬
ANFIS-based solar MPPT control
Implemented completely in MATLAB/Simulink
Uses irradiance and temperature as ANFIS inputs
Generates maximum-power-point voltage reference
Uses 1000 samples for ANFIS training
Temperature training range from 15°C to 35°C
Irradiance training range from 0 to 1000 W/m²
Uses triangular membership functions
Uses hybrid learning
Includes 100 training iterations
Reported training error around 3.73 × 10⁻⁷
PI-controlled boost converter
PWM-based semiconductor switching
Tested under changing irradiance
Tested under sudden load variation
Includes I-V and P-V PV characteristics
Suitable for studying intelligent MPPT control
𝐀𝐝𝐯𝐚𝐧𝐭𝐚𝐠𝐞𝐬 𝐨𝐟 𝐀𝐍𝐅𝐈𝐒 𝐌𝐏𝐏𝐓
The ANFIS approach provides several useful characteristics for photovoltaic control.
𝐀𝐝𝐚𝐩𝐭𝐢𝐯𝐞 𝐁𝐞𝐡𝐚𝐯𝐢𝐨𝐫
ANFIS learns from the training dataset rather than depending only on a fixed mathematical decision rule.
𝐍𝐨𝐧𝐥𝐢𝐧𝐞𝐚𝐫 𝐌𝐚𝐩𝐩𝐢𝐧𝐠
Solar PV characteristics are nonlinear. ANFIS can represent the nonlinear relationship between:
Irradiance + Temperature → Maximum-Power-Point Voltage
𝐅𝐚𝐬𝐭 𝐑𝐞𝐟𝐞𝐫𝐞𝐧𝐜𝐞 𝐆𝐞𝐧𝐞𝐫𝐚𝐭𝐢𝐨𝐧
After training, the ANFIS controller can directly provide the required voltage reference from measured environmental inputs.
𝐑𝐞𝐬𝐩𝐨𝐧𝐬𝐞 𝐭𝐨 𝐈𝐫𝐫𝐚𝐝𝐢𝐚𝐧𝐜𝐞 𝐂𝐡𝐚𝐧𝐠𝐞
The simulation demonstrates appropriate power tracking for different solar irradiance levels.
𝐑𝐨𝐛𝐮𝐬𝐭𝐧𝐞𝐬𝐬 𝐭𝐨 𝐋𝐨𝐚𝐝 𝐂𝐡𝐚𝐧𝐠𝐞
The controller adjusts the converter duty cycle when the connected load changes and restores the desired PV operating condition.
𝐀𝐩𝐩𝐥𝐢𝐜𝐚𝐭𝐢𝐨𝐧𝐬
The ANFIS-based MPPT concept can be studied for applications such as:
Standalone solar PV systems
PV-fed DC loads
Solar battery charging systems
DC microgrids
Renewable-energy conversion systems
Solar-powered motor-drive systems
Intelligent DC–DC converter control
Solar pumping systems
Academic research on AI-based MPPT
Comparative studies of conventional and intelligent MPPT techniques
𝐖𝐡𝐚𝐭 𝐂𝐚𝐧 𝐁𝐞 𝐋𝐞𝐚𝐫𝐧𝐞𝐝 𝐟𝐫𝐨𝐦 𝐓𝐡𝐢𝐬 𝐌𝐀𝐓𝐋𝐀𝐁 𝐌𝐨𝐝𝐞𝐥?
This implementation is useful for understanding the complete development sequence of an intelligent MPPT controller.
Students, researchers, and engineers can learn how to:
Generate PV operating data in MATLAB
Prepare ANFIS training datasets
Select ANFIS inputs and outputs
Configure membership functions
Train an ANFIS model
Evaluate training performance
Export a trained fuzzy inference system
Integrate ANFIS with Simulink
Generate a maximum-power voltage reference
Design PI-based voltage control
Control a boost converter using PWM
Analyze PV I-V and P-V characteristics
Test MPPT under variable irradiance
Evaluate MPPT during sudden load changes
𝐂𝐨𝐧𝐜𝐥𝐮𝐬𝐢𝐨𝐧
The MATLAB implementation of ANFIS based MPPT for a solar PV system demonstrates how neuro-fuzzy intelligence can be integrated with a DC–DC boost converter for maximum power extraction.
The ANFIS model is trained using irradiance and temperature as inputs and maximum-power-point voltage as the output. With 1000 training samples and hybrid learning, the trained system achieves a very small reported error.
Simulation under variable irradiance shows approximately:
250 W at 1000 W/m²
200 W at 800 W/m²
150 W at 600 W/m²
The second test shows that when the load changes suddenly, the converter duty cycle automatically changes and the PV power returns close to its maximum-power operating point.
Overall, the simulation provides a clear demonstration of ANFIS-based intelligent MPPT, PV modeling, boost converter control, PI regulation, and PWM implementation in MATLAB/Simulink.



Comments