2012-05-22 11:33:21 +08:00
|
|
|
|
tic
|
|
|
|
|
|
clear
|
2012-05-25 17:16:59 +08:00
|
|
|
|
[kmax,Precision,UAngel,Volt,Busnum,PVi,PVu,Balance,Y,Angle,P0,Q0,r,c,GB,Linei,Linej,Transfori,Transforj,GenU,GenL,GenC,PG,QG,PD,QD,CenterA,PGi,PVQU,PVQL]=pf('ieee10471PG.dat');
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%PVi<56><69>ѹ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
%PVu<56><75>ѹ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>ѹ<EFBFBD><D1B9><EFBFBD><EFBFBD>ֵ
|
2012-05-24 10:07:18 +08:00
|
|
|
|
Volt;
|
|
|
|
|
|
UAngel*180/3.1415926;
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%% <20><>ֵ
|
2012-05-24 10:07:18 +08:00
|
|
|
|
PG0=PG;
|
|
|
|
|
|
PD0=PD;
|
2012-05-25 17:16:59 +08:00
|
|
|
|
[Volt,UAngel,Init_Z,Init_W,Init_L,Init_U,Init_Y,PG,QG,RestraintCount,wG,wD,PD,PD0,randPDind,Loadi]=OPF_Init(Busnum,Balance,PG,QG,Volt,GenU,GenL,PVi,PGi,PVQU,PVQL,PD0,QD);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
Gap=(Init_L*Init_Z'-Init_U*Init_W');
|
|
|
|
|
|
KK=0;
|
|
|
|
|
|
plotGap=zeros(1,50);
|
2012-05-25 17:16:59 +08:00
|
|
|
|
ContrlCount=size(PVi,1)+size(PGi,1)+size(Loadi,1)+Busnum*2;
|
2012-05-24 10:07:18 +08:00
|
|
|
|
kmax=600;
|
|
|
|
|
|
%% 20120523 <20><>ʱ
|
|
|
|
|
|
QD_NON_ZERO=QD(PD==0 & QD~=0);
|
|
|
|
|
|
QD_NON_ZERO_IND=find(PD==0 & QD~=0);
|
|
|
|
|
|
%%
|
2012-05-22 11:33:21 +08:00
|
|
|
|
while(abs(Gap)>Precision)
|
|
|
|
|
|
if KK>kmax
|
|
|
|
|
|
break;
|
|
|
|
|
|
end
|
|
|
|
|
|
plotGap(KK+1)=Gap;
|
|
|
|
|
|
Init_u=Gap/2/RestraintCount*CenterA;
|
2012-05-25 15:38:31 +08:00
|
|
|
|
AngleIJMat=0;
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%% <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>OPF
|
|
|
|
|
|
%% <20>γɵ<CEB3>ʽԼ<CABD><D4BC><EFBFBD><EFBFBD><EFBFBD>ſ˱<C5BF>
|
2012-05-25 17:16:59 +08:00
|
|
|
|
deltH=func_deltH(Busnum,Volt,PVi,Y,PGi,UAngel,r,c,Angle,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%% <20>γɲ<CEB3><C9B2><EFBFBD>ʽԼ<CABD><D4BC><EFBFBD><EFBFBD><EFBFBD>ſ˱<C5BF>
|
2012-05-25 17:16:59 +08:00
|
|
|
|
deltG=func_deltG(Busnum,PVi,PGi,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%%
|
|
|
|
|
|
L_1Z=diag(Init_Z./Init_L);
|
|
|
|
|
|
U_1W=diag(Init_W./Init_U);
|
|
|
|
|
|
%% <20>γɺ<CEB3>ɭ<EFBFBD><C9AD>
|
2012-05-25 17:16:59 +08:00
|
|
|
|
deltdeltF=func_deltdeltF(Busnum,PVi,PGi,wG,wD,ContrlCount);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%% <20>γ<EFBFBD>ddHy
|
2012-05-25 17:16:59 +08:00
|
|
|
|
ddh=func_ddh3(AngleIJMat,GB,Volt,Init_Y,Busnum,PVi,PGi,Y,UAngel,r,c,Angle,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%% <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>ddg
|
2012-05-25 17:16:59 +08:00
|
|
|
|
ddg=func_ddg(PGi,PVi,Busnum,RestraintCount,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%% <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>deltF
|
2012-05-25 17:16:59 +08:00
|
|
|
|
deltF=func_deltF(PG,PVi,GenC,ContrlCount,PGi,wG,wD,PG0,PD0,PD,Busnum,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
|
|
|
|
|
|
%% <20>γɷ<CEB3><C9B7>̾<EFBFBD><CCBE><EFBFBD>
|
|
|
|
|
|
Luu=Init_U'.*Init_W'+Init_u*ones(RestraintCount,1);
|
|
|
|
|
|
Lul=Init_L'.*Init_Z'-Init_u*ones(RestraintCount,1);
|
2012-05-25 17:16:59 +08:00
|
|
|
|
Mat_G=FormG(Volt,PVi,PGi,PG,QG,PD,Loadi);
|
2012-05-25 15:38:31 +08:00
|
|
|
|
Mat_H=FormH(Busnum,GB,AngleIJMat,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,QD_NON_ZERO,QD_NON_ZERO_IND);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
Ly=Mat_H;
|
2012-05-25 17:16:59 +08:00
|
|
|
|
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD0,randPDind,Loadi);
|
|
|
|
|
|
Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD0,randPDind,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W);
|
|
|
|
|
|
YY=FormYY1(Lul,Lz,Ly,Luu,Lw,Lx);
|
|
|
|
|
|
%% <20><>ʼ<EFBFBD>ⷽ<EFBFBD><E2B7BD>
|
2012-05-25 17:16:59 +08:00
|
|
|
|
XX=SolveIt(deltF,deltG,Init_L,Init_Z,Init_U,Init_W,deltdeltF,ddh,ddg,deltH,Init_Y,Ly,Lz,ContrlCount,Lw,Lul,Luu,RestraintCount,Lx,Balance,PVi,PGi,Busnum,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
%%ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
[deltZ,deltL,deltW,deltU,deltX,deltY]=AssignXX1(XX,ContrlCount,RestraintCount,Busnum);
|
2012-05-25 17:16:59 +08:00
|
|
|
|
[Init_Z,Init_L,Init_W,Init_U,Init_Y,PG,QG,Volt,UAngel,PD]=Modification(Init_Z,Init_L,Init_W,Init_U,Init_Y,deltZ,deltL,deltW,deltU,deltX,deltY,PG,QG,Volt,UAngel,PVi,ContrlCount,Balance,Busnum,PGi,PD,Loadi);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
Gap=(Init_L*Init_Z'-Init_U*Init_W');
|
|
|
|
|
|
KK=KK+1;
|
|
|
|
|
|
end
|
|
|
|
|
|
fprintf('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>%d\n',KK);
|
2012-05-25 17:16:59 +08:00
|
|
|
|
ObjectiveFun(PG,PG0,PGi,PD,PD0,wG,wD,Loadi)
|
2012-05-22 11:33:21 +08:00
|
|
|
|
DrawGap(plotGap);
|
2012-05-25 17:16:59 +08:00
|
|
|
|
%%
|
|
|
|
|
|
Volt=full(Volt');
|
|
|
|
|
|
PD=full(PD);
|
2012-05-22 11:33:21 +08:00
|
|
|
|
toc
|
|
|
|
|
|
|