diff --git a/FormLw.m b/FormLw.m index 9683a8d..3a258f8 100644 --- a/FormLw.m +++ b/FormLw.m @@ -1,4 +1,4 @@ -function Lw=FormLw(Mat_G,Init_U,Loadi,rPD3P,rQD3P,mVoltABCV) +function Lw=FormLw(Mat_G,Init_U,Loadi,rPD3P,rQD3P,mVoltABCV,PDU,QDU) % KK=999; % %PU=GenU(:,2);%发电机有功上界 % @@ -26,8 +26,10 @@ function Lw=FormLw(Mat_G,Init_U,Loadi,rPD3P,rQD3P,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.3*rPD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); -QDU=1.3*rQD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); + +% PDU=1.3*rPD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); +% QDU=1.3*rQD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); + % t1=([PDU',QDU',1*ones(length(Volt),1)'])'; t1=([PDU',QDU'])'; t2=Mat_G+Init_U'-t1; diff --git a/FormLz.m b/FormLz.m index ea56136..913e331 100644 --- a/FormLz.m +++ b/FormLz.m @@ -1,4 +1,4 @@ -function Lz=FormLz(Mat_G,Init_L,Loadi,rPD3P,rQD3P,mVoltABCV) +function Lz=FormLz(Mat_G,Init_L,Loadi,rPD3P,rQD3P,mVoltABCV,PDL,QDL) % KK=999; % % VoltL=(0.9)*ones(1,Busnum); @@ -23,8 +23,10 @@ function Lz=FormLz(Mat_G,Init_L,Loadi,rPD3P,rQD3P,mVoltABCV) % QDL=0*PD(Loadi).*sqrt((1-PF.^2))./PF; % PDL=0*ones(length(Loadi),1); % QDL=0*ones(length(Loadi),1); -PDL=0.70*rPD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); -QDL=0.70*rQD3P.*(1+unifrnd(-0.15,0.15,length(rQD3P),1)); + +% PDL=0.70*rPD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); +% QDL=0.70*rQD3P.*(1+unifrnd(-0.15,0.15,length(rQD3P),1)); + % t1=([PDL',QDL',0.88*ones(length(Volt),1)'])'; t1=([PDL',QDL'])'; t2=Mat_G-Init_L'-t1; diff --git a/OPF.m b/OPF.m index 516ea27..fd1ed56 100644 --- a/OPF.m +++ b/OPF.m @@ -257,6 +257,7 @@ CenterA=0.1; Volt=1*Vp3m; % Volt=mVoltABCV; UAngel=Vp3a; +isSetBound=0; while(abs(Gap)>Precision) if KK>kmax break; @@ -288,8 +289,15 @@ 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); + if isSetBound==0 + PDL=0.70*rPD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); + QDL=0.70*rQD3P.*(1+unifrnd(-0.15,0.15,length(rQD3P),1)); + PDU=1.3*rPD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); + QDU=1.3*rQD3P.*(1+unifrnd(-0.15,0.15,length(rPD3P),1)); + isSetBound=1; + end + Lz=FormLz(Mat_G,Init_L,Loadi,rPD3P,rQD3P,rVoltABCV,PDL,QDL); + Lw=FormLw(Mat_G,Init_U,Loadi,rPD3P,rQD3P,rVoltABCV,PDU,QDU); Lx=FormLx(deltF,deltH,Init_Y,deltG,Init_Z,Init_W); % YY=FormYY(Lul,Lz,Ly,Luu,Lw,Lx); %% 开始解方程