0% found this document useful (0 votes)
234 views3 pages

Program To Form Admittance and Impedance Bus Formation PDF

The document contains code to calculate the bus admittance matrix (Ybus) and bus impedance matrix (Zbus) from line data consisting of from bus, to bus, resistance, reactance, and ground admittance values. It reads in the line data from an Excel file, calculates the impedance and admittance of each line, initializes the Ybus matrix, populates the off-diagonal and diagonal elements using loops, and displays the resulting Ybus and Zbus matrices.
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)
234 views3 pages

Program To Form Admittance and Impedance Bus Formation PDF

The document contains code to calculate the bus admittance matrix (Ybus) and bus impedance matrix (Zbus) from line data consisting of from bus, to bus, resistance, reactance, and ground admittance values. It reads in the line data from an Excel file, calculates the impedance and admittance of each line, initializes the Ybus matrix, populates the off-diagonal and diagonal elements using loops, and displays the resulting Ybus and Zbus matrices.
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/ 3

% Program to form Admittance And Impedance Bus Formation....

clc
clear all
close all
linedata = xlsread('ydata.xlsx'); % Calling "ydata.xlsx" for Line Data...
fb = linedata(:,1); % From bus number...
tb = linedata(:,2); % To bus number...
r = linedata(:,3); % Resistance, R...
x = linedata(:,4); % Reactance, X...
b = linedata(:,5); % Ground Admittance, B/2...
z = r + 1i*x; % Z matrix...
y = 1./z; % To get inverse of each element...
b = 1i*b; % Make B imaginary...

nbus = max(max(fb),max(tb)); % no. of buses...


nbranch = length(fb); % no. of branches...
ybus = zeros(nbus,nbus); % Initialise YBus...

% Formation of the Off Diagonal Elements...


for k=1:nbranch
ybus(fb(k),tb(k)) = -y(k);
ybus(tb(k),fb(k)) = ybus(fb(k),tb(k));
end

% Formation of Diagonal Elements....


for m=1:nbus
for n=1:nbranch
if fb(n) == m || tb(n) == m
ybus(m,m) = ybus(m,m) + y(n) + b(n);
end
end
end
disp(ybus); % Bus Admittance Matrix
zbus = inv(ybus); % Bus Impedance Matrix
disp(zbus);

1.0e+14 *

-1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i

-1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i

-1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i

-1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i -1.0640 - 2.3286i


% Program to form Admittance And Impedance Bus Formation....
clc
clear all
close all
linedata = xlsread('xdata.xlsx'); % Calling "ydata(1).xlsx" for Line Data...
fb = linedata(:,1); % From bus number...
tb = linedata(:,2); % To bus number...
r = linedata(:,3); % Resistance, R...
x = linedata(:,4); % Reactance, X...
b = linedata(:,5); % Ground Admittance, B/2...
z = r + 1i*x; % Z matrix...
y = 1./z; % To get inverse of each element...
b = 1i*b; % Make B imaginary...

nbus = max(max(fb),max(tb)); % no. of buses...


nbranch = length(fb); % no. of branches...
ybus = zeros(nbus,nbus); % Initialise YBus...

% Formation of the Off Diagonal Elements...


for k=1:nbranch
ybus(fb(k),tb(k)) = -y(k);
ybus(tb(k),fb(k)) = ybus(fb(k),tb(k));
end

% Formation of Diagonal Elements....


for m=1:nbus
for n=1:nbranch
if fb(n) == m || tb(n) == m
ybus(m,m) = ybus(m,m) + y(n) + b(n);
end
end
end
disp(ybus); % Bus Admittance Matrix
zbus = inv(ybus); % Bus Impedance Matrix
disp(zbus);

3.6573 -17.8314i 0.0000 + 0.0000i 0.0000 + 0.0000i -0.6750 + 4.3394i -2.1459 + 9.0129i -0.8364 +
4.4956i

0.0000 + 0.0000i 0.0000 -28.5714i 0.0000 + 0.0000i 0.0000 +28.5714i 0.0000 + 0.0000i 0.0000 +
0.0000i

0.0000 + 0.0000i 0.0000 + 0.0000i 0.0000 -23.8095i 0.0000 + 0.0000i 0.0000 +23.8095i 0.0000 +
0.0000i

-0.6750 + 4.3394i 0.0000 +28.5714i 0.0000 + 0.0000i 2.3814 -40.5186i 0.0000 + 0.0000i -1.7064 +
7.6178i

-2.1459 + 9.0129i 0.0000 + 0.0000i 0.0000 +23.8095i 0.0000 + 0.0000i 2.9766 -38.3788i -0.8306 +
5.5909i

-0.8364 + 4.4956i 0.0000 + 0.0000i 0.0000 + 0.0000i -1.7064 + 7.6178i -0.8306 + 5.5909i 3.3734 -
17.6652i
0.0080 - 9.9606i 0.0007 -10.0025i -0.0016 -10.0030i 0.0007 -10.0025i -0.0016 -10.0030i -0.0022 -
10.0133i

0.0007 -10.0025i 0.0144 - 9.8917i -0.0042 -10.0232i 0.0144 - 9.9267i -0.0042 -10.0232i -0.0003 -
9.9972i

-0.0016 -10.0030i -0.0042 -10.0232i 0.0061 - 9.9250i -0.0042 -10.0232i 0.0061 - 9.9670i -0.0036 -
10.0219i

0.0007 -10.0025i 0.0144 - 9.9267i -0.0042 -10.0232i 0.0144 - 9.9267i -0.0042 -10.0232i -0.0003 -
9.9972i

-0.0016 -10.0030i -0.0042 -10.0232i 0.0061 - 9.9670i -0.0042 -10.0232i 0.0061 - 9.9670i -0.0036 -
10.0219i

-0.0022 -10.0133i -0.0003 - 9.9972i -0.0036 -10.0219i -0.0003 - 9.9972i -0.0036 -10.0219i 0.0042 -
9.9757i

You might also like