加其它方法。

Signed-off-by: dmy@lab <dmy@lab.lab>
This commit is contained in:
dmy@lab 2015-03-18 20:32:01 +08:00
parent 7e91bafa7f
commit 4c521bd022
32 changed files with 99 additions and 39 deletions

View File

@ -38,27 +38,35 @@ this.cl=zeros(length(output_args),1);
%% 开始增加不等式约束-电压\PD\QD
%电压不等式约束
output_args=[output_args;Volt];
this.cu=[this.cu;1.07*ones(length(Volt),1)];%9½Úµã
this.cl=[this.cl;0.93*ones(length(Volt),1)];%9½Úµã
% this.cu=[this.cu;1.00*ones(length(Volt),1)];
% this.cl=[this.cl;0.90*ones(length(Volt),1)];
% this.cu=[this.cu;1.07*ones(length(Volt),1)];%9½Úµã
% this.cl=[this.cl;0.93*ones(length(Volt),1)];%9½Úµã
this.cu=[this.cu;1.00*ones(length(Volt),1)];
this.cl=[this.cl;0.90*ones(length(Volt),1)];
%% PD
rPD=this.rPD;
output_args=[output_args;PD];
% PDU=[0.124;0.315;0.5;1;1;0.5;0.63;0.4];%原始数据
% PDU=[0.63;0.4;0.5;1;0.8;1;0.63;0.4];%偏差比较大
this.cu=[this.cu;1.2*rPD];
this.cl=[this.cl;0.8*rPD];
this.cu=[this.cu;PDU];
this.cl=[this.cl;0*PDU];
%Generate values from the uniform distribution on the interval [a, b].
global loadFlag;
if loadFlag==0
r =-0.201 + (-0.01-(-0.2)).*rand(length(rPD),1);
else
end
this.cu=[this.cu;(r+1.4).*rPD];
this.cl=[this.cl;(r+1).*rPD];
% this.cu=[this.cu;PDU];
% this.cl=[this.cl;0*PDU];
%% QD
rQD=this.rQD;
output_args=[output_args;QD];
QDU=PDU;
% this.cu=[this.cu;1.2*rQD];
% this.cl=[this.cl;0.8*rQD];
this.cu=[this.cu;QDU];
this.cl=[this.cl;0*QDU];
% QDU=PDU;
this.cu=[this.cu;(r+1.4).*rQD];
this.cl=[this.cl;(r+1).*rQD];
% this.cu=[this.cu;QDU];
% this.cl=[this.cl;0*QDU];
%% 稠密化
output_args=full(output_args);
this.cu=full(this.cu);

View File

@ -47,16 +47,27 @@ rPD=this.rPD;
output_args=[output_args;PD];
% PDU=[0.124;0.315;0.5;1;1;0.5;0.63;0.4];%
% PDU=[0.63;0.4;0.5;1;0.8;1;0.63;0.4];%
this.cu=[this.cu;1.2*rPD];
this.cl=[this.cl;0.8*rPD];
%Generate values from the uniform distribution on the interval [a, b].
global loadFlag;
if loadFlag==1
r=load('rLD');
r=r.r;
else
%r=-0.2;
r =-0.201 + (-0.001-(-0.2)).*rand(length(rPD),1);
end
this.cu=[this.cu;(r+1.4).*rPD];
this.cl=[this.cl;(r+1).*rPD];
% this.cu=[this.cu;PDU];
% this.cl=[this.cl;0*PDU];
%% QD
rQD=this.rQD;
output_args=[output_args;QD];
% QDU=PDU;
this.cu=[this.cu;1.2*rQD];
this.cl=[this.cl;0.8*rQD];
this.cu=[this.cu;(r+1.4).*rQD];
this.cl=[this.cl;(r+1).*rQD];
% this.cu=[this.cu;QDU];
% this.cl=[this.cl;0*QDU];
%%

7
LineP.m Normal file
View File

@ -0,0 +1,7 @@
function [ output_args ] = LineP( Linei,Linej,Liner,Linex,SEVolt,SEVAngel )
L=LineCurrent( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
SEVolt=SEVolt.*exp(1j*SEVAngel);
output_args=real(SEVolt(Linei).*conj(L));
end

7
LineQ.m Normal file
View File

@ -0,0 +1,7 @@
function [ output_args ] = LineQ( Linei,Linej,Liner,Linex,SEVolt,SEVAngel )
L=LineCurrent( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
SEVolt=SEVolt.*exp(1j*SEVAngel);
output_args=imag(SEVolt(Linei).*conj(L));
end

View File

@ -1,10 +1,13 @@
clear
clc
close all
txt=dlmread('E:\\\\.txt');
txt=txt./10000;
x=1:length(txt);
plot(x,txt,'k');
plot(x,txt,'k','linewidth',2);
hold on
plot(x,txt*0.8,'k--');
plot(x,txt*1.2,'k--');
plot(x,txt*0.8,'k--','linewidth',2);
plot(x,txt*1.2,'k--','linewidth',2);
legend('线','')
ylabel('/kW')

BIN
PD0.mat

Binary file not shown.

BIN
QD0.mat

Binary file not shown.

View File

@ -1 +1,2 @@
2015.3.18 依据电工学报专家的意见,添加其它状态估计方法做对比。
2013.10.15 准备加入支路功率量测量试试,原来只有电压和负荷的效果太不好了,主要是负荷的估计效果不好。

View File

@ -2,11 +2,14 @@ clc
clear
close all
% yalmip('clear')
global loadFlag;
LineCurs=zeros(32,100);
tic
for I=1:1
for I=1:100
close all;
[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, ...
Liner,Linex,Lineb,Transforr,Transforx,Transfork0]=pf('E:/ËãÀý/feeder33/feeder33.txt');
Liner,Linex,Lineb,Transforr,Transforx,Transfork0]=pf('E:\算例\feeder33\feeder33.txt');
%pf('C:\bpa\长虹世纪线_556844_2013-10-28\长虹世纪线_556844_2013-10-28_iPso_newFil
%e.txt');
% pf('E:/算例/东际911_2751267_2012-09-05/pyth-增加3倍.txt'); 20131125
@ -57,6 +60,7 @@ for I=1:1
% load('QD0');
% load('mVolt');
% load('mLoadCurrent');
loadFlag=0;
%% 17号负荷上加负数
% PD0(17)=-10;
%% 负荷用Pd=(1+k)Pd0添加负荷
@ -65,7 +69,7 @@ for I=1:1
% load('I');
sigma=0.03;
%
% [ mVolt,PD0,QD0,mLoadCurrent ] = GetMeasure(sigma,rVolt,rPD,rQD,rLoadCurrent );
[ mVolt,PD0,QD0,mLoadCurrent ] = GetMeasure(sigma,rVolt,rPD,rQD,rLoadCurrent );
% sigma=sigma*(I-1)/50;
% 排除大于3倍sigma的数据
% save('mVolt','mVolt');
@ -124,6 +128,11 @@ for I=1:1
% sum([SEVolt;PD;QD]>cu(length(SEVolt)*2+2:end));
% sum([SEVolt;PD;QD]<cl(length(SEVolt)*2+2:end));
% RealValuePlot(mPD(PDi),mQD(QDi),rPD(PDi),rQD(QDi),mVolt,rVolt,rVAngel);
%measurementN=sum(find(wVolt)>0)+sum(find(wPD)>0)+sum(find(wQD)>0);
stE=StErrorS(SEVolt,SEVAngel,PD,QD,rVolt,rVAngel,rPD(PDi),rQD(QDi));
fprintf('真实值统计误差为: %f',stE);
stE=StErrorZ(SEVolt,PD,QD,rVolt,mPD(PDi),mQD(QDi),noLoadi);
fprintf('测量值统计误差为: %f',stE);
NormalizedResiduals(x,sigma,PDi,QDi,Volt0,mPD,mQD);
SECurrent=LoadCurrent( SEVolt,SEVAngel,PD,QD,PDi,QDi );
[flag,t1,t2]=MaxSigma( x,PDi,QDi,mPD,mQD,mVolt,mLoadCurrent,sigma,rPD,rQD,rVolt,rLoadCurrent );
@ -132,11 +141,14 @@ for I=1:1
[ok,msg] = checkSol(Opt);
figure();
plotError( SEVolt,SEVAngel,rVolt,rVAngel,mVolt,PD,mPD(PDi),rPD(PDi),QD,mQD(QDi),rQD(QDi),PDi );
% LineCurrent( Linei,Linej,Liner,Linex,Volt,VAngle )
% LineCurrent( Linei,Linej,Liner,Linex,SEVolt,SEVAngel )
LineCurs(:,I)=LineCurrent( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
LineP( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
LineQ( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
if flag==1
I
t1
t2
break;
%break;
end
end

View File

@ -2,8 +2,11 @@ clc
clear
close all
% yalmip('clear')
global loadFlag;
LineCurs=zeros(32,100);
tic
for I=1:1
close all;
[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, ...
Liner,Linex,Lineb,Transforr,Transforx,Transfork0]=pf('E:\\feeder33\feeder33.txt');
@ -53,10 +56,11 @@ for I=1:1
[Volt,UAngel,Init_Z,Init_W,Init_L,Init_U,Init_Y,PG,QG,RestraintCount,wPG,wQG,wPD,wQD,wVolt,wLoadCurrent,PD,PD0,QD,randPDind,Loadi,noLoadi]=OPF_Init(Busnum,Balance,PG,QG,rVolt,GenU,GenL,PVi,PGi,PVQU,PVQL,PD0,QD0,rQD,rPD,rLoadCurrent);
%%
%%
load('PD0');
load('QD0');
load('mVolt');
load('mLoadCurrent');
% load('PD0');
% load('QD0');
% load('mVolt');
% load('mLoadCurrent');
loadFlag=0;
%% 17
% PD0(17)=-10;
%% Pd=(1+k)Pd0
@ -65,7 +69,7 @@ for I=1:1
% load('I');
sigma=0.03;
%
% [ mVolt,PD0,QD0,mLoadCurrent ] = GetMeasure(sigma,rVolt,rPD,rQD,rLoadCurrent );
[ mVolt,PD0,QD0,mLoadCurrent ] = GetMeasure(sigma,rVolt,rPD,rQD,rLoadCurrent );
% sigma=sigma*(I-1)/50;
% 3sigma
% save('mVolt','mVolt');
@ -89,7 +93,7 @@ for I=1:1
opts.tolafun=1e-4;
opts.warnings='all';
opts.display='off';
x0=[0.1*rPD(PDi);0.1*rQD(QDi); ...
x0=[rand()*rPD(PDi);rand()*rQD(QDi); ...
ones(length(Volt),1); ...
zeros(length(Volt),1)];
% x0=[PD(PDi);QD(QDi);xVolt';xUAngel'];
@ -127,7 +131,7 @@ for I=1:1
%measurementN=sum(find(wVolt)>0)+sum(find(wPD)>0)+sum(find(wQD)>0);
stE=StErrorS(SEVolt,SEVAngel,PD,QD,rVolt,rVAngel,rPD(PDi),rQD(QDi));
fprintf(': %f',stE);
stE=StErrorZ(SEVolt,PD,QD,rVolt,mPD(PDi),mQD(QDi),noLoadi);
stE=StErrorZ(SEVolt,PD,QD,mVolt,mPD(PDi),mQD(QDi),noLoadi);
fprintf(': %f',stE);
NormalizedResiduals(x,sigma,PDi,QDi,Volt0,mPD,mQD);
SECurrent=LoadCurrent( SEVolt,SEVAngel,PD,QD,PDi,QDi );
@ -137,11 +141,14 @@ for I=1:1
[ok,msg] = checkSol(Opt);
figure();
plotError( SEVolt,SEVAngel,rVolt,rVAngel,mVolt,PD,mPD(PDi),rPD(PDi),QD,mQD(QDi),rQD(QDi),PDi );
% LineCurrent( Linei,Linej,Liner,Linex,Volt,VAngle )
% LineCurrent( Linei,Linej,Liner,Linex,SEVolt,SEVAngel )
% LineCurs(:,I)=LineCurrent( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
LineP( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
LineQ( Linei,Linej,Liner,Linex,SEVolt,SEVAngel );
if flag==1
I
t1
t2
break;
I;
t1;
t2;
%break;
end
end

View File

@ -3,8 +3,10 @@ function [ output_args ] = StErrorS( SEVolt,SEVangle,SEPD,SEQD,rVolt,rVangle,rSE
% Detailed explanation goes here
t1=[SEVolt;SEVangle;SEPD;SEQD];
t2=[rVolt;rVangle;rSEPD;rSEQD];
t1=t1(t2~=0);
t2=t2(t2~=0);
m=length(t1);
t3=sum( ((t1-t2)./0.03).^2)/m;
t3=sum( ((t1-t2)./0.999./t2).^2)/m;
output_args=t3^.5;
end

BIN
graph/9/20140616/PD0.mat Normal file

Binary file not shown.

BIN
graph/9/20140616/QD0.mat Normal file

Binary file not shown.

Binary file not shown.

BIN
graph/9/20140616/mVolt.mat Normal file

Binary file not shown.

BIN
graph/9/20140616/rLD.mat Normal file

Binary file not shown.

BIN
graph/9/201406162/PD0.mat Normal file

Binary file not shown.

BIN
graph/9/201406162/QD0.mat Normal file

Binary file not shown.

Binary file not shown.

BIN
graph/9/201406162/mVolt.mat Normal file

Binary file not shown.

BIN
graph/9/201406162/rLD.mat Normal file

Binary file not shown.

BIN
graph/9/201406163/PD0.mat Normal file

Binary file not shown.

BIN
graph/9/201406163/QD0.mat Normal file

Binary file not shown.

View File

@ -0,0 +1,2 @@
这个比较好
2014.6.16 1701

Binary file not shown.

BIN
graph/9/201406163/mVolt.mat Normal file

Binary file not shown.

BIN
graph/9/201406163/rLD.mat Normal file

Binary file not shown.

Binary file not shown.

BIN
mVolt.mat

Binary file not shown.

BIN
rLD.mat Normal file

Binary file not shown.

BIN
负荷曲线.fig Normal file

Binary file not shown.