how can i interconnect pso code to mppt code
1 view (last 30 days)
Show older comments
function duty = MPPT_algorithm(vpv,ipv,delta)
%MPPT CODE
duty_init = 0.1;
%min and max value are used to limit duty between 0 & 0.85
duty_min=0;
duty_max=0.85;
persistent Vold Pold duty_old;
%persistent variable type can be stored the data
%we need the old data by obtain difference between old and new value
if isempty(Vold)
Vold = 0;
Pold = 0;
duty_old = duty_init;
end
P=vpv*ipv;%power
dV = vpv - Vold;%difference between old and new voltage
dP = P - Pold;%difference between old and new power
%the algorithm is below search the dP/dV=0
%if the derivative=0,duty will not change
%if old and new power not equal & pv voltage bigger than 30v
%the algorithm will works
if dP ~= 0 && vpv>30
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
else
duty = duty_old;
end
%the below if limits the duty between min and max
if duty >= duty_max
duty = duty_max;
elseif duty<duty_min
duty = duty_min;
end
% stored data
duty_old = duty;
Vold = vpv;
Pold = P;
0 Comments
Answers (0)
See Also
Categories
Find more on Particle Swarm in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!