You are on page 1of 31

EE-343

Mid Semester Examination

Name: Atul Kumar


Roll No: 19084007
Branch: Electrical Engineering(IDD)
Next slides are for NRLF
Main file:
22/2/22 1:42 AM D:\Software\MATLAB\bin\NRLF_main.m 1 of 2

clear;
clc;

basemva = 100; accuracy = 0.0001; accel = 1.1; maxiter = 100;

% 22 Bus system
% Bus Bus Voltage Angle ---Load---- -------Generator----- Static Mvar
% No code Mag. Degree MW Mvar MW Mvar Qmin Qmax +Qc/-Ql
busdata=[1 1 1.01 0.0 0.0 0.0 0.0 0.0 0 0 0
2 0 1.0 0.0 13.5 32.0 0.0 0.0 0 0 0
3 0 1.0 0.0 12 43 0.0 0.0 0 0 0
4 0 1.0 0.0 25.4 30 0.0 0.0 0 0 0
5 0 1.0 0.0 15 45.0 0.0 0.0 0 0 0
6 0 1.0 0.0 34 57 0.0 0.0 0 0 0
7 0 1.0 0.0 25 40 0.0 0.0 0 0 0
8 0 1.0 0.0 22.5 60.0 0.0 0.0 0 0 0
9 0 1.0 0.0 23.5 24.5 0.0 0.0 0 0 0
10 0 1.0 0.0 16 22 0.0 0.0 0 0 0
11 0 1.0 0.0 24 28 0.0 0.0 0 0 0
12 0 1.0 0 12 20 0 0 0 0 0
13 0 1.0 0 23 24 0 0 0 0 0
14 0 1.0 0 32 41 0 0 0 0 0
15 0 1.0 0 40 50 0 0 0 0 0
16 0 1.0 0 31.5 24 0 0 0 0 0
17 0 1.0 0 20.0 34 0 0 0 0 0
18 0 1.0 0 15 42 0 0 0 0 0
19 2 1.015 0 0 12.5 35 0 0 0 0
20 2 1.02 0 0 10 25 0 0 0 0
21 2 1.025 0 0 20 25 0 0 0 0
22 2 1.05 0 0 24 15 0 0 0 0];

% Line code
% Bus bus R X 1/2 B = 1 for lines
% nl nr p.u. p.u. p.u. > 1 or < 1 tr. tap at bus nl
linedata=[1 4 0.03 0.21 0.04 1
1 5 0.05 0.15 0.01 1
1 9 0.02 0.2 0.01 1
2 3 0.021 0.18 0.028 1
2 10 0.04 0.15 0.021 1
2 20 0.024 0.2 0.026 1
2 21 0.01 0.136 0.01 1
3 7 0.025 0.24 0.06 1
3 12 0.015 0.125 0.013 1
5 13 0.028 0.25 0.02 1
5 18 0.05 0.15 0.021 1
6 11 0.02 0.14 0.025 1
6 15 0.04 0.2 0 1
6 20 0.03 0.12 0.02 1
6 22 0.01 0.16 0.02 1
7 19 0.035 0.15 0.03 1
7 21 0.01 0.136 0.01 1
8 20 0.02 0.16 0.05 1
9 16 0.025 0.16 0.06 1
10 15 0.021 0.25 0.02 1
10 20 0.02 0.1 0.03 1
11 18 0.01 0.15 0.028 1
13 17 0.04 0.12 0.024 1
14 19 0.024 0.14 0.018 1
15 18 0.026 0.156 0.015 1
15 20 0.027 0.164 0.005 1
17 20 0.01 0.14 0.02 1
1 8 0 0.15 0 1.01
8 13 0 0.25 0 1.02
8 22 0 0.2 0 1.02];

Helper1 % form the bus admittance matrix


NRLF % Load flow solution by Newton Raphson method
Helper2 % Prints the power flow solution on the screen
22/2/22 1:42 AM D:\Software\MATLAB\bin\NRLF_main.m 2 of 2

Helper3 % Computes and displays the line flow and losses


NRLF function:
22/2/22 1:42 AM D:\Software\MATLAB\bin\NRLF.m 1 of 3

% Power flow solution by Newton-Raphson method

ns=0; ng=0; Vm=0; delta=0; yload=0; deltad=0;


NumberOfBus = length(busdata(:,1));
for k=1:NumberOfBus
n=busdata(k,1);
kb(n)=busdata(k,2); Vm(n)=busdata(k,3); delta(n)=busdata(k, 4);
Pd(n)=busdata(k,5); Qd(n)=busdata(k,6); Pg(n)=busdata(k,7); Qg(n) = busdata(k,8);
Qmin(n)=busdata(k, 9); Qmax(n)=busdata(k, 10);
Qsh(n)=busdata(k, 11);
if Vm(n) <= 0 Vm(n) = 1.0; V(n) = 1 + j*0;
else delta(n) = pi/180*delta(n);
V(n) = Vm(n)*(cos(delta(n)) + j*sin(delta(n)));
P(n)=(Pg(n)-Pd(n))/basemva;
Q(n)=(Qg(n)-Qd(n)+ Qsh(n))/basemva;
S(n) = P(n) + j*Q(n);
end
end
for k=1:NumberOfBus
if kb(k) == 1, ns = ns+1; else, end
if kb(k) == 2 ng = ng+1; else, end
ngs(k) = ng;
nss(k) = ns;
end
Ym=abs(Ybus); t = angle(Ybus);
m=2*NumberOfBus-ng-2*ns;
maxerror = 1; converge=1;
iter = 0;
% Start of iterations
clear A DC J DX
while maxerror >= accuracy & iter <= maxiter % Test for max. power mismatch
for i=1:m
for k=1:m
A(i,k)=0; %Initializing Jacobian matrix
end, end
iter = iter+1;
for n=1:NumberOfBus
nn=n-nss(n);
lm=NumberOfBus+n-ngs(n)-nss(n)-ns;
J11=0; J22=0; J33=0; J44=0;
for i=1:NBR
if nl(i) == n | nr(i) == n
if nl(i) == n, l = nr(i); end
if nr(i) == n, l = nl(i); end
J11=J11+ Vm(n)*Vm(l)*Ym(n,l)*sin(t(n,l)- delta(n) + delta(l));
J33=J33+ Vm(n)*Vm(l)*Ym(n,l)*cos(t(n,l)- delta(n) + delta(l));
if kb(n)~=1
J22=J22+ Vm(l)*Ym(n,l)*cos(t(n,l)- delta(n) + delta(l));
J44=J44+ Vm(l)*Ym(n,l)*sin(t(n,l)- delta(n) + delta(l));
else, end
if kb(n) ~= 1 & kb(l) ~=1
lk = NumberOfBus+l-ngs(l)-nss(l)-ns;
ll = l -nss(l);
% off diagonalelements of J1
A(nn, ll) =-Vm(n)*Vm(l)*Ym(n,l)*sin(t(n,l)- delta(n) + delta(l));
if kb(l) == 0 % off diagonal elements of J2
A(nn, lk) =Vm(n)*Ym(n,l)*cos(t(n,l)- delta(n) + delta(l));end
if kb(n) == 0 % off diagonal elements of J3
A(lm, ll) =-Vm(n)*Vm(l)*Ym(n,l)*cos(t(n,l)- delta(n)+delta(l)); end
if kb(n) == 0 & kb(l) == 0 % off diagonal elements of J4
A(lm, lk) =-Vm(n)*Ym(n,l)*sin(t(n,l)- delta(n) + delta(l));end
else end
else , end
end
Pk = Vm(n)^2*Ym(n,n)*cos(t(n,n))+J33;
Qk = -Vm(n)^2*Ym(n,n)*sin(t(n,n))-J11;
if kb(n) == 1 P(n)=Pk; Q(n) = Qk; end % Swing bus P
if kb(n) == 2 Q(n)=Qk;
22/2/22 1:42 AM D:\Software\MATLAB\bin\NRLF.m 2 of 3

if Qmax(n) ~= 0
Qgc = Q(n)*basemva + Qd(n) - Qsh(n);
if iter <= 7 % Between the 2th & 6th iterations
if iter > 2 % the Mvar of generator buses are
if Qgc < Qmin(n), % tested. If not within limits Vm(n)
Vm(n) = Vm(n) + 0.01; % is changed in steps of 0.01 pu to
elseif Qgc > Qmax(n), % bring the generator Mvar within
Vm(n) = Vm(n) - 0.01;end % the specified limits.
else, end
else,end
else,end
end
if kb(n) ~= 1
A(nn,nn) = J11; %diagonal elements of J1
DC(nn) = P(n)-Pk;
end
if kb(n) == 0
A(nn,lm) = 2*Vm(n)*Ym(n,n)*cos(t(n,n))+J22; %diagonal elements of J2
A(lm,nn)= J33; %diagonal elements of J3
A(lm,lm) =-2*Vm(n)*Ym(n,n)*sin(t(n,n))-J44; %diagonal of elements of J4
DC(lm) = Q(n)-Qk;
end
end
DX=A\DC';
for n=1:NumberOfBus
nn=n-nss(n);
lm=NumberOfBus+n-ngs(n)-nss(n)-ns;
if kb(n) ~= 1
delta(n) = delta(n)+DX(nn); end
if kb(n) == 0
Vm(n)=Vm(n)+DX(lm); end
end
maxerror=max(abs(DC));
if iter == maxiter & maxerror > accuracy
fprintf('\nWARNING: Iterative solution did not converged after ')
fprintf('%g', iter), fprintf(' iterations.\n\n')
fprintf('Press Enter to terminate the iterations and print the results \n')
converge = 0; pause, else, end

end

if converge ~= 1
tech= (' ITERATIVE SOLUTION DID NOT CONVERGE'); else,
tech=(' Power Flow Solution by Newton-Raphson Method');
end
V = Vm.*cos(delta)+j*Vm.*sin(delta);
deltad=180/pi*delta;
i=sqrt(-1);
k=0;
for n = 1:NumberOfBus
if kb(n) == 1
k=k+1;
S(n)= P(n)+j*Q(n);
Pg(n) = P(n)*basemva + Pd(n);
Qg(n) = Q(n)*basemva + Qd(n) - Qsh(n);
Pgg(k)=Pg(n);
Qgg(k)=Qg(n); %june 97
elseif kb(n) ==2
k=k+1;
S(n)=P(n)+j*Q(n);
Qg(n) = Q(n)*basemva + Qd(n) - Qsh(n);
Pgg(k)=Pg(n);
Qgg(k)=Qg(n); % June 1997
end
yload(n) = (Pd(n)- j*Qd(n)+j*Qsh(n))/(basemva*Vm(n)^2);
end
busdata(:,3)=Vm'; busdata(:,4)=deltad';
Pgt = sum(Pg); Qgt = sum(Qg); Pdt = sum(Pd); Qdt = sum(Qd); Qsht = sum(Qsh);
22/2/22 1:42 AM D:\Software\MATLAB\bin\NRLF.m 3 of 3

%clear A DC DX J11 J22 J33 J44 Qk delta lk ll lm


%clear A DC DX J11 J22 J33 Qk delta lk ll lm
Helper1:
22/2/22 1:34 AM D:\Software\MATLAB\bin\Helper1.m 1 of 1

% This program obtains th Bus Admittance Matrix for power flow solution

j=sqrt(-1); i = sqrt(-1);
nl = linedata(:,1); nr = linedata(:,2); R = linedata(:,3);
X = linedata(:,4); Bc = j*linedata(:,5); a = linedata(:, 6);
NBR=length(linedata(:,1)); NumberOfBus = max(max(nl), max(nr));
Z = R + j*X; y= ones(NBR,1)./Z; %branch admittance
for n = 1:NBR
if a(n) <= 0 a(n) = 1; else end
Ybus=zeros(NumberOfBus,NumberOfBus); % initialize Ybus to zero
% formation of the off diagonal elements
for k=1:NBR;
Ybus(nl(k),nr(k))=Ybus(nl(k),nr(k))-y(k)/a(k);
Ybus(nr(k),nl(k))=Ybus(nl(k),nr(k));
end
end
% formation of the diagonal elements
for n=1:NumberOfBus
for k=1:NBR
if nl(k)==n
Ybus(n,n) = Ybus(n,n)+y(k)/(a(k)^2) + Bc(k);
elseif nr(k)==n
Ybus(n,n) = Ybus(n,n)+y(k) +Bc(k);
else, end
end
end
clear Pgg
Helper2:
22/2/22 1:35 AM D:\Software\MATLAB\bin\Helper2.m 1 of 1

% This program prints the power flow solution in a tabulated form


% on the screen.

%clc
disp(tech)
fprintf(' Maximum Power Mismatch = %g \n', maxerror)
fprintf(' No. of Iterations = %g \n\n', iter)
head =[' Bus Voltage Angle ------Load------ ---Generation--- Injected'
' No. Mag. Degree MW Mvar MW Mvar Mvar '
' '];
disp(head)
for n=1:NumberOfBus
fprintf(' %5g', n), fprintf(' %7.3f', Vm(n)),
fprintf(' %8.3f', deltad(n)), fprintf(' %9.3f', Pd(n)),
fprintf(' %9.3f', Qd(n)), fprintf(' %9.3f', Pg(n)),
fprintf(' %9.3f ', Qg(n)), fprintf(' %8.3f\n', Qsh(n))
end
fprintf(' \n'), fprintf(' Total ')
fprintf(' %9.3f', Pdt), fprintf(' %9.3f', Qdt),
fprintf(' %9.3f', Pgt), fprintf(' %9.3f', Qgt), fprintf(' %9.3f\n\n', Qsht)
helper3:
22/2/22 1:35 AM D:\Software\MATLAB\bin\Helper3.m 1 of 1

% This program is used in conjunction with lfgauss or lf Newton


% for the computation of line flow and line losses.

SLT = 0;
fprintf('\n')
fprintf(' Line Flow and Losses \n\n')
fprintf(' --Line-- Power at bus & line flow --Line loss-- Transformer\n')
fprintf(' from to MW Mvar MVA MW Mvar tap\n')

for n = 1:NumberOfBus
busprt = 0;
for L = 1:NBR;
if busprt == 0
fprintf(' \n'), fprintf('%6g', n), fprintf(' %9.3f', P(n)*basemva)
fprintf('%9.3f', Q(n)*basemva), fprintf('%9.3f\n', abs(S(n)*basemva))

busprt = 1;
else, end
if nl(L)==n k = nr(L);
In = (V(n) - a(L)*V(k))*y(L)/a(L)^2 + Bc(L)/a(L)^2*V(n);
Ik = (V(k) - V(n)/a(L))*y(L) + Bc(L)*V(k);
Snk = V(n)*conj(In)*basemva;
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
elseif nr(L)==n k = nl(L);
In = (V(n) - V(k)/a(L))*y(L) + Bc(L)*V(n);
Ik = (V(k) - a(L)*V(n))*y(L)/a(L)^2 + Bc(L)/a(L)^2*V(k);
Snk = V(n)*conj(In)*basemva;
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
else, end
if nl(L)==n | nr(L)==n
fprintf('%12g', k),
fprintf('%9.3f', real(Snk)), fprintf('%9.3f', imag(Snk))
fprintf('%9.3f', abs(Snk)),
fprintf('%9.3f', real(SL)),
if nl(L) ==n & a(L) ~= 1
fprintf('%9.3f', imag(SL)), fprintf('%9.3f\n', a(L))
else, fprintf('%9.3f\n', imag(SL))
end
else, end
end
end
SLT = SLT/2;
fprintf(' \n'), fprintf(' Total loss ')
fprintf('%9.3f', real(SLT)), fprintf('%9.3f\n', imag(SLT))
clear Ik In SL SLT Skn Snk
Results for NRLF:
MATLAB Command Window Page 1

Power Flow Solution by Newton-Raphson Method


Maximum Power Mismatch = 1.54336e-05
No. of Iterations = 4

Bus Voltage Angle ------Load------ ---Generation--- Injected


No. Mag. Degree MW Mvar MW Mvar Mvar

1 1.010 0.000 0.000 0.000 302.005 146.649 0.000


2 0.973 -18.248 13.500 32.000 0.000 0.000 0.000
3 0.909 -20.355 12.000 43.000 0.000 0.000 0.000
4 0.942 -2.736 25.400 30.000 0.000 0.000 0.000
5 0.899 -8.163 15.000 45.000 0.000 0.000 0.000
6 0.955 -15.861 34.000 57.000 0.000 0.000 0.000
7 0.976 -20.357 25.000 40.000 0.000 0.000 0.000
8 0.982 -10.373 22.500 60.000 0.000 0.000 0.000
9 0.899 -6.493 23.500 24.500 0.000 0.000 0.000
10 0.978 -17.046 16.000 22.000 0.000 0.000 0.000
11 0.896 -15.978 24.000 28.000 0.000 0.000 0.000
12 0.880 -21.224 12.000 20.000 0.000 0.000 0.000
13 0.925 -13.163 23.000 24.000 0.000 0.000 0.000
14 0.948 -22.780 32.000 41.000 0.000 0.000 0.000
15 0.927 -16.574 40.000 50.000 0.000 0.000 0.000
16 0.851 -9.903 31.500 24.000 0.000 0.000 0.000
17 0.943 -15.421 20.000 34.000 0.000 0.000 0.000
18 0.876 -13.969 15.000 42.000 0.000 0.000 0.000
19 1.015 -20.675 0.000 12.500 35.000 76.600 0.000
20 1.020 -15.843 0.000 10.000 25.000 250.393 0.000
21 1.025 -18.542 0.000 20.000 25.000 92.171 0.000
22 1.050 -12.844 0.000 24.000 15.000 129.032 0.000

Total 384.400 683.000 402.005 694.846 0.000

Line Flow and Losses

--Line-- Power at bus & line flow --Line loss-- Transformer


from to MW Mvar MVA MW Mvar tap

1 302.005 146.649 335.727


4 25.855 25.556 36.354 0.455 -4.444
5 101.613 45.961 111.524 6.143 16.600
9 56.666 52.424 77.196 1.190 10.068
8 117.872 22.712 120.040 0.000 21.615 1.010

2 -13.500 -32.000 34.731


3 21.836 29.615 36.795 0.337 -2.083
10 -13.193 -1.527 13.281 0.074 -3.722
20 -23.174 -22.013 31.963 0.233 -3.226
21 1.030 -38.075 38.089 0.146 -0.017

3 -12.000 -43.000 44.643


2 -21.499 -31.698 38.301 0.337 -2.083
7 -2.598 -30.033 30.145 0.192 -8.838
12 12.098 18.731 22.298 0.098 -1.269

4 -25.400 -30.000 39.309


1 -25.400 -30.000 39.309 0.455 -4.444

5 -15.000 -45.000 47.434


1 -95.471 -29.361 99.883 6.143 16.600
13 27.741 -12.775 30.541 0.310 -0.562
18 52.730 -2.864 52.807 1.721 1.853

6 -34.000 -57.000 66.370


11 6.881 37.116 37.748 0.351 -1.830
15 7.866 11.790 14.173 0.088 0.441
20 -12.415 -50.489 51.993 0.830 -0.585
22 -36.332 -55.417 66.265 0.460 3.327
MATLAB Command Window Page 2

7 -25.000 -40.000 47.170


3 2.790 21.195 21.378 0.192 -8.838
19 -2.087 -27.546 27.625 0.225 -4.984
21 -25.703 -33.649 42.343 0.181 0.464

8 -22.500 -60.000 64.080


20 56.241 -32.334 64.873 0.813 -3.519
1 -117.872 -1.098 117.877 0.000 21.615
13 17.339 14.973 22.909 0.000 1.416 1.020
22 21.792 -41.541 46.910 0.000 4.748 1.020

9 -23.500 -24.500 33.948


1 -55.476 -42.356 69.797 1.190 10.068
16 31.976 17.856 36.624 0.476 -6.144

10 -16.000 -22.000 27.203


2 13.266 -2.195 13.447 0.074 -3.722
15 -1.299 18.202 18.249 0.089 -2.571
20 -27.968 -38.007 47.188 0.422 -3.883

11 -24.000 -28.000 36.878


6 -6.531 -38.946 39.490 0.351 -1.830
18 -17.469 10.946 20.616 0.060 -3.500

12 -12.000 -20.000 23.324


3 -12.000 -20.000 23.324 0.098 -1.269

13 -23.000 -24.000 33.242


5 -27.431 12.213 30.027 0.310 -0.562
17 21.771 -22.656 31.421 0.420 -2.927
8 -17.339 -13.557 22.010 0.000 1.416

14 -32.000 -41.000 52.010


19 -32.000 -41.000 52.010 0.688 0.538

15 -40.000 -50.000 64.031


6 -7.778 -11.349 13.759 0.088 0.441
10 1.388 -20.773 20.819 0.089 -2.571
18 -18.036 32.493 37.163 0.444 0.222
20 -15.574 -50.371 52.723 0.860 4.273

16 -31.500 -24.000 39.601


9 -31.500 -24.000 39.601 0.476 -6.144

17 -20.000 -34.000 39.446


13 -21.351 19.729 29.070 0.420 -2.927
20 1.351 -53.729 53.746 0.304 0.393

18 -15.000 -42.000 44.598


5 -51.009 4.718 51.226 1.721 1.853
11 17.529 -14.446 22.715 0.060 -3.500
15 18.480 -32.271 37.188 0.444 0.222

19 35.000 64.100 73.033


7 2.312 22.562 22.680 0.225 -4.984
14 32.688 41.538 52.858 0.688 0.538

20 25.000 240.393 241.690


2 23.406 18.787 30.014 0.233 -3.226
6 13.245 49.904 51.632 0.830 -0.585
8 -55.428 28.815 62.470 0.813 -3.519
10 28.389 34.124 44.389 0.422 -3.883
15 16.434 54.643 57.061 0.860 4.273
17 -1.047 54.121 54.131 0.304 0.393

21 25.000 72.171 76.379


2 -0.885 38.058 38.068 0.146 -0.017
MATLAB Command Window Page 3

7 25.885 34.113 42.822 0.181 0.464

22 15.000 105.032 106.098


6 36.792 58.743 69.314 0.460 3.327
8 -21.792 46.289 51.162 0.000 4.748

Total loss 17.606 11.850


>>
Next Slide are for
DC load Flow
Data file:
22/2/22 1:17 AM D:\Software\MATLAB\bin\dataForDC.m 1 of 1

busdata=[1 1 1.01 0.0 0.0 0.0 0.0 0.0 0 0 0


2 0 1.0 0.0 13.5 32.0 0.0 0.0 0 0 0
3 0 1.0 0.0 12 43 0.0 0.0 0 0 0
4 0 1.0 0.0 25.4 30 0.0 0.0 0 0 0
5 0 1.0 0.0 15 45.0 0.0 0.0 0 0 0
6 0 1.0 0.0 34 57 0.0 0.0 0 0 0
7 0 1.0 0.0 25 40 0.0 0.0 0 0 0
8 0 1.0 0.0 22.5 60.0 0.0 0.0 0 0 0
9 0 1.0 0.0 23.5 24.5 0.0 0.0 0 0 0
10 0 1.0 0.0 16 22 0.0 0.0 0 0 0
11 0 1.0 0.0 24 28 0.0 0.0 0 0 0
12 0 1.0 0 12 20 0 0 0 0 0
13 0 1.0 0 23 24 0 0 0 0 0
14 0 1.0 0 32 41 0 0 0 0 0
15 0 1.0 0 40 50 0 0 0 0 0
16 0 1.0 0 31.5 24 0 0 0 0 0
17 0 1.0 0 20.0 34 0 0 0 0 0
18 0 1.0 0 15 42 0 0 0 0 0
19 2 1.015 0 0 12.5 35 0 0 0 0
20 2 1.02 0 0 10 25 0 0 0 0
21 2 1.025 0 0 20 25 0 0 0 0
22 2 1.05 0 0 24 15 0 0 0 0];

% Line code
% Bus bus R X 1/2 B = 1 for lines
% nl nr p.u. p.u. p.u. > 1 or < 1 tr. tap at bus nl
linedata=[1 4 0.03 0.21 0.04 1
1 5 0.05 0.15 0.01 1
1 9 0.02 0.2 0.01 1
2 3 0.021 0.18 0.028 1
2 10 0.04 0.15 0.021 1
2 20 0.024 0.2 0.026 1
2 21 0.01 0.136 0.01 1
3 7 0.025 0.24 0.06 1
3 12 0.015 0.125 0.013 1
5 13 0.028 0.25 0.02 1
5 18 0.05 0.15 0.021 1
6 11 0.02 0.14 0.025 1
6 15 0.04 0.2 0 1
6 20 0.03 0.12 0.02 1
6 22 0.01 0.16 0.02 1
7 19 0.035 0.15 0.03 1
7 21 0.01 0.136 0.01 1
8 20 0.02 0.16 0.05 1
9 16 0.025 0.16 0.06 1
10 15 0.021 0.25 0.02 1
10 20 0.02 0.1 0.03 1
11 18 0.01 0.15 0.028 1
13 17 0.04 0.12 0.024 1
14 19 0.024 0.14 0.018 1
15 18 0.026 0.156 0.015 1
15 20 0.027 0.164 0.005 1
17 20 0.01 0.14 0.02 1
1 8 0 0.15 0 1.01
8 13 0 0.25 0 1.02
8 22 0 0.2 0 1.02];
Main file:
22/2/22 1:17 AM D:\Software\MATLAB\bin\DCmain.m 1 of 1

clear ; clc;
dataForDC
% neglecting resistance of the transmission lines
linedata(:,3) = zeros(length(linedata),1);
% number of buses of the electric power system
numberOfBuses=length(busdata(:,1));
[Y] = Helper(linedata,busdata,numberOfBuses); % function to get the admittance matrix

%% Start the DC Load Flow computation


% the code was written assuming the slack bus is the # 1 bus of the BUS
% matrix
% delete first row and column of the admitance matrix
y = 1*Y; y(1,:) = []; y(:,1) = [];
% Net power (Generation - Load)
netPower = busdata(:,7)-busdata(:,5);
% from the netPower vector also erease the P of the slack bus
netPower(1) = [];
% compute the angles of the nodes using the imaginary part of the y matrix
Theta = inv(imag(y))*netPower;
% It is assumed tha the slack bus has an angle of zero
Theta = [0; Theta];
% compute the power injections at each node
PowerInjection = imag(Y)*Theta;
% compute the line flows
% voltage of buses are equal to one
V = ones(length(busdata(:,1)),1);
%% calculate the line flows and power losses
From=linedata(:,1);
To=linedata(:,2);
% define active power flows
for k = 1:length(linedata(:,1))
Mij(k) = imag(Y(From(k),To(k)))*(Theta(From(k))-Theta(To(k)));
end
for k = 1:length(linedata(:,1))
Mji(k) = imag(Y(To(k),From(k)))*(Theta(To(k))-Theta(From(k)));
end
%% Print results
% +++++++++++++++++++++++++++ Print results +++++++++++++++++++++++++++++++
disp(' DC Load-Flow Study')
disp(' Report of Power Flow Calculations ')
disp(' ')
disp(date)
disp(' Generation Load')
disp(' Bus Volts Angle Real Real')

for n=1:numberOfBuses
fprintf(' %5g ', n), fprintf(' %7.3f ', V(n)),
fprintf(' %8.3f ',Theta(n)), fprintf(' %9.3f ', PowerInjection(n)),fprintf(' %9.3f \n',
busdata(n,5))
end
fprintf('\n');
disp(' Line Flows ')
disp(' #Line From Bus To Bus Real flow ')
l=1:1:length(linedata(:,1));
xy=[l' From To Mij'];
yx=[l' To From Mji'];
disp(xy)
disp(yx)
Helper file which is used in Main file:
22/2/22 1:17 AM D:\Software\MATLAB\bin\Helper.m 1 of 1

function [Y] = Y_admi(line,bus,nbuses)


%% Y_BUS Building
orden=zeros(1,nbuses);
Y=zeros(nbuses);
for k=1:nbuses
orden(k)=bus(k,1); % vector which contains the order of building according to the bus information
end
for p=1:length(line(:,1));
P_Bus=find(orden==line(p,1));
Q_Bus=find(orden==line(p,2));
a=line(p,6); %Tap value for the p iteration
if a>0 % for transformers out of nominal position
yl=(1/((line(p,3)+j*line(p,4)))); % line admittance
Ad=(j*line(p,5)/2); % line charging
Y(P_Bus,Q_Bus)=Y(P_Bus,Q_Bus)-yl/a; % a non diagonal element
Y(Q_Bus,P_Bus)=Y(P_Bus,Q_Bus); % symmetry is declared for elements out of the diagonal
Y(P_Bus,P_Bus)=Y(P_Bus,P_Bus)+(yl/a)+((1/a)*(1/a-1)*yl)+Ad; %Equivalent admittance at the P-terminal
plus line charging
Y(Q_Bus,Q_Bus)=Y(Q_Bus,Q_Bus)+(yl/a)+(1-1/a)*yl+Ad; %Equivalent admittance at the Q-terminal plus line
charging
else % for lines
yl=(1/((line(p,3)+j*line(p,4)))); % line admittance
Ad=(j*line(p,5)/2); % line charging
Y(P_Bus,Q_Bus)=Y(P_Bus,Q_Bus)-yl; % a non diagonal element
Y(Q_Bus,P_Bus)=Y(P_Bus,Q_Bus); % symmetry is declared for elements out of the diagonal
Y(P_Bus,P_Bus)=Y(P_Bus,P_Bus)+yl; % diagonal element
Y(Q_Bus,Q_Bus)=Y(Q_Bus,Q_Bus)+yl; % diagonal element
c=line(p,5); % line charging for the whole line
if c>0
Y(P_Bus,P_Bus)= Y(P_Bus,P_Bus)+Ad; %add value of line charging to the diagonal element
Y(Q_Bus,Q_Bus)= Y(Q_Bus,Q_Bus)+Ad; %add value of line charging to the diagonal element
end
end
end
% Susceptance and conductance
for m=1:nbuses
dir=find(orden==bus(m,1));
Y(dir,dir)=Y(dir,dir)+bus(m,8)+j*bus(m,9); % add the shunt admittance
end
end
Results for DC load flow:
MATLAB Command Window Page 1

DC Load-Flow Study
Report of Power Flow Calculations

22-Feb-2022
Generation Load
Bus Volts Angle Real Real
1 1.000 0.000 297.942 0.000
2 1.000 30.834 -13.500 13.500
3 1.000 35.188 -12.000 12.000
4 1.000 5.356 -25.400 25.400
5 1.000 15.340 -15.000 15.000
6 1.000 26.768 -34.000 34.000
7 1.000 34.750 -25.000 25.000
8 1.000 17.315 -22.500 22.500
9 1.000 11.176 -23.500 23.500
10 1.000 28.577 -16.000 16.000
11 1.000 27.360 -24.000 24.000
12 1.000 36.718 -12.000 12.000
13 1.000 22.150 -23.000 23.000
14 1.000 39.006 -32.000 32.000
15 1.000 27.928 -40.000 40.000
16 1.000 16.294 -31.500 31.500
17 1.000 25.085 -20.000 20.000
18 1.000 24.285 -15.000 15.000
19 1.000 34.476 35.000 0.000
20 1.000 25.631 25.000 0.000
21 1.000 31.113 25.000 0.000
22 1.000 21.101 15.000 0.000

Line Flows
#Line From Bus To Bus Real flow
1.0000 1.0000 4.0000 -25.5071
2.0000 1.0000 5.0000 -102.2655
3.0000 1.0000 9.0000 -55.8800
4.0000 2.0000 3.0000 -24.1900
5.0000 2.0000 10.0000 15.0421
6.0000 2.0000 20.0000 26.0111
7.0000 2.0000 21.0000 -2.0528
8.0000 3.0000 7.0000 1.8257
9.0000 3.0000 12.0000 -12.2387
10.0000 5.0000 13.0000 -27.2421
11.0000 5.0000 18.0000 -59.6322
12.0000 6.0000 11.0000 -4.2245
13.0000 6.0000 15.0000 -5.7983
14.0000 6.0000 20.0000 9.4739
15.0000 6.0000 22.0000 35.4189
16.0000 7.0000 19.0000 1.8215
17.0000 7.0000 21.0000 26.7416
18.0000 8.0000 20.0000 -51.9791
19.0000 9.0000 16.0000 -31.9888
20.0000 10.0000 15.0000 2.5975
21.0000 10.0000 20.0000 29.4591
22.0000 11.0000 18.0000 20.5005
23.0000 13.0000 17.0000 -24.4552
24.0000 14.0000 19.0000 32.3511
25.0000 15.0000 18.0000 23.3546
26.0000 15.0000 20.0000 14.0032
27.0000 17.0000 20.0000 -3.9033
28.0000 1.0000 8.0000 -114.2890
29.0000 8.0000 13.0000 -18.9630
30.0000 8.0000 22.0000 -18.5612

1.0000 4.0000 1.0000 25.5071


2.0000 5.0000 1.0000 102.2655
3.0000 9.0000 1.0000 55.8800
4.0000 3.0000 2.0000 24.1900
5.0000 10.0000 2.0000 -15.0421
6.0000 20.0000 2.0000 -26.0111
MATLAB Command Window Page 2

7.0000 21.0000 2.0000 2.0528


8.0000 7.0000 3.0000 -1.8257
9.0000 12.0000 3.0000 12.2387
10.0000 13.0000 5.0000 27.2421
11.0000 18.0000 5.0000 59.6322
12.0000 11.0000 6.0000 4.2245
13.0000 15.0000 6.0000 5.7983
14.0000 20.0000 6.0000 -9.4739
15.0000 22.0000 6.0000 -35.4189
16.0000 19.0000 7.0000 -1.8215
17.0000 21.0000 7.0000 -26.7416
18.0000 20.0000 8.0000 51.9791
19.0000 16.0000 9.0000 31.9888
20.0000 15.0000 10.0000 -2.5975
21.0000 20.0000 10.0000 -29.4591
22.0000 18.0000 11.0000 -20.5005
23.0000 17.0000 13.0000 24.4552
24.0000 19.0000 14.0000 -32.3511
25.0000 18.0000 15.0000 -23.3546
26.0000 20.0000 15.0000 -14.0032
27.0000 20.0000 17.0000 3.9033
28.0000 8.0000 1.0000 114.2890
29.0000 13.0000 8.0000 18.9630
30.0000 22.0000 8.0000 18.5612

>>
Next slide are for FDLF
Main File:
22/2/22 1:34 AM D:\Software\MATLAB\bin\FDLF_main.m 1 of 2

clear;
clc;

basemva = 100; accuracy = 0.0001; accel = 1.1; maxiter = 100;

% 22 Bus system
% Bus Bus Voltage Angle ---Load---- -------Generator----- Static Mvar
% No code Mag. Degree MW Mvar MW Mvar Qmin Qmax +Qc/-Ql
busdata=[1 1 1.01 0.0 0.0 0.0 0.0 0.0 0 0 0
2 0 1.0 0.0 13.5 32.0 0.0 0.0 0 0 0
3 0 1.0 0.0 12 43 0.0 0.0 0 0 0
4 0 1.0 0.0 25.4 30 0.0 0.0 0 0 0
5 0 1.0 0.0 15 45.0 0.0 0.0 0 0 0
6 0 1.0 0.0 34 57 0.0 0.0 0 0 0
7 0 1.0 0.0 25 40 0.0 0.0 0 0 0
8 0 1.0 0.0 22.5 60.0 0.0 0.0 0 0 0
9 0 1.0 0.0 23.5 24.5 0.0 0.0 0 0 0
10 0 1.0 0.0 16 22 0.0 0.0 0 0 0
11 0 1.0 0.0 24 28 0.0 0.0 0 0 0
12 0 1.0 0 12 20 0 0 0 0 0
13 0 1.0 0 23 24 0 0 0 0 0
14 0 1.0 0 32 41 0 0 0 0 0
15 0 1.0 0 40 50 0 0 0 0 0
16 0 1.0 0 31.5 24 0 0 0 0 0
17 0 1.0 0 20.0 34 0 0 0 0 0
18 0 1.0 0 15 42 0 0 0 0 0
19 2 1.015 0 0 12.5 35 0 0 0 0
20 2 1.02 0 0 10 25 0 0 0 0
21 2 1.025 0 0 20 25 0 0 0 0
22 2 1.05 0 0 24 15 0 0 0 0];

% Line code
% Bus bus R X 1/2 B = 1 for lines
% nl nr p.u. p.u. p.u. > 1 or < 1 tr. tap at bus nl
linedata=[1 4 0.03 0.21 0.04 1
1 5 0.05 0.15 0.01 1
1 9 0.02 0.2 0.01 1
2 3 0.021 0.18 0.028 1
2 10 0.04 0.15 0.021 1
2 20 0.024 0.2 0.026 1
2 21 0.01 0.136 0.01 1
3 7 0.025 0.24 0.06 1
3 12 0.015 0.125 0.013 1
5 13 0.028 0.25 0.02 1
5 18 0.05 0.15 0.021 1
6 11 0.02 0.14 0.025 1
6 15 0.04 0.2 0 1
6 20 0.03 0.12 0.02 1
6 22 0.01 0.16 0.02 1
7 19 0.035 0.15 0.03 1
7 21 0.01 0.136 0.01 1
8 20 0.02 0.16 0.05 1
9 16 0.025 0.16 0.06 1
10 15 0.021 0.25 0.02 1
10 20 0.02 0.1 0.03 1
11 18 0.01 0.15 0.028 1
13 17 0.04 0.12 0.024 1
14 19 0.024 0.14 0.018 1
15 18 0.026 0.156 0.015 1
15 20 0.027 0.164 0.005 1
17 20 0.01 0.14 0.02 1
1 8 0 0.15 0 1.01
8 13 0 0.25 0 1.02
8 22 0 0.2 0 1.02];

Helper1 % form the bus admittance matrix


FDLF % Load flow solution by fast decoupled method
Helper2 % Prints the power flow solution on the screen
22/2/22 1:34 AM D:\Software\MATLAB\bin\FDLF_main.m 2 of 2

Helper3 % Computes and displays the line flow and losses


FDLF function file:
22/2/22 1:34 AM D:\Software\MATLAB\bin\FDLF.m 1 of 3

% Fast Decoupled Power Flow Solution

ns=0; Vm=0; delta=0; yload=0; deltad=0;


NumberOfBus = length(busdata(:,1));
for k=1:NumberOfBus
n=busdata(k,1);
kb(n)=busdata(k,2); Vm(n)=busdata(k,3); delta(n)=busdata(k, 4);
Pd(n)=busdata(k,5); Qd(n)=busdata(k,6); Pg(n)=busdata(k,7); Qg(n) = busdata(k,8);
Qmin(n)=busdata(k, 9); Qmax(n)=busdata(k, 10);
Qsh(n)=busdata(k, 11);
if Vm(n) <= 0 Vm(n) = 1.0; V(n) = 1 + j*0;
else delta(n) = pi/180*delta(n);
V(n) = Vm(n)*(cos(delta(n)) + j*sin(delta(n)));
P(n)=(Pg(n)-Pd(n))/basemva;
Q(n)=(Qg(n)-Qd(n)+ Qsh(n))/basemva;
S(n) = P(n) + j*Q(n);
end
if kb(n) == 1, ns = ns+1; else, end
nss(n) = ns;
end
Ym = abs(Ybus); t = angle(Ybus);
ii=0;
for ib=1:NumberOfBus
if kb(ib) == 0 | kb(ib) == 2
ii = ii+1;
jj=0;
for jb=1:NumberOfBus
if kb(jb) == 0 | kb(jb) == 2
jj = jj+1;
B1(ii,jj)=imag(Ybus(ib,jb));
else,end
end
else, end
end

ii=0;
for ib=1:NumberOfBus
if kb(ib) == 0
ii = ii+1;
jj=0;
for jb=1:NumberOfBus
if kb(jb) == 0
jj = jj+1;
B2(ii,jj)=imag(Ybus(ib,jb));
else,end
end
else, end
end
B1inv=inv(B1); B2inv = inv(B2);

maxerror = 1; converge = 1;
iter = 0;
% Start of iterations
while maxerror >= accuracy & iter <= maxiter % Test for max. power mismatch
iter = iter+1;
id=0; iv=0;
for n=1:NumberOfBus
nn=n-nss(n);
J11=0; J33=0;
for i=1:NBR
if nl(i) == n | nr(i) == n
if nl(i) == n, l = nr(i); end
if nr(i) == n, l = nl(i); end
J11=J11+ Vm(n)*Vm(l)*Ym(n,l)*sin(t(n,l)- delta(n) + delta(l));
J33=J33+ Vm(n)*Vm(l)*Ym(n,l)*cos(t(n,l)- delta(n) + delta(l));
else , end
end
22/2/22 1:34 AM D:\Software\MATLAB\bin\FDLF.m 2 of 3

Pk = Vm(n)^2*Ym(n,n)*cos(t(n,n))+J33;
Qk = -Vm(n)^2*Ym(n,n)*sin(t(n,n))-J11;
if kb(n) == 1 P(n)=Pk; Q(n) = Qk; end % Swing bus P
if kb(n) == 2 Q(n)=Qk;
Qgc = Q(n)*basemva + Qd(n) - Qsh(n);
if Qmax(n) ~= 0
if iter <= 20 % Between the 1th & 6th iterations
if iter >= 10 % the Mvar of generator buses are
if Qgc < Qmin(n), % tested. If not within limits Vm(n)
Vm(n) = Vm(n) + 0.005; % is changed in steps of 0.05 pu to
elseif Qgc > Qmax(n), % bring the generator Mvar within
Vm(n) = Vm(n) - 0.005;end % the specified limits.
else, end
else,end
else,end
end
if kb(n) ~= 1
id = id+1;
DP(id) = P(n)-Pk;
DPV(id) = (P(n)-Pk)/Vm(n);
end
if kb(n) == 0
iv=iv+1;
DQ(iv) = Q(n)-Qk;
DQV(iv) = (Q(n)-Qk)/Vm(n);
end
end
Dd=-B1\DPV';
DV=-B2\DQV';
id=0;iv=0;
for n=1:NumberOfBus
if kb(n) ~= 1
id = id+1;
delta(n) = delta(n)+Dd(id); end
if kb(n) == 0
iv = iv+1;
Vm(n)=Vm(n)+DV(iv); end
end
maxerror=max(max(abs(DP)),max(abs(DQ)));
if iter == maxiter & maxerror > accuracy
fprintf('\nWARNING: Iterative solution did not converged after ')
fprintf('%g', iter), fprintf(' iterations.\n\n')
fprintf('Press Enter to terminate the iterations and print the results \n')
converge = 0; pause, else, end

end
if converge ~= 1
tech= (' ITERATIVE SOLUTION DID NOT CONVERGE'); else,
tech=(' Power Flow Solution by Fast Decoupled Method');
end
k=0;
V = Vm.*cos(delta)+j*Vm.*sin(delta);
deltad=180/pi*delta;
clear A; clear DC; clear DX
i=sqrt(-1);
for n = 1:NumberOfBus
if kb(n) == 1
S(n)=P(n)+j*Q(n);
Pg(n) = P(n)*basemva + Pd(n);
Qg(n) = Q(n)*basemva + Qd(n) - Qsh(n);
k=k+1;
Pgg(k)=Pg(n);
elseif kb(n) ==2
S(n)=P(n)+j*Q(n);
Qg(n) = Q(n)*basemva + Qd(n) - Qsh(n);
k=k+1;
Pgg(k)=Pg(n);
end
22/2/22 1:34 AM D:\Software\MATLAB\bin\FDLF.m 3 of 3

yload(n) = (Pd(n)- j*Qd(n)+j*Qsh(n))/(basemva*Vm(n)^2);


end
busdata(:,3)=Vm'; busdata(:,4)=deltad';
Pgt = sum(Pg); Qgt = sum(Qg); Pdt = sum(Pd); Qdt = sum(Qd); Qsht = sum(Qsh);
clear Pk Qk DP DQ J11 J33 B1 B1inv B2 B2inv DPV DQV Dd delta ib id ii iv jb jj
Helper1:
22/2/22 1:34 AM D:\Software\MATLAB\bin\Helper1.m 1 of 1

% This program obtains th Bus Admittance Matrix for power flow solution

j=sqrt(-1); i = sqrt(-1);
nl = linedata(:,1); nr = linedata(:,2); R = linedata(:,3);
X = linedata(:,4); Bc = j*linedata(:,5); a = linedata(:, 6);
NBR=length(linedata(:,1)); NumberOfBus = max(max(nl), max(nr));
Z = R + j*X; y= ones(NBR,1)./Z; %branch admittance
for n = 1:NBR
if a(n) <= 0 a(n) = 1; else end
Ybus=zeros(NumberOfBus,NumberOfBus); % initialize Ybus to zero
% formation of the off diagonal elements
for k=1:NBR;
Ybus(nl(k),nr(k))=Ybus(nl(k),nr(k))-y(k)/a(k);
Ybus(nr(k),nl(k))=Ybus(nl(k),nr(k));
end
end
% formation of the diagonal elements
for n=1:NumberOfBus
for k=1:NBR
if nl(k)==n
Ybus(n,n) = Ybus(n,n)+y(k)/(a(k)^2) + Bc(k);
elseif nr(k)==n
Ybus(n,n) = Ybus(n,n)+y(k) +Bc(k);
else, end
end
end
clear Pgg
Helper2:
22/2/22 1:35 AM D:\Software\MATLAB\bin\Helper2.m 1 of 1

% This program prints the power flow solution in a tabulated form


% on the screen.

%clc
disp(tech)
fprintf(' Maximum Power Mismatch = %g \n', maxerror)
fprintf(' No. of Iterations = %g \n\n', iter)
head =[' Bus Voltage Angle ------Load------ ---Generation--- Injected'
' No. Mag. Degree MW Mvar MW Mvar Mvar '
' '];
disp(head)
for n=1:NumberOfBus
fprintf(' %5g', n), fprintf(' %7.3f', Vm(n)),
fprintf(' %8.3f', deltad(n)), fprintf(' %9.3f', Pd(n)),
fprintf(' %9.3f', Qd(n)), fprintf(' %9.3f', Pg(n)),
fprintf(' %9.3f ', Qg(n)), fprintf(' %8.3f\n', Qsh(n))
end
fprintf(' \n'), fprintf(' Total ')
fprintf(' %9.3f', Pdt), fprintf(' %9.3f', Qdt),
fprintf(' %9.3f', Pgt), fprintf(' %9.3f', Qgt), fprintf(' %9.3f\n\n', Qsht)
Helper3:
22/2/22 1:35 AM D:\Software\MATLAB\bin\Helper3.m 1 of 1

% This program is used in conjunction with lfgauss or lf Newton


% for the computation of line flow and line losses.

SLT = 0;
fprintf('\n')
fprintf(' Line Flow and Losses \n\n')
fprintf(' --Line-- Power at bus & line flow --Line loss-- Transformer\n')
fprintf(' from to MW Mvar MVA MW Mvar tap\n')

for n = 1:NumberOfBus
busprt = 0;
for L = 1:NBR;
if busprt == 0
fprintf(' \n'), fprintf('%6g', n), fprintf(' %9.3f', P(n)*basemva)
fprintf('%9.3f', Q(n)*basemva), fprintf('%9.3f\n', abs(S(n)*basemva))

busprt = 1;
else, end
if nl(L)==n k = nr(L);
In = (V(n) - a(L)*V(k))*y(L)/a(L)^2 + Bc(L)/a(L)^2*V(n);
Ik = (V(k) - V(n)/a(L))*y(L) + Bc(L)*V(k);
Snk = V(n)*conj(In)*basemva;
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
elseif nr(L)==n k = nl(L);
In = (V(n) - V(k)/a(L))*y(L) + Bc(L)*V(n);
Ik = (V(k) - a(L)*V(n))*y(L)/a(L)^2 + Bc(L)/a(L)^2*V(k);
Snk = V(n)*conj(In)*basemva;
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
else, end
if nl(L)==n | nr(L)==n
fprintf('%12g', k),
fprintf('%9.3f', real(Snk)), fprintf('%9.3f', imag(Snk))
fprintf('%9.3f', abs(Snk)),
fprintf('%9.3f', real(SL)),
if nl(L) ==n & a(L) ~= 1
fprintf('%9.3f', imag(SL)), fprintf('%9.3f\n', a(L))
else, fprintf('%9.3f\n', imag(SL))
end
else, end
end
end
SLT = SLT/2;
fprintf(' \n'), fprintf(' Total loss ')
fprintf('%9.3f', real(SLT)), fprintf('%9.3f\n', imag(SLT))
clear Ik In SL SLT Skn Snk
Results for FDLF:
MATLAB Command Window Page 1

Power Flow Solution by Fast Decoupled Method


Maximum Power Mismatch = 9.88309e-05
No. of Iterations = 8

Bus Voltage Angle ------Load------ ---Generation--- Injected


No. Mag. Degree MW Mvar MW Mvar Mvar

1 1.010 0.000 0.000 0.000 302.007 146.650 0.000


2 0.973 -18.248 13.500 32.000 0.000 0.000 0.000
3 0.909 -20.355 12.000 43.000 0.000 0.000 0.000
4 0.942 -2.736 25.400 30.000 0.000 0.000 0.000
5 0.899 -8.163 15.000 45.000 0.000 0.000 0.000
6 0.955 -15.861 34.000 57.000 0.000 0.000 0.000
7 0.976 -20.357 25.000 40.000 0.000 0.000 0.000
8 0.982 -10.373 22.500 60.000 0.000 0.000 0.000
9 0.899 -6.493 23.500 24.500 0.000 0.000 0.000
10 0.978 -17.046 16.000 22.000 0.000 0.000 0.000
11 0.896 -15.979 24.000 28.000 0.000 0.000 0.000
12 0.880 -21.224 12.000 20.000 0.000 0.000 0.000
13 0.925 -13.163 23.000 24.000 0.000 0.000 0.000
14 0.948 -22.780 32.000 41.000 0.000 0.000 0.000
15 0.927 -16.574 40.000 50.000 0.000 0.000 0.000
16 0.851 -9.903 31.500 24.000 0.000 0.000 0.000
17 0.943 -15.421 20.000 34.000 0.000 0.000 0.000
18 0.876 -13.969 15.000 42.000 0.000 0.000 0.000
19 1.015 -20.675 0.000 12.500 35.000 76.600 0.000
20 1.020 -15.843 0.000 10.000 25.000 250.389 0.000
21 1.025 -18.542 0.000 20.000 25.000 92.171 0.000
22 1.050 -12.844 0.000 24.000 15.000 129.031 0.000

Total 384.400 683.000 402.007 694.842 0.000

Line Flow and Losses

--Line-- Power at bus & line flow --Line loss-- Transformer


from to MW Mvar MVA MW Mvar tap

1 302.007 146.650 335.729


4 25.855 25.556 36.354 0.455 -4.444
5 101.613 45.960 111.524 6.143 16.600
9 56.665 52.422 77.195 1.190 10.067
8 117.872 22.712 120.040 0.000 21.615 1.010

2 -13.500 -32.000 34.731


3 21.836 29.615 36.795 0.337 -2.083
10 -13.193 -1.527 13.281 0.074 -3.722
20 -23.173 -22.013 31.963 0.233 -3.226
21 1.030 -38.075 38.089 0.146 -0.017

3 -12.000 -43.000 44.643


2 -21.499 -31.698 38.301 0.337 -2.083
7 -2.598 -30.033 30.145 0.192 -8.838
12 12.098 18.731 22.298 0.098 -1.269

4 -25.400 -30.000 39.309


1 -25.400 -30.000 39.309 0.455 -4.444

5 -15.000 -45.000 47.434


1 -95.470 -29.361 99.883 6.143 16.600
13 27.741 -12.775 30.541 0.310 -0.562
18 52.731 -2.865 52.809 1.721 1.853

6 -34.000 -57.000 66.370


11 6.882 37.116 37.748 0.351 -1.830
15 7.866 11.790 14.173 0.088 0.441
20 -12.415 -50.489 51.993 0.830 -0.585
22 -36.333 -55.416 66.265 0.460 3.327
MATLAB Command Window Page 2

7 -25.000 -40.000 47.170


3 2.790 21.195 21.378 0.192 -8.838
19 -2.087 -27.546 27.625 0.225 -4.984
21 -25.703 -33.649 42.343 0.181 0.464

8 -22.500 -60.000 64.080


20 56.241 -32.334 64.873 0.813 -3.519
1 -117.872 -1.098 117.877 0.000 21.615
13 17.339 14.973 22.909 0.000 1.416 1.020
22 21.792 -41.541 46.910 0.000 4.748 1.020

9 -23.500 -24.500 33.948


1 -55.476 -42.355 69.796 1.190 10.067
16 31.976 17.855 36.623 0.476 -6.144

10 -16.000 -22.000 27.203


2 13.266 -2.195 13.447 0.074 -3.722
15 -1.298 18.202 18.248 0.089 -2.571
20 -27.968 -38.007 47.188 0.422 -3.883

11 -24.000 -28.000 36.878


6 -6.531 -38.946 39.490 0.351 -1.830
18 -17.469 10.946 20.615 0.060 -3.500

12 -12.000 -20.000 23.324


3 -12.000 -20.000 23.324 0.098 -1.269

13 -23.000 -24.000 33.242


5 -27.432 12.213 30.027 0.310 -0.562
17 21.771 -22.656 31.421 0.420 -2.927
8 -17.339 -13.557 22.010 0.000 1.416

14 -32.000 -41.000 52.010


19 -32.000 -41.000 52.010 0.688 0.538

15 -40.000 -50.000 64.031


6 -7.778 -11.349 13.759 0.088 0.441
10 1.388 -20.773 20.819 0.089 -2.571
18 -18.035 32.492 37.162 0.444 0.221
20 -15.574 -50.371 52.723 0.860 4.273

16 -31.500 -24.000 39.601


9 -31.500 -23.999 39.600 0.476 -6.144

17 -20.000 -34.000 39.446


13 -21.351 19.729 29.070 0.420 -2.927
20 1.350 -53.729 53.746 0.304 0.393

18 -15.000 -42.000 44.598


5 -51.010 4.718 51.228 1.721 1.853
11 17.529 -14.446 22.715 0.060 -3.500
15 18.479 -32.271 37.187 0.444 0.221

19 35.000 64.100 73.033


7 2.312 22.562 22.680 0.225 -4.984
14 32.688 41.539 52.858 0.688 0.538

20 25.000 240.389 241.686


2 23.406 18.787 30.014 0.233 -3.226
6 13.245 49.903 51.631 0.830 -0.585
8 -55.428 28.815 62.470 0.813 -3.519
10 28.390 34.124 44.389 0.422 -3.883
15 16.434 54.643 57.061 0.860 4.273
17 -1.047 54.121 54.131 0.304 0.393

21 25.000 72.171 76.379


2 -0.885 38.058 38.068 0.146 -0.017
MATLAB Command Window Page 3

7 25.885 34.113 42.822 0.181 0.464

22 15.000 105.031 106.097


6 36.792 58.743 69.314 0.460 3.327
8 -21.792 46.289 51.162 0.000 4.748

Total loss 17.606 11.850


>>

You might also like