From 059c5c20742605854f22c2a0251aa9cf1c02a541 Mon Sep 17 00:00:00 2001 From: facat Date: Sun, 14 Apr 2013 22:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E7=94=B5=E6=B5=81=E7=9A=84=E5=B9=B3?= =?UTF-8?q?=E6=96=B9=E8=80=8C=E4=B8=8D=E6=98=AF=E7=BB=9D=E5=AF=B9=E5=80=BC?= =?UTF-8?q?=EF=BC=8C=E5=9B=A0=E4=B8=BAabs=E7=9A=84=E5=AF=BC=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E5=A5=BD=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: facat --- @SEOpti/SEOpti.m | 4 ---- @SEOpti/equ.m | 10 +++++----- @SEOpti/fun.m | 4 ++-- @SEOpti/init.m | 10 +++++----- run.m | 2 +- 5 files changed, 13 insertions(+), 17 deletions(-) diff --git a/@SEOpti/SEOpti.m b/@SEOpti/SEOpti.m index 653e12b..e757fa3 100644 --- a/@SEOpti/SEOpti.m +++ b/@SEOpti/SEOpti.m @@ -20,10 +20,6 @@ classdef SEOpti Balance=NaN; mnle=NaN; mnlrhs=NaN; - Y=NaN; - Yangle=NaN; - r=NaN; - c=NaN; end methods diff --git a/@SEOpti/equ.m b/@SEOpti/equ.m index 7c41d19..8e2bfa0 100644 --- a/@SEOpti/equ.m +++ b/@SEOpti/equ.m @@ -5,11 +5,11 @@ SEVolt=x(1:this.Busnum); SEVAngel=x(this.Busnum+1:2*this.Busnum); cmpSEV=SEVolt.*exp(1j*SEVAngel); %复数电压 PQ=diag(cmpSEV)*conj(this.cmpY*cmpSEV); -YAngle=sparse(this.r,this.c,SEVAngel(this.r)-SEVAngel(this.c)-this.Yangle,this.Busnum,this.Busnum); -PQ1=diag(SEVolt)*(this.Y.*cos(YAngle))*SEVolt; -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);]; +% YAngle=sparse(this.r,this.c,SEVAngel(this.r)-SEVAngel(this.c)-this.Yangle,this.Busnum,this.Busnum); +% PQ1=diag(SEVolt)*(this.Y.*cos(YAngle))*SEVolt; +% 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.Busnum+this.Balance)]; out_arg=full(out_arg); this.mnle=zeros(2*length(this.zerosInjectionIndex)+1,1); diff --git a/@SEOpti/fun.m b/@SEOpti/fun.m index 284c4e0..6e4e726 100644 --- a/@SEOpti/fun.m +++ b/@SEOpti/fun.m @@ -8,8 +8,8 @@ Objective=(SEVolt-this.mVolt)'*(1./this.sigma^2*eye(length(this.mVolt)))*(SEVolt % %% 支路电流 cmpSEV=SEVolt.*exp(1j*SEVAngel); %复数电压 cmpSEBranchI=(cmpSEV(this.lineI)-cmpSEV(this.lineJ))./(this.lineR+1j*this.lineX);%复数支路电流 -% SEBranchI=abs(cmpSEBranchI);% 支路电流幅值 -% Objective=Objective+(SEBranchI-this.mBranchI)'*(1./this.sigma^2*eye(length(this.mBranchI)))*(SEBranchI-this.mBranchI);%%电流 +SEBranchI=real(cmpSEBranchI).^2+imag(cmpSEBranchI).^2;% 支路电流幅值 +Objective=Objective+(SEBranchI-this.mBranchI.^2)'*(1./this.sigma^2*eye(length(this.mBranchI)))*(SEBranchI-this.mBranchI.^2);%%电流 %% 支路功率 SEBranchP=real((cmpSEV(this.lineI)-cmpSEV(this.lineJ)).*conj(cmpSEBranchI)); SEBranchQ=imag((cmpSEV(this.lineI)-cmpSEV(this.lineJ)).*conj(cmpSEBranchI)); diff --git a/@SEOpti/init.m b/@SEOpti/init.m index ddcf88c..7f5b04e 100644 --- a/@SEOpti/init.m +++ b/@SEOpti/init.m @@ -1,4 +1,4 @@ -function [ this ] = init(this,Busnum, mVolt,sigma,newwordParameter,zerosInjectionIndex,cmpY,onlyPG,onlyQG,mPG,mQG,Balance,mBranchI,mBranchP,mBranchQ,Y,Yangle,r,c ) +function [ this ] = init(this,Busnum, mVolt,sigma,newwordParameter,zerosInjectionIndex,cmpY,onlyPG,onlyQG,mPG,mQG,Balance,mBranchI,mBranchP,mBranchQ) %INIT Summary of this function goes here % Detailed explanation goes here this.mVolt=mVolt; @@ -19,9 +19,9 @@ function [ this ] = init(this,Busnum, mVolt,sigma,newwordParameter,zerosInjectio this.mBranchI=mBranchI; this.mBranchP=mBranchP; this.mBranchQ=mBranchQ; - this.Y=Y; - this.Yangle=Yangle; - this.r=r; - this.c=c; +% this.Y=Y; +% this.Yangle=Yangle; +% this.r=r; +% this.c=c; end diff --git a/run.m b/run.m index 2151b02..97499c8 100644 --- a/run.m +++ b/run.m @@ -95,7 +95,7 @@ onlyQG=setdiff(QGi,PDQDi); %% Opti ToolBox Busnum=length(Volt); seOpti=SEOpti(); -seOpti=seOpti.init(Busnum, mVolt,sigma,newwordParameter,zerosInjectionIndex,cmpY,onlyPG,onlyQG,mPG,mQG,Balance,mBranchI,mBranchP,mBranchQ,Y,Yangle,r,c ); +seOpti=seOpti.init(Busnum, mVolt,sigma,newwordParameter,zerosInjectionIndex,cmpY,onlyPG,onlyQG,mPG,mQG,Balance,mBranchI,mBranchP,mBranchQ); opts = optiset('solver','ipopt'); opts.maxiter=3500; opts.tolrfun=1e-3;