1.删除680这个没负荷的节点。

2.修复一个50%量测权重置0的bug。
3.不考虑电压约束
4.恢复20%的边界设置。

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab 2015-04-03 21:47:26 +08:00
parent 315f3509d3
commit d3748a6ff3
7 changed files with 32 additions and 22 deletions

View File

@ -3,6 +3,6 @@ function Mat_G=FormG(Volt,PD,QD,Loadi)
Mat_G=[ Mat_G=[
sparse(PD); sparse(PD);
sparse(QD); sparse(QD);
Volt; % Volt;
]; ];
end end

View File

@ -26,10 +26,10 @@ function Lw=FormLw(Mat_G,Init_U,Loadi,mPD3P,mQD3P,mVoltABCV)
% QDU=1.0*PD(Loadi).*sqrt(1 -PF.^2)./PF; % QDU=1.0*PD(Loadi).*sqrt(1 -PF.^2)./PF;
% PDU=1.8*ones(length(Loadi),1); % PDU=1.8*ones(length(Loadi),1);
% QDU=1.8*ones(length(Loadi),1); % QDU=1.8*ones(length(Loadi),1);
PDU=1.05*mPD3P; PDU=1.20*mPD3P;
QDU=1.05*mQD3P; QDU=1.20*mQD3P;
% t1=([PDU',QDU',1*ones(length(Volt),1)'])'; % t1=([PDU',QDU',1*ones(length(Volt),1)'])';
t1=([PDU',QDU',1.1*mVoltABCV'])'; t1=([PDU',QDU'])';
t2=Mat_G+Init_U'-t1; t2=Mat_G+Init_U'-t1;
Lw=t2; Lw=t2;

View File

@ -23,10 +23,10 @@ function Lz=FormLz(Mat_G,Init_L,Loadi,mPD3P,mQD3P,mVoltABCV)
% QDL=0*PD(Loadi).*sqrt((1-PF.^2))./PF; % QDL=0*PD(Loadi).*sqrt((1-PF.^2))./PF;
% PDL=0*ones(length(Loadi),1); % PDL=0*ones(length(Loadi),1);
% QDL=0*ones(length(Loadi),1); % QDL=0*ones(length(Loadi),1);
PDL=0.95*mPD3P; PDL=0.8*mPD3P;
QDL=0.95*mQD3P; QDL=0.8*mQD3P;
% t1=([PDL',QDL',0.88*ones(length(Volt),1)'])'; % t1=([PDL',QDL',0.88*ones(length(Volt),1)'])';
t1=([PDL',QDL',0.9*mVoltABCV'])'; t1=([PDL',QDL'])';
t2=Mat_G-Init_L'-t1; t2=Mat_G-Init_L'-t1;
Lz=t2; Lz=t2;

25
OPF.m
View File

@ -225,15 +225,16 @@ wQD=1./(abs(mQD3P*sigma).^2);
%% %%
noLoadi=[1,5,6,10,11]; noLoadi=[1,5,6,10,11];
noLoadi=Loadi; % noLoadi=Loadi;
% noLoadi=[1,11]; % noLoadi=[1,11];
% noLoadi=[]; % noLoadi=[];
noPQi3P=zeros(length(noLoadi)*3,1); noPQi3P=zeros(length(noLoadi)*3,1);
noPQi3P(1:3:end)=(noLoadi-1)*3+1; noPQi3P(1:3:end)=(noLoadi-1)*3+1;
noPQi3P(2:3:end)=(noLoadi-1)*3+2; noPQi3P(2:3:end)=(noLoadi-1)*3+2;
noPQi3P(3:3:end)=(noLoadi-1)*3+3; noPQi3P(3:3:end)=(noLoadi-1)*3+3;
% noLoadi=noPQi3P; noLoadi=noPQi3P;
wVolt( ismember( Loadi,noLoadi) )=0; wVolt(setdiff(1:length(wVolt),Loadi))=0;%
wVolt( noLoadi)=0;
wPD(ismember( Loadi,noLoadi))=0; wPD(ismember( Loadi,noLoadi))=0;
wQD(ismember( Loadi,noLoadi))=0; wQD(ismember( Loadi,noLoadi))=0;
@ -242,8 +243,8 @@ wQD(ismember( Loadi,noLoadi))=0;
% wPD(5)=0; % wPD(5)=0;
% wQD(5)=0; % wQD(5)=0;
%% %%
RestraintCount=size(Loadi,1)*2+length(rVoltABCV); % % RestraintCount=size(Loadi,1)*2+length(rVoltABCV); %
% RestraintCount=size(Loadi,1)*2; % RestraintCount=size(Loadi,1)*2; %
Init_Z=sparse(ones(1,RestraintCount)); Init_Z=sparse(ones(1,RestraintCount));
Init_W=sparse(-1*ones(1,RestraintCount)); Init_W=sparse(-1*ones(1,RestraintCount));
Init_L=1*sparse(ones(1,RestraintCount)); Init_L=1*sparse(ones(1,RestraintCount));
@ -252,12 +253,13 @@ Init_Y=sparse(1,2*Busnum*3);%
Gap=(Init_L*Init_Z'-Init_U*Init_W'); Gap=(Init_L*Init_Z'-Init_U*Init_W');
KK=0; KK=0;
ContrlCount=size(Loadi,1)*2+Busnum*6; ContrlCount=size(Loadi,1)*2+Busnum*6;
kmax=2000; kmax=500;
%% %%
Precision=1e-5; Precision=1e-5;
CenterA=0.1; CenterA=0.1;
%% %%
Volt=1*Vp3m; Volt=1*Vp3m;
Volt=mVoltABCV;
UAngel=Vp3a; UAngel=Vp3a;
while(abs(Gap)>Precision) while(abs(Gap)>Precision)
if KK>kmax if KK>kmax
@ -290,8 +292,8 @@ while(abs(Gap)>Precision)
Mat_G=FormG(Volt,PD3P,QD3P,Loadi); Mat_G=FormG(Volt,PD3P,QD3P,Loadi);
Mat_H=FormH(Busnum,Volt,PG3P,PD3P,QG3P,QD3P,Y,UAngel,r,c,Yangle,Loadi); Mat_H=FormH(Busnum,Volt,PG3P,PD3P,QG3P,QD3P,Y,UAngel,r,c,Yangle,Loadi);
Ly=Mat_H; Ly=Mat_H;
Lz=FormLz(Mat_G,Init_L,Loadi,rPD3P,rQD3P,rVoltABCV); Lz=FormLz(Mat_G,Init_L,Loadi,mPD3P,mQD3P,rVoltABCV);
Lw=FormLw(Mat_G,Init_U,Loadi,rPD3P,rQD3P,rVoltABCV); Lw=FormLw(Mat_G,Init_U,Loadi,mPD3P,mQD3P,rVoltABCV);
Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W); Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W);
% YY=FormYY(Lul,Lz,Ly,Luu,Lw,Lx); % YY=FormYY(Lul,Lz,Ly,Luu,Lw,Lx);
%% %%
@ -323,6 +325,13 @@ AME_mPD=sum(sum(abs(rPD3P-mPD3P)));
AME_mQD=sum(sum(abs(rQD3P-mQD3P))); AME_mQD=sum(sum(abs(rQD3P-mQD3P)));
% %
isConverged=1; isConverged=1;
if KK>=kmax
isConverged=0;
end
if abs(Gap)>Precision
isConverged=0;
end
fprintf('%d\n',KK); fprintf('%d\n',KK);
toc toc
end end

View File

@ -8,14 +8,15 @@
602 684 652 800 602 684 652 800
601 632 671 2000 601 632 671 2000
600 671 684 300 600 671 684 300
602 671 680 1000
600 671 692 300 600 671 692 300
602 684 611 300 602 684 611 300
601 692 675 500 601 692 675 500
0 0
652 20 20 0
671 20 220 120
684 200 200 200 684 200 200 200
671 200 320 320 675 120 220 220
652 150 300 200 634 50 130 120
0 0
634 120 90 120 90 160 110 634 120 90 120 90 160 110
645 40 30 50 40 60 50 645 40 30 50 40 60 50

View File

@ -26,7 +26,7 @@ deltG=[dg3_dPD,dg4_dPD,dg5_dPD;
dg3_dQD,dg4_dQD,dg5_dQD; dg3_dQD,dg4_dQD,dg5_dQD;
dg3_dx,dg4_dx,dg5_dx; dg3_dx,dg4_dx,dg5_dx;
]; ];
% deltG=[dg3_dPD,dg4_dPD; deltG=[dg3_dPD,dg4_dPD;
% dg3_dQD,dg4_dQD; dg3_dQD,dg4_dQD;
% dg3_dx,dg4_dx;]; dg3_dx,dg4_dx;];
end end

2
test.m
View File

@ -9,7 +9,7 @@ AME_QDSum=0;
AME_mVoltSum=0; AME_mVoltSum=0;
AME_mPDSum=0; AME_mPDSum=0;
AME_mQDSum=0; AME_mQDSum=0;
N=1000; N=500;
for I=1:N for I=1:N
[JMeasurement,AME_Volt,AME_VAngle,AME_PD,AME_QD,AME_mVolt,AME_mPD,AME_mQD,isConverged]=OPF(); [JMeasurement,AME_Volt,AME_VAngle,AME_PD,AME_QD,AME_mVolt,AME_mPD,AME_mQD,isConverged]=OPF();
if isConverged==0 if isConverged==0