修改了新的负荷文件

Signed-off-by: facat <dugg@21cn.com>
This commit is contained in:
facat 2013-03-19 19:41:52 +08:00
parent 55529d26b4
commit 942120eb70
13 changed files with 41 additions and 10 deletions

BIN
0PD0.mat

Binary file not shown.

BIN
0QD0.mat

Binary file not shown.

BIN
12PD0.mat

Binary file not shown.

BIN
12QD0.mat

Binary file not shown.

BIN
16PD0.mat

Binary file not shown.

BIN
16QD0.mat

Binary file not shown.

BIN
4PD0.mat

Binary file not shown.

BIN
4QD0.mat

Binary file not shown.

BIN
8PD0.mat

Binary file not shown.

BIN
8QD0.mat

Binary file not shown.

View File

@ -1,10 +1,41 @@
function [ output_args ] = MaxBranchDeviation( this, Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Branchg,Branchb,Transfork0,Volt0,UAngel0,Volt,UAngel)
function [ output_args ] = MaxBranchDeviation( ~, Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Branchi,Branchg,Branchb,Transfork0,Volt0,UAngel0,Volt,UAngel,FileName,PD0,QD0)
%% 最大支路功率偏差
% 支路功率包括线路和变压器
%%
[dispLineloss0 dispTransloss0]=Lineloss(Linei,Linej,Liner,Linex,Lineb2,Transi,Transj,Transr,Transx,Branchg,Branchb,k0,Volt0,Angle0);
[dispLineloss dispTransloss]=Lineloss(Linei,Linej,Liner,Linex,Lineb2,Transi,Transj,Transr,Transx,Branchg,Branchb,k0,Volt,Angle);
real(dispLineloss0 - dispLineloss)./real(dispLineloss0)
%% 先用加了误差的负荷功率计算潮流值
[Busnum,Balance,PQstandard,Precision,~,~,~,~,~,kmax,~ ,...
~,~,~,~,~,~,~,Pointpoweri,PG,QG,PD,QD,PVi,PVu,~,~,~,~,~,~,~]= openfile2(FileName);
PD=PD0;
QD=QD0;
%% 形成节点导纳矩阵
[~,Y,r,c,Angle] = admmatrix(Busnum,Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,...
Transforx,Transfork0,Branchi,Branchg,Branchb);
[P0,Q0,U,Uangle] = Initial(PG,PD,PQstandard,Pointpoweri,QG,QD,Busnum); %求功率不平衡量
%disp('迭代次数i 最大不平衡量');
%% 循环体计算
for i = 0:kmax
[Jacob,PQ,U,Uangle] = jacobian(Busnum,Balance,PVi,PVu,U,Uangle,Y,Angle,P0,Q0,r,c); %形成雅克比矩阵
% disp('第一次雅克比');
m = max(abs(PQ));
m=full(m);
%fprintf(' %u %.8f \n',i,m);
if m > Precision %判断不平衡量是否满足精度要求
[Uangle,U] = solvefun(Busnum,Jacob,PQ,Uangle,U); %求解修正方程,更新电压变量
else
disp(['收敛,迭代次数为',num2str(i),'次']);
break %若满足精度要求,则计算收敛
end
end
Volt0=U;
UAngel0=Uangle;
[dispLineloss0 dispTransloss0]=Lineloss(Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Branchi,Branchg,Branchb,Transfork0,Volt0,UAngel0);
[dispLineloss dispTransloss]=Lineloss(Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Branchi,Branchg,Branchb,Transfork0,Volt,UAngel);
t1=(dispLineloss0(:,3) - dispLineloss(:,3))./dispLineloss0(:,3);
t2=(dispTransloss0(:,3) - dispTransloss(:,3))./dispTransloss0(:,3);
t11=dispLineloss0(:,3)>1e-5;% 太小的值不计算
t22=dispTransloss0(:,3)>1e-5;% 太小的值不计算
t3=abs([t1(t11);t2(t22)]);
output_args=max(t3(t3~=Inf));
end

View File

@ -3,7 +3,7 @@ function [ output_args ] = MaxBranchDeviation( ~, Linei,Linej,Liner,Linex,Lineb,
% 线
%%
[Busnum,Balance,PQstandard,Precision,~,~,~,~,~,kmax,~ ,...
~,~,~,~,~,~,~,Pointpoweri,PG,QG,~,~,PVi,PVu,~,~,~,~,~,~,~]= openfile2(FileName);
~,~,~,~,~,~,~,Pointpoweri,PG,QG,PD,QD,PVi,PVu,~,~,~,~,~,~,~]= openfile2(FileName);
PD=PD0;
QD=QD0;
%%

6
OPF.m
View File

@ -7,7 +7,7 @@ clear
thesis=ForThesis(1,45);
for II=1:1
[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,Branchi,Branchg,Branchb,Transfork0]= ...
pf('E:\\<EFBFBD>926_21671693_2012-09-06\newFIle20.txt');
pf('E:\\926_21671693_2012-09-06\newFIle4 - .txt');
%pf('D:\Project\\\\\9223-1_0.5_120%.txt');
%pf('D:\Project\\\919.txt');
%pf('c:/file31.txt');
@ -55,8 +55,8 @@ for II=1:1
%%
PD0(Loadi)=PD0(Loadi).*(1+normrnd(0,0.05,length(Loadi),1));
QD0(Loadi)=QD0(Loadi).*(1+normrnd(0,0.05,length(Loadi),1));
load('200PD0.mat');
load('200QD0.mat');
load('20PD0.mat');
load('20QD0.mat');
% PG0(PGi)=PG0(PGi).*(1+normrnd(0,0.01,length(PGi),1));
% QG0(PVi)=QG0(PVi).*(1+normrnd(0,0.01,length(PVi),1));
%%