Featured post

Renewable Energy Certificates

What is Renewable Energy Certificate? Renewable Energy Certificates (REC) are generation based certificates awarded to those who genera...

Sunday 19 October 2014

MATLAB coding for Y-bus

In recent years, the analysis and design of power system have been influenced greatly by the high end performance of personal computers. These computers can be used to perform the steady-state and transient analysis of large interconnected power systems.   
MATLAB which stands for MATrix LABoratory, is a powerful software package developed by MathWorks Inc.  This software having analysis capability, flexibility, reliability and powerful graphics is currently the main software package used by power system engineers. MATLAB provides matrix as one of the basic elements and does the basic operation as addition, subtraction, multiplication using simple mathematical operators. With hundreds of reliable and built in functions, MATLAB helps in solving a variety of mathematical problems including differential equations, linear systems, non-linear systems, optimization and many other type of engineering computations.The most appreciable feature of MATLAB is its programming capability and the several optional toolboxes for simulating specialized problems of different areas.  
In power system, nodal admittance matrix or bus admittance matrix or Y matrix or Y bus is an n x n matrix describing a power system with n buses. It represents the nodal admittance of the buses in a power system. In a real power system, each bus is usually connected to only a few other buses, hence the Y bus matrix is sparse. The Y bus is one of the data requirements needed to formulate a power flow study.
Power flow studies, commonly known as load flow, are necessary for planning, operation, economic scheduling and exchange of power between utilities. Power flow analysis is also required for transient stability and contingency studies.
Y bus is a tool that provides a method of systematically reducing a complex power system to a matrix that can be solved by a computer program. The equation used to formulate Y bus is based on Kirchhoff’s Current Law (KCL) and Kirchhoff’s Voltage Law (KVL), applied to a circuit with steady state sinusoidal operation. These laws are applied to all the nodes of a power system and elements of the admittance matrix are determined, which then represents the admittance relationship between nodes to further find the voltages, currents and power flows in the system.
The below given MATLAB program is for the formulation of bus admittance matrix or the Y bus.
The input data required for Y bus formulation is “linedata” which contains 4 columns. The 1st column gives the branch number. The 2nd column is the “from bus” number whereas the 3rd column is the “to bus” number. The 4th column is the admittance of the corresponding branch.
% Declaring function [Y] that takes the “linedata” as input and returns Y bus matrix as output.
 function [Y]=ybus(linedata)
% extracting the maximum numerical value of column 1 of the “linedata” which gives the maximum number of %branches in the network.
elements=max(linedata(:,1));
%   defining the total number of buses in the network.
buses=max(max(linedata(:,2)),max(linedata(:,3)));
Y=zeros(buses,buses);
% defining a loop for the diagonal and off-diagonal elements of Y -bus
 for row=1:elements,
i1=linedata(row,2);
j1=linedata(row,3);
Y(i1,i1) =Y(i1,i1) + linedata(row,4);
Y(i1,j1) =Y(i1,j1) - linedata(row,4);
Y(j1,i1) =Y(i1,j1);
Y(j1,j1) =Y(j1,j1) + linedata(row,4);
end
Y

No comments:

Post a Comment