From d3748a6ff30d7de5f41133f4a04f5cd1a19a3bf7 Mon Sep 17 00:00:00 2001 From: "dmy@lab" Date: Fri, 3 Apr 2015 21:47:26 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=88=A0=E9=99=A4680=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E6=B2=A1=E8=B4=9F=E8=8D=B7=E7=9A=84=E8=8A=82=E7=82=B9=E3=80=82?= =?UTF-8?q?=202.=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=B8=AA50%=E9=87=8F=E6=B5=8B?= =?UTF-8?q?=E6=9D=83=E9=87=8D=E7=BD=AE0=E7=9A=84bug=E3=80=82=203.=E4=B8=8D?= =?UTF-8?q?=E8=80=83=E8=99=91=E7=94=B5=E5=8E=8B=E7=BA=A6=E6=9D=9F=204.?= =?UTF-8?q?=E6=81=A2=E5=A4=8D20%=E7=9A=84=E8=BE=B9=E7=95=8C=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: dmy@lab --- FormG.m | 2 +- FormLw.m | 6 +++--- FormLz.m | 6 +++--- OPF.m | 25 +++++++++++++++++-------- feeder13/data1.txt | 7 ++++--- func_deltG.m | 6 +++--- test.m | 2 +- 7 files changed, 32 insertions(+), 22 deletions(-) diff --git a/FormG.m b/FormG.m index 0ce089a..d24743a 100644 --- a/FormG.m +++ b/FormG.m @@ -3,6 +3,6 @@ function Mat_G=FormG(Volt,PD,QD,Loadi) Mat_G=[ sparse(PD); sparse(QD); - Volt; +% Volt; ]; end \ No newline at end of file diff --git a/FormLw.m b/FormLw.m index c6dd38e..644ef75 100644 --- a/FormLw.m +++ b/FormLw.m @@ -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; % PDU=1.8*ones(length(Loadi),1); % QDU=1.8*ones(length(Loadi),1); -PDU=1.05*mPD3P; -QDU=1.05*mQD3P; +PDU=1.20*mPD3P; +QDU=1.20*mQD3P; % t1=([PDU',QDU',1*ones(length(Volt),1)'])'; -t1=([PDU',QDU',1.1*mVoltABCV'])'; +t1=([PDU',QDU'])'; t2=Mat_G+Init_U'-t1; Lw=t2; diff --git a/FormLz.m b/FormLz.m index 19d19a3..f7f6b79 100644 --- a/FormLz.m +++ b/FormLz.m @@ -23,10 +23,10 @@ function Lz=FormLz(Mat_G,Init_L,Loadi,mPD3P,mQD3P,mVoltABCV) % QDL=0*PD(Loadi).*sqrt((1-PF.^2))./PF; % PDL=0*ones(length(Loadi),1); % QDL=0*ones(length(Loadi),1); -PDL=0.95*mPD3P; -QDL=0.95*mQD3P; +PDL=0.8*mPD3P; +QDL=0.8*mQD3P; % t1=([PDL',QDL',0.88*ones(length(Volt),1)'])'; -t1=([PDL',QDL',0.9*mVoltABCV'])'; +t1=([PDL',QDL'])'; t2=Mat_G-Init_L'-t1; Lz=t2; diff --git a/OPF.m b/OPF.m index 17c8fc6..a29d989 100644 --- a/OPF.m +++ b/OPF.m @@ -225,15 +225,16 @@ wQD=1./(abs(mQD3P*sigma).^2); %% 没有量测量 noLoadi=[1,5,6,10,11]; -noLoadi=Loadi; +% noLoadi=Loadi; % noLoadi=[1,11]; % noLoadi=[]; noPQi3P=zeros(length(noLoadi)*3,1); noPQi3P(1:3:end)=(noLoadi-1)*3+1; noPQi3P(2:3:end)=(noLoadi-1)*3+2; noPQi3P(3:3:end)=(noLoadi-1)*3+3; -% noLoadi=noPQi3P; -wVolt( ismember( Loadi,noLoadi) )=0; +noLoadi=noPQi3P; +wVolt(setdiff(1:length(wVolt),Loadi))=0;%只有负荷处才有电压量测。 +wVolt( noLoadi)=0; wPD(ismember( Loadi,noLoadi))=0; wQD(ismember( Loadi,noLoadi))=0; @@ -242,8 +243,8 @@ wQD(ismember( Loadi,noLoadi))=0; % wPD(5)=0; % wQD(5)=0; %% -RestraintCount=size(Loadi,1)*2+length(rVoltABCV); %约束条件数 -% RestraintCount=size(Loadi,1)*2; %约束条件数 +% RestraintCount=size(Loadi,1)*2+length(rVoltABCV); %约束条件数 +RestraintCount=size(Loadi,1)*2; %约束条件数 Init_Z=sparse(ones(1,RestraintCount)); Init_W=sparse(-1*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'); KK=0; ContrlCount=size(Loadi,1)*2+Busnum*6; -kmax=2000; +kmax=500; %% Precision=1e-5; CenterA=0.1; %% 加误差 Volt=1*Vp3m; +Volt=mVoltABCV; UAngel=Vp3a; while(abs(Gap)>Precision) if KK>kmax @@ -290,8 +292,8 @@ while(abs(Gap)>Precision) Mat_G=FormG(Volt,PD3P,QD3P,Loadi); Mat_H=FormH(Busnum,Volt,PG3P,PD3P,QG3P,QD3P,Y,UAngel,r,c,Yangle,Loadi); Ly=Mat_H; - Lz=FormLz(Mat_G,Init_L,Loadi,rPD3P,rQD3P,rVoltABCV); - Lw=FormLw(Mat_G,Init_U,Loadi,rPD3P,rQD3P,rVoltABCV); + Lz=FormLz(Mat_G,Init_L,Loadi,mPD3P,mQD3P,rVoltABCV); + Lw=FormLw(Mat_G,Init_U,Loadi,mPD3P,mQD3P,rVoltABCV); Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W); % 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))); %返回收敛信息 isConverged=1; +if KK>=kmax + isConverged=0; +end +if abs(Gap)>Precision + isConverged=0; +end + fprintf('迭代次数%d\n',KK); toc end diff --git a/feeder13/data1.txt b/feeder13/data1.txt index 095beb0..0bb5f24 100644 --- a/feeder13/data1.txt +++ b/feeder13/data1.txt @@ -8,14 +8,15 @@ 602 684 652 800 601 632 671 2000 600 671 684 300 -602 671 680 1000 600 671 692 300 602 684 611 300 601 692 675 500 0 +652 20 20 0 +671 20 220 120 684 200 200 200 -671 200 320 320 -652 150 300 200 +675 120 220 220 +634 50 130 120 0 634 120 90 120 90 160 110 645 40 30 50 40 60 50 diff --git a/func_deltG.m b/func_deltG.m index 7ec19c5..23430f3 100644 --- a/func_deltG.m +++ b/func_deltG.m @@ -26,7 +26,7 @@ deltG=[dg3_dPD,dg4_dPD,dg5_dPD; dg3_dQD,dg4_dQD,dg5_dQD; dg3_dx,dg4_dx,dg5_dx; ]; -% deltG=[dg3_dPD,dg4_dPD; -% dg3_dQD,dg4_dQD; -% dg3_dx,dg4_dx;]; +deltG=[dg3_dPD,dg4_dPD; + dg3_dQD,dg4_dQD; + dg3_dx,dg4_dx;]; end \ No newline at end of file diff --git a/test.m b/test.m index ec2b662..8ecd4a3 100644 --- a/test.m +++ b/test.m @@ -9,7 +9,7 @@ AME_QDSum=0; AME_mVoltSum=0; AME_mPDSum=0; AME_mQDSum=0; -N=1000; +N=500; for I=1:N [JMeasurement,AME_Volt,AME_VAngle,AME_PD,AME_QD,AME_mVolt,AME_mPD,AME_mQD,isConverged]=OPF(); if isConverged==0