fd_lflow - % update voltages at PQ buses only...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Fast Decoupled Newton Raphson Method % tolerance=0.01; % Allowable error iter=0; % Iteration count maxiter=50; % Maximum number of iterations time=cputime; % cpu time reset % Input load data ex7_9; e % Calculate the initial mismatches (all divided by voltage magnitude) deltaPv = zeros(n,1); deltaQv = zeros(n,1); V = V.*(cos(delta)+j*sin(delta)); Sv = (cos(delta)+j*sin(delta)).*conj(Ybus*V) % Power injections S deltaPv(2:n) = diag(abs(V(2:n)))^(-1)*P(2:n) - real(Sv(2:n)) deltaQv(ng+1:n) = diag(abs(V(ng+1:n)))^(-1)*Q(ng+1:n) - imag(Sv(ng+1:n)) error=max(abs(deltaPv+j*deltaQv)); e % Initialize the update vectors deltadelta=zeros(n,1); deltaV=zeros(n,1); % Bp and Bpp for calculating angle and voltage updates respectively Bpinv = Bp(2:n,2:n)^(-1); Bppinv = Bpp(ng+1:n,ng+1:n)^(-1); B % Iteration loop iter=iter+1; % update angles at PV and PQ buses deltadelta(2:n) = Bpinv*deltaPv(2:n); delta = delta+deltadelta; % Note: this update angles can be used to calculate deltaQv but not done here
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % update voltages at PQ buses only deltaV(ng+1:n)= Bppinv*deltaQv(ng+1:n); V = abs(V)+deltaV; V = diag(V)*(cos(delta)+j*sin(delta)); % Calculation of injections divided by voltage magnitude Sv = diag(cos(delta)+j*sin(delta))*conj(Ybus*V); % Mismatches based on calculated voltage deltaPv(2:n) = diag(abs(V(2:n)))^(-1)*P(2:n) - real(Sv(2:n)); deltaQv(ng+1:n) = diag(abs(V(ng+1:n)))^(-1)*Q(ng+1:n) - imag(Sv(ng+1:n)); error=max(abs(deltaPv+j*deltaQv)); % New error end e % Solution % Voltages Vmag=abs(V) % Angles delta=angle(V)*180/pi % Injections S = V.*conj(Ybus*V); % Calculation of line flows Sflow = zeros(n,1);for ii=1:n % Negative since Ybusij is the negative of the line admittance for jj=ii+1:n if Ybus(ii,jj) ~= 0, Sflow(ii,jj) = - V(ii)*conj((V(ii)-V(jj))*Ybus(ii,jj)); end if Ybus(jj,ii) ~= 0, Sflow(jj,ii) = - V(jj)*conj((V(jj)-V(ii))*Ybus(jj,ii)); end endend% Iterations iter time=cputime-time...
View Full Document

Ask a homework question - tutors are online