Programming for Y bus matrix of power system network.

Experiment No.: – 01

Programming for Y bus matrix of power system network.

  1. MATLAB installed in computer system.
Fig. 1.1: 14 bus system.

In order to obtain the node-voltage equations, consider the simple power system shown in Figure 1.1 where impedances are expressed in per unit on a common MVA base and the system datas are given in table no. 1.1 . Since the nodal solution is based upon Kirchhoff’s current law, impedances are converted to admittance, i.e.,

\[\color\red{y_{ij}\;=\;\dfrac{1}{z_{ij}}\color\red{\;=\;\dfrac{1}{r_{ij}+jx_{ij}}}}\]

The circuit has been redrawn in Figure 9.2 in terms of admittances and transformation to current sources. Node 0 (which is normally ground) is taken as reference. Applying KCL to the independent nodes 1 through 4 results in

\[I_1 = y_{10}V_1 + y_{12}(V_1 – V_2) + y_{13}(V_1 – V_3)\] \[I_2 = y_{20}V_2 + y_{12}(V_2 – V_1) + y_{23}(V_2 – V_3)\] \[0 = y_{23}(V_3 – V_2) + y_{13}(V_3 – V_1) + y_{34}(V_3 – V_4)\] \[0 = y_{34}(V_4 – V_3) \]
\[ I_1 = (y_{10} + y_{12} + y_{13})V_1 – y_{12}V_2 – y_{13}V_3\] \[I_2 = -y_{12}V_1 + (y_{20} + y_{12} – y_{23})V_2 – y_{23}V_3\] \[0 = -y_{13}V_1 – y_{23}V_2 + (y_{13} + y_{23} – y_{34})V_3 – y_{34}V_4\] \[0 = -y_{34}V_3 + y{34}V_4\]
\[Y_{11} = y_{10} + y_{12} + y_{13}\] \[Y_{22} = y_{20} + y_{12} + y_{23}\] \[Y_{33} = y_{13} + y_{23} + y_{34}\] \[Y_{44} = y_{34}\] \[Y_{12} = Y_{21} = -y_{12}\] \[Y_{13} = Y_{31} = -y_{13}\] \[Y_{23} = Y_{32} = -y_{23}\] \[Y_{34} = Y_{43} = -y_{34}\]
\[I_1 = Y_{11}V_1 + Y_{12}V_2 + Y_{13}V_3 + Y_{14}V_4\] \[I_2 = Y_{21}V_1 + Y_{22}V_2 + Y_{23}V_3 + Y_{24}V_4\] \[I_3 = Y_{31}V_1 + Y_{32}V_2 + Y_{33}V_3 + Y_{34}V_4\] \[I_4 = Y_{41}V_1 + Y_{42}V_2 + Y_{43}V_3 + Y_{44}V_4\]

Extending the above relation to an n bus system, the node-voltage equation in matrix form is

The off-diagonal element is equal to the negative of the admittance between the nodes. It is known as the mutual admittance or transfer admittance, i.e.,

When the bus currents are known, (9.1) can be solved for the n bus voltages.

The inverse of the bus admittance matrix is known as the bus impedance matrix Zbus. The admittance matrix obtained with one of the buses as reference is nonsingular. Otherwise the nodal matrix is singular.

Inspection of the bus admittance matrix reveals that the matrix is symmetric along the leading diagonal, and we need to store the upper triangular nodal admittance matrix only. In a typical power system network, each bus is connected to only a few nearby buses. Consequently, many off-diagonal elements are zero. Such a matrix is called sparse, and efficient numerical techniques can be applied to compute its inverse. By means of an appropriately ordered triangular decomposition, the inverse of a sparse matrix can be expressed as a product of sparse matrix factors, thereby giving an advantage in computational speed, storage and reduction of round-off errors. Based on above equations, the bus admittance matrix for the network in Figure 9.2 obtained by inspection is

Algorithms for Ybus in MATLAB.

  1. A function called Y = ybus(zdata) is written for the formation of the bus admittance matrix.
  2. zdata is the line data input and contains four columns.
  3. The first two columns are the line bus numbers and the remaining columns contain the line resistance and reactance in per unit.
  4. In the program, the line impedances are first converted to admittances.
  5. Y is then initialized to zero.
  6. In the first loop, the line data is searched, and the off-diagonal elements are entered. Finally, in a nested loop, line data is searched to find the elements connected to a bus, and the diagonal elements are thus formed.

MATLAB Program

Creating the Y bus matrix for a power system network involves performing load flow analysis and solving a set of equations based on the network topology and component parameters. The Y bus matrix represents the admittance (or impedance) values of the network elements and is used for power flow calculations and fault analysis. Here’s a high-level overview of the steps involved in programming the Y bus matrix calculation:

  1. Define the network topology: Create a data structure to represent the network topology, including buses, branches, generators, loads, and other components. Each bus should have information such as voltage magnitude, voltage angle, and type (slack, PV, or PQ).
  2. Read network data: Read the parameters of the network components from input files or databases. This includes the admittance (or impedance) values of transmission lines, transformers, generators, and loads.
  3. Build the Y bus matrix: Initialize an empty Y bus matrix of appropriate size based on the number of buses in the network. The Y bus matrix is typically a square matrix where each element represents the admittance between two buses.
  4. Populate the Y bus matrix: Traverse through the network topology and calculate the admittance values for each branch. Consider both series and shunt components of the branch to calculate the corresponding admittance values. Update the appropriate elements of the Y bus matrix based on the calculated admittances.
  5. Handle special cases: Depending on the network configuration, you may need to handle special cases like transformer connections, tapped transformers, and shunt capacitor or reactor banks. Adjust the calculations and update the Y bus matrix accordingly.
  6. Incorporate generator and load models: If your power system network includes generators and loads, you may need to include their models in the Y bus matrix calculations. Depending on the complexity of the models, additional equations and calculations might be required.
  7. Perform load flow analysis: Once the Y bus matrix is constructed, you can use it to perform load flow analysis to determine the steady-state operating conditions of the power system. This involves solving a set of power flow equations iteratively until convergence is achieved.
  8. Output the Y bus matrix: Finally, you can output or store the calculated Y bus matrix for further analysis or use in other power system studies.

Using Matlab: –

Bus Data: put it in Excel file named “IEEE1”

Load MVARGeneration MWGeneration MVARVoltage Magnitude in p.uP lossQ lossSusceptance
0232.4-16.91.06000
12.74042.41.04550-400
19023.41.014000
-3.9000000
1.6000000
7.5012.21.0724-60
0000000
0017.41.0924-60
16.6000000.19
5.8000000
1.8000000
1.6000000
5.8000000
5000000

Line Data: put it in Excel file named “IEEE1”

From BusTo BusResistance in p.u (r)Reactance in p.u (x)Half Shunt Charging in p.u (b/2)Turn-ratio in p.u (t)
120.019380.059170.05281
150.054030.223040.04921
230.046990.197970.04381
240.058110.176320.03741
250.056950.173880.0341
340.067010.171030.03461
450.013350.042110.01281
4700.2091200.978
4900.5561800.969
5600.2520200.932
6110.094980.198901
6120.122910.2558101
6130.066150.1302701
7800.1761501
7900.1100101
9100.031810.084501
9140.127110.2703801
10110.082050.1920701
12130.220920.1998801
13140.170930.3480201

\[\color\red{clear\; all;\;}\color\green{\; \% \;clear\; all.\;}\] \[\color\red{clc;}\;\color\green{\%\; clear\; comand \;window \;only.\;}\] \[\color\red{bus\;= \;xlsread(‘IEEE1.xlsx’,’bus’);\;}\] \[ \;\color\green{\% \;for\; Bus\; Data\; from \;xls\; sheet.}\] \[\color\red{line\;= \;xlsread(‘IEEE1.xlsx’,’line’);}\] \[ \;\color\green{\% \;for \;Line \;Data\; from \;xls\;sheet.}\] \[\color\red{n=length(bus(:,1)); }\;\color\green{\%\; Nos.\; of \;Bus.}\] \[\color\red{nl=length(line(:,1)); }\;\color\green{\% \;Nos.\; of\; lines.}\] \[\color\red{y_{bus}\;=sparse(zeros(n,n)); }\] \[\;\color\green{\% \;initiate\; for\; Zeros\; matrix\; ybus.}\] \[\color\red{for\;\; k=1:nl }\] \[\;\color\green{\%\; for\; loop \;start\; in \;making \;of \;ybus.}\] \[\color\red{if \;line(k,6)==0} \;\color\green{\% \;if \;loop\; start}\] \[\color\red{i=line(k,1); }\] \[\;\color\green{\%\; from \;bus\; line \;data \;in \;column \;1.}\] \[\color\red{j=line(k,2);}\] \[ \;\color\green{\% \;to\; bus \;line\; data \;in\; column \;2.}\] \[\color\red{r=line(k,3);}\] \[ \;\color\green{\%\; resistance\; of \;line \;data \;in \;column\; 3.}\] \[\color\red{x=line(k,4); }\] \[\;\color\green{\% \; reactance \; line \;data \;in\; column \;4.}\] \[\color\red{b=line(k,5);}\] \[ \;\color\green{\% \;shunt \;conductance\; line \;data \;in\; column\; 5.}\] \[\color\red{y=1/(r+1i*x);}\] \[ \;\color\green{\% \;admittance\; = \;1/impedance.}\] \[\color\red{y_{bus}(i,i)= y_{bus}(i,i)+y+1i*b/2; }\] \[\;\color\green{\%\; the\; diagonal \;element \;with\; b.}\] \[\color\red{y_{bus}(j,j)= y_{bus}(j,j)+y+1i*b/2; }\] \[\;\color\green{\% \;the\; diagonal\; element \;with\; b.}\] \[\color\red{y_{bus}(i,j)= y_{bus}(i,j)-y;}\] \[ \;\color\green{\%\; the\; off\; diagonal\; element \;with\; b.}\] \[\color\red{y_{bus}(j,i)= y_{bus}(j,i)-y;}\] \[ \;\color\green{\%\;the\; off\; diagonal\; element\; with\; b.}\] \[\color\red{else}\] \[\color\red{i=line(k,1); }\] \[\;\color\green{\%\; read\; from\; bus\; line\; data\; in\; column\; 1.}\] \[\color\red{j=line(k,2); }\] \[\;\color\green{\% \;to \;bus\; line\; data\; in \;column\; 2.}\] \[\color\red{r=line(k,3); }\] \[\;\color\green{\% \;resistance \;line\; data\; in\; column\; 3.}\] \[\color\red{x=line(k,4); }\] \[\;\color\green{\% \; reactance\; line \;data\; in\; column\; 4.}\] \[\color\red{b=line(k,5);}\] \[ \;\color\green{\% \; shunt\; conductance\; line \;data \;in \;column\; 5.}\] \[\color\red{t=line(k,6); }\] \[\;\color\green{\% \;turn \;ratio\; value\; line\; data\; in \;column\; 6}\]. \[\color\red{y=1/(r+1i*x);}\] \[ \;\color\green{\% \;admittance \;= \;1/impedance.}\] \[\color\red{y_{bus}(i,i)= y_{bus}(i,i)+y/(t*t);}\] \[ \;\color\green{\%\;the\; diagonal\; element \;with\; t.}\] \[\color\red{y_{bus}(j,j)= y_{bus}(j,j)+y; }\] \[\;\color\green{\% \;the\; diagonal\; element\; with \;t.}\] \[\color\red{y_{bus}(i,j)= y_{bus}(i,j)-y/t;}\] \[ \;\color\green{\% \;the\; off \;diagonal\; element \;with\; t.}\] \[\color\red{y_{bus}(j,i)= y_{bus}(j,i)-y/t;}\] \[ \;\color\green{\%\; the \;off\; diagonal\; element\; with\; t.}\] \[\color\red{end}\] \[ \;\color\green{\% \;End \;of \;the\; if \;loop.}\] \[\color\red{end }\] \[\;\color\green{\%\; End\; of\; the\; for \;loop.}\] \[\color\red{for k=1:n }\] \[\;\color\green{\%\; for \;loop \;start\; in \;displaying\; of \;ybus.}\] \[\color\red{y_{bus}(k,k)=y_{bus}(k,k)+1i*bus(k,11);}\] \[ \;\color\green{\% \;formation\; of \;ybus\;in \;command\; window.}\] \[\color\red{end }\;\color\green{\% \;End\; of \;the \;for\; loop.}\]
\[\color\red{y_{bus} =}\] \[\color\red{(1,1)}\;\color\green{ 6.0250 -19.4981i}\] \[\color\red{(2,1)}\;\color\green{ -4.9991 +15.2631i}\] \[\color\red{(5,1)}\;\color\green{ -1.0259 + 4.2350i}\] \[\color\red{(1,2)}\;\color\green{ -4.9991 +15.2631i}\] \[\color\red{(2,2)}\;\color\green{ 9.5213 -30.3547i}\] \[\color\red{(3,2)}\;\color\green{ -1.1350 + 4.7819i}\] \[\color\red{(4,2)}\;\color\green{ -1.6860 + 5.1158i}\] \[\color\red{(5,2)}\;\color\green{ -1.7011 + 5.1939i}\] \[\color\red{(2,3)}\;\color\green{ -1.1350 + 4.7819i}\] \[\color\red{(3,3)}\;\color\green{ 3.1210 – 9.8507i}\] \[\color\red{(4,3)}\;\color\green{ -1.9860 + 5.0688i}\] \[\color\red{(2,4)}\;\color\green{ -1.6860 + 5.1158i}\] \[\color\red{(3,4)}\;\color\green{ -1.9860 + 5.0688i}\] \[\color\red{(4,4)}\;\color\green{ 10.5130 -38.6776i}\] \[\color\red{(5,4)}\;\color\green{ -6.8410 +21.5786i}\] \[\color\red{(7,4)}\;\color\green{ 0.0000 + 4.8895i}\] \[\color\red{(9,4)}\;\color\green{ 0.0000 + 1.8555i}\] \[\color\red{(1,5)}\;\color\green{ -1.0259 + 4.2350i}\] \[\color\red{(2,5)}\;\color\green{ -1.7011 + 5.1939i}\] \[\color\red{(4,5)}\;\color\green{ -6.8410 +21.5786i}\] \[\color\red{(5,5)}\;\color\green{ 9.5680 -35.5755i}\] \[\color\red{(6,5)}\;\color\green{ 0.0000 + 4.2574i}\] \[\color\red{(5,6)}\;\color\green{ 0.0000 + 4.2574i}\] \[\color\red{(6,6)}\;\color\green{ 6.5799 -17.3407i}\] \[\color\red{(11,6)}\;\color\green{ -1.9550 + 4.0941i}\] \[\color\red{(12,6)}\;\color\green{ -1.5260 + 3.1760i}\] \[\color\red{(13,6)}\;\color\green{ -3.0989 + 6.1028i}\] \[\color\red{(4,7)}\;\color\green{ 0.0000 + 4.8895i}\] \[\color\red{(7,7)}\;\color\green{ 0.0000 -19.5490i}\] \[\color\red{(8,7)}\;\color\green{ 0.0000 + 5.6770i}\] \[\color\red{(9,7)}\;\color\green{ 0.0000 + 9.0901i}\] \[\color\red{(7,8)}\;\color\green{ 0.0000 + 5.6770i}\] \[\color\red{(8,8)}\;\color\green{ 0.0000 – 5.6770i}\] \[\color\red{(4,9)}\;\color\green{ 0.0000 + 1.8555i}\] \[\color\red{(7,9)}\;\color\green{ 0.0000 + 9.0901i}\] \[\color\red{(9,9)}\;\color\green{ 5.3261 -24.2825i}\] \[\color\red{(10,9)}\;\color\green{ -3.9020 +10.3654i}\] \[\color\red{(14,9)}\;\color\green{ -1.4240 + 3.0291i}\] \[\color\red{(9,10)}\;\color\green{ -3.9020 +10.3654i}\] \[\color\red{(10,10)}\;\color\green{ 5.7829 -14.7683i}\] \[\color\red{(11,10)}\;\color\green{ -1.8809 + 4.4029i}\] \[\color\red{(6,11)}\;\color\green{ -1.9550 + 4.0941i}\] \[\color\red{(10,11)}\;\color\green{ -1.8809 + 4.4029i}\] \[\color\red{(11,11)}\;\color\green{ 3.8359 – 8.4970i}\] \[\color\red{(6,12)}\;\color\green{ -1.5260 + 3.1760i}\] \[\color\red{(12,12)}\;\color\green{ 4.0150 – 5.4279i}\] \[\color\red{(13,12)}\;\color\green{ -2.4890 + 2.2520i}\] \[\color\red{(6,13)}\;\color\green{ -3.0989 + 6.1028i}\] \[\color\red{(12,13)}\;\color\green{ -2.4890 + 2.2520i}\] \[\color\red{(13,13)}\;\color\green{ 6.7249 -10.6697i}\] \[\color\red{(14,13)}\;\color\green{ -1.1370 + 2.3150i}\] \[\color\red{(9,14)}\;\color\green{ -1.4240 + 3.0291i}\] \[\color\red{(13,14)}\;\color\green{ -1.1370 + 2.3150i}\] \[\color\red{(14,14)}\;\color\green{ 2.5610 – 5.3440i}\]