You are on page 1of 8

Experiment 6

American International University- Bangladesh


Department of Electrical and Electronic Engineering
EEE1234: Power Systems Analysis Laboratory

Title: Load Flow Analysis using Gauss-Seidel and Newton- Raphson Methods

Introduction:

To be familiar with Load Flow Analysis using Gauss-Seidel and Newton-Raphson methods

Theory and Methodology:

To calculate the power system parameters generally nodal analysis is used. In the subject node if
Kirchhoff's current law is applied then the following equation would be achieved;

Total injected current = Summation of outgoing currents

For example let us consider a system having two nodes node 'i' and 'j'.

Figure 1: Three Bus System

In bus-i total injected current is Ii, in bus-j Ij and in bus-k total injected current is Ik. Based on
Kirchhoff's current law;

If the impedances are converted into admittance values then the equation would become;

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 1


Identifying bus type is very important for load flow analysis because the bus type defines the
known and unknown parameters to start with.

Load (or PQ) bus:


At load bus the real and reactive power are specified, and the bus voltage as well as the
voltage angle will be calculated. Generally all the busses that do not have a generator
connected to it are considered as load bus. The voltage and the voltage angle of a load bus
vary with the active and reactive power consumption.

Generator (or PV) bus:


A generator bus is a bus where generally a generator is connected and the node voltage is
kept constant. The active power 'P' is also constant. The voltage and active power is kept
constant in this bus thus the slack bus can deal with the variation in active and reactive power
generation and consumption. A generator works best at full load. That is why it is better to
keep active power and the bus voltage at PV bus fixed.

Slack bus:
Slack bus is the special generator bus which generally serves as the reference of the system.
In a slack bus the voltage magnitude and the angle are known parameters. Where active and
reactive power are unknown and can be changed based on the system requirement.

Gauss-Seidel Method:
In a three bus system if there is one slack, one PQ and one PV bus then the calculation can be
started from the PQ bus. If in the 1 bus 'i' is slack, 'j' is PV and 'k' is a PQ bus then, the
apparent power S3 can be represented;

Solving Vk in iterations provides;

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 2


Similarly;

In Gauss-Seidel method the unknown values are calculated from the known values in
iterations. The unknown parameters in first iteration is assumed then using the assumed value
other unknown values are calculated in multiple iterations until the difference between two
consecutive values (in-in-1) reach within a tolerant value.

Newton-Raphson Method:
In a three bus system if there is one slack, one PQ and one PV bus then the calculation can be
started from the PQ bus. If in the 1 bus 'i' is slack, 'j' is PV and 'k' is a PQ bus then, the
apparent power S3 can be represented. (See Equation Number 8, 9 and 10 from Gauss-Siedel
Method)

Now, the active and reactive power on the bus ‘k’ can be calculated as;
(13)

Newton-Raphson method uses the above equation and known active and reactive power in
iterations the following set of equations is prepared;
(14)

Where,

(15)
(16)

The calculated values are initially considered equal to the specified values and used to
calculate the unknown voltages and angles for the first time. After first iteration the new
calculated values are chosen.

Pre-Lab Homework:

Students must study load flow analysis and iterative solution of non-linear equations using
Gauss-Seidel and Newton-Raphson methods. Student also must be familiar with
MATLAB/Simulink/SimPowerSystem software before performing the experiment.

Software Requirement:
• PSA Lab Software
• MATLAB

Mathematical Problem:
For the following diagram reactances are given in per-unit on a 100 MVA base.

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 3


Find Q2, V2, V3 using Gauss-Seidel and Newton-Raphson methods.

Experimental Procedure:

1) Solve the Mathematical Problem manually


2) Open the PSA Lab Software and fill the necessary data tables
3) Press the button 'Ybus Matrix'
4) Press the button 'Solve(Gauss-Seidel)'
5) Press the pushbutton 'Solve(Newton Raphson)'
6) Compare the results obtained at the table situated on the bottom right corner.
7) Code the problem using MATLAB and compare the results with Manual and Lab
Software results.

Simulations With Result:


Compare all the results for the given mathematical problem (Manual, Software and
MATLAB coding).

Discussion and Conclusion:


Interpret the data/findings and determine the extent to which the experiment was successful
in complying with the goal that was initially set. Discuss any mistake you might have made
while conducting the investigation and describe ways the study could have been improved.

Reference(s):
[1] Stevenson, W. D. (1982). Elements of power system analysis. New York: McGraw-Hill.

Special Instruction for the Instructor


The instructor should assist the student in case they face any difficulty while using the PSA
Software and while coding the problem using MATLAB. Different parts of the given code
should be explained thoroughly.

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 4


MATLAB Codes:
clear all
close all
clc

base_power = 100;

% Bus Number V delta P Q


% pu pu MW MVAR

bus1 = [1 0 NaN NaN];


bus2 = [1 NaN 60 0];
bus3 = [NaN NaN -80 -60];

bus_data = [bus1; bus2; bus3];

Z12 = j*0.5;
Z13 = j*0.2;
Z23 = j*0.25;

Y12 = -1/Z12;
Y13 = -1/Z13;
Y23 = -1/Z23;
Y21 = Y12;
Y31 = Y13;
Y32 = Y23;

Y11 = -(Y12+Y13);
Y22 = -(Y12+Y23);
Y33 = -(Y23+Y13);

Y_bus = [Y11 Y12 Y13;...


Y12 Y22 Y23;...
Y13 Y23 Y33];

p_bus2 = 60/base_power;
p_bus3 = -80/base_power;
q_bus3 = -60/base_power;

% Estimated and initial values

voltage_bus1 = bus1(1,1)+j*bus1(1,2);
voltage_bus2 = bus2(1,1)*(1+j*0);
voltage_bus3 = 1+j*0;

V2 = [];
V3 = [];

% % % % Iterations with gauss-seidel

% % % itr = 10;
% % %
% % % for i = 1:itr;
% % % q_bus2(i) = -
imag(conj(voltage_bus2)*(Y21*voltage_bus1+Y22*voltage_bus2+Y23*voltage_bus3));
% % % V2(i) = 1/Y22*((p_bus2-
j*(q_bus2(i))/conj(voltage_bus2))-Y21*voltage_bus1-Y23*voltage_bus3);
% % % V2_new(i) = V2(i)/abs(V2(i))*abs(voltage_bus2);
% % % V3(i) = 1/Y33*((p_bus3-j*(q_bus3)/conj(voltage_bus3))-
Y31*voltage_bus1-Y23*V2_new(i));
% % % voltage_bus3 = V3(i);
% % % voltage_bus2 = V2_new(i);
% % % end

%----------------------------------------------------------------------------------
--------------------------------------------------

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 5


% % % % Iterations with newton raphson method

% P2 =
abs(Y21*voltage_bus1*voltage_bus2)*cos(angle(Y21)+angle(voltage_bus1)-
theta2)+abs(Y22*(voltage_bus2)^2)*cos(Y22)+abs(Y23*voltage_bus2*volt3)*cos(angle(Y2
3)+theta3-theta2);
% P3 = abs(Y31*voltage_bus1*volt3)*cos(angle(Y31)+angle(voltage_bus1)-
theta3)+abs(Y33*(volt3)^2)*cos(Y33)+abs(Y23*voltage_bus2*volt3)*cos(angle(Y23)+thet
a2-theta3);
% Q3 =-abs(Y31*voltage_bus1*volt3)*sin(angle(Y31)+angle(voltage_bus1)-
theta3)-abs(Y33*(volt3)^2)*sin(Y33)-
abs(Y23*voltage_bus2*volt3)*sin(angle(Y23)+theta2-theta3);

% 9 element matrix del2, del3, volt3

% syms theta2
% f1(theta2) =
abs(Y21*voltage_bus1*voltage_bus2)*cos(angle(Y21)+angle(voltage_bus1)-
theta2)+abs(Y22*(voltage_bus2)^2)*cos(Y22)+abs(Y23*voltage_bus2*voltage_bus3)*cos(a
ngle(Y23)+angle(voltage_bus3)-theta2);
% diff(f1);
%
% syms theta2
% f2(theta2) =
abs(Y31*voltage_bus1*voltage_bus3)*cos(angle(Y31)+angle(voltage_bus1)-
angle(voltage_bus3))+abs(Y33*(voltage_bus3)^2)*cos(Y33)+abs(Y23*voltage_bus2*voltag
e_bus3)*cos(angle(Y23)+theta2-angle(voltage_bus3));
% diff(f2);
%
% syms theta2
% f3(theta2) = -
abs(Y31*voltage_bus1*voltage_bus3)*sin(angle(Y31)+angle(voltage_bus1)-
angle(voltage_bus3))-abs(Y33*(voltage_bus3)^2)*sin(Y33)-
abs(Y23*voltage_bus2*voltage_bus3)*sin(angle(Y23)+theta2-angle(voltage_bus3));
% diff(f3);
%
%
% syms theta3
% f4(theta3) =
abs(Y21*voltage_bus1*voltage_bus2)*cos(angle(Y21)+angle(voltage_bus1)-
angle(voltage_bus2))+abs(Y22*(voltage_bus2)^2)*cos(Y22)+abs(Y23*voltage_bus2*voltag
e_bus3)*cos(angle(Y23)+theta3-angle(voltage_bus2));
% diff(f4);
%
% syms theta3
% f5(theta3) =
abs(Y31*voltage_bus1*voltage_bus3)*cos(angle(Y31)+angle(voltage_bus1)-
theta3)+abs(Y33*(voltage_bus3)^2)*cos(Y33)+abs(Y23*voltage_bus2*voltage_bus3)*cos(a
ngle(Y23)+angle(voltage_bus2)-theta3);
% diff(f5);
%
% syms theta3
% f6(theta3) = -
abs(Y31*voltage_bus1*voltage_bus3)*sin(angle(Y31)+angle(voltage_bus1)-theta3)-
abs(Y33*(voltage_bus3)^2)*sin(Y33)-
abs(Y23*voltage_bus2*voltage_bus3)*sin(angle(Y23)+angle(voltage_bus2)-theta3);
% diff(f6);

syms volt3
f7(volt3) =
abs(Y21*voltage_bus1*voltage_bus2)*cos(angle(Y21)+angle(voltage_bus1)-
angle(voltage_bus2))+abs(Y22*(voltage_bus2)^2)*cos(Y22)+abs(Y23*voltage_bus2*volt3)
*cos(angle(Y23)+angle(voltage_bus3)-angle(voltage_bus2));
diff(f7);

syms volt3
f8(volt3) = abs(Y31*voltage_bus1*volt3)*cos(angle(Y31)+angle(voltage_bus1)-
angle(voltage_bus3))+abs(Y33*(volt3)^2)*cos(Y33)+abs(Y23*voltage_bus2*volt3)*cos(an
gle(Y23)+angle(voltage_bus2)-angle(voltage_bus3));

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 6


diff(f8);

syms volt3
f9(volt3) = -abs(Y31*voltage_bus1*volt3)*sin(angle(Y31)+angle(voltage_bus1)-
angle(voltage_bus3))-abs(Y33*(volt3)^2)*sin(Y33)-
abs(Y23*voltage_bus2*volt3)*sin(angle(Y23)+angle(voltage_bus2)-
angle(voltage_bus3));
diff(f9);

% % jacob1 = [diff(f1) diff(f2) diff(f3)]';


% % jacob2 = [diff(f4) diff(f5) diff(f6)]';
% % jacob3 = [diff(f7) diff(f8) diff(f9)]';

delp2 = p_bus2 - 0;
delp3 = p_bus3 - 0;
delq3 = q_bus3 - 0;

% j1 = diff(f1);
% j2 = diff(f2);
% j3 = diff(f3);
%
% j4 = diff(f4);
% j5 = diff(f5);
% j6 = diff(f6);

volt3 = 1;
theta2 = 0;
theta3 = 0;

% For Plotting
theta2_new = [];
theta3_new = [];
volt3_new = [];
Q2_calc_new = [];
P2_calc_new = [];
Q3_calc_new = [];
P3_calc_new = [];
%------------------------------------------

j1 = -6*sin(theta2 - pi/2);
j2 = -4*sin(pi/2 + theta2);
j3 = -4*cos(pi/2 + theta2);

j4 = -4*sin(pi/2 + theta3);
j5 = -9*sin(theta3 - pi/2);
j6 = 9*cos(theta3 - pi/2);

% j7 = (4967757600021511*sign(volt3))/20282409603651670423947251286016;
j7 = abs(Y23*voltage_bus2)*cos(angle(Y23)+angle(voltage_bus3)-angle(voltage_bus2));

% j8 = (44709818400193599*sign(volt3))/81129638414606681695789005144064 +
(80184916214140221*abs(volt3)*sign(volt3))/1099511627776;
j8 = abs(Y31*voltage_bus1)*cos(pi/2-
theta3)+2*abs(volt3)*cos(angle(Y33))+abs(Y32*voltage_bus2)*cos(pi/2-theta3);

% j9 = - 9*sign(volt3) +
(abs(volt3)*sign(volt3)*80184913771710951*i)/1099511627776;
j9 = -abs(Y31*voltage_bus1)*sin(pi/2-theta3)+2*abs(volt3)*sin(angle(Y33))-
abs(Y32*voltage_bus2)*sin(pi/2-theta3);

jacob = [j1 j4 j7; j2 j5 j8; j3 j6 j9];


inv_jacob = inv(jacob);

del_v3 = [];
del_th2 = [];
del_th3 = [];

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 7


iter = 5;
for i =1:iter

% del_th2(i) = delp2*(-6*sin(theta2 - pi/2)-4*sin(pi/2 +


theta3)+(4967757600021511*sign(volt3))/20282409603651670423947251286016);
% del_th3(i) = delp3*(-4*sin(pi/2 + theta2)-9*sin(theta3 -
pi/2)+(44709818400193599*sign(volt3))/81129638414606681695789005144064 +
(80184916214140221*abs(volt3)*sign(volt3))/1099511627776);
% del_v3(i) = delq3*(-4*cos(pi/2 + theta2)+9*cos(theta3 - pi/2)- 9*sign(volt3) +
(abs(volt3)*sign(volt3)*80184913771710951*j)/1099511627776);

del_th2(i) = delp2*inv_jacob(1,1)+delp3*inv_jacob(1,2)+delq3*inv_jacob(1,3);
del_th3(i) = delp2*inv_jacob(2,1)+delp3*inv_jacob(2,2)+delq3*inv_jacob(2,3);
del_v3(i) = delp2*inv_jacob(3,1)+delp3*inv_jacob(3,2)+delq3*inv_jacob(3,3);

theta2 = theta2+del_th2(i);
theta3 = theta3+del_th3(i);
volt3 = volt3+del_v3(i);

theta2_new(i) = theta2;
theta3_new(i) = theta3;
volt3_new(i) = volt3;

%
P2_calc =
abs(Y21*voltage_bus1*voltage_bus2)*cos(angle(Y21)+angle(voltage_bus1)-theta2) +
abs(Y22*(voltage_bus2)^2)*cos(angle(Y22)) +
abs(Y23*voltage_bus2*volt3)*cos(angle(Y23)+theta3-theta2);
P3_calc = abs(Y31*voltage_bus1*volt3)*cos(angle(Y31)+angle(voltage_bus1)-
theta3) + abs(Y33*(volt3)^2)*cos(angle(Y33)) +
abs(Y23*voltage_bus2*volt3)*cos(angle(Y23)+theta2-theta3);
Q3_calc = abs(Y31*voltage_bus1*volt3)*sin(angle(Y31)+angle(voltage_bus1)-
theta3) + abs(Y33*(volt3)^2)*sin(angle(Y33)) +
abs(Y23*voltage_bus2*volt3)*sin(angle(Y23)+theta2-theta3);
%
P2_calc_new(i) = P2_calc;
Q3_calc_new(i) = P3_calc;
P3_calc_new(i) = Q3_calc;

%
delp2 = p_bus2 - P2_calc;
delp3 = p_bus3 - P3_calc;
delq3 = q_bus3 - Q3_calc;

Q2_calc = abs((P2_calc/(cos(theta2))-P2_calc)/(j*1));
Q2_calc_new(i) = Q2_calc;

end
% plot(theta2_new)
% plot(theta3_new)
% plot(volt3_new)
% plot(Q2_calc_new(i))

% delp2
% delp3
% delq3
% P2_calc
% P3_calc
% Q3_calc

%--------------------------------------------------------------------------

© Dept. of EEE, Faculty of Engineering, American International University-Bangladesh (AIUB) 8

You might also like