2013-04-17 10:04:43 +08:00
|
|
|
|
function [ output_args,this ] = equ( this,x )
|
|
|
|
|
|
%EQU Summary of this function goes here
|
|
|
|
|
|
% Detailed explanation goes here
|
2014-04-14 15:12:07 +08:00
|
|
|
|
output_args=[];
|
2013-04-17 10:04:43 +08:00
|
|
|
|
PDi=this.PDi;
|
|
|
|
|
|
QDi=this.QDi;
|
|
|
|
|
|
Volt0=this.Volt0;
|
|
|
|
|
|
Angel=this.Angel;
|
|
|
|
|
|
r=this.r;
|
|
|
|
|
|
c=this.c;
|
|
|
|
|
|
PG=this.PG;
|
|
|
|
|
|
QG=this.QG;
|
|
|
|
|
|
Balance=this.Balance;
|
|
|
|
|
|
Y=this.Y;
|
|
|
|
|
|
PD=x(1:length(PDi));
|
|
|
|
|
|
QD=x(length(PDi)+1:length(PDi)+length(QDi));
|
|
|
|
|
|
Volt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
|
2013-04-17 11:15:22 +08:00
|
|
|
|
VAngel=x(length(PDi)+length(QDi)+length(Volt0)+1:end);
|
2013-04-17 10:04:43 +08:00
|
|
|
|
PD_=zeros(length(Volt0),1);
|
|
|
|
|
|
QD_=zeros(length(Volt0),1);
|
|
|
|
|
|
PD_(PDi)=PD;
|
|
|
|
|
|
QD_(QDi)=QD;
|
|
|
|
|
|
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;
|
2014-04-14 15:12:07 +08:00
|
|
|
|
output_args=[dP;dQ];%<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Լ<EFBFBD><EFBFBD>
|
2013-04-21 10:46:45 +08:00
|
|
|
|
%% ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>begin
|
|
|
|
|
|
% zeroInj=setdiff(1:busNum,union(Balance,union(PDi,QDi)));
|
2013-04-25 09:52:16 +08:00
|
|
|
|
% output_args=[output_args(zeroInj);output_args(length(Volt0)+zeroInj)];
|
2013-04-21 10:46:45 +08:00
|
|
|
|
%% ʹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ע<EFBFBD><EFBFBD>end
|
|
|
|
|
|
%<EFBFBD><EFBFBD>ѹ<EFBFBD>㶨
|
|
|
|
|
|
output_args=[output_args;Volt(Balance)-1];
|
|
|
|
|
|
%<EFBFBD><EFBFBD><EFBFBD>Ǻ㶨
|
|
|
|
|
|
output_args=[output_args;VAngel(Balance)];
|
2013-04-17 16:05:40 +08:00
|
|
|
|
this.cu=zeros(length(output_args),1);
|
2014-04-14 15:12:07 +08:00
|
|
|
|
this.cl=zeros(length(output_args),1);
|
2013-04-17 16:18:35 +08:00
|
|
|
|
%% <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD><EFBFBD>ʽԼ<EFBFBD><EFBFBD>-<EFBFBD><EFBFBD>ѹ\PD\QD
|
|
|
|
|
|
%<EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽԼ<EFBFBD><EFBFBD>
|
2013-04-17 16:10:17 +08:00
|
|
|
|
output_args=[output_args;Volt];
|
2014-04-14 15:12:07 +08:00
|
|
|
|
% this.cu=[this.cu;1.07*ones(length(Volt),1)];%9<EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
|
% this.cl=[this.cl;0.93*ones(length(Volt),1)];%9<EFBFBD>ڵ<EFBFBD>
|
|
|
|
|
|
this.cu=[this.cu;1.00*ones(length(Volt),1)];
|
|
|
|
|
|
this.cl=[this.cl;0.90*ones(length(Volt),1)];
|
2013-04-17 16:18:35 +08:00
|
|
|
|
%% PD
|
|
|
|
|
|
rPD=this.rPD;
|
|
|
|
|
|
output_args=[output_args;PD];
|
2014-04-14 15:12:07 +08:00
|
|
|
|
% PDU=[0.124;0.315;0.5;1;1;0.5;0.63;0.4];%ԭʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
% PDU=[0.63;0.4;0.5;1;0.8;1;0.63;0.4];%ƫ<EFBFBD><EFBFBD><EFBFBD>Ƚϴ<EFBFBD>
|
2015-03-18 20:32:01 +08:00
|
|
|
|
%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];
|
2014-04-14 15:12:07 +08:00
|
|
|
|
% this.cu=[this.cu;PDU];
|
|
|
|
|
|
% this.cl=[this.cl;0*PDU];
|
2013-04-17 16:19:45 +08:00
|
|
|
|
%% QD
|
|
|
|
|
|
rQD=this.rQD;
|
|
|
|
|
|
output_args=[output_args;QD];
|
2014-04-14 15:12:07 +08:00
|
|
|
|
% QDU=PDU;
|
2015-03-18 20:32:01 +08:00
|
|
|
|
this.cu=[this.cu;(r+1.4).*rQD];
|
|
|
|
|
|
this.cl=[this.cl;(r+1).*rQD];
|
2014-04-14 15:12:07 +08:00
|
|
|
|
% this.cu=[this.cu;QDU];
|
|
|
|
|
|
% this.cl=[this.cl;0*QDU];
|
2013-04-17 16:19:45 +08:00
|
|
|
|
%% <EFBFBD><EFBFBD><EFBFBD>ܻ<EFBFBD>
|
2013-04-17 16:18:35 +08:00
|
|
|
|
output_args=full(output_args);
|
|
|
|
|
|
this.cu=full(this.cu);
|
|
|
|
|
|
this.cl=full(this.cl);
|
2013-04-17 10:04:43 +08:00
|
|
|
|
end
|
|
|
|
|
|
|