stateestimateionyalmip-lu9-.../@Opti/obj.m

37 lines
1.1 KiB
Mathematica
Raw Normal View History

function [ output_args ] = obj( this,x )
%OBJ Summary of this function goes here
% Detailed explanation goes here
PDi=this.PDi;
QDi=this.QDi;
PD=x(1:length(PDi));
QD=x(length(PDi)+1:length(PDi)+length(QDi));
wPD=this.wPD;
wQD=this.wQD;
PD0=this.PD0;
QD0=this.QD0;
t4=(wPD(PDi).*(PD-PD0(PDi))).^2;
% t4=wPD(PDi).*((PD-PD0(PDi))./PD0(PDi)).^2;
t5=(wQD(QDi).*(QD-QD0(QDi))).^2;
% t5=wQD(QDi).*((QD-QD0(QDi))./QD0(QDi)).^2;
Volt0=this.Volt0;
SEVolt=x(length(PDi)+length(QDi)+1:length(PDi)+length(QDi)+length(Volt0));
wVolt=this.wVolt;
t6=(wVolt.*(SEVolt-Volt0)).^2;
% t6=wVolt.*((SEVolt-Volt0)./Volt0).^2;
Balance=this.Balance;
t6(Balance)=0;%<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><EFBFBD><EFBFBD>
% xx=t6(8);
% t6=xx;
% t6(9:end)=0;
% <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
SEVAngel=x(length(PDi)+length(QDi)+length(SEVolt)+1:end);
loadCurrent=LoadCurrent( SEVolt,SEVAngel,PD0(PDi),QD0(QDi),PDi,QDi );
wLoadCurrent=this.wLoadCurrent;
mLoadCurrent=this.mLoadCurrent;
% t7=(wLoadCurrent.*(loadCurrent-mLoadCurrent)).^2;
t7=wLoadCurrent.*((loadCurrent-mLoadCurrent)./mLoadCurrent).^2;
output_args=sum(t4)+sum(t5)+sum(t6)+sum(0);
output_args=full(output_args);
end