✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。
个人主页:Matlab科研工作室
个人信条:格物致知。
更多Matlab仿真内容点击
智能优化算法 神经网络预测 雷达通信 无线传感器
信号处理 图像处理 路径规划 元胞自动机 无人机
粒子群优化算法是一种新兴的群体智能优化技术,适用于目前科学领域、工程领域和经济领域中很多复杂的、非线性的甚至非凸形式的最优化问题。本文介绍了PSO算法的基本原理及其在负荷经济分配、无功优化、最优潮流计算等方面的应用。
%% Calculation of Power System
clc
clear
close all
%% NR load flow analysis
nbus = 30;
busdata = busdatas(nbus);
linedata = linedatas(nbus);
resultWithoutDG = nrloadflow(nbus,busdata,linedata);
dim = 10;
Pmin=3; %minimum power of solar DG unit
if nbus==30
Pmax=30; %maximum power of solar DG unit in MW
else
Pmax=100;
end
%% potential bus selection
R=linedata(:,3);
sourcbus=linedata(:,1);
destintnbus=linedata(:,2);
% del=180/pi*del;
for ii=1:size(linedata,1)
alpha(ii)=(R(ii)/(abs(resultWithoutDG.V(sourcbus(ii)))...
*abs(resultWithoutDG.V(sourcbus(ii)))))...
*cos(resultWithoutDG.del(sourcbus(ii))...
-resultWithoutDG.del(destintnbus(ii)));
beta(ii)=(R(ii)/(abs(resultWithoutDG.V(sourcbus(ii)))...
*abs(resultWithoutDG.V(sourcbus(ii)))))...
*sin(resultWithoutDG.del(sourcbus(ii))...
-resultWithoutDG.del(destintnbus(ii)));
SV(ii)=alpha(ii).*resultWithoutDG.Pi(destintnbus(ii))...
-beta(ii).*resultWithoutDG.Qi(destintnbus(ii));
end
[sv,ind]=sort(SV,'descend');
po=destintnbus(ind);
[poo,ia,ic]=unique(po);
temp=po(sort(ia));
loadBusLocation = temp(1:dim);
%% GA optimisation
fitness= @(x) objf(x,loadBusLocation,resultWithoutDG,nbus);
options = gaoptimset('MutationFcn',@mutationadaptfeasible,'PopulationSize',20);
options = gaoptimset(options,'PlotFcns',{@gaplotbestf}, ...
'Display','iter','Generations',80);
[GAx,fval] = ga(fitness,dim,[],[],[],[],Pmin.*ones(1,dim)...
,Pmax.*ones(1,dim),[],options);
finalGAresults= resultcalc(GAx,loadBusLocation,resultWithoutDG,nbus);
%% PSO optimisation
[PSOx,objval]=PSO(loadBusLocation,resultWithoutDG,nbus,dim,Pmax,Pmin);
finalPSOresults= resultcalc(PSOx',loadBusLocation,resultWithoutDG,nbus);
FIG1 = figure('Name', 'PSO Optimization','NumberTitle','off');
figure(FIG1)
plot(1./objval)
grid on;
ylabel('VL (pu)');
xlabel('time (sec)');
title('PSO optimisation')
%% Result plotting
% volatge magnitude plot
FIG2 = figure('Name', 'BUS VOLTAGE','NumberTitle','off');
figure(FIG2)
bar([finalPSOresults.V,finalGAresults.V,resultWithoutDG.V],'group')
xlim([0 nbus+1])
ylim([0.95,1.1])
grid on;
legend('PSO optimised','GA optimised','Without DG')
xlabel('Bus number')
ylabel('Volatge Magnitude in p.u.')
title('Bus Voltage')
% power loss comparison
FIG3 = figure('Name', 'Total Active Power loss','NumberTitle','off');
figure(FIG3)
bar([sum(finalPSOresults.Lpij);sum(finalGAresults.Lpij);sum(resultWithoutDG.Lpij)])
grid on;
title('Total Active Power loss in MW')
ylabel('Active Power loss(MW)')
set(gca,'Xtick',0)
text(0.8,-0.2,'PSO tuned')
text(1.8,-0.2,'GA tuned')
text(2.8,-0.2,'Without Optimisation')
% printresult
[1]林小朗, 王磊. 改进粒子群优化算法的电力系统最优潮流计算[J]. 广东电力, 2007, 20(3):5.
[2]郭羚, 黄鹏. 粒子群优化算法及其在电力系统中的应用[J]. 科学咨询, 2010.
❤️ 关注我领取海量matlab电子书和数学建模资料
❤️部分理论引用网络文献,若有侵权联系博主删除