Perturb and Observe MPPT algorithm only outputs maximum possible duty cycle
Show older comments
I am trying to simulate a Perturb and Observe MPPT algorithm in simulink for an PV array.
However I am maxing up the PWM duty cycle to maximum possible value of duty cycle (i.e. 85%). If I manually set the duty cycle using pulse generator I get maximum power between 30% to 35% but in my simulation it does directly to 85%.
In C/C++ we can debug (Step Over/Into) the program using GDB. Kindly advice how I can debug this issue.
Code
function [duty_cycle, dp_pv, dv_pv] = fcn(v_pv, i_pv, delta)
duty_cycle_max = 0.85;
duty_cycle_min = 0.0;
persistent p_pv_n
if isempty(p_pv_n)
p_pv_n = 0.0;
end
persistent v_pv_n
if isempty(v_pv_n)
v_pv_n = 0.0;
end
persistent duty_cycle_old
if isempty(duty_cycle_old)
duty_cycle_old = 0.0;
end
duty_cycle = 0.0;
p_pv = v_pv * i_pv;
dp_pv = p_pv - p_pv_n;
dv_pv = v_pv - v_pv_n;
if(dp_pv == 0)
return;
end
if(dp_pv > 0)
if(dv_pv > 0)
duty_cycle = duty_cycle_old + delta;
else
duty_cycle = duty_cycle_old - delta;
end
else
if(dv_pv > 0)
duty_cycle = duty_cycle_old - delta;
else
duty_cycle = duty_cycle_old + delta;
end
end
if(duty_cycle > duty_cycle_max)
duty_cycle = duty_cycle_max;
elseif (duty_cycle < duty_cycle_min)
duty_cycle = duty_cycle_min;
end
v_pv_n = v_pv;
p_pv_n = p_pv;
duty_cycle_old = duty_cycle;
end
Accepted Answer
More Answers (0)
Categories
Find more on Thermal Liquid Library in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!