改用Opti Toolbox

Signed-off-by: facat <dugg@21cn.com>
This commit is contained in:
facat
2013-04-14 19:40:35 +08:00
parent f50bbd3435
commit 32f96a94f0
9 changed files with 203 additions and 47 deletions

33
@SEOpti/SEOpti.m Normal file
View File

@@ -0,0 +1,33 @@
classdef SEOpti
properties
mVolt=0;
mVAngel=0;
mBranchI=0;
mBranchP=0;
mBranchQ=0;
onlyPG=0;
onlyQG=0;
PG=0;
QG=0;
sigma=0;
Busnum=0;
lineI=0;
lineJ=0;
lineR=0;
lineX=0;
lineB2=0;
zerosInjectionIndex=0;
cmpY=0;
Balance=0;
end
methods
function [this]=SEOpti()
end
end
end

13
@SEOpti/equ.m Normal file
View File

@@ -0,0 +1,13 @@
function [ out_arg ] = equ(this, x )
%EQU Summary of this function goes here
% Detailed explanation goes here
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);
% Constraints=[SEVAngel(Balance)==0,PQ(zerosInjectionIndex)==0];
out_arg=[real(PQ(this.zerosInjectionIndex));imag(PQ(this.zerosInjectionIndex));];
out_arg=[out_arg;x(this.Busnum+this.Balance)];
end

25
@SEOpti/fun.m Normal file
View File

@@ -0,0 +1,25 @@
function [ Objective ] = fun(this, x )
%FUN Summary of this function goes here
% Detailed explanation goes here
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);%
%%
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);%%
%%
SEBranchP=real((cmpSEV(this.lineI)-cmpSEV(this.lineJ)).*conj(SEBranchI));
SEBranchQ=imag((cmpSEV(this.lineI)-cmpSEV(this.lineJ)).*conj(SEBranchI));
Objective=Objective+(SEBranchP-this.mBranchP)'*(1./this.sigma^2*eye(length(this.mBranchP)))*(SEBranchP-this.mBranchP);
Objective=Objective+(SEBranchQ-this.mBranchQ)'*(1./this.sigma^2*eye(length(this.mBranchQ)))*(SEBranchQ-this.mBranchQ);
% %% 0
PQ=diag(cmpSEV)*conj(this.cmpY*cmpSEV);
% zeroInjP=real(PQ(this.zerosInjectionIndex));%% 0
% zeroInjQ=imag(PQ(this.zerosInjectionIndex));%% 0
%%
Objective=Objective+(this.PG(this.onlyPG)-real(PQ(this.onlyPG)))'*(1./this.sigma^2*eye(length(this.PG(this.onlyPG))))*(this.PG(this.onlyPG)-real(PQ(this.onlyPG)));
Objective=Objective+(this.QG(this.onlyQG)-imag(PQ(this.onlyQG)))'*(1./this.sigma^2*eye(length (this.QG(this.onlyQG))))*(this.QG(this.onlyQG)-imag(PQ(this.onlyQG)));
end

21
@SEOpti/init.m Normal file
View File

@@ -0,0 +1,21 @@
function [ this ] = init(this,Busnum, mVolt,sigma,newwordParameter,zerosInjectionIndex,cmpY,onlyPG,onlyQG,PG,QG,Balance )
%INIT Summary of this function goes here
% Detailed explanation goes here
this.mVolt=mVolt;
this.sigma=sigma;
this.Busnum=Busnum;
this.lineI=newwordParameter.line.lineI;
this.lineJ=newwordParameter.line.lineJ;
this.lineR=newwordParameter.line.lineR;
this.lineX=newwordParameter.line.lineX;
this.lineB2=newwordParameter.line;
this.zerosInjectionIndex=zerosInjectionIndex;
this.cmpY=cmpY;
this.onlyPG=onlyPG;
this.onlyQG=onlyQG;
this.PG=PG;
this.QG=QG;
this.Balance=Balance;
end

7
@SEOpti/nle.m Normal file
View File

@@ -0,0 +1,7 @@
function [ output_args ] = nle( this )
%NLE Summary of this function goes here
% Detailed explanation goes here
output_args=zeros(2*length(this.zerosInjectionIndex)+1,1);
end

7
@SEOpti/nlrhs.m Normal file
View File

@@ -0,0 +1,7 @@
function [ output_args ] = nlrhs( this )
%NLRHS Summary of this function goes here
% Detailed explanation goes here
output_args=zeros(2*length(this.zerosInjectionIndex)+1,1);
end