parent
c8406a43c0
commit
fd65438b98
|
|
@ -1,7 +1,7 @@
|
||||||
function [ output_args ] = Geteb( this )
|
function [ output_args ] = Getcl( this )
|
||||||
%BE Summary of this function goes here
|
%BE Summary of this function goes here
|
||||||
% Detailed explanation goes here
|
% Detailed explanation goes here
|
||||||
output_args=this.eb;
|
output_args=this.cl;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
function [ output_args ] = Getgle( this )
|
function [ output_args ] = Getcu( this )
|
||||||
%GLE Summary of this function goes here
|
%GLE Summary of this function goes here
|
||||||
% Detailed explanation goes here
|
% Detailed explanation goes here
|
||||||
output_args=this.gle;
|
output_args=this.cu;
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -17,8 +17,8 @@ classdef Opti
|
||||||
c=NaN;
|
c=NaN;
|
||||||
PG=NaN;
|
PG=NaN;
|
||||||
QG=NaN;
|
QG=NaN;
|
||||||
gle=NaN;%opti toolbox大于小于等于
|
cl=NaN;%opti toolbox大于小于等于
|
||||||
eb=NaN;%等式、不等式约束右边的值
|
cu=NaN;%等式、不等式约束右边的值
|
||||||
Balance=NaN;
|
Balance=NaN;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,11 @@ VMatrix=sparse(r,c,VAngel(r)-VAngel(c)-Angel,busNum,busNum);
|
||||||
dP=PG-PD_-diag(Volt)*(Y.*cos(VMatrix))*Volt;
|
dP=PG-PD_-diag(Volt)*(Y.*cos(VMatrix))*Volt;
|
||||||
dQ=QG-QD_-diag(Volt)*(Y.*spfun(@sin,VMatrix))*Volt;
|
dQ=QG-QD_-diag(Volt)*(Y.*spfun(@sin,VMatrix))*Volt;
|
||||||
output_args=[dP;dQ;VAngel(Balance)];
|
output_args=[dP;dQ;VAngel(Balance)];
|
||||||
|
%% 开始增加不等式约束-电压\PD\QD
|
||||||
|
%电压不等式约束
|
||||||
|
|
||||||
output_args=full(output_args);
|
output_args=full(output_args);
|
||||||
this.gle=zeros(length(output_args),1);
|
this.cu=zeros(length(output_args),1);
|
||||||
this.eb=this.gle;
|
this.cl=this.cu;
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,9 +79,9 @@ opts.display='iter';
|
||||||
% zeros(length(Volt),1)];
|
% zeros(length(Volt),1)];
|
||||||
x0=[PD(PDi);QD(QDi);xVolt';xUAngel'];
|
x0=[PD(PDi);QD(QDi);xVolt';xUAngel'];
|
||||||
[~,seOpti]=seOpti.equ(x0);
|
[~,seOpti]=seOpti.equ(x0);
|
||||||
nlrhs=seOpti.Geteb();
|
cl=seOpti.Getcl();
|
||||||
nle=seOpti.Getgle();
|
cu=seOpti.Getcu();
|
||||||
Opt = opti('fun',@seOpti.obj,'ndec',length(Volt)*2+length(PDi)+length(QDi),'nlmix',@seOpti.equ,nlrhs,nle,'options',opts)
|
Opt = opti('fun',@seOpti.obj,'ndec',length(Volt)*2+length(PDi)+length(QDi),'nl',@seOpti.equ,cl,cu,'options',opts)
|
||||||
% Opt = opti('fun',@seOpti.obj,'ndec',length(PDi)+length(QDi),'options',opts)
|
% Opt = opti('fun',@seOpti.obj,'ndec',length(PDi)+length(QDi),'options',opts)
|
||||||
[x,fval,exitflag,info] = solve(Opt,x0);
|
[x,fval,exitflag,info] = solve(Opt,x0);
|
||||||
info
|
info
|
||||||
|
|
@ -96,3 +96,5 @@ fprintf('
|
||||||
PD=x(1:length(PDi));
|
PD=x(1:length(PDi));
|
||||||
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
||||||
MaxDeviation(rVolt,SEVolt,rVAngel,SEVAngel,rPD(PDi),rQD(QDi),PD,QD)
|
MaxDeviation(rVolt,SEVolt,rVAngel,SEVAngel,rPD(PDi),rQD(QDi),PD,QD)
|
||||||
|
fprintf('ͳ¼ÆÆ«²î\n')
|
||||||
|
StatDeviation(rVolt,SEVolt,rVAngel,SEVAngel,rPD(PDi),rQD(QDi),PD,QD)
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
function [ output_args ] = StatDeviation( this,PG0,QG0,PD0,QD0 )%ͳ¼ÆÎó²î
|
||||||
|
%STATDEVIATION Summary of this function goes here
|
||||||
|
% Detailed explanation goes here
|
||||||
|
PDArray=PD;
|
||||||
|
PD0Array=repmat(PD0,1,1);
|
||||||
|
QD0Array=repmat(QD0,1,1);
|
||||||
|
PDDev=(PDArray-PD0Array)/0.05;
|
||||||
|
QDDev=(QDArray-QD0Array)/0.05;
|
||||||
|
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
|
||||||
|
|
||||||
|
|
@ -1,15 +1,14 @@
|
||||||
function [ output_args ] = StatDeviation( this,PG0,QG0,PD0,QD0 )%ͳ¼ÆÎó²î
|
function [ output_args ] = StatDeviation(rVolt,SEVolt,rVAngel,SEVAngel,rPD,rQD,PD,QD)%ͳ¼ÆÎó²î
|
||||||
%STATDEVIATION Summary of this function goes here
|
%STATDEVIATION Summary of this function goes here
|
||||||
% Detailed explanation goes here
|
% Detailed explanation goes here
|
||||||
|
PDArray=PD;
|
||||||
PD0Array=repmat(PD0,1,this.sampleNum);
|
QDArray=QD;
|
||||||
QD0Array=repmat(QD0,1,this.sampleNum);
|
PD0Array=repmat(rPD,1,1);
|
||||||
PDDev=(this.PDArray-PD0Array)/0.05;
|
QD0Array=repmat(rQD,1,1);
|
||||||
QDDev=(this.QDArray-QD0Array)/0.05;
|
PDDev=(PDArray-PD0Array)/0.05;
|
||||||
% PG0Array=repmat(PG0,this.sampleNum,1);
|
QDDev=(QDArray-QD0Array)/0.05;
|
||||||
% QG0Array=repmat(QG0,this.sampleNum,1);
|
% VoltDev=(SEVolt-rVolt)/0.05;
|
||||||
% PGDev=(PG0Array-this.PGArray)/0.01;
|
% VAngelDev=(SEVAngel-QD0Array)/0.05;
|
||||||
% QGDev=(QG0Array-this.QGArray)/0.01;
|
|
||||||
wholeMat=[PDDev;QDDev;];
|
wholeMat=[PDDev;QDDev;];
|
||||||
t1=wholeMat.^2;
|
t1=wholeMat.^2;
|
||||||
t2=sum(t1,1);
|
t2=sum(t1,1);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue