You are on page 1of 3

Lab - : 2 Construction of Y-Bus Matrix (Algorithm)

Objective:

To learn writing code for Y-Bus matrix for multi-bus system in MATLAB

Resources:
Pc installed with latest version of MATLAB.

Example:

Matlab Code:

data_file= [ 1 2 0.02 0.04j;


2 3 0.04 0.05j;
1 30.03 0.07j];
left_node = data_file(:,1);
right_node = data_file(:,2);
branches = length(left_node);
admittance = 1./ (data_file(:,3) + data_file(:,4));
For ss = 1:3
For pp = 1:3
Y_bus(ss,pp) = 0;
End
End

fori = 1:4

16
for j = 1:4
if(i==j)
for k = 1:3
if(left_node(k)==i)||(right_node(k)==j)
Y_bus(i,j) = Y_bus(i,j) + admittance(k)
End
End
End
End
End

Task 1:

Students are required to write the code for the non-diagonal entries of the admittance matrix.

Solution to task 1:

Modify your code by adding these lines to your existing code:

Else
For i=1:4;
For j=1:4;
If I !=j
Y_bus(i,j) = Y_bus(i,j) + admittance(k)
End
End
End
End

Learning Outcomes:

1. Able to write the algorithm of Ybus.


2. Able to write the code of Ybus and application of certain logics.
3. Able to write Ybus code for any complex system.

Questions:

1. Construct a generic code for ”n” number of buses.

17
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________

2. Apply different logics to make the code concise.


__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________
__________________________________________________________________________

18

You might also like