微信网页制作网站,站长聚集地,易营宝自助建站系统,建筑公司企业简介范文目录 一、背景
二、源程序及结果
2.1 simulink仿真程序
2.2 GA模块源程序
2.3 PSO模块源程序
三、程序运行结果
3.1 基于GA优化的MPPT
3.2 基于PSO优化的MPPT 一、背景
MPPT策略能够显著提高光伏、风电等发电效率#xff0c;节省大量成本。该策略的经典算法是#xf…目录 一、背景
二、源程序及结果
2.1 simulink仿真程序
2.2 GA模块源程序
2.3 PSO模块源程序
三、程序运行结果
3.1 基于GA优化的MPPT
3.2 基于PSO优化的MPPT 一、背景
MPPT策略能够显著提高光伏、风电等发电效率节省大量成本。该策略的经典算法是采用遗传算法GA和粒子群优化算法PSO进行MPPT控制器中调节器占空比的实时寻优。
只有将这两种经典算法吃明白了才算入了门可以在后续MPPT策略改进中游刃有余答辩时也能信手拈来。
GA和PSO策略不多赘述核心在于此时在线优化而非离线优化。即以实时局部最优策略进行MPPT控制。建议大家吃透源程序
二、源程序及结果
在线优化有源程序基于遗传算法GA和粒子群优化PSO算法的MPPT控制策略资源-CSDN文库
2.1 simulink仿真程序 2.2 GA模块源程序
function D GSA(Vpv,Ipv)
coder.extrinsic(randi)
persistent u;
persistent dcurrent;%store current duty cycle
persistent pbest;%store local best dc for power
persistent force; %store force
persistent acceleration; %store acceleration
persistent mass; % mass
persistent q; % strength of mass
persistent p; % power for each particle
persistent p_current; % power current for each particle
persistent p_min; % power min for each particle
persistent worse; %store best worse of each particle
persistent dc; %store duty cycle ~ position
persistent v; %velocity
persistent counter; %delay iteration
persistent iteration;
persistent gbest;%store global best dc for power
%initializationmax_iter 3000;
if(isempty(counter))counter 0;dcurrent 0.5; gbest 0.5;pbest zeros(3,1);worse zeros(3,1);v zeros (3,1);force zeros(3,1);mass zeros(3,1);q zeros(3,1);p zeros(3,1);p_current zeros(3,1);p_minzeros(3,1);accelerationzeros(3,1);u 0;dc zeros (3,1); iteration 1;%initialize position for each particledc(1)0.69;dc(2) 0.7;dc(3)0.8;endif(counter 1 counter 3000)Ddcurrent;counter counter1;return;
endif(u1 u3)p_current(u) Vpv*Ipv;if((Vpv*Ipv)p(u))p(u) Vpv*Ipv;pbest(u)dcurrent;endif(Vpv*Ipv p_min(u))p_min(u) Vpv*Ipv;worse(u) dcurrent;end
end
uu1;
if(u5)u1;
end
if(u 1 u 3)%Avoid over shootingif(iteration max_iter)Ddc(u);dcurrentD;counter1;return;elseD dcurrent;returnend
elseif(u4)iteration iteration 1;[~,i]max(p);gbestpbest(i);Dgbest;dcurrentD;counter1;%Calculate strength of massfor i 1:3q(i) (p_current(i) - worse(i))/(pbest(i)-worse(i));end%Calculate sum of strength of masssum_strength_of_mass q(1) q(2) q(3);%Calculate mass for i 1:3mass(i) q(i)/sum_strength_of_mass;end%Calculate forcealpha 200;G0 1;G G0 * exp(-alpha*iteration/max_iter);%G 6.67430 * 10^-13; %gravitational constante 2.2204*10^-16;force(1) rand()*G*(mass(3)*mass(1)*(dc(3)-dc(1))/(Euclidian_distance(dc(3),dc(1))e) mass(2)*mass(1)*(dc(3)-dc(1))/(Euclidian_distance(dc(3),dc(1))e));force(2) rand()*G*(mass(3)*mass(2)*(dc(3)-dc(2))/(Euclidian_distance(dc(3),dc(2))e) mass(1)*mass(2)*(dc(1)-dc(2))/(Euclidian_distance(dc(1),dc(2))e));force(3) rand()*G*(mass(2)*mass(3)*(dc(2)-dc(3))/(Euclidian_distance(dc(2),dc(3))e) mass(1)*mass(3)*(dc(1)-dc(3))/(Euclidian_distance(dc(1),dc(3))e));%Avoid over shootingif(iteration max_iter)Ddcurrent;return;end%Calculate acceleration for i 1:3acceleration(i) force(i)/mass(i);endfor i1:3v(i)updatevelocity(v(i),acceleration(i));dc(i)updateduty(dc(i),v(i));end return;elseD0.5;
end
endfunction d Euclidian_distance(d1,d2)d sqrt(d1^2d2^2);
endfunction vfinalupdatevelocity(velocity,acceleration)vfinal rand()*velocity acceleration;
endfunction dfinalupdateduty(d,velocity)
dupdvelocity;
if(dup1)dfinal1;
elseif(dup0.1)dfinal0.1;
elsedfinaldup;
end
end
2.3 PSO模块源程序
function D PSO(Vpv, Ipv)coder.extrinsic(randi)persistent localbest globalbest k p dc Pbest Pprev dcurrent u v temp;c1 1;c2 2;P Ipv * Vpv;if isempty(globalbest)k 0;dc zeros(3,1);dc(1)randi( [5 330])/1000;dc(2)randi( [330 660])/1000;dc(3)randi( [660 995])/1000;p zeros(3,1);localbest zeros(3,1);v zeros(3,1);Pbest Ipv * Vpv;Pprev 0;dcurrent 0.5;globalbest dcurrent;u0;temp 0;endDdcurrent;if (temp 0)temp temp 1;return;endif (P Pbest)Pbest P; endif (k 3000)kk1;return;elsek0;endif abs(P - Pprev) 1if abs(P - Pbest) 15dc(1)randi( [5 330])/1000;dc(2)randi( [330 660])/1000;dc(3)randi( [660 995])/1000;v zeros(3,1);localbest zeros(3,1);p zeros(3,1);u 0;endendif(u1 u3)if(Pp(u))p(u)P;localbest(u)dcurrent;endenduu1;if (u 4)u1;endif (u 4)[~,idx]max(p);globalbestlocalbest(idx);D globalbest;dcurrentD;for j1:3v(j)updatevelocity(c1,c2,v(j),localbest(j),dc(j),globalbest);dc(j)updateduty(dc(j),v(j));endelseDdc(u);dcurrentdc(u);Pprev P;endendfunction vfinalupdatevelocity(c1,c2,velocity,pobest,d,gwbest)% PSO Parametersvfinal (0.1*velocity)(c1*rand(1)*(pobest-d))(c2*rand(1)*(gwbest-d));
endfunction dfinalupdateduty(d,velocity)dupdvelocity;if(dup1)dfinal1;elseif(dup0)dfinalabs(dup);elsedfinaldup;end
end
三、程序运行结果
3.1 基于GA优化的MPPT 3.2 基于PSO优化的MPPT 四、源程序获取
上述章节已经给出了框图和源码但一定要喂到嘴里下载即可
在线优化有源程序基于遗传算法GA和粒子群优化PSO算法的MPPT控制策略资源-CSDN文库