加入了负荷电流

Signed-off-by: facat <dugg@21cn.com>
This commit is contained in:
facat
2013-04-21 10:46:45 +08:00
parent c225bc4950
commit 1e06fb7127
17 changed files with 177 additions and 69 deletions

34
@Opti/Opti.asv Normal file
View File

@@ -0,0 +1,34 @@
classdef Opti
%OPTI Summary of this class goes here
% Detailed explanation goes here
properties
PD0=NaN;
QD0=NaN;
Volt0=NaN;
wPD=NaN;
wQD=NaN;
wVolt=NaN;
PDi=NaN;
QDi=NaN;
Y=NaN;
Angel=NaN;
r=NaN;
c=NaN;
PG=NaN;
QG=NaN;
cl=NaN;%opti toolbox大于小于等于
cu=NaN;%等式、不等式约束右边的值
Balance=NaN;
rPD=NaN;
rQD=NaN;
m
end
methods
function this=Opti()
end
end
end

View File

@@ -9,6 +9,7 @@ classdef Opti
wPD=NaN;
wQD=NaN;
wVolt=NaN;
wLoadCurrent=NaN;
PDi=NaN;
QDi=NaN;
Y=NaN;
@@ -22,6 +23,7 @@ classdef Opti
Balance=NaN;
rPD=NaN;
rQD=NaN;
mLoadCurrent=NaN;
end
methods

View File

@@ -23,7 +23,16 @@ busNum=length(Volt0);
VMatrix=sparse(r,c,VAngel(r)-VAngel(c)-Angel,busNum,busNum);
dP=PG-PD_-diag(Volt)*(Y.*cos(VMatrix))*Volt;
dQ=QG-QD_-diag(Volt)*(Y.*spfun(@sin,VMatrix))*Volt;
output_args=[dP;dQ;VAngel(Balance)];
output_args=[dP;dQ];
%% 使begin
% zeroInj=setdiff(1:busNum,union(Balance,union(PDi,QDi)));
% output_args=[output_args(zeroInj);output_args(length(PDi)+zeroInj)];
%% 使end
%
output_args=[output_args;Volt(Balance)-1];
%
output_args=[output_args;VAngel(Balance)];
this.cu=zeros(length(output_args),1);
this.cl=this.cu;
%% -\PD\QD
@@ -45,5 +54,6 @@ this.cl=[this.cl;0.8*rQD];
output_args=full(output_args);
this.cu=full(this.cu);
this.cl=full(this.cl);
end

View File

@@ -1,4 +1,4 @@
function [ this ] = init( this,Volt0,PDi,QDi,wPD,wQD,PD0,QD0,Y,Angel,r,c,PG,QG,Balance,rPD,rQD )
function [ this ] = init( this,Volt0,PDi,QDi,wPD,wQD,wVolt,wLoadCurrent,PD0,QD0,rPD,rQD,Y,Angel,r,c,PG,QG,Balance,mLoadCurrent)
%INIT Summary of this function goes here
% Detailed explanation goes here
this.PDi=PDi;
@@ -17,5 +17,8 @@ this.Balance=Balance;
this.Volt0=Volt0;
this.rPD=rPD;
this.rQD=rQD;
this.wVolt=wVolt;
this.wLoadCurrent=wLoadCurrent;
this.mLoadCurrent=mLoadCurrent;
end

View File

@@ -1,15 +1,22 @@
function [ output_args ] = obj( this )
function [ output_args ] = obj( this,x )
%OBJ Summary of this function goes here
% Detailed explanation goes here
PDi=this.PDi;
QDi=this.QDi;
PD=x(1:length(PDi));
QD=x(length(PDi)+1:length(PDi)+length(QDi));
wPD=this.wPD;
wQD=this.wQD;
PD=this.PD;
QD=this.QD;
wVolt=t
t4=wPD.*(PD(PD0~=0)-PD0(PD0~=0)).^2;
t5=wQD.*(QD(QD0~=0)-QD0(QD0~=0)).^2;
t6=wVolt.*(Volt-Volt0').^2;
out_arg=sum(t4)+sum(t5)+sum(t6);
% wVolt=this.wVolt;
PD0=this.PD0;
QD0=this.QD0;
t4=(wPD(PDi).*(PD-PD0(PDi))).^2;
t5=(wQD(QDi).*(QD-QD0(QDi))).^2;
Volt0=this.Volt0;
SEVolt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
wVolt
t6=(wVolt.*(SEVolt-Volt0)).^2;
output_args=sum(t4)+sum(t5)+sum(t6);
output_args=full(output_args);
end

View File

@@ -12,7 +12,19 @@ PD0=this.PD0;
QD0=this.QD0;
t4=(wPD(PDi).*(PD-PD0(PDi))).^2;
t5=(wQD(QDi).*(QD-QD0(QDi))).^2;
output_args=sum(t4)+sum(t5);
Volt0=this.Volt0;
SEVolt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
wVolt=this.wVolt;
t6=(wVolt.*(SEVolt-Volt0)).^2;
Balance=this.Balance;
t6(Balance)=0;%²»¼ÆËãÆ½ºâ½ÚµãµÄ
% µçÁ÷
SEVAngel=x(length(PDi)+length(QDi)+length(SEVolt)+1:end);
loadCurrent=LoadCurrent( SEVolt,SEVAngel,PD0(PDi),QD0(QDi),PDi,QDi );
wLoadCurrent=this.wLoadCurrent;
mLoadCurrent=this.mLoadCurrent;
t7=(wLoadCurrent.*(loadCurrent-mLoadCurrent)).^2;
output_args=sum(t4)+sum(t5)+sum(t7);
output_args=full(output_args);
end