Duty Cycle Capping At .7, Power Output inaccurate

26 views (last 30 days)
Micaela
Micaela on 5 Feb 2025
Edited: MULI on 12 Feb 2025
This is our code, we are making an MPPT algorithm, Perturb and Oberseve with a variable step size. The issue is we are having the duty cycle start at .5 and when we use the delta =(N * abs(dp)) it jumps around a lot and creates varied power, so we tried to add the if statement that is commented and for some reason even when we make sure p does not equal between 29 and 30 it still chooses the fixed step of .035. We notice that when it is using the delta =(N * abs(dp)) the duty cycle slowly increases until it hits .7 then it begins jumping. The graph is using the variable step, yellow is the mppt power.
function [duty, delta, dp,dv]= P_O(vpv,ipv)
duty_init = 0.5;
duty_min = 0.1;
duty_max = 0.95;
N = 0.00016;
%N=.005;
persistent Vold Pold Iold duty_old;
if isempty(Vold)
Vold = 0;
Pold = 0;
Iold = 0;
duty_old = duty_init;
end
p = vpv * ipv;
dv = vpv - Vold;
di = ipv - Iold;
dp = p - Pold;
delta =(N * abs(dp));
%{
if p >= 29 || p<=30
delta = 0.035;
else
delta =(N * abs(dp));
end
%}
if dp < 0
if dv < 0
duty = duty_old - delta;
else
duty = duty_old + delta;
end
else
if dv < 0
duty = duty_old + delta;
else
duty = duty_old - delta;
end
end
if duty >= duty_max || duty <= duty_min
duty = duty_old;
end
duty_old =duty;
Vold = vpv;
Iold = ipv;
Pold = p;
end

Answers (1)

MULI
MULI on 12 Feb 2025
Edited: MULI on 12 Feb 2025
I have noticed that your MPPT algorithm using the Perturb and Observe (P&O) method with a variable step size is experiencing power tracking instability due to the following issues:
Incorrect Fixed Step Condition
  • The condition which you have mentioned "(p >= 29 || p <= 30)" is always true, causing the algorithm to frequently apply the fixed step size (0.035), leading to inconsistent MPPT performance.
  • To fix this you can modify the condition to ensure the fixed step size is applied only when power is between 29 and 30.
if p >= 29 && p <= 30 % Use "&&" instead of "||"
Duty Cycle Instability at 0.7
  • When using "delta = (N * abs(dp))", the duty cycle gradually increases until 0.7, then starts fluctuating unpredictably, disrupting stable power tracking.
  • To fix this you can implement adaptive step size scaling to reduce step size as the duty cycle approaches "duty_max"
scale_factor = 1 - (duty_old / duty_max);
delta = (N * abs(dp)) * scale_factor;
Duty Cycle Freezing at Limits
  • The condition "(duty >= duty_max || duty <= duty_min)" prevents the duty cycle from updating, which can stall the MPPT algorithm.
  • Instead of freezing duty adjustments at the limits you can allow small corrective steps.
if duty > duty_max
duty = duty_max - 0.001;
elseif duty < duty_min
duty = duty_min + 0.001;
end
For an optimized approach, you can refer to this MATLAB File Exchange implementation of an "Enhanced Variable Step P&O MPPT Algorithm" for solar panel systems:

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!