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