You are on page 1of 2

Experiment 7

USING MATLAB TO FORM THE Y-BUS

Objectives:
The objectives of this lab is to obtain more familiarization of Matlab and to construct the YMatirx of a given system.
The System
The line data of a 5-bus system (in addition to the reference node) is shown in the table below.
The values shown are the series impedances in pu. (R+jX) and shunt susceptances.

Part A
Five parameters are associated with each line in the system, these are: a from-bus, a to-bus, R of
the line, X of the line, and the line charging (assuming a pi-model) of the line,
Create a data file (MAT-file) to include line information. The data should be arranged in a
matrix form having 5 columns and a number of rows equal to the number of lines. Each line in
this data file should have the five parameters associated with each system line. Call this matrix
linedata and save the data file.
Part B
Study section 1.12 of Granger and Stevensons book or any other reference to understand how to
construct the Y-Matrix.

Create an M-file that will read the data of linedata and construct the Y-Matrix.
Print the Y-matrix and manually verify some of the entries in that matrix
Below is a sample function to output Y.
function [Y] = ybus(linedata) %declaring function[Y] that takes as input
linedata and outputs Y-matrix.
nl = linedata (:,1); % extracting column 1 from the linedata file. nl is line
from bus nr = linedata (:,2); % extracting column 2 from the linedata file.
nl is line to bus R = linedata (:,3) %extracting the resistance in column 3
from the linedata file.
X = linedata (:,4) %xtracting the line reactance from column 4 B = linedata
(:,8); %extracting half of the total line susceptance from column 8 OF
LINEDATA FILE nline = length (linedata (:,1)); %declaring the total # of
lines nbus = max (max (nl), max (nr)); %defining the toal no of nodes Z = R +
j*X; % declaring the impedance y = ones (nline,1)./Z ; Y= zeros (nbus,nbus);
for n = 1:nbus
%defining a for
loop to find the diagonal elements of Y-matrix.
for k = 1:nline
if nl (k) == n| nr (k) == n
Y (n,n) = Y (n,n) + y(k) - B(k);
else, end
end
end
for k = 1:nline
%defining a loop
to find the off-diagonal elements of Y-matrix
Y (nl(k), nr(k))=Y(nl(k),nr(k))-y(k);
Y(nr(k),nl(k))=Y(nl(k),nr(k));
end

Part C
Use PowerWorld to create a one-line diagram of the system.

You might also like