Power Flow Analysis Using MATLAB: by MOHAMMAD NASER (092312) Najibullah (092314)
Power Flow Analysis Using MATLAB: by MOHAMMAD NASER (092312) Najibullah (092314)
Power Flow Analysis Using MATLAB: by MOHAMMAD NASER (092312) Najibullah (092314)
By
NAJIBULLAH (092314)
Supervised By
By
NAJIBULLAH (092314)
Supervised By
Gazipur-1704,Dhaka,Bangladesh
By
Najibullah -092314
Supervised By
…………………………………………..
Rakibul Hasan Sagor
Project Supervisor
Dept. of Electrical & Electronic Engineering (EEE)
………………………………………..
Prof. Dr. Md . shahidUllah
Head of the department of Electrical and Electronic Engineering (EEE)
Members :
…………………………… …………………………
Mohammad Naser (092312) Najibulla (092314)
Islamic University of Technology (IUT)
Organization of Islamic Cooperation
Gazipur-1704, Bangladesh
October 2012
Declaration
This is to certify that the project entitled ”Power
Flow Analysis Using Matlab@ “is
supervised by
…………………………………………..
Rakibul Hasan Sagor
Project Supervisor
Dept. of Electrical & Electronic Engineering (EEE)
…………………………… …….......................................
Mohammad Naser (092312) Najibulla (092314)
To our parents &uncle
You are the light of our life.
Acknowledgements
First of all, we would like to express our deep and sincere gratitude to our
respected supervisor Rakibul Hasan Sagor lecturer in Electrical and Electronic
Engineering Department of Islamic University of Technology (IUT), Dhaka,
Bangladesh, for his kind guidance and supervision. His regular helps and
supervision on this thesis really made us to complete this work within the very
short time we had.
Second, we would like to express our deepest cordial thanks to our parents for
their supporting and tolerance of being far away from them. It is not really we
who reached here to study but of course it is our parents who gave us hope and
inspiration.
Table of contents
Contents
CHAPTER 1
1.1Introduction…………………………………………………………………………………………3
1.2Bus Admittance Matrix ………………………………………………………………………..4
CHPTER 2
2.1 Solution of Nonlinear Algebraic Equations………………………………………….8
CHAPTER 3
3.1 Power Flow Solution…………………………………………………………………23
1
Table of contents
Contents
CHAPTER 4
4.1 Power flow programs………………………………………………………………..40
4.1.1 Lfybus…………………………………………………………………………...…40
4.1.2 Lfguass……………………………………………………………………………..40
4.1.3 busout……………………………………………………………………………….41
CHAPTER 5
IEEE 118 Bus system…………………………………………………………………………83
Conclusion…………………………………………………………………………………128
References…………………………………………………………………………………..129
2
Chapter 1 Introduction
CHAPTER 1
1.1 INTRODUCTION:
The system is assumed 3-phase balanced operating in a steady state and stable condition. It is
represented by a single phase diagram on a per-unit basis, with a system wide MVA base, and a
voltage base properly chosen on each side of every transformer. The base MVA and base V are
specified/ known everywhere in the system. The most common way to represent such a system is
to use the node-voltage method. Given the voltages of generators at all generator nodes, and
knowing all impedances of machines and loads, one can solve for all the currents in the typical
node voltage analysis first the generators are replaced by methods using Kirchhoff’s current law
first the generators are replaced by equivalent current sources and the node equations are written
in the form:
(1.1)
Where I is the injected current vector, Y is the admittance matrix and V is the node voltage
vector. These equations are easy to write by inspection of the circuit. The problem is not so
simple in real power circuits and systems. Usually in generator nodes only the real power and
voltage are known .thus not enough variable are known to solve an equation of the form I = YV.in
fact the power is a nonlinear function of the current and voltage, the solution of the resulting
equations (while it may exist)is not easy! In fact there is no known analytical method to find the
solution. As a result iterative techniques are used to find the solution (voltage, current, etc.), the
nonlinear set of equations which are generated are called power flow equations. The solution of
such equations results in a power flow study or load flow analysis. Such studies are the backbone
of power system studies, for analysis, design, control, and economic operation of the power
system. they are also essential for transient analysis of the system.
3
Chapter 1 Bus Admittance Matrix
In order to obtained the node voltage equations consider the simple power system in figure (1.1),
where impedances is express in per unit and for simplicity the resistances is neglected, to find
the node current by KCL the impedance must be converted to admittance shows in equation
(1.2)
(1.2)
Z20
Z10
Z12
1 2
Z13 Z23
Z34
Figure (1.1)
4
Chapter 1 Bus Admittance Matrix
I1 I2
y10 y20
y13
1 2
y13 y23
y34
Figure(1.2)
The circuit has been redrawn in figure (1.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 result in
(1.3)
(1.4)
(1.5)
(1.6)
5
Chapter 1 Bus Admittance Matrix
6
Chapter 1 Bus Admittance Matrix
But in the network shown in figure (1.1), There is no connection between bus 1 and bus 4, So
. Similarly,
= (1.7)
[ ] [ ][ ]
Diagonal element ( ) is called mutual admittance and off diagonal element ( ) is called
self-admittance.
(1.8)
is the vector injected bus current which is positive when it is flows towards the bus and it is
negative when it is away from the bus the vector of bus magnitude measured from the
reference node , is known as the bus admittance matrix.
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,
7
Chapter 2 Gauss-Seidel Method
CHAPTER 2
Large numbers of iterations are require to solve load flow equation using both and .
For efficient calculation, the program should have following features: High speed, fast
convergent, Minimal storage, Simplicity and ease of programming, reliability for all condition of
the system.
The factors of convergence is very high and low series impedances ,long EHV lines ,large series
capacitances, series and shunt compensation, The most method of solving nonlinear equations
are Gauss-Seidel , Newton-Raphson methods which are discuss as follow:
The method of Gauss-Seidel is known as the method of successive displacements ,To illustrate
the technique, Consider the solution of the nonlinear equation given by
( )
The solution is obtained when the difference between the absolute value of the successive
iteration is less than a specified accuracy.
8
Chapter 2 Gauss-Seidel Method
Example 2.1:
Using the Gauss –Seidel method to find a root of the following equation.
Considering the acceleration factor of =1.25, where the starting initial estimation of
[ ]
[ ]
The subsequent iteration result in 3.0801, 3.1831, 3.7238, 4.0084, 3.9978 and 4.0005, Where the
effect of iteration is graphically shown in matlab.
9
Chapter 2 Gauss-Seidel Method
3.5
g(x)=-1/9x 3+6/9x 2=4/9
x
3
2.5
gx
1.5
0.5
0
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5
x
Figure(2.1)
( )
( )
10
Chapter 2 Gauss-Seidel Method
( )
Solving of one variable from each equation, the above functions are rearranged and written as
( )
( )
………………………
( )
The iteration procedure is initialed by assuming an approximate solution for each of the
independent variables ( ,…, ) which the result of this equation is new equation which
is ,…, ) ,calculated by Gauss-Seidel method, at the end of each iteration the
calculated values of all variables are tested against the previous values. If the variables are with
the specific accuracy a solution has converged, otherwise iteration must be performed. The rate
of convergence can often be increased by using a suitable acceleration factor , and the iterative
sequence becomes
( )
11
Chapter 2 Newton-Raphson Method
The output is
Iter g dx x
The most widely used method for solving simultaneous nonlinear algebraic equations is the
Newton –Raphson method. Newton’s method is a successive approximation procedure based on
an initial estimate of the unknown and the use of Taylor’s series expansion. Consider the solution
of the one-dimensional equation given by
12
Chapter 2 Newton-Raphson Method
If is an initial estimate of the solution, and is a small deviation formed the correct
solution, ’’we must have’’
( )
Expand the left hand side of the above equation in Taylor’s series about yields
( ) +…=C
Assuming the error is very small, the higher order terms can be neglected which results in
Where
( )
( )
13
Chapter 2 Newton-Raphson Method
Where
Example 2.2:
Use the Newton–Raphson method find a root of the equation
The matlab program is given in the last of this chapter, where the graph is follow
14
Chapter 2 Newton-Raphson Method
40
30
20
10
-10
0 1 2 3 4 5 6
x
Figure (2.1)
The graphically description of the Newton-Raphson method. Starting with the initial estimate
of , We extrapolate along the tangent to its intersection with the x-axis and take that as
the next approximation. This is continued until successive x-values are sufficiently close. The
analytical solution is given by the Newton-Raphson algorithm is
( ) [ ]
15
Chapter 2 Newton-Raphson Method
The method may converge to a root different from the expected one or diverge if the starting
value is not close enough to the root. The result of the iteration by newton method is
16
Chapter 2 Newton-Raphson Method
iter Dc J dx X
Consider the n-dimensional equations given by (2.6). Expanding left hand side of the equations
(2.6) in the Taylor’s series about the initial estimates and neglecting all higher order terms leads
to the expression.
We can be written as
Or
17
Chapter 2 Newton-Raphson Method
[ ]
Where
and
[ ] [ ]
[ ]
is called the Jacobian matrix. Elements of this matrix are the partial derivatives evaluated at
. It is assumed that has an inverse during each iteration. Newton’s method is applied to
set of nonlinear equations, to reduce the problem of solving linear equations in order to determine
the values that improve the accuracy of the estimates.
18
Chapter 2 Gauss-Seidel Method
% figure 2.
%plot the following eqution
% x=-x^3/9+6/9*x^2+4/9=gx
s1=[]; s2=[];
x=0:0.05:4.5;
g=-1/9*x.^3+6/9*x.^2+4/9;
k=1;
dz=10; z=2;
s1(k)=z;
s2(k)=z;
while dz>0.01
k=k+2;
s1(k-1)=z;
p=-1/9*z^3+6/9*z^2+4/9;
s2(k-1)=p;
dz=abs(z-p);
z=z+1.25*(p-z);
s1(k)=z;
s2(k)=p; end
plot(x,g,'-',x,x,'-',s1,s2,'-'),grid
xlabel('x')
text(1,3.25,'g(x)=-1/9x^3+6/9x^2=4/9')
text(3.425,3.25 , 'x')
text(2.625,3.275,'\rightarrow')
text(3.3,3.27,'\leftarrow')
clear x g r
19
Chapter 2 Gauss-Seidel Method
figure2.1
dx=1;
x=2;
iter = 0; % Iteration counter
disp('Iter g dx x') % Heading
for results
while abs(dx) >= 0.001 & iter < 100 % Test for
convergence
iter = iter + % No. of iterations
g = -1/9*x^3+6/9*x^2+4/9;
dx = g-x; % Change in
variable
x = x + 1.25*dx; % Successive approximation with
1.25 accel. factor
fprintf('%g', iter), disp([g, dx, x])
end
grid on
20
Chapter 2 Gauss-Seidel Method
z=6;
s1(k)=z;
while abs(dz) >.1
Df= z^3-6*z^2+9*z -4;
s2(k)=Df;
s1(k)=z;
J = 3*z^2-12*z+9;
dz=-Df/J;
z=z+dz;
k=k+2;
s1(k-1)=z;
s2(k-1)=0;
s1(k)=z;
s2(k)=Df;
end
h=zeros(1,length(x));
plot(x,f,'-', x,h,'-', s1,s2,'-'),grid
xlabel('x')
text(3.4, 25,'f(x) = x^3-6x^2+9x-4')
text(5.1, 25, '\rightarrow')
21
Chapter 2 Newton-Raphson Method
%Newton2.2
dx=1; % Change in variable is set to a high
value
x=input('Enter the initial estimate -> '); %
Initial %estimate
iter = 0; %Iteration counter
disp('iter Dc J dx x')% Heading
for result
while abs(dx) >= 0.001 & iter < 100 %
Test for %convergence
iter = iter + 1; % No. of
iterations
Dc=4 - (x^3-6*x^2+9*x); %
Residual
J = 3*x^2-12*x+9; % Derivative
dx= Dc/J; %Change in
variable
x=x+dx; % Successive
solution
fprintf('%g', iter), disp([Dc, J, dx, x])
end
22
Chapter 3 Power Flow Solution
CHAPTER 3
In solving a power flow problem, the system is assumed to be operating under balanced
conditions and a single-phase model is used .four quantities are associated with each bus .these
are voltage magnitude | |,phase angle ,real power ,and reactive power ,the system buses
are generally classified in to three types.
23
Chapter 3 Power Flow Solution
Consider a typical bus of a power system network as shown in the figure (3.1) the Transmission
lines are represented by their equivalent models where impedances have been converted to per
unit admittances on a common MVA base.
(3.1)
∑ ∑ (3.2)
Vi
yi1 V1
Ii
yi2 V2
Vn
yin
yi0
Figure(3.1)
24
Chapter 3 Power flow equation
(3.3)
Or
(3.4)
∑ ∑ ( 3.5)
In the power flow study, it is necessary to solve the set of nonlinear equations represented by
(3.5) for two unknown variables at each node. Using the Gauss-Seidel method (3.5) is solved for
, and the iterative sequence becomes
∑
(3.6)
Where shown in lowercase letter is the actual admittance in per unit. and are the
real and reactive powers expressed in per unit. Applying KCL, current entering bus was
assumed positive. Thus, for buses where real and reactive powers are injected into the bus, such
as generator buses, and have positive values. For load buses where real and reactive
powers are flowing away from the bus, and have negative values. If (3.5) is solved for
and , we have
, * ∑ ∑ +- (3.7)
, * ∑ ∑ +- (3.8)
25
Chapter 3 Gauss-Seidel power flow solution
The load flow equation is usually expressed in terms of the elements of the bus admittance
matrix. Since the off- diagonal elements of the bus admittance matrix , Shown the uppercase
latters, are ,and the diagonal elements are ∑ ,(3.6) becomes
∑
(3.9)
{ [ ∑ ]} (3.10)
{ [ ∑ ]} (3.11)
Include the admittance to ground of line changing susceptance and any other fixed admittance
to ground. Since both component of voltage are specified for slack bus, there are 2(n-1)
equations which must be solved by an iterative method, under normal operating conditions, the
voltage magnitude of the buses are in neighborhood of 1.0 per unit or closed to the voltage
magnitude of the slack bus.
Voltage magnitude at the load buses are somewhat lower than the slack bus value, Depending on
the reactive power demand, whereas the scheduled voltage at the generator buses are somewhat
higher also, the phase angle of the load buses are below the reference angle in accordance to the
real power demand, whereas the phase angle of the generator buses may be above the reference
value depending on the amount of real power flowing in to the bus. Thus, for the Gauss-Seidel
method, an initial voltage estimate of 1.0+j0.0 for unknown voltages is satisfactory, and the
converged solution correlates with the actual operating states.
For P-Q buses, the real and reactive powers and are known. Starting with an initial
estimate, (3.9) is solved for the real and imaginary components of voltage. For the voltage
controlled buses (P-V buses).
26
Chapter 3 Gauss-Seidel power flow solution
Where and | | are specified in (3.6), first (3.11) is solved for , and then is used in
(3.9) to solve for . However, since | | is specified, only the imaginary part of is
retained, and its real part is selected in order to satisfy following equation
(3.12)
√ ( ) (3.13)
Where and are the real and imaginary components of the voltage in the
iterative sequence.
( ) (3.14)
Where is the accelerating factor its value depends upon the system. The range of 1.3 to 1.7 is
found to be satisfactory for typical systems.
The updated voltages immediately replace the previous values in the solution of the subsequent
equations. The process is continued until changes in the real and imaginary components of bus
voltages between successive iterations are within a specified accuracy.
(3.15)
For the power mismatch to be reasonably small and acceptable, a very tight tolerance must be
specified on both components of the voltage .A voltage accuracy in the range of 0.00001 to
0.00005pu is satisfactory .in practice , the method for determining the completion of a solution is
based on an accuracy index set up on the power mismatch. This is continued until the magnitude
of the largest element the and Q columns are less than the specified value. A typical power
mismatch accuracy is 0.001pu Once a solution is converged, the net real and reactive powers at
the slack bus are computed form (3.10) and (3.11).
27
Chapter 3 Gauss-Seidel power flow solution
After iterative solution of the bus voltage, the next step is the line flows and line losses,
considering two buses , where the current is , measured at bus and defined positive in
the direction is given by
Vi
Vj
Ii0 Ij0
yi0 yj0
Figure (3.2)
( ) (3.16)
The power loss in line is the algebraic sum of the power flow obtain by (3.18) and (3.19),
i.e.,
(3.17)
( ) (3.18)
(3.19)
(3.20)
28
Chapter 3 Line flows and losses
Example 3.1:
The one line diagram of a simple three bus power system with generators 1 and 3 is shown in the
figure (3.3). The magnitude of voltage at bus 1 is adjusted to 1.05pu. Voltage magnitude at bus 3
is fixed at 1.04pu with a real power generation of 200 MW. A load consisting of 400 MW and
250Mvar is taken from bus 2. Line impedances are marked in per unit on a 100MVA base, and
the line charging susceptances are neglected. Obtain the power flow solution by the Gauss-Seidel
method including line flows and line losses.
1 2
0.02+J0.04 256.6 MW
Figure (3.3)
29
Chapter 3 Gauss-Seidel power flow solution
Bus 1 is taken as the reference bus (slack bus). Starting from an initial estimate of
and , and are computed from (3.7).
Bus 3 is a regulated bus where voltage magnitude and real power are specified. For the voltage –
controlled bus, first the reactive power is computed from (3.8)
[ ]
[
]
The value of is used as for the computation of voltage at bus 3. The complex voltage at
bus 3, by , is calculated
30
Thus
[ ]
[
]
31
Or
The power flow diagram is shown below where the real power direction is indicated by and
reactive power direction is indicated by .The values with parentheses are the real and reactive
losses in the line.
2
1
179.362 (8.393) 170.968
218.423
(16.787)
118.734 229.032
400
200 146.177
figure(3.4)
33
Chapter 3 Gauss-Seidel power flow solution
34
Chapter 3 Gauss-Seidel power flow solution
35
Chapter 3 Tap changing transformer
In tap changing transformer, when the ratio is at nominal value, the transformer is represented by
a series of admittance in per unit. With off-nominal ratio, the per unit admittance is different
from both sides of the transformer, and the admittance must be modified to include the effect of
the off-nominal ratio. Consider a transformer with admittance in series with an ideal
transformer representing the off-nominal tap ratio 1: as shown in the figure (3.5). is the
admittance per unit based on the nominal turn ratio and is the per unit off-nominal tap
position allowing for small adjustment in voltage of usually percent . In the case of
phase shifting transformers, is a complex number .consider a fictitious bus x between the turn
ratio and admittance of the transformer. Since the complex power on either side if the ideal
transformer is the same, it follows that if the voltage goes through a positive phase angle shift,
the current will go through a negative phase angle shift. Thus, for the assumed direction of
currents, we have
Ij Vj
Vi yt
Ii Vx
1:a
Figure(3.5)
36
Chapter 3 Tap changing transformer
[ ] [ ][ ]
In this case if the a is real ,the model shown in the figure represents the admittance matrix
in(3.25).in the model, the left side corresponds to the non-tap side and the right side
corresponding to the tap side of the transformer .
Non-tap side Tap side
yt/a
j
i
Figure(3.6)
37
Chapter 3 Matlab code
%Example 3.1
y12=10-j*20;
y13=10-j*30;
y23=16-j*32;
y33=y13+y23;
V1=1.05+j*0;
%format long
iter =0;
S2=-4.0-j*2.5;
P3 = 2;
V2=1+j*0;
Vm3=1.04;
V3=1.04+j*0;
for I=1:10;
iter=iter+1 %NO of iteration
E2 = V2;
E3=V3;
V2= (conj(S2)/conj(V2)+y12*V1+y23*V3)/(y12+y23)
DV2 = V2-E2
Q3 = -imag(conj(V3)*(y33*V3-y13*V1-y23*V2))
S3 = P3 +j*Q3;
Vc3= (conj(S3)/conj(V3)+y13*V1+y23*V2)/(y13+y23)
Vi3 = imag(Vc3);
Vr3= sqrt(Vm3^2 - Vi3^2);
V3 = Vr3 + j*Vi3
DV3=V3-E3
end
format short
38
Chapter 3 Matlab code
%consideration of currents
I12=y12*(V1-V2); I21=-I12;
I13=y13*(V1-V3); I31=-I13;
I23=y23*(V2-V3); I32=-I23;
%consideration of complex powers
S12=V1*conj(I12); S21=V2*conj(I21);
S13=V1*conj(I13); S31=V3*conj(I31);
S23=V2*conj(I23); S32=V3*conj(I32);
I1221=[I12,I21]
I1331=[I13,I31]
I2332=[I23,I32]
S1221=[S12, S21 (S12+S13) S12+S21]
S1331=[S13, S31 (S31+S32) S13+S31]
S2332=[S23, S32 (S23+S21) S23+S32]
39
Chapter 4 Power Flow Program
CHAPTER 4
Several computer programs have been developed for the power flow solution of practical
systems. Each method of solution consists of four programs. The program for the gauss-seidel
method is Lfgauss, which is preceded by Lfybus, and is followed by busout and lineflow.
Programs Ifybus ,busout,and lineflow are designed to be used with two more power flow
programs. These are Lfnewton for the Newton-Raphson method and decouple for fast decouple
method. The following is a brief description of the programs used in the gauss-Seidel method.
4.1.1 Lfybus
This program is requires the line and transformer parameters and transformer tap settings
specified in the input file named linedata. It converting impedances to admittances and obtains
the bus admittance matrix. The program is designed to handle parallel lines.
4.1.2 Lfgauss
This program is obtains the power flow solution by the Gauss-Seidel method and requires the
files named busdata and linedata. It designed for the direct use of load and generation in MW and
Mvar, bus voltages in per unit, and angle in degrees. Loads and generation are converted to per
unit quantities on the base MVA selected. A provision is made to maintain the generator reactive
power of the voltage controlled buses within their specified limits. The violation of reactive
Power limit may occur if the specified voltage is either too high or too low. After a few iterations
(10th iteration in the Gauss metod), the var calculated at the generator buses are examined. If a
limit is reached, the voltage magnitude is adjusted in steps of 0.5 percent up to percent to
bring the var demand within the specified limites.
40
Chapter 4 Power Flow Program
4.1.3 Busout
This program produces the bus output result in tabulated form. The bus output result includes the
voltage magnitude and angle, real and reactive power of generators and loads, and the shunt
capacitor/reactors M var. Total generation and total load are also outlined in the sample case.
4.1.4 Lineflow
this program prepares the line output data. It is design to display the active and reactive power
flow entering the line terminals and line losses as well as the net power at each bus. Also
included are the total real and reactive losses in the system. The output of this portion is also
shown in the sample case.
In order to perform the power flow analysis in matlab environment, we need to define the
following variables, power system base MVA, power mismatch accuracy, acceleration factor,
and maximum number of iterations. The name (in lowercases latters) reserved for these variables
are base mva , accuracy, accel, and maxiter , respectively. The typical values are as follows:
basemva=100;
accuracy= 0.001;
accel=1.8;
maxiter=100;
41
The last column is the injected Mvar of shunt capacitors. The bus code entered in column 2 is used for
identifying load, voltage-controlled, and slack buses as outlined below:
1 this code is used for the slack bus. The only necessary information for this bus is the voltage
magnitude and its phase angle.
0 this code is using for load buses. The load is entered positive in megawatts and megavars. For this
bus the initial estimate must be specified. This is usually 1 and 0for voltage magnitude and phase angle
for this type of bus are specified.
they will be taken as the initial starting voltage for that bus instead of a flat start of 1 and 0.
2 this code is used for voltage controlled buses. For this bus the voltage magnitude and real power
generation in megawatts, and the minimum and maximum limits of the megavar demand must be
specified
The IEEE 30 bus system is used to demonstrate the data reparation and the use of the power flow
programs by the Gauss-Seidel method.
42
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
Example 4.1:
In figure (4.1) is part of the American Electric power service Corporation network which is being
made available to the electric utility industry as a standard test case for evaluation various
analytical methods and computer programs for the solution of power system problems. Use the
Ifgauss program to obtain the power solution by the Gauss-Seidel method. Bus 1 is taken as the
slack bus with its voltage adjusted to 1.06 . The data for the voltage-controlled buses is
Regulated Bus Data
Transformer Data
4-12 0.932
6-9 0.978
6-10 0.969
28-27 0.968
43
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
Figure(4.1)
44
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
Generation and loads are as given in the data prepared for use in the matlab environment in the
matrix defined as busdata. Code 0, code 1, and code 2 are used for the load buses, the slack bus
and the voltage controlled buses, respectively. Values for basemva, accuracy, accel and maxiter
must be specified. Line data are as given in the matrix called linedata. The last column of this
data must contain 1 for lines, or the tap setting values for transformers with off-nominal turn
ratio. The control commands required are Ifybus, Ifgauss and lineflow. A diary command may be
used to save the output to the specified file name. The power flow data and the commands
required are as follows.
basemva=100;
accuracy=0.001;
accel=1.8;
maxiter=100;
busdata=[
45
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
13 2 1.071 0 0 0.0 0 0 -6 24 0
14 0 1 0 6.2 1.6 0 0 0 0 0
15 0 1 0 8.2 2.5 0 0 0 0 0
16 0 1 0 3.5 1.8 0 0 0 0 0
17 0 1 0 9.0 5.8 0 0 0 0 0
18 0 1 0 3.2 0.9 0 0 0 0 0
19 0 1 0 9.5 3.4 0 0 0 0 0
20 0 1 0 2.2 0.7 0 0 0 0 0
21 0 1 0 17.5 11.2 0 0 0 0 0
22 0 1 0 0 0.0 0 0 0 0 0
23 0 1 0 3.2 1.6 0 0 0 0 0
25 0 1 0 0 0.0 0 0 0 0 0
26 0 1 0 3.5 2.3 0 0 0 0 0
27 0 1 0 0 0.0 0 0 0 0 0
28 0 1 0 0 0.0 0 0 0 0 0
46
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
29 0 1 0 2.4 0.9 0 0 0 0 0
% Line Data
linedata=[
47
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
48
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
No. of Iterations = 34
49
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
50
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
51
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
52
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
53
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
54
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
55
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
56
Chapter 4 IEEE 30 Bus system by Gauss- Seidel Method
57
Chapter 4 Newton –Raphson Power Flow Solution
Because of its initial quadratic convergence, Newton’s method is mathematically superior to the
gauss-Seidel method and is less prone to divergence with ill- conditioned problems. For large
power systems, The Newton-Raphson method is found to be more efficient and practical. The
number of iteration requires to obtain the solution is independent of the system size, but more
functional evaluations are required at each iteration. Since in the power flow problem real power
and voltage magnitude are specified for the voltage- controlled buses, the power flow equation is
formulated in polar form. For the typical bus of the power system in the figure (6.7), The current
entering bus is given by (3.2). This equation can be rewritten in terms of the bus admittance
matrix as
In the above equation, j includes bus i. Expressing this equation in polar form, we have
(4.3)
∑ | |
58
Chapter 4 Newton –Raphson Power Flow Solution
∑ | |
∑ | |
Equations (4.5) and (4.6) constitute a set of nonlinear algebraic equations in terms of the
independent variables, voltage magnitude in per unit, and phase angle in radians. We have two
equations for each load bus, given by (4.5) and (4.6), and one equation for each voltage-
controlled bus, given by (4.5). expanding (4.5)and(4.6) in Taylor’s series about the initial
estimate and neglecting all higher order terms results in the following set of linear equations.
|
[ ]
|[ ]
(4.7)
| [ ]
[ ]
[[ ] [ ]]
In the above equation, bus 1is assumed to be the slack bus. The Jacobian matrix gives the
linearized relationship between small changes in voltage angle and voltage magnitude
with the small changes in real and reactive power and . Elements of the
Jacobian matrix are the partial derivatives of (4.5)and(4.6), evaluated at and .In
short form, it can be written as
59
Chapter 4 Newton –Raphson Power Flow Solution
[ ] [ ][ ] (4.8)
For voltage-controlled buses, the voltage magnitudes are known. Therefore, if m buses of the
system are voltage-controlled, m equations involving and and the corresponding columns
of the Jacobian matrix are eliminated. Accordingly, There are n-1 real power constraints and n-1-
m reactive power constrains, and the Jacobian matrix is of order (2n-2-m)*(2n-2-m). Is of the
order (n-1)*(n-1), is of the order (n-1)*(n-1-m), is of the order (n-1-m)*(n-1), and is of
the order (n-1-m)*(n-1-m).
∑ | || | ( )
( )
∑| || | ( )
( )
∑ | || | ( )
( )
60
Chapter 4 Newton –Raphson Power Flow Solution
∑| || | ( )
( )
The terms and are the difference between the scheduled and calculated values,
known as the power residuals, given by
Example 4.2:
Obtain the power flow solution for the IEEE-30 bus test system by Newton-Raphson method.
The data required is same as in example (4.1) with the following commands
61
Chapter 4 IEEE 30 Bus system by Newton-Raphhson Method
62
Chapter 4 IEEE 30 Bus system by Newton-Raphhson Method
The output of the line flow is the same as the line flow output is
63
Chapter 4 IEEE 30 Bus system by Newton-Raphhson Method
64
Chapter 4 IEEE 30 Bus system by Newton-Raphhson Method
65
Chapter 4 IEEE 30 Bus system by Newton-Raphhson Method
66
Chapter 4 IEEE 30 Bus system by Newton-Raphhson Method
67
Chapter 4 IEEE 30 Bus system by Newton-Raphhson Method
68
Chapter 4 Matlab Programming
%ifgauss
Vm=0;
delta=0;
yload=0;
deltad =0;
nbus = length(busdata(:,1));
kb=[];
Vm=[];
delta=[];
Pd=[];
Qd=[];
Pg=[];
Qg=[];
Qmin=[];
Qmax=[];
Pk=[];
P=[];
Qk=[];
Q=[];
S=[];
V=[];
for k=1:nbus
n=busdata(k,1);
kb(n)=busdata(k,2);
Vm(n)=busdata(k,3);
delta(n)=busdata(k, 4);
Pd(n)=busdata(k,5);
Qd(n)=busdata(k,6);
69
Chapter 4 Matlab Programming
Pg(n)=busdata(k,7);
Qg(n) = busdata(k,8);
Qmin(n)=busdata(k, 9);
Qmax(n)=busdata(k, 10);
Qsh(n)=busdata(k, 11);
if Vm(n) <= 0 Vm(n) = 1.0;
V(n) = 1 + j*0;
else delta(n) = pi/180*delta(n);
V(n) = Vm(n)*(cos(delta(n)) + j*sin(delta(n)));
P(n)=(Pg(n)-Pd(n))/basemva;
Q(n)=(Qg(n)-Qd(n)+ Qsh(n))/basemva;
S(n) = P(n) + j*Q(n);
end
DV(n)=0;
end
num = 0;
AcurBus = 0;
converge = 1;
Vc = zeros(nbus,1)+j*zeros(nbus,1);
Sc = zeros(nbus,1)+j*zeros(nbus,1);
while exist('accel')~=1
accel = 1.3;
end
while exist('accuracy')~=1
accuracy = 0.001;
end
while exist('basemva')~=1
basemva= 100;
end
while exist('maxiter')~=1
maxiter = 100;
end
70
Chapter 4 Matlab Programming
mline=ones(nbr,1);
for k=1:nbr
for m=k+1:nbr
if((nl(k)==nl(m)) & (nr(k)==nr(m)));
mline(m)=2;
elseif ((nl(k)==nr(m)) & (nr(k)==nl(m)));
mline(m)=2;
else, end
end
end
iter=0;
maxerror=10;
while maxerror >= accuracy &
iter <= maxiter
iter=iter+1;
for n = 1:nbus;
YV = 0+j*0;
for L = 1:nbr;
if (nl(L) == n &
mline(L) == 1), k=nr(L);
%modified to handle parallel lines (
YV = YV + Ybus(n,k)*V(k);
elseif (nr(L) == n & mline(L)==1),
k=nl(L); %modified to handle parallel lines
71
Chapter 4 Matlab Programming
YV = YV + Ybus(n,k)*V(k);
end end
Sc = conj(V(n))*(Ybus(n,n)*V(n) + YV) ;
Sc = conj(Sc);
DP(n) = P(n) - real(Sc);
DQ(n) = Q(n) - imag(Sc);
if kb(n) == 1
S(n) =Sc; P(n) = real(Sc); Q(n) = imag(Sc); DP(n)
=0; DQ(n)=0;
Vc(n) = V(n);
elseif kb(n) == 2
Q(n) = imag(Sc); S(n) = P(n) + j*Q(n);
if Qmax(n) ~= 0
Qgc = Q(n)*basemva + Qd(n) - Qsh(n);
if abs(DQ(n)) <= .005 & iter >= 10 % After 10
iterations
if DV(n) <= 0.045 % the Mvar of generator buses
are
if Qgc < Qmin(n), % tested. If not within limits
Vm(n)
Vm(n) = Vm(n) + 0.005;% is changed in steps of
0.005 pu
DV(n) = DV(n)+.005; % up to .05 pu in order to
bring
elseif Qgc > Qmax(n) % the generator Mvar within
the
Vm(n) = Vm(n) - 0.005; % specified limits.
DV(n)=DV(n)+.005; end
else, end
else,end
else,end
end
72
Chapter 4 Matlab Programming
if kb(n) ~= 1
Vc(n) = (conj(S(n))/conj(V(n)) - YV )/
Ybus(n,n);
else, end
if kb(n) == 0
V(n) = V(n) + accel*(Vc(n)-V(n));
elseif kb(n) == 2
VcI = imag(Vc(n));
VcR = sqrt(Vm(n)^2 - VcI^2);
Vc(n) = VcR + j*VcI;
V(n) = V(n) + accel*(Vc(n) -V(n));
End end
maxerror=max(max(abs(real(DP))),
max(abs(imag(DQ))) )
if iter == maxiter & maxerror > accuracy
fprintf('\nWARNING: Iterative solution did not
converged after ')
fprintf('%g', iter), fprintf(' iterations.\n\n')
fprintf('Press Enter to terminate the iterations
and print the results \n')
converge = 0; pause, else, end, end
if converge ~= 1
tech= (' ITERATIVE SOLUTION DID NOT CONVERGE');
else,
tech=('Power Flow Solution by Gauss-Seidel
Method');
end
k=0;
for n = 1:nbus
Vm(n) = abs(V(n));
deltad(n) = angle(V(n))*180/pi;
if kb(n) == 1
S(n)=P(n)+j*Q(n);
73
Chapter 4 Matlab Programming
for Ifybus:
%ifybus
j=sqrt(-1); i = sqrt(-1);
nl = linedata(:,1); nr = linedata(:,2);
R = linedata(:,3);
X = linedata(:,4); Bc =
j*linedata(:,5); a = linedata(:, 6);
nbr=length(linedata(:,1)); nbus =
max(max(nl), max(nr));
Z = R + j*X; y= ones(nbr,1)./Z;%branch
admittance
for n = 1:nbr
74
Chapter 4 Matlab Programming
75
Chapter 4 Matlab Programming
for lineflow:
% lineflow
SLT = 0;
fprintf('\n')
fprintf(' Line Flow and Losses \n\n')
fprintf(' --Line-- Power at bus & line flow
--Line loss-- Transformer\n')
fprintf(' from to MW Mvar MVA
MW Mvar tap\n')
76
Chapter 4 Matlab Programming
for n = 1:nbus
busprt = 0;
for L = 1:nbr;
if busprt == 0
fprintf('\n'),fprintf('%6g',n),fprintf('%9.3f',
P(n)*basemva)
fprintf('%9.3f',Q(n)*basemva),fprintf('%9.3f\n',
abs(S(n)*basemva))
busprt = 1;
else, end
if nl(L)==n k = nr(L);
In =(V(n)-a(L)*V(k))*y(L)/a(L)^2 + Bc(L)/a(L)^2*V(n);
Ik = (V(k) - V(n)/a(L))*y(L) + Bc(L)*V(k);
Snk = V(n)*conj(In)*basemva;
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
elseif nr(L)==n k = nl(L);
In = (V(n) - V(k)/a(L))*y(L) + Bc(L)*V(n);
Ik =(V(k)- a(L)*V(n))*y(L)/a(L)^2+ Bc(L)/a(L)^2*V(k);
Snk = V(n)*conj(In)*basemva;
Skn = V(k)*conj(Ik)*basemva;
SL = Snk + Skn;
SLT = SLT + SL;
else, end
if nl(L)==n | nr(L)==n
fprintf('%12g', k),
fprintf('%9.3f', real(Snk)), fprintf('%9.3f',
imag(Snk))
77
Chapter 4 Matlab Programming
fprintf('%9.3f', abs(Snk)),
fprintf('%9.3f', real(SL)),
if nl(L) ==n & a(L) ~= 1
fprintf('%9.3f', imag(SL)), fprintf('%9.3f\n',
a(L))
else, fprintf('%9.3f\n', imag(SL))
end
else, end
end
end
SLT = SLT/2;
fprintf(' \n'), fprintf(' Total loss ')
fprintf('%9.3f',real(SLT)) fprintf('%9.3f\n',
imag(SLT))
clear Ik In SL SLT Skn Snk
Example 4.2:
for this example all the above programs are same just in please of Ifgauss the
program for Ifnewton can come , which is as follow:
%ifnewton 4.2
ns=0; ng=0; Vm=0; delta=0; yload=0;
deltad=0;
nbus = length(busdata(:,1));
kb=[];Vm=[]; delta=[]; Pd=[]; Qd=[];
Pg=[]; Qg=[]; Qmin=[]; Qmax=[];
Pk=[]; P=[]; Qk=[]; Q=[]; S=[]; V=[];
for k=1:nbus
n=busdata(k,1);
kb(n)=busdata(k,2);
78
Chapter 4 Matlab Programming
end end
for k=1:nbus
if kb(k) == 1, ns = ns+1; else, end
if kb(k) == 2 ng = ng+1; else, end
ngs(k) = ng;
nss(k) = ns;
end
Ym=abs(Ybus); t = angle(Ybus);
m=2*nbus-ng-2*ns;
maxerror = 1; converge=1;
iter = 0;
% added for parallel lines
mline=ones(nbr,1);
for k=1:nbr
for m=k+1:nbr
if((nl(k)==nl(m)) & (nr(k)==nr(m)));
79
Chapter 4 Matlab Programming
delta(n) + delta(l));
J44=J44+ Vm(l)*Ym(n,l)*sin(t(n,l)-delta(n) +
delta(l));
else, end
if kb(n) ~= 1 & kb(l) ~=1
lk = nbus+l-ngs(l)-nss(l)-ns;ll = l -nss(l);
% off diagonalelements of J1
A(nn,ll) =-Vm(n)*Vm(l)*Ym(n,l)*sin(t(n,l)-
delta(n)+ delta(l));
if kb(l) == 0 % off diagonal elements of J2
A(nn, lk) =Vm(n)*Ym(n,l)*cos(t(n,l)- delta(n) +
delta(l));end
if kb(n) == 0 % off diagonal elements of J3
A(lm, ll) =-Vm(n)*Vm(l)*Ym(n,l)*cos(t(n,l)-
delta(n)+delta(l)); end
if kb(n) == 0 & kb(l) == 0 % off diagonal
elements of J4
A(lm, lk) =-Vm(n)*Ym(n,l)*sin(t(n,l)- delta(n) +
delta(l));end
else end
else , end
else, end
end
Pk = Vm(n)^2*Ym(n,n)*cos(t(n,n))+J33;
2*Vm(n)*Ym(n,n)*sin(t(n,n))-J44;
%diagonal of elements of J4
80
Chapter 4 Matlab Programming
Qk =-Vm(n)^2*Ym(n,n)*sin(t(n,n))-J11;
if kb(n) == 1 P(n)=Pk; Q(n) = Qk; end
% Swing bus P
if kb(n) == 2 Q(n)=Qk;
if Qmax(n) ~= 0
Qgc = Q(n)*basemva + Qd(n) - Qsh(n);
if iter <= 7 % Between the 2th
& 6th iterations
if iter > 2 % the Mvar of
generator buses are
if Qgc < Qmin(n), % tested. If not within
limits Vm(n)
Vm(n) = Vm(n) + 0.01; % is changed in steps
of 0.01 pu to
elseif Qgc > Qmax(n), % bring the generator
Mvar within
Vm(n) = Vm(n) -0.01;end % the specified limits.
else, end,else,end
else,end
end
if kb(n) ~= 1
A(nn,nn) = J11;%diagonal elements of J1
DC(nn) = P(n)-Pk;
end
if kb(n) == 0
A(nn,lm) = 2*Vm(n)*Ym(n,n)*cos(t(n,n))+J22;
%diagonal elements of J2
A(lm,nn)= J33%diagonal elements of J3
A(lm,lm) =- DC(lm) = Q(n)-Qk;
end,end
81
Chapter 4 Matlab Programming
DC(lm) = Q(n)-Qk;
end
end
DX=A\DC';
k=0;
for n = 1:nbus
if kb(n) == 1
k=k+1;
S(n)= P(n)+j*Q(n);
Pg(n) = P(n)*basemva + Pd(n);
Qg(n) = Q(n)*basemva + Qd(n) - Qsh(n);
Pgg(k)=Pg(n);
Qgg(k)=Qg(n);
elseif kb(n) ==2
k=k+1;
S(n)=P(n)+j*Q(n);
Qg(n) = Q(n)*basemva + Qd(n) - Qsh(n);
Pgg(k)=Pg(n);
Qgg(k)=Qg(n);
end
yload(n) (Pd(n)-
j*Qd(n)+j*Qsh(n))/(basemva*Vm(n)^2);
end
busdata(:,3)=Vm'; busdata(:,4)=deltad';
Pgt = sum(Pg); Qgt = sum(Qg); Pdt = sum(Pd); Qdt =
sum(Qd); Qsht = sum(Qsh);
82
Chapter 5 IEEE 118 Bus system
CHAPTER 5
The data preparation for 118 bus system
Figure(5.1)
83
Chapter 5 IEEE 118 Bus system
84
Chapter 5 IEEE 118 Bus system
85
Chapter 5 IEEE 118 Bus system
86
Chapter 5 IEEE 118 Bus system
87
Chapter 5 IEEE 118 Bus system
88
Chapter 5 IEEE 118 Bus system
linedata = [
89
Chapter 5 IEEE 118 Bus system
8 50 0.0267 0 0.985 0
90
Chapter 5 IEEE 118 Bus system
26 25 0 0.0382 0 0.96 0
30 17 0 0.0388 0 0.96 0
91
Chapter 5 IEEE 118 Bus system
38 37 0 0.0375 0 0.935 0
92
Chapter 5 IEEE 118 Bus system
93
Chapter 5 IEEE 118 Bus system
63 59 0 0.0386 0 0.96 0
64 61 0 0.0268 0 0.985 0
65 66 0 0.037 0 0.935 0
94
Chapter 5 IEEE 118 Bus system
68 69 0 0.037 0 0.935 0
81 80 0 0.037 0 0.935 0
95
Chapter 5 IEEE 118 Bus system
96
Chapter 5 IEEE 118 Bus system
97
Chapter 5 IEEE 118 Bus system
98
Chapter 5 IEEE 118 Bus system
The output is :
accuracy = 1.0000e-003
accel = 1.800
No. of Iterations = 10
99
Chapter 5 IEEE 118 Bus system
100
Chapter 5 IEEE 118 Bus system
101
Chapter 5 IEEE 118 Bus system
102
Chapter 5 IEEE 118 Bus system
103
Chapter 5 IEEE 118 Bus system
104
Chapter 5 IEEE 118 Bus system
105
Chapter 5 IEEE 118 Bus system
106
Chapter 5 IEEE 118 Bus system
107
Chapter 5 IEEE 118 Bus system
108
Chapter 5 IEEE 118 Bus system
109
Chapter 5 IEEE 118 Bus system
110
Chapter 5 IEEE 118 Bus system
111
Chapter 5 IEEE 118 Bus system
112
Chapter 5 IEEE 118 Bus system
113
Chapter 5 IEEE 118 Bus system
114
Chapter 5 IEEE 118 Bus system
115
Chapter 5 IEEE 118 Bus system
116
Chapter 5 IEEE 118 Bus system
117
Chapter 5 IEEE 118 Bus system
118
Chapter 5 IEEE 118 Bus system
120
Chapter 5 IEEE 118 Bus system
121
Chapter 5 IEEE 118 Bus system
122
Chapter 5 IEEE 118 Bus system
123
Chapter 5 IEEE 118 Bus system
124
Chapter 5 IEEE 118 Bus system
125
Chapter 5 IEEE 118 Bus system
126
Chapter 5 IEEE 118 Bus system
127
Conclusion
Conclusion
In additional to discussing how load flow studies are made by computer in this book represented
the two methods of controlling voltage and the flow of power from standpoint of understanding
how this control is accomplished.
The load flow study on a computer is the best way to obtain quantitative answers for the effect
of specific control.
Acceleration factor is a multiplier constant that enhances correction between the values of
voltage in two successive iterations. Study the real, reactive power as well as voltage magnitude
and phase angle. Using tap changing transformer for propose of voltage control.
Analysis of 30 bus system as well as 118 bus system and finding the real and reactive power and
the total loss of the line .using matlab as well as ETP where we did in matlab and our future
plane is for 2737 bus system using ETP the price of ETP is $39 so in this book we just did using
matlab.
128
Conclusion
References
[3] Modern power system Analysis -third adition by D P Kothari and I J Nagrath
[4] http://www.ee.washington.edu/research/pstca/pf118/ieee118cdf.txt
[5] http://www.ee.washington.edu/research/pstca/pf118/pg_tca118fig.htm
[6] http://www.ee.washington.edu/research/pstca/formats/cdf.txt
[7] http://www.ee.washington.edu/research/pstca/
129