Docsity

Load Flow Study by constructing Y-Bus Matrix using MATLAB, Study notes of Power Distribution and Utilization

Partial preview of the text

Download Load Flow Study by constructing Y-Bus Matrix using MATLAB and more Study notes Power Distribution and Utilization in PDF only on Docsity!

EEE433L

Power Systems II Laboratory

Lab Report

Section: 01 Group No: 03

Experiment no: 04

Name of the experiment: Load Flow Study by constructing Y-Bus

Matrix using MATLAB

Prepared by:

Name: Dewan Muhammad Inamul Hoque ID: 22221104

All Group members:

Sl. Name ID

1. Adrija Khastagir 22221018

2. Quafshad Tayush Nur 22221029

3. Anika Azmain 22321067

4. Trina Biswas 22221035

5. Fariha Raunak 22221010

  1. Miftahul Jannat 21221048 Date of Submission: 17 March 2026

Abstract

In this experiment, the bus admittance matrix (Y-bus) and bus impedance matrix (Z-bus) of a three-phase power

system were calculated using MATLAB. The IEEE 5-bus system data were used as the input. From this data, the

line impedances and shunt admittances were taken to build the Y-bus matrix. The diagonal elements of the matrix

were found by adding all admittances connected to each bus. The off-diagonal elements were the negative values

of the admittance between two buses. After forming the Y-bus matrix, the Z-bus matrix was obtained by taking its

inverse in MATLAB. This experiment is an important first step for power flow analysis. It shows how proper

matrix formation helps in studying voltage levels, current flow, and the overall behavior of a power system

network.

Theoretical Background

In power system analysis, the bus admittance matrix (Y-bus) and bus impedance matrix (Z-bus) are important

tools used to represent the steady-state behavior of electrical power networks. A power system consists of many

buses connected through transmission lines, transformers, and shunt elements. For efficient load flow analysis,

these components are modeled using their admittance and impedance values.

The Y-bus matrix is a sparse and symmetric matrix that relates the current at each bus to the bus voltages using the

nodal equation:

Here, I represents the injected current vector and V represents the bus voltage vector. The diagonal elements Yii,

known as self-admittance, are calculated as the sum of all admittances connected to bus i , including transmission

lines and shunt elements. The off-diagonal elements Yij, called mutual admittances, are equal to the negative of the

admittance of the transmission line connecting buses i and j. Because most buses are connected to only a few other

buses, the Y-bus matrix contains many zero elements, making it sparse and computationally efficient for load flow

and contingency analysis.

The Z-bus matrix is defined as the inverse of the Y-bus matrix:

Fig: Methodology flowchart for MATLAB

The process starts by importing the transmission line data of the power system (excel file). We have to make sure

that our MATLAB file and excel file must be in the same folder. This excel file includes the resistance, reactance,

shunt admittance of each transmission line, and the bus numbers that the line connects. MATLAB reads this data

from an external file, such as an Excel sheet, using functions like readtable(). After importing the data, MATLAB

converts the line parameters into complex impedance and admittance values using its built-in mathematical

operations.

After that, MATLAB forms the Y-bus matrix. According to the admittance rules, the diagonal elements of the

matrix are equal to the sum of all admittances connected to that bus. The off-diagonal elements are the negative

value of the admittance between two buses. MATLAB usually uses loops to go through the line data and fill the

matrix step by step.

After creating the Y-bus matrix, the Z-bus matrix can be calculated. MATLAB simply takes the inverse of the Y-

bus matrix using the inv() function. The result is the Z-bus matrix, which shows the impedance relationship

between all buses in the network.

Problem 6.

Function Code:

function Ybus = my_ybus_matrix(file_name,branch_data_sheet_name) bus_data = readtable(file_name,"Sheet",branch_data_sheet_name); Z = bus_data.R + 1j*bus_data.X; %extract bus-impedance data B = bus_data.B; %extract shunt-admittance data bus_from = bus_data.bus_from; %id of buses from which the line starts bus_to = bus_data.bus_to; %id of buses to which the line ends % Defining a function to extract ID from strings extract_id = @(str) str2double(regexp(str, '\d+$', 'match', 'once')); %Applying cellfunc() on the function and the cell bus_from_id = cellfun(extract_id, bus_from); bus_to_id = cellfun(extract_id,bus_to); list_of_bus = unique([bus_from_id;bus_to_id]); nbus = length(list_of_bus); %bus count y = zeros(nbus); %line-admittance matrix y_primeBy2 = zeros(nbus); %shunt-admittance matrix Ybus = zeros(nbus); %Ybus matrix %Forming shunt-admittance matrix by calculating diagonal elements

end %Zbus matrix Zbus = inv(Ybus)

Result

Problem 6.

Function Code:

function Ybus = ybus_matrix(file_name, work_sheet_name) %% Read the file bus_data = readtable(file_name,"Sheet",work_sheet_name); %% Extract Z and Y'/ Z = bus_data.R + 1j*bus_data.X; %extract bus-impedance data B = bus_data.B; %extract shunt-admittance data % because G = 0 , only B is used %% Extracting bus numbers bus_from = bus_data.bus_from; %id of buses from which the line starts bus_to = bus_data.bus_to; %id of buses to which the line ends %% Extracting total number or buses % Defining a function to extract ID from strings extract_id = @(str) str2double(regexp(str, '\d+$', 'match', 'once')); %Applying cellfunc() on the function and the cell bus_from_id = cellfun(extract_id, bus_from); bus_to_id = cellfun(extract_id,bus_to); list_of_bus = unique([bus_from_id;bus_to_id]);

Zbus = inv(Ybus)

Result

Home Task(i)

Hand Calculation

MATLAB code

clc clear file = 'IEEE 5 Bus.xlsx'; sheet = 'Fault'; Ybus_full = ybus_matrix(file, sheet); Ybus = Ybus_full(2:end, 2:end) Zbus = inv(Ybus) V_prefault = 1.0; % pu fault_bus = 4; % Bus (4) If = V_prefault / Zbus(fault_bus, fault_bus); fprintf('Fault Current at Bus 4: %.4f pu\n', abs(If));

V_fault = zeros(size(Zbus,1), 1); for i = 1:size(Zbus,1) V_fault(i) = V_prefault - Zbus(i, fault_bus) * If; end X34 = 0.336; I34 = (V_fault(3) - V_fault(4)) / (1j * X34); X54 = 0.252; I54 = (V_fault(5) - V_fault(4)) / (1j * X54); fprintf('Current from Bus 3 to 4: %.4f pu\n', abs(I34)); fprintf('Current from Bus 5 to 4: %.4f pu\n', abs(I54));

Result

The outputs exactly matched with our theoretical calculations. We have used abs() function so that the current

values can be shown as positive.

y(bus_from_id(i)+1,bus_to_id(i)+1) = 1./Z(i); y(bus_to_id(i)+1,bus_from_id(i)+1) = 1./Z(i); end %Calculating Ybus Matrix for i = 1:nbus for j = 1:nbus if i~=j Ybus(i,j) = -y(i,j); %off-diagonal elements end Ybus(i,i) = Ybus(i,i) + y(i,j) + y_primeBy2(i,j); %diagonal elements end end end

Main Script:

clc; clear; %Ybus matrix Ybus = my_ybus_matrix("IEEE 57.xlsx", "branch")

Result

Here, the matrix size is 57 Ɨ 57 , so it is difficult to display the entire output in a single frame. So, only a portion

of the output is shown.

Conclusion

The construction of the Y-bus matrix using MATLAB for the IEEE-5 and IEEE-57 bus systems provides a

organized way to represent the connections in a power network. The code successfully reads the network data,

calculates the line admittances, and automatically forms the nodal admittance matrix for systems of different sizes.

This experiment shows that the Y-bus matrix is an important part of power system analysis because it is used in

load flow studies, fault analysis, and stability studies. The comparison between the small IEEE-5 bus system and

the larger IEEE-57 bus system also shows that MATLAB can easily handle both simple and complex power

networks.

The results confirm that the calculated Y-bus matrices are accurate, which means they can be reliably used for

further power system analysis and studies.