distributionnetwork-power2c.../Solv.m

16 lines
412 B
Matlab
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function [dV, dVangle]=Solv(busNum,jaco,dP,dQ)
%y=klu (jaco, '\', full(-[dP;dQ]));
y=jaco\(-[dP;dQ]);
% [L,U] = luinc(jaco,1e-3); %luinc(A,'0')也可以试一下是一种完全不同的ILU
% tol=1e-5; %残量的精度要求
% restart=30; % 30-50之间吧不要过小
% maxit=100; %看情况,如果不收敛就适当调大
% [x,flag]=gmres(jaco,-[dP;dQ],restart,tol,maxit);
% y=sparse(x);
y=sparse(y);
dV=y(1:busNum);
dVangle=y(busNum+1:end);
end