1 加了算例A的收敛曲线展示。
2 算离散结果时,重新初始化松弛变量。 3 结果对松弛变量的初衷也比较敏感。 Signed-off-by: dugg@lab-desk <dugg@lab-desk>
This commit is contained in:
14
@ForThesis1/AddPDQDPGQG.m
Normal file
14
@ForThesis1/AddPDQDPGQG.m
Normal file
@@ -0,0 +1,14 @@
|
||||
function this=AddPDQDPGQG( this, PD,QD,PG,QG)
|
||||
%ADDPD Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
if this.currentPos>this.sampleNum
|
||||
error('出入的数太多了');
|
||||
return;
|
||||
end
|
||||
this.currentPos=this.currentPos+1;
|
||||
this.PDArray(:,this.currentPos)=PD;
|
||||
this.QDArray(:,this.currentPos)=QD;
|
||||
this.PGArray(this.currentPos)=PG;
|
||||
this.QGArray(this.currentPos)=QG;
|
||||
end
|
||||
|
||||
30
@ForThesis1/ForThesis.m
Normal file
30
@ForThesis1/ForThesis.m
Normal file
@@ -0,0 +1,30 @@
|
||||
classdef ForThesis
|
||||
%UNTITLED Summary of this class goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
properties
|
||||
currentPos=0;
|
||||
sampleNum=0;
|
||||
LoadNum=0;
|
||||
PDArray=0;
|
||||
|
||||
QDArray=0;
|
||||
PGArray=0;
|
||||
QGArray=0;
|
||||
|
||||
end
|
||||
|
||||
methods
|
||||
function this=ForThesis(sampleNum,LoadNum)
|
||||
this.currentPos=0;%记录当前用到的列,不要超过100列
|
||||
this.sampleNum=sampleNum;
|
||||
this.LoadNum=LoadNum;
|
||||
this.PDArray=zeros(LoadNum,sampleNum);
|
||||
this.QDArray=zeros(LoadNum,sampleNum);
|
||||
this.PGArray=zeros(sampleNum,1);
|
||||
this.QGArray=zeros(sampleNum,1);
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
41
@ForThesis1/MaxBranchDeviation.m
Normal file
41
@ForThesis1/MaxBranchDeviation.m
Normal file
@@ -0,0 +1,41 @@
|
||||
function [ output_args ] = MaxBranchDeviation( ~, Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Branchi,Branchg,Branchb,Transfork0,Volt0,UAngel0,Volt,UAngel,FileName,PD0,QD0)
|
||||
%% 最大支路功率偏差
|
||||
% 支路功率包括线路和变压器
|
||||
%% 先用加了误差的负荷功率计算潮流值
|
||||
[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
|
||||
|
||||
11
@ForThesis1/MaxDeviation.m
Normal file
11
@ForThesis1/MaxDeviation.m
Normal file
@@ -0,0 +1,11 @@
|
||||
function [output_arg]=MaxDeviation(this,PG0,QG0,PD0,QD0)
|
||||
PD0Array=repmat(PD0,1,this.sampleNum);
|
||||
QD0Array=repmat(QD0,1,this.sampleNum);
|
||||
PDMaxDev=max(abs( (this.PDArray-PD0Array)./PD0Array ),[],2);
|
||||
QDMaxDev=max(abs( (this.QDArray-QD0Array)./QD0Array ),[],2);
|
||||
PG0Array=repmat(PG0,this.sampleNum,1);
|
||||
QG0Array=repmat(QG0,this.sampleNum,1);
|
||||
PGMaxDev=max(abs( (PG0Array-this.PGArray)./PG0Array ));
|
||||
QGMaxDev=max( abs( (QG0Array-this.QGArray)./QG0Array ) );
|
||||
output_arg=max([PDMaxDev;QDMaxDev;PGMaxDev;QGMaxDev;]);
|
||||
end
|
||||
7
@ForThesis1/MeanPD.m
Normal file
7
@ForThesis1/MeanPD.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function [ output_args ] = MeanPD(this)
|
||||
%MEANPD Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=sum(this.PDArray,2)/this.sampleNum;
|
||||
|
||||
end
|
||||
|
||||
7
@ForThesis1/MeanPG.m
Normal file
7
@ForThesis1/MeanPG.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function [ output_args ] = MeanPG( this )
|
||||
%MEANPG Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=sum(this.PGArray,1)/this.sampleNum;
|
||||
|
||||
end
|
||||
|
||||
7
@ForThesis1/MeanQD.m
Normal file
7
@ForThesis1/MeanQD.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function [ output_args ] = MeanQD(this)
|
||||
%MEANQD Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=sum(this.QDArray,2)/this.sampleNum;
|
||||
|
||||
end
|
||||
|
||||
7
@ForThesis1/MeanQG.m
Normal file
7
@ForThesis1/MeanQG.m
Normal file
@@ -0,0 +1,7 @@
|
||||
function [ output_args ] = MeanQG( this )
|
||||
%MEAQG Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
output_args=sum(this.QGArray,1)/this.sampleNum;
|
||||
|
||||
end
|
||||
|
||||
12
@ForThesis1/PercentOfPass.m
Normal file
12
@ForThesis1/PercentOfPass.m
Normal file
@@ -0,0 +1,12 @@
|
||||
function [ output_args ] = PercentOfPass( this, PG0,QG0,PD0,QD0 )
|
||||
%% 估计值合格率
|
||||
PD=this.PDArray(:,end);%用最后一列
|
||||
QD=this.QDArray(:,end);%用最后一列
|
||||
t1=PD-PD0;
|
||||
t2=QD-QD0;
|
||||
t3=abs(t1)/3*0.05;
|
||||
t4=abs(t2)/3*0.05;
|
||||
output_args=sum(t3<=1)+sum(t4<=1);
|
||||
|
||||
end
|
||||
|
||||
13
@ForThesis1/SqareDeviation.m
Normal file
13
@ForThesis1/SqareDeviation.m
Normal file
@@ -0,0 +1,13 @@
|
||||
function [ output_args ] = SqareDeviation( this, PG0,QG0,PD0,QD0)
|
||||
%% 其实就是负荷系数不为0的目标函数
|
||||
|
||||
PD=this.PDArray(:,end);%用最后一列
|
||||
QD=this.QDArray(:,end);%用最后一列
|
||||
t1=PD-PD0;
|
||||
t2=t1./0.05;
|
||||
t3=QD-QD0;
|
||||
t4=t3./0.05;
|
||||
|
||||
output_args=sqrt(sum(t2.^2)+sum(t4.^2));
|
||||
end
|
||||
|
||||
19
@ForThesis1/StatBranchDeviation.m
Normal file
19
@ForThesis1/StatBranchDeviation.m
Normal file
@@ -0,0 +1,19 @@
|
||||
function [ output_args ] = StatBranchDeviation( ~, Linei,Linej,Liner,Linex,Lineb,Transfori,Transforj,Transforr,Transforx,Branchi,Branchg,Branchb,Transfork0,Volt0,UAngel0,Volt,UAngel )
|
||||
%STATBRANCHDEVIATION Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
%% 支路功率统计偏差 L2 范数
|
||||
% 支路功率包括线路和变压器
|
||||
%%
|
||||
[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=[t1(t11);t2(t22)];
|
||||
t4=t3.^2;
|
||||
t5=sum(t4).^.5;
|
||||
output_args=t5;
|
||||
end
|
||||
|
||||
20
@ForThesis1/StatDeviation.m
Normal file
20
@ForThesis1/StatDeviation.m
Normal file
@@ -0,0 +1,20 @@
|
||||
function [ output_args ] = StatDeviation( this,PG0,QG0,PD0,QD0 )%ͳ¼ÆÎó²î
|
||||
%STATDEVIATION Summary of this function goes here
|
||||
% Detailed explanation goes here
|
||||
|
||||
PD0Array=repmat(PD0,1,this.sampleNum);
|
||||
QD0Array=repmat(QD0,1,this.sampleNum);
|
||||
PDDev=(this.PDArray-PD0Array)/0.05;
|
||||
QDDev=(this.QDArray-QD0Array)/0.05;
|
||||
% PG0Array=repmat(PG0,this.sampleNum,1);
|
||||
% QG0Array=repmat(QG0,this.sampleNum,1);
|
||||
% PGDev=(PG0Array-this.PGArray)/0.01;
|
||||
% QGDev=(QG0Array-this.QGArray)/0.01;
|
||||
wholeMat=[PDDev;QDDev;];
|
||||
t1=wholeMat.^2;
|
||||
t2=sum(t1,1);
|
||||
t3=t2/size(t1,1);
|
||||
t4=t3.^.5;
|
||||
output_args=sum(t4)/length(t4);
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user