function [ output_args ] = obj( this,x ) %OBJ Summary of this function goes here % Detailed explanation goes here PDi=this.PDi; QDi=this.QDi; wPD=this.wPD; wQD=this.wQD; PD0=this.PD0; QD0=this.QD0; Volt0=this.Volt0; SEVolt=x(1:length(Volt0)); wVolt=this.wVolt; % wVolt=ones(length(wVolt),1); t6=(wVolt.*((SEVolt-Volt0))).^2; Balance=this.Balance; t6(Balance)=0;%不计算平衡节点的 % 电流 SEVAngel=x(length(SEVolt)+1:end); busNum=length(Volt0); Angel=this.Angel; r=this.r; c=this.c; PG=this.PG; QG=this.QG; Y=this.Y; VMatrix=sparse(r,c,SEVAngel(r)-SEVAngel(c)-Angel,busNum,busNum); PD_=PG-diag(SEVolt)*(Y.*cos(VMatrix))*SEVolt; QD_=QG-diag(SEVolt)*(Y.*spfun(@sin,VMatrix))*SEVolt; t4=(wPD(PDi).*(PD_(PDi)-PD0(PDi))).^2; t5=(wQD(QDi).*(QD_(QDi)-QD0(QDi))).^2; % 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); output_args=sum(t6)+sum(t4)+sum(t5); output_args=full(output_args); end