0% found this document useful (0 votes)
102 views11 pages

Experiment 3 - Newton Raphson

The document describes performing power flow analysis for a given power system using the Newton-Raphson method in MATLAB. It includes the MATLAB code to model the system, calculate the Jacobian matrix, solve for bus voltage corrections, and check for power mismatch convergence. The output shows the iterative process converges within 3 iterations with decreasing mismatch values.

Uploaded by

Arvind Sriram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views11 pages

Experiment 3 - Newton Raphson

The document describes performing power flow analysis for a given power system using the Newton-Raphson method in MATLAB. It includes the MATLAB code to model the system, calculate the Jacobian matrix, solve for bus voltage corrections, and check for power mismatch convergence. The output shows the iterative process converges within 3 iterations with decreasing mismatch values.

Uploaded by

Arvind Sriram
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

EXP 3: POWER FLOW ANALYSIS USING NEWTON

RAHPSON METHOD
AIM:

To develop a MATLAB program to perform power flow analysis for a given


system using Newton-Raphson Method.

APPARATUS:

S.no Software Version

1. MATLAB R2022a

FORMULAE:
MATLAB CODE:
clc;clear;
format short g;
format compact;

% SNO FB TB IMPEDANCE CHG ADMITTANCE


line = [1 1 2 0.09i 0;
2 2 3 0.1i 0;
3 3 1 0.11i 0];

% BNo Type P Q |V| Delta


bus = [1 0 NaN NaN 1.01 0;
2 1 0.95 NaN 1.03 0;
3 2 -1.3 -0.8 1 0;];

V=bus(:,5);

nlines = length(line(:,1));
FB = line(:,2);
TB = line(:,3);
nbuses = max(max(FB),max(TB));
y = zeros(nbuses);

delta = zeros(nbuses-1,1);

for k = 1 : nlines
l = line(k,2);
m = line(k,3);
y(l,l) = y(l,l) + 1/line(k,4) + line(k,5);
y(m,m) = y(m,m) + 1/line(k,4) + line(k,5);
y(m,l) = - 1/line(k,4);
y(l,m) = y(m,l);
end
YBus = y;

for i = 1:nbuses
for j = 1:nbuses
ybusR(i,j) = abs(YBus(i,j));
ybusA(i,j) = rad2deg(angle(YBus(i,j)));
end
end

%mismatch vectors

w=0;
for n=1:nbuses % total no of PV buses
if bus(n,2) == 1
w=w+1;
end
end

u=0;
for n=2:nbuses % total no of PQ buses
if bus(n,2)== 2
u=u+1;
end
end

power_mismatch = 1;
iter = 0;

while(power_mismatch>0.00025 && iter<100)


iter = iter +1
for i = 2:nbuses
sum = 0;
for n = 1:nbuses

sum = sum +
(ybusR(i,n)*bus(n,5)*bus(i,5))*cos((deg2rad(ybusA(i,n)))+bus(n
,6)-bus(i,6)); % multiplying admittance & voltage

end

delta(i-1) = bus(i,3) - sum;


end

for i = 2:nbuses
sum = 0;
if(bus(i,2) == 2)
for n = 1:nbuses
sum = sum +
(ybusR(i,n)*bus(n,5)*bus(i,5))*sin(deg2rad((ybusA(i,n)))+bus(n
,6)-bus(i,6)); % multiplying admittance & voltage
delta(i) = bus(i,4) + sum;
end
end
end
delta

J11=zeros(nbuses-1,nbuses-1);
J12=zeros(nbuses-1,u);
J21=zeros(u,nbuses-1);
J22=zeros(u,u);

%----------------------------H-------------------------------%
for i=2:nbuses
for j=2:nbuses
if i~=j
J11(i-1,j-1)= -abs(((ybusR(i,j)*
V(i)*V(j)))*sind((ybusA(i,j))+bus(j,6)-bus(i,6)));
end
if i==j
for n=1:nbuses
if n~=i
J11(i-1,i-1)=J11(i-1,i-1)+(
abs(((ybusR(i,n)* V(i)*V(n)))*sind((ybusA(i,n))+bus(n,6)-
bus(i,6))));
end
end
end
end
end
J11;

%----------------------------N-------------------------------%
for i=2:nbuses
for j=2:nbuses-w

if bus(j,2)== 1
if i~=j
J12(i-1,j-1)= (abs(V(j))*abs((ybusR(i,j)*
V(i))))*cosd((ybusA(i,j))+bus(j,6)-bus(i,6));
end

yv12=0;
if i==j
for n=1:nbuses
if n~=i
yv12=yv12 + abs((ybusR(i,n)*
V(n)))*cosd((ybusA(i,n))+bus(n,6)-bus(i,6));

end
end
J12(i-1,j-1) =
abs(V(i))*(2*abs(V(i))*real(YBus(i,i))+yv12);
end
end
end
end
J12;

%----------------------------J-------------------------------%

for i=2:nbuses-w
if bus(i,2)== 1
for j=2:nbuses
if i~=j
J21(i-1,j-1)= abs(((ybusR(i,j)*
V(i)*V(j)))*cosd((ybusA(i,j))+bus(j,6)-bus(i,6)));
end

if i==j
for n=1:nbuses
if n~=i
J21(i-1,j-1)=J21(i-1,j-1)+( -
abs(((ybusR(i,n)* V(i)*V(n)))*cosd((ybusA(i,n))+bus(n,6)-
bus(i,6))));
end
end
end
end
end
end
J21;

%----------------------------L-------------------------------%

for i=2:nbuses-w
for j=2:nbuses-w
if bus(i,2)== 1 && bus(j,2) == 1
if i~=j
J22(i-1,j-1)= -(abs(V(j))*abs((ybusR(i,j)*
V(i))))*sind((ybusA(i,j))+bus(j,6)-bus(i,6));
end

yv12=0;
if i==j
J22(i-1,i-1)=-(J11(i,i)) -
(2*(abs(V(i+1))^2)*imag(YBus(i+1,i+1)));
end
end
end
end
J22;

J = [J11 , J12 ; J21 , J22];


J
del = J\delta

for i = 2 : nbuses
bus(i,6) = bus(i,6) + del(i-1);
if bus(i,2) == 2
bus(i,5) = bus(i,5) + del(i);
end
end
bus

power_mismatch = max(abs(delta))
% finding line flows

Ii = zeros(nbuses,nbuses);
nbranch = length(bus(:,1));
fb = line(:,2);
tb = line(:,3);

for i = 1 : nbuses
Vnew(i) = bus(i,5) * exp(1i * bus(i,6));
end
Vnew

% lineflows
for i = 1 : nbranch
Ii(fb(i),tb(i)) = (Vnew(fb(i)) - Vnew(tb(i))) * (-
YBus(fb(i),tb(i)));
Ii(tb(i),fb(i)) = -Ii(fb(i),tb(i));
end
Ii

lineflows = zeros(nbuses,nbuses);
for i = 1 : nbranch
lineflows(fb(i),tb(i)) = (Vnew(fb(i))) *
conj(Ii(fb(i),tb(i)));
lineflows(tb(i),fb(i)) = (Vnew(tb(i))) *
conj(Ii(tb(i),fb(i)));
end
lineflows

% losses

for i = 1:nbranch
losses(i) = lineflows(fb(i),tb(i)) +
lineflows(tb(i),fb(i));
end

losses

% power injected at each bus


I_inj = zeros(nbuses,1);
S_inj = zeros(nbuses,1);

for i = 1: nbuses
for j = 1 : nbuses
I_inj(i) = I_inj(i) + (YBus(i,j) * Vnew(j));
end
S_inj(i) = Vnew(i) * conj(I_inj(i));
end
I_inj
S_inj
end

OUTPUT:
iter =
1

delta =
0.95
-1.3
-0.40909

J =
21.859 -10.3 0
-10.3 19.482 0
0 0 18.7

del =
0.016005
-0.058267
-0.021877

bus =
1 0 NaN NaN 1.01 0
2 1 0.95 NaN 1.03 0.016005
3 2 -1.3 -0.8 0.97812 -0.058267

power_mismatch =
1.3

Vnew =
1.01 + 0i 1.0299 + 0.016484i 0.97646 - 0.05696i

Ii =
0 + 0i -0.18316 + 0.22076i 0.51782 - 0.30488i
0.18316 - 0.22076i 0 + 0i 0.73445 - 0.53405i
-0.51782 + 0.30488i -0.73445 + 0.53405i 0 + 0i

lineflows =
0 + 0i -0.18499 - 0.22296i 0.523 + 0.30793i
0.18499 + 0.23037i 0 + 0i 0.74758 + 0.5621i
-0.523 - 0.26821i -0.74758 - 0.47964i 0 + 0i

losses =
0 + 0.0074053i 0 + 0.082461i 0 + 0.03972i

I_inj =
0.33466 - 0.08412i
0.9176 - 0.7548i
-1.2523 + 0.83892i
S_inj =
0.33801 + 0.084961i
0.93257 + 0.79247i
-1.2706 - 0.74785i

iter =
2

delta =
0.017431
-0.029423
-0.052153

J =
21.859 -10.3 0.016581
-10.3 19.482 -0.013352
-0.016581 0.013352 18.7

del =
0.00011587
-0.0014509
-0.0027878

bus =
1 0 NaN NaN 1.01 0
2 1 0.95 NaN 1.03 0.016121
3 2 -1.3 -0.8 0.97534 -0.059718

power_mismatch =
0.052153

Vnew =
1.01 + 0i 1.0299 + 0.016604i 0.9736 - 0.058211i

Ii =
0 + 0i -0.18448 + 0.22074i 0.52919 - 0.33094i
0.18448 - 0.22074i 0 + 0i 0.74814 - 0.56269i
-0.52919 + 0.33094i -0.74814 + 0.56269i 0 + 0i

lineflows =
0 + 0i -0.18633 - 0.22294i 0.53448 + 0.33424i
0.18633 + 0.23039i 0 + 0i 0.76114 + 0.59192i
-0.53448 - 0.29139i -0.76114 - 0.50428i 0 + 0i

losses =
0 + 0.0074483i 0 + 0.087634i 0 + 0.042851i

I_inj =
0.3447 - 0.1102i
0.93263 - 0.78343i
-1.2773 + 0.89363i
S_inj =
0.34815 + 0.1113i
0.94747 + 0.82231i
-1.2956 - 0.79568i

iter =
3

delta =
0.002527
-0.0043776
-0.004322

J =
21.859 -10.3 0.016886
-10.3 19.482 -0.013633
-0.016886 0.013633 18.7

del =
1.3086e-05
-0.00021794
-0.00023095

bus =
1 0 NaN NaN 1.01 0
2 1 0.95 NaN 1.03 0.016134
3 2 -1.3 -0.8 0.9751 -0.059936

power_mismatch =
0.0043776

Vnew =
1.01 + 0i 1.0299 + 0.016617i 0.97335 - 0.058409i

Ii =
0 + 0i -0.18463 + 0.22073i 0.53099 -0.33315i
0.18463 - 0.22073i 0 + 0i 0.75026 -0.56512i
-0.53099 + 0.33315i -0.75026 + 0.56512i 0 + 0i

lineflows =
0 + 0i -0.18648 - 0.22294i 0.5363 + 0.33648i
0.18648 + 0.23039i 0 + 0i 0.76328 + 0.59447i
-0.5363 - 0.29326i -0.76328 - 0.50624i 0 + 0i

losses =
0 + 0.0074532i 0 + 0.088225i 0 + 0.043223i

I_inj =
0.34636 - 0.11241i
0.93489 - 0.78585i
-1.2813 + 0.89827i

S_inj =
0.34982 + 0.11354i
0.94976 + 0.82486i
-1.2996 - 0.7995i

RESULT:

Thus, the power flow analysis using Newton Raphson method was carried
out in MATLAB and the results were verified.

You might also like