34 lines
1.5 KiB
Matlab
34 lines
1.5 KiB
Matlab
function [ Objective ] = fun(this, x )
|
|
%FUN Summary of this function goes here
|
|
% Detailed explanation goes here
|
|
Objective=0;
|
|
SEVolt=x(1:this.Busnum);
|
|
SEVAngel=x(this.Busnum+1:2*this.Busnum);
|
|
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);% 支路电流幅值
|
|
% (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));
|
|
% (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));
|
|
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+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
|
|
|