PSO for MPPT not fully converging although after several time achieving the desired value
2 views (last 30 days)
Show older comments
So, my problem is the PSO is not converging on time and repeating, (my supervisor advice me to add another set of condition for example stoping the tracking of MPP when the particle found the maximum power desired), but my code are able to converge but it needs more time and it keeps on finding the maximum value although the particle have found it multiple times, i have no idea on what condition do i need to set. there are several advice in mathworks that suggest that I should adjust the parameters of the PSO. Any suggestion would be helpful. THANK YOU IN ADVANCE.
So this is the screenshot of the result, the green line is the targeted value
Below is my PSO code:
% ======================== Initialization Stage ===========================
if ( isempty(Ppv) )
rng('shuffle');
Ppvold= 0; Gbest= 0; idx= 0;
i= 1; j= 1; k=1; ub=0.82; lb=0.52; dim=1; Loop= 1; Iter= 1; Iter_Max=10; flag= 0; % c= 0.4; ub=1; lb=0; ub=0.82; lb=0.52;
Ts= 0.1; Pop_Size= 5; Wmax=0.7; Wmin=0.01; W= Wmax; c1=1.49; c2=1.49;Tolerance=0.01;
Parent_X= zeros(Pop_Size,dim); Parent_fit= zeros(Pop_Size,dim); % Initialize Array
Offspring_X= zeros(Pop_Size,dim); Offspring_fit= zeros(Pop_Size,dim); % Initialize Array
X= rand(Pop_Size,1).*(ub-lb)+lb; % Initialize particles (Randomize)
Xold= X; Pbest= X; Vmax= (ub-lb).*0.2;Vmin= -Vmax;
Vel= Vmin+(Vmax-Vmin).*rand(Pop_Size,1).*0.2;% Initialize velocity
end
so this reproduction part is where i usually change the inertia weight method
% =========================== REPRODUCTION ============================
if (i==Pop_Size+1)
[Pmpp, idx]= max(Parent_fit);
Gbest = Parent_X(idx(1),1); % Determine Gbest
Pbest= Parent_X; % Determine Pbest
W= Wmax-Iter.*((Wmax-Wmin)/Iter_Max); W = max(W,Wmin);
for k=1:size(X,1)
Vel(k)=W.*(Vel(k))+c1.*rand.*(Pbest(k)-Xold(k))+c2.*rand.*(Gbest-Xold(k)); % Update Velocity
Vel(k)= max(Vel(k),Vmin); % Checking Velocity's Lower Limit
Vel(k)= min(Vel(k),Vmax); % Checking Velocity's Upper Limit
X(k)= Xold(k) + Vel(k); % Update Particle's Position
end
1 Comment
Umang Pandey
on 19 Aug 2024
Hi Nornaim,
You can refer to the following MATLAB file exchange submission to understand the theory and implementation of PSO in MATLAB with the help of provided videos and functions :
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!