收敛了的,而且是做好了的。准备加真实的tolerance
Signed-off-by: dugg@lab-desk <dugg@lab-desk>
This commit is contained in:
parent
1599e58150
commit
16db56fb26
2
FormG.m
2
FormG.m
|
|
@ -1,4 +1,4 @@
|
||||||
function Mat_G=FormG(Volt,PD,QD,Loadi,bigM,mVolt,rVolt,sigma,Vbi,PDbi,QDbi,mPD,mQD)
|
function Mat_G=FormG(Volt,PD,QD,Loadi,bigM,mVolt,rVolt,sigma,Vbi,PDbi,QDbi,mPD,mQD,uPD,lPD)
|
||||||
|
|
||||||
Mat_G=[
|
Mat_G=[
|
||||||
sparse(PD(Loadi))-mPD(Loadi)-bigM*PDbi-0.1;
|
sparse(PD(Loadi))-mPD(Loadi)-bigM*PDbi-0.1;
|
||||||
|
|
|
||||||
27
OPF.m
27
OPF.m
|
|
@ -50,12 +50,20 @@ kmax=100;
|
||||||
Precision=Precision/1;
|
Precision=Precision/1;
|
||||||
%% ¼ÓÎó²î
|
%% ¼ÓÎó²î
|
||||||
sigma=0.01;
|
sigma=0.01;
|
||||||
PD0(Loadi)=PD0(Loadi).*(1+normrnd(0,sigma,length(Loadi),1));
|
PD0(Loadi)=RealPD(Loadi).*(1+normrnd(0,sigma,length(Loadi),1));
|
||||||
QD0(Loadi)=QD0(Loadi).*(1+normrnd(0,sigma,length(Loadi),1));
|
QD0(Loadi)=RealQD(Loadi).*(1+normrnd(0,sigma,length(Loadi),1));
|
||||||
|
mVolt=rVolt.*(1+normrnd(0,sigma,length(rVolt),1))';
|
||||||
mPD=PD0;
|
mPD=PD0;
|
||||||
mQD=QD0;
|
mQD=QD0;
|
||||||
mVolt=rVolt.*(1+normrnd(0,sigma,length(rVolt),1))';
|
%加估计上下界
|
||||||
mVolt(2)=2;
|
lPD=RealPD*(1-3*sigma);
|
||||||
|
uPD=RealPD*(1+3*sigma);
|
||||||
|
lQD=RealQD*(1-3*sigma);
|
||||||
|
uQD=RealQD*(1+3*sigma);
|
||||||
|
lVolt=rVolt*(1-3*sigma);
|
||||||
|
uVolt=rVolt*(1+3*sigma);
|
||||||
|
%错误数据
|
||||||
|
mVolt(2)=5;
|
||||||
bigM=10;
|
bigM=10;
|
||||||
Vbi=sparse(0.5*ones(Busnum,1));
|
Vbi=sparse(0.5*ones(Busnum,1));
|
||||||
PDbi=sparse(0.5*ones(length(Loadi),1));
|
PDbi=sparse(0.5*ones(length(Loadi),1));
|
||||||
|
|
@ -89,7 +97,7 @@ while(abs(Gap)>Precision*1)
|
||||||
%% Ðγɷ½³Ì¾ØÕó
|
%% Ðγɷ½³Ì¾ØÕó
|
||||||
Luu=Init_U'.*Init_W'+Init_u*ones(RestraintCount,1);
|
Luu=Init_U'.*Init_W'+Init_u*ones(RestraintCount,1);
|
||||||
Lul=Init_L'.*Init_Z'-Init_u*ones(RestraintCount,1);
|
Lul=Init_L'.*Init_Z'-Init_u*ones(RestraintCount,1);
|
||||||
Mat_G=FormG(Volt,PD,QD,Loadi,bigM,mVolt,rVolt,sigma,Vbi,PDbi,QDbi,mPD,mQD);
|
Mat_G=FormG(Volt,PD,QD,Loadi,bigM,mVolt,rVolt,sigma,Vbi,PDbi,QDbi,mPD,mQD,uPD,lPD);
|
||||||
Mat_H=FormH(Busnum,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,Loadi);
|
Mat_H=FormH(Busnum,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,Loadi);
|
||||||
Ly=Mat_H;
|
Ly=Mat_H;
|
||||||
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD,RealPD,RealQD,Loadi,KK,PF,eps);
|
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD,RealPD,RealQD,Loadi,KK,PF,eps);
|
||||||
|
|
@ -139,8 +147,11 @@ while(abs(Gap)>Precision*1)
|
||||||
Mat_G=FormG(Volt,PD,QD,Loadi,bigM,mVolt,rVolt,sigma,Vbi,PDbi,QDbi,mPD,mQD);
|
Mat_G=FormG(Volt,PD,QD,Loadi,bigM,mVolt,rVolt,sigma,Vbi,PDbi,QDbi,mPD,mQD);
|
||||||
Mat_H=FormH(Busnum,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,Loadi);
|
Mat_H=FormH(Busnum,Volt,PG,PD,QG,QD,Y,UAngel,r,c,Angle,Loadi);
|
||||||
Ly=Mat_H;
|
Ly=Mat_H;
|
||||||
if KK>5
|
if KK>8
|
||||||
eps=eps*0.1;
|
eps=eps*0.2;
|
||||||
|
if abs(eps)<1e-6
|
||||||
|
eps=1e-6;
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD,RealPD,RealQD,Loadi,KK,PF,eps);
|
Lz=FormLz(Mat_G,Init_L,GenL,Busnum,PVQL,PD,RealPD,RealQD,Loadi,KK,PF,eps);
|
||||||
Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD,PD0,QD0,Loadi,KK,PF,eps);
|
Lw=FormLw(Mat_G,Init_U,GenU,Busnum,PVQU,PD,PD0,QD0,Loadi,KK,PF,eps);
|
||||||
|
|
@ -156,4 +167,6 @@ while(abs(Gap)>Precision*1)
|
||||||
KK=KK+1;
|
KK=KK+1;
|
||||||
end
|
end
|
||||||
toc
|
toc
|
||||||
|
obj=sum(Vbi)+sum(PDbi)+sum(QDbi);
|
||||||
|
fprintf('目标函数值 %.2f\n',full(obj));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue