23 lines
718 B
Mathematica
23 lines
718 B
Mathematica
|
|
function ddg=func_ddg(PGi,PVi,Busnum,ContrlCount,RestraintCount,Loadi,PD,QD,Init_Z,Init_W)
|
|||
|
|
% <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵ<EFBFBD><EFBFBD>
|
|||
|
|
InitZW=Init_Z+Init_W;
|
|||
|
|
loc=InitZW(length(PGi)+length(PVi)+length(Loadi)*1+Busnum+1:RestraintCount);
|
|||
|
|
PD_=PD(Loadi);
|
|||
|
|
QD_=QD(Loadi);
|
|||
|
|
t1=sparse(length(PGi)+length(PVi),ContrlCount);
|
|||
|
|
t21=sparse(length(PD_),length(PGi)+length(PVi));
|
|||
|
|
t22=diag(sparse(-2./PD_.^2-2*(QD_.^2-PD_.^2)./( PD_.^2+QD_.^2).^2))*diag(loc);%dF/dPdP
|
|||
|
|
t23=diag(sparse(4*PD_.*QD_./(PD_.^2+QD_.^2).^2))*diag(loc); %dF/dPdQ
|
|||
|
|
t24=sparse(length(PD_),2*Busnum);
|
|||
|
|
t31=t21;
|
|||
|
|
t32=t23;
|
|||
|
|
t33=diag(sparse(-2*(PD_.^2-QD_.^2)./(PD_.^2+QD_.^2).^2 ))*diag(loc);
|
|||
|
|
t34=t24;
|
|||
|
|
t4=sparse(Busnum*2,ContrlCount);
|
|||
|
|
ddg=[
|
|||
|
|
t1;
|
|||
|
|
t21,t22,t23,t24;
|
|||
|
|
t31,t32,t33,t34;
|
|||
|
|
t4;
|
|||
|
|
];
|
|||
|
|
end
|