# nr_lflow - deltaQ(ng+1:n)./abs(V(ng+1:n))]; V =...

This preview shows pages 1–2. Sign up to view the full content.

% Full 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 deltaP = zeros(n,1); deltaQ = zeros(n,1); V = V.*(cos(delta)+j*sin(delta)); S=V.*conj(Ybus*V); % Power injections deltaP(2:n) = P(2:n) - real(S(2:n)); deltaQ(ng+1:n) = Q(ng+1:n) - imag(S(ng+1:n)) error=max(abs(deltaP+j*deltaQ)); e % Initialize the update vectors deltadelta=zeros(n,1); deltaV=zeros(n,1); d % Iteration loop iter=iter+1; % Calculation of jacobian and inverse jacobian; J Jinv=J^(-1); % update angles at PV and PQ buses deltadelta(2:n) = Jinv(1:n-1,:)*[deltaP(2:n); deltaQ(ng+1:n)./abs(V(ng+1:n))]; delta = delta+deltadelta; % update voltages at PQ buses only deltaV(ng+1:n)= Jinv(n:2*n-ng-1,:)*[deltaP(2:n);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: deltaQ(ng+1:n)./abs(V(ng+1:n))]; V = abs(V)+deltaV; V = V.*(cos(delta)+j*sin(delta)); % Calculation of injections based on calculated voltage S = V.*conj(Ybus*V); % Mismatches based on calculated voltage deltaP(2:n) = P(2:n) - real(S(2:n)); deltaQ(ng+1:n) = Q(ng+1:n) - imag(S(ng+1:n)); error=max(abs(deltaP+j*deltaQ)); % New error end e % Solution % Voltages Vmag=abs(V) 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 end end e % Iterations and computations iter time=cputime-time...
View Full Document

## This note was uploaded on 07/14/2011 for the course ECE 522 taught by Professor Tomsovic during the Summer '10 term at University of Florida.

### Page1 / 2

nr_lflow - deltaQ(ng+1:n)./abs(V(ng+1:n))]; V =...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online