From 202e7e62af17b60c4c65d550ea19f07907ff1516 Mon Sep 17 00:00:00 2001 From: facat Date: Tue, 23 Apr 2013 11:43:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E4=BA=86=E5=88=9D=E5=80=BC=EF=BC=8C?= =?UTF-8?q?=E6=95=88=E6=9E=9C=E5=BE=88=E5=A5=BD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: facat --- @SEOpti/equ.m | 3 ++- @SEOpti/fun.asv | 15 +++++++++------ @SEOpti/fun.m | 21 +++++++++++---------- TransPower.m | 2 +- TransReactivePower.m | 2 +- mBranchI.mat | Bin 0 -> 374 bytes mBranchP.mat | Bin 0 -> 357 bytes mBranchQ.mat | Bin 0 -> 373 bytes mPG.mat | Bin 0 -> 196 bytes mQG.mat | Bin 0 -> 218 bytes mTransP.mat | Bin 0 -> 205 bytes mTransQ.mat | Bin 0 -> 206 bytes mVolt.mat | Bin 0 -> 332 bytes run.asv | 38 +++++++++++++++++++++++++++++--------- run.m | 36 ++++++++++++++++++++++++++++-------- 15 files changed, 81 insertions(+), 36 deletions(-) create mode 100644 mBranchI.mat create mode 100644 mBranchP.mat create mode 100644 mBranchQ.mat create mode 100644 mPG.mat create mode 100644 mQG.mat create mode 100644 mTransP.mat create mode 100644 mTransQ.mat create mode 100644 mVolt.mat diff --git a/@SEOpti/equ.m b/@SEOpti/equ.m index d1e95d5..3e286bb 100644 --- a/@SEOpti/equ.m +++ b/@SEOpti/equ.m @@ -10,9 +10,10 @@ PQ=diag(cmpSEV)*conj(this.cmpY*cmpSEV); % PQ2=diag(SEVolt)*(this.Y.*sin(YAngle))*SEVolt; out_arg=[real(PQ(this.zerosInjectionIndex));imag(PQ(this.zerosInjectionIndex));]; % out_arg=[PQ1(this.zerosInjectionIndex);PQ2(this.zerosInjectionIndex);]; +% out_arg=[out_arg;x(this.Balance+this.Busnum)]; out_arg=[out_arg;x(this.Balance+this.Busnum)]; out_arg=full(out_arg); -this.mnle=zeros(2*length(this.zerosInjectionIndex)+1,1); +this.mnle=zeros(length(out_arg),1); this.mnlrhs=this.mnle; end diff --git a/@SEOpti/fun.asv b/@SEOpti/fun.asv index f23e6b8..e3682ed 100644 --- a/@SEOpti/fun.asv +++ b/@SEOpti/fun.asv @@ -4,9 +4,8 @@ function [ Objective ] = fun(this, x ) Objective=0; SEVolt=x(1:this.Busnum); SEVAngel=x(this.Busnum+1:2*this.Busnum); -Objective=(SEVolt-this.mVolt)'*(1./this.sigma^2*eye(length(this.mVolt)))*(SEVolt-this.mVolt);%电压 -% Objective=0; -% %% 支路电流 +Objective=sum(((SEVolt-this.mVolt)./this.sigma).^2);%电压 +%% 支路电流 cmpSEV=SEVolt.*exp(1j*SEVAngel); %复数电压 cmpSEBranchI=(cmpSEV(this.lineI)-cmpSEV(this.lineJ))./(this.lineR+1j*this.lineX);%复数支路电流 SEBranchI=abs(cmpSEBranchI);% 支路电流幅值 @@ -17,12 +16,16 @@ SEBranchQ=imag((cmpSEV(this.lineI)-cmpSEV(this.lineJ)).*conj(cmpSEBranchI)); Objective=Objective+sum((SEBranchP-this.mBranchP).^2/this.sigma^2); Objective=Objective+sum((SEBranchQ-this.mBranchQ).^2/this.sigma^2); %% 变压器 -newwordParameter=th -transP=TransPower( newwordParameter,cmpY,Volt,VAngel ); +newwordParameter=this.newwordParameter; +cmpY=this.cmpY; +transP=TransPower( newwordParameter,cmpY,SEVolt,SEVAngel ); +Objective=Objective+sum((transP-this.mTransP).^2/this.sigma^2); +transQ=TransReactivePower( newwordParameter,cmpY,SEVolt,SEVAngel ); +Objective=Objective+sum((transQ-this.mTransQ).^2/this.sigma^2); %% 0注入节点 PQ=diag(cmpSEV)*conj(this.cmpY*cmpSEV); %% 发电机注入功率 -% Objective=Objective+(this.mPG(this.onlyPG)-real(PQ(this.onlyPG)))'*(1./this.sigma^2*eye(length(this.mPG(this.onlyPG))))*(this.mPG(this.onlyPG)-real(PQ(this.onlyPG))); +Objective=Objective+(this.mPG(this.onlyPG)-real(PQ(this.onlyPG)))/this.sigmas.onlyPG)-real(PQ(this.onlyPG))); % Objective=Objective+(this.mQG(this.onlyQG)-imag(PQ(this.onlyQG)))'*(1./this.sigma^2*eye(length(this.mQG(this.onlyQG))))*(this.mQG(this.onlyQG)-imag(PQ(this.onlyQG))); end diff --git a/@SEOpti/fun.m b/@SEOpti/fun.m index 47fee30..ebe5058 100644 --- a/@SEOpti/fun.m +++ b/@SEOpti/fun.m @@ -4,29 +4,30 @@ function [ Objective ] = fun(this, x ) Objective=0; SEVolt=x(1:this.Busnum); SEVAngel=x(this.Busnum+1:2*this.Busnum); -Objective=(SEVolt-this.mVolt)'*(1./this.sigma^2*eye(length(this.mVolt)))*(SEVolt-this.mVolt);%电压 -% Objective=0; -% %% 支路电流 +Objective=sum(((SEVolt-this.mVolt)./this.sigma).^2);%电压 +%% 支路电流 cmpSEV=SEVolt.*exp(1j*SEVAngel); %复数电压 cmpSEBranchI=(cmpSEV(this.lineI)-cmpSEV(this.lineJ))./(this.lineR+1j*this.lineX);%复数支路电流 SEBranchI=abs(cmpSEBranchI);% 支路电流幅值 -Objective=Objective+sum((SEBranchI-this.mBranchI.^2).^2./this.sigma^2);%%电流 +% (SEBranchI-this.mBranchI).^2./(this.sigma^2) +Objective=Objective+sum((SEBranchI-this.mBranchI).^2./(this.sigma^2));%%电流 %% 线路功率 SEBranchP=real((cmpSEV(this.lineI)-cmpSEV(this.lineJ)).*conj(cmpSEBranchI)); SEBranchQ=imag((cmpSEV(this.lineI)-cmpSEV(this.lineJ)).*conj(cmpSEBranchI)); -Objective=Objective+sum((SEBranchP-this.mBranchP).^2/this.sigma^2); -Objective=Objective+sum((SEBranchQ-this.mBranchQ).^2/this.sigma^2); +% (SEBranchP-this.mBranchP).^2/(this.sigma^2)./(this.mBranchP.^2); +Objective=Objective+sum((SEBranchP-this.mBranchP).^2/(this.sigma^2)); +Objective=Objective+sum((SEBranchQ-this.mBranchQ).^2/(this.sigma^2)); %% 变压器 newwordParameter=this.newwordParameter; cmpY=this.cmpY; transP=TransPower( newwordParameter,cmpY,SEVolt,SEVAngel ); -Objective=Objective+sum((transP-this.mTransP).^2/this.sigma^2); +Objective=Objective+sum((transP-this.mTransP).^2/(this.sigma^2)); transQ=TransReactivePower( newwordParameter,cmpY,SEVolt,SEVAngel ); -Objective=Objective+sum((transQ-this.mTransQ).^2/this.sigma^2); +Objective=Objective+sum((transQ-this.mTransQ).^2/(this.sigma^2)); %% 0注入节点 PQ=diag(cmpSEV)*conj(this.cmpY*cmpSEV); %% 发电机注入功率 -% Objective=Objective+(this.mPG(this.onlyPG)-real(PQ(this.onlyPG)))'*(1./this.sigma^2*eye(length(this.mPG(this.onlyPG))))*(this.mPG(this.onlyPG)-real(PQ(this.onlyPG))); -% Objective=Objective+(this.mQG(this.onlyQG)-imag(PQ(this.onlyQG)))'*(1./this.sigma^2*eye(length(this.mQG(this.onlyQG))))*(this.mQG(this.onlyQG)-imag(PQ(this.onlyQG))); +% Objective=Objective+sum(((this.mPG(this.onlyPG)-real(PQ(this.onlyPG)))/this.sigma).^2); +% Objective=Objective+sum(((this.mQG(this.onlyQG)-imag(PQ(this.onlyQG)))./this.sigma).^2); end diff --git a/TransPower.m b/TransPower.m index 41fd53c..e0b924c 100644 --- a/TransPower.m +++ b/TransPower.m @@ -7,6 +7,6 @@ cmpSEV=Volt.*exp(1j*VAngel); % % cmpY=sparse(r,c,Y.*(1j*YAngel),length(Volt),length(Volt)); cmpSETransI=(cmpSEV(transI)-cmpSEV(transJ)).*cmpY(sub2ind(size(cmpY),transI,transJ)); SETransP=real((cmpSEV(transI)-cmpSEV(transJ)).*conj(cmpSETransI)); -output_args=SETransP; +output_args=full(SETransP); end diff --git a/TransReactivePower.m b/TransReactivePower.m index 7ca1d2f..bbffe3c 100644 --- a/TransReactivePower.m +++ b/TransReactivePower.m @@ -7,6 +7,6 @@ cmpSEV=Volt.*exp(1j*VAngel); % % cmpY=sparse(r,c,Y.*(1j*YAngel),length(Volt),length(Volt)); cmpSETransI=(cmpSEV(transI)-cmpSEV(transJ)).*cmpY(sub2ind(size(cmpY),transI,transJ)); SETransQ=imag((cmpSEV(transI)-cmpSEV(transJ)).*conj(cmpSETransI)); -output_args=SETransQ; +output_args=full(SETransQ); end diff --git a/mBranchI.mat b/mBranchI.mat new file mode 100644 index 0000000000000000000000000000000000000000..502780e6b452ae7aaa26dfab474cd7d66db37d60 GIT binary patch literal 374 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w>_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYi`V_;yYnDaO}At4|kB_Vn!`TG@n z)e<(H-S_3`zVCZlkH3lM)}3ZCr}W6Z1BnlJUT7D8vv|4o{g|q<=D+U!pZO+6r{BK6 j-DiJsc>dbIz6aGmC&iZCP}kXSyt?#sQZ++=o{u2_0#KI? literal 0 HcmV?d00001 diff --git a/mBranchP.mat b/mBranchP.mat new file mode 100644 index 0000000000000000000000000000000000000000..1ba197c6eed986cdc51d29c1975ca1a0e694e8a0 GIT binary patch literal 357 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w>_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYjRWnf^anDaO}AweJ^B_V;J=pv6tU2*8NtT zmgTqQ{QrP$2iI>rxi9bRKW{;{%5OE=r?!7dpK|NV%}%u8&&>WSDv?~?f;+3ZhUvO=%1~bU+~#;?Ao{5m&liw)+|lBU;Xv*$}2|d)ot===S|DmZ(4Kw Q+b{XU>zo{ew!ecd0RL%-ga7~l literal 0 HcmV?d00001 diff --git a/mBranchQ.mat b/mBranchQ.mat new file mode 100644 index 0000000000000000000000000000000000000000..d3655ba5a660f2d06d2cfb53b6d031eff0aa4e03 GIT binary patch literal 373 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w>_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYi`Wnf^anDaO}At4|kB_Vnzt7-4cD!#Md-J9Pi>&>52 z{waS#ZNY=8^O@zJ-g5WMyEiv3I%U1({eKNfZq0w2zTC+V%zO4NzJ7n<`TL7gR|5OLj25dbMtle+)_ literal 0 HcmV?d00001 diff --git a/mPG.mat b/mPG.mat new file mode 100644 index 0000000000000000000000000000000000000000..c08e25ae860c207f3373f6f7670a97af53100ee2 GIT binary patch literal 196 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w>_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYjNFfcGw%z2!gkPyLeB*)_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYg&F)%Px%z2!gkPyLeB*)&G+5*%m3Z^Imeb+>cY*S-EUk^ a)a}^uaa!&6x+^k=1Kc?n7@oI?oCg3uBSWzO literal 0 HcmV?d00001 diff --git a/mTransP.mat b/mTransP.mat new file mode 100644 index 0000000000000000000000000000000000000000..57d029211689d3882c402e56da9c5500c8a98aa5 GIT binary patch literal 205 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w>_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYi?GB7Yy%z2!gkifx^WTx<} z;gZ4uuBXP#hRPzFnG5qg0+Zqj8JN{4=rSG&{4G~h)nR?Z#{1^>+ZF5f^v?Ku=zTQ{ La}I-;1aC6{NkuoF literal 0 HcmV?d00001 diff --git a/mTransQ.mat b/mTransQ.mat new file mode 100644 index 0000000000000000000000000000000000000000..f7a3b7a40a434259d4b66d4edf066ecb9f8eeaae GIT binary patch literal 206 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w>_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYi?F)%Px%z2!gkifx^WTx<} z;gZ4uuBXP#hRPzFnG5qg0+Zqj6`0j0=rSJB{2pdkI@2<_-p^z1u76Aa{Y?wMuQ#W@ M{AwM8eT3jj0Dglw;{X5v literal 0 HcmV?d00001 diff --git a/mVolt.mat b/mVolt.mat new file mode 100644 index 0000000000000000000000000000000000000000..492b7862a05315f429d6608f975952be3719c19f GIT binary patch literal 332 zcmeZu4DoSvQZUssQ1EpO(M`+DN!3vZ$Vn_o%P-2cQV4Jk_w>_Ia4t$sEJ;mK$j`G< z2q{ffa4aZNFfvv!G_W$Yv@$VQFfuSSRv;NLFnap(GcYh5VPIgWnDaO}A>jw(ksOCJ zj7Qcm@$l3rNS$KeD7jEVWt#M~`N2%7(FP6-9(|l0GaF~HYOx#j%Vx2u3luXNnhShp zFw~#)lPAF1A&aZw#+>~9Hv;eVe+&M;ZpHT3zY_jGx_7DCxXJ#8H>*YLKdGMw>vmhM zUgmm_{r64XRN+^xcDK~e{rF+p{CM%-