Load Flow Analysis - Gauss-Seidel Method: Roll No.: 107119142 Name: Koshal Agrawal Experiment No.: 06

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Roll No.: 107119142 Name: Koshal Agrawal Experiment No.

: 06

Load Flow Analysis – Gauss-Seidel Method

Question 1

1. Write a MATLAB code to analyse the power flow using the Gauss-Seidel Method for the system shown in Fig. 1. Take base
MVA as 100 MVA. Perform iterations till a tolerance of 𝜀 = 0.0001 is reached. The final results should display the following

a. the bus voltages (magnitude and angles)


b. active and reactive power flows in the lines
c. active and reactive power losses in the lines
d. active and reactive power supplied by the slack bus

MATLAB Code:
% Implemented matrix based on Given Values
A = [1 2 0.05i;
1 3 0.025i;
2 3 0.025i];

n = max(A(:,2)); % No of Buses
l = numel(A(:,1));

Base_MVA = 100; % Base MVA


V1 = 1.025*exp(1i*0); % Slack bus voltage

%Initial values for generator bus


modV2 = 1.03; % Mod value of V2
V2 = 1.03+0i; % Complex form of V2
P2 = 300/Base_MVA; % Real Power in Per-unit value

%Initial values for load bus


modV3 = 1; % Mod value of V3
V3 = 1+0i; % Complex form of v3
P3 = 400/Base_MVA; % Real Power in Per-unit value
Q3 = 200/Base_MVA; % Reactive Power in Per-unit value

Ybus=zeros(n); %Initializing zero matrix of size n X n

for q = 1:l
f = A(q,1);
t = A(q,2);
X = A(q,3);

% Assigning values in Ybus matrix


Ybus(f,t) = -Ybus(f,t) - 1/X;
Ybus(t,f) = -Ybus(t,f) - 1/X;
EELR17 Power Systems Laboratory 1
Ybus(f,f) = Ybus(f,f) + 1/X;
Ybus(t,t) = Ybus(t,t) + 1/X;
end

% Algorithm Part
val2=1;
val3=1;
while(val2 > 0.0001 && val3 > 0.0001)
Q2 = -imag(conj(V2) * ((Ybus(2, 1)*V1) + (Ybus(2, 2)*V2) + (Ybus(2, 3)*V3)));
oldV2 = V2;
V2 = (1/Ybus(2, 2)) * (((complex(P2, -Q2))/conj(oldV2)) - Ybus(2, 1)*V1 - Ybus(2, 3)*V3);
V2 = modV2 * exp(1i*angle(V2));
val2 = abs(V2 - oldV2);

oldV3 = V3;
V3 = (1/Ybus(3, 3)) * (((complex(-P3, Q3))/conj(oldV3)) - Ybus(3, 1) * V1-Ybus(3, 2)*V2);
val3 = abs(V3 - oldV3);
end

S12 = V1 * conj(-Ybus(1,2)*(V1-V2)) * Base_MVA;


S13 = V1 * conj(-Ybus(1,3)*(V1-V3)) * Base_MVA;
S21 = V2 * conj(-Ybus(2,1)*(V2-V1)) * Base_MVA;
S23 = V2 * conj(-Ybus(2,3)*(V2-V3)) * Base_MVA;
S31 = V3 * conj(-Ybus(3,1)*(V3-V1)) * Base_MVA;
S32 = V3 * conj(-Ybus(3,2)*(V3-V2)) * Base_MVA;

%Output
fprintf("1. The bus voltages:\n");
fprintf(" a)Bus 1: %f<%f V\n", abs(V1), angle(V1));
fprintf(" b)Bus 2: %f<%f V\n", abs(V2), angle(V2));
fprintf(" c)Bus 3: %f<%f V\n", abs(V3), angle(V3));
fprintf("\n")

fprintf("2. Active and Reactive power flows in lines:\n");


fprintf(" a)Active Power flow from bus 1 to 2 is : %f MW\n", real(S12));
fprintf(" b)Reactive Power flow from bus 1 to 2 is : %f MVAR\n", imag(S12));
fprintf(" c)Active Power flow from bus 2 to 1 is : %f MW\n", real(S21));
fprintf(" d)Reactive Power flow from bus 2 to 1 is : %f MVAR\n", imag(S21));
fprintf(" e)Active Power flow from bus 2 to 3 is : %f MW\n", real(S23));
fprintf(" f)Reactive Power flow from bus 2 to 3 is : %f MVAR\n", imag(S23));
fprintf(" g)Active Power flow from bus 3 to 2 is : %f MW\n", real(S32));
fprintf(" h)Reactive Power flow from bus 3 to 2 is : %f MVAR\n", imag(S32));
fprintf(" i)Active Power flow from bus 1 to 3 is : %f MW\n", real(S13));
fprintf(" j)Reactive Power flow from bus 1 to 3 is : %f MVAR\n", imag(S13));
fprintf(" k)Active Power flow from bus 3 to 1 is : %f MW\n", real(S31));
fprintf(" l)Reactive Power flow from bus 3 to 1 is : %f MVAR\n", imag(S31));
fprintf("\n")

fprintf("3. Active and Reactive power losses in lines:\n");


fprintf("2. Active and Reactive power flows in lines:\n");
fprintf(" a)Active Power loss in line(1,2) is : %f MW\n", real(S12) + real(S21));
fprintf(" b)Reactive Power loss in line(1,2) is : %f MVAR\n", imag(S12) + imag(S21));
fprintf(" c)Active Power loss in line(2,3) is : %f MW\n", real(S23) + real(S32));
fprintf(" d)Reactive Power loss in line(2,3) is : %f MVAR\n", imag(S23) + imag(S32));
fprintf(" e)Active Power loss in line(1,3) is : %f MW\n", real(S13) + real(S31));
fprintf(" f)Reactive Power loss in line(1,3) is : %f MVAR\n", imag(S13) + imag(S31));
fprintf("\n")

fprintf("4. Active and Reactive power supplied by slack bus:\n")


fprintf(" a)Active power supplied by slack bus is : %f MW\n", real(S12) + real(S13));
fprintf(" b)Active power supplied by slack bus is : %f MVAr\n", imag(S12) + imag(S13));

EELR17 Power Systems Laboratory 2


MATLAB Output:

Observations:

 In the Gauss method, we assume the voltage for all the buses except the slack bus where the voltage
magnitude and phase angle are specified and remain fixed.
 Normally, we assume the voltage magnitude and phase angle of these buses are equal to that of the slack bus
and work in a per-unit system.
 In the case of the Gauss-Seidel method, the value of bus voltages calculated for any bus immediately replace
the previous values in the next step while in the case of the Gauss method, the calculated bus voltages replace
the earlier value only at the end of the iteration. Due to this Gauss-Seidel method converges much faster than
that of the Gauss method compared to the Gauss method.

Question 2

For the same system, if a capacitor bank of rating 100 Mvar is added at bus 2, analyse the load flow and
comment on the results obtained

MATLAB Code:
% Implemented matrix based on Given Values
A = [1 2 0.05i;
1 3 0.025i;
2 3 0.025i];

n = max(A(:,2)); % No of Buses
l = numel(A(:,1));

Base_MVA = 100; % Base MVA


V1 = 1.025*exp(1i*0); % Slack bus voltage

%Initial values for generator bus


modV2 = 1.03; % Mod value of V2
V2 = 1.03+0i; % Complex form of V2
P2 = 300/Base_MVA; % Real Power in Per-unit vlaue

%Initial values for load bus


modV3 = 1; % Mod value of V3
V3 = 1+0i; % Complex form of v3
P3 = 400/Base_MVA; % Real Power in Per-unit vlaue
Q3 = 100/Base_MVA; % Reactive Power in Per-unit vlaue

Ybus=zeros(n); %Initializing zero matrix of size n X n

for q = 1:l
f = A(q,1);
t = A(q,2);
X = A(q,3);

% Assigning values in Ybus matrix


Ybus(f,t) = -Ybus(f,t) - 1/X;
Ybus(t,f) = -Ybus(t,f) - 1/X;
Ybus(f,f) = Ybus(f,f) + 1/X;
Ybus(t,t) = Ybus(t,t) + 1/X;
end

% Algorithm Part
val2=1;
val3=1;
while(val2 > 0.0001 && val3 > 0.0001)
Q2 = -imag(conj(V2) * ((Ybus(2, 1)*V1) + (Ybus(2, 2)*V2) + (Ybus(2, 3)*V3)));
oldV2 = V2;
EELR17 Power Systems Laboratory 3
V2 = (1/Ybus(2, 2)) * (((complex(P2, -Q2))/conj(oldV2)) - Ybus(2, 1)*V1 - Ybus(2, 3)*V3);
V2 = modV2 * exp(1i*angle(V2));
val2 = abs(V2 - oldV2);

oldV3 = V3;
V3 = (1/Ybus(3, 3)) * (((complex(-P3, Q3))/conj(oldV3)) - Ybus(3, 1) * V1-Ybus(3, 2)*V2);
val3 = abs(V3 - oldV3);
end

S12 = V1 * conj(-Ybus(1,2)*(V1-V2)) * Base_MVA;


S13 = V1 * conj(-Ybus(1,3)*(V1-V3)) * Base_MVA;
S21 = V2 * conj(-Ybus(2,1)*(V2-V1)) * Base_MVA;
S23 = V2 * conj(-Ybus(2,3)*(V2-V3)) * Base_MVA;
S31 = V3 * conj(-Ybus(3,1)*(V3-V1)) * Base_MVA;
S32 = V3 * conj(-Ybus(3,2)*(V3-V2)) * Base_MVA;

%Output
fprintf("1. The bus voltages:\n");
fprintf(" a)Bus 1: %f<%f V\n", abs(V1), angle(V1));
fprintf(" b)Bus 2: %f<%f V\n", abs(V2), angle(V2));
fprintf(" c)Bus 3: %f<%f V\n", abs(V3), angle(V3));
fprintf("\n")

fprintf("2. Active and Reactive power flows in lines:\n");


fprintf(" a)Active Power flow from bus 1 to 2 is : %f MW\n", real(S12));
fprintf(" b)Reactive Power flow from bus 1 to 2 is : %f MVAR\n", imag(S12));
fprintf(" c)Active Power flow from bus 2 to 1 is : %f MW\n", real(S21));
fprintf(" d)Reactive Power flow from bus 2 to 1 is : %f MVAR\n", imag(S21));
fprintf(" e)Active Power flow from bus 2 to 3 is : %f MW\n", real(S23));
fprintf(" f)Reactive Power flow from bus 2 to 3 is : %f MVAR\n", imag(S23));
fprintf(" g)Active Power flow from bus 3 to 2 is : %f MW\n", real(S32));
fprintf(" h)Reactive Power flow from bus 3 to 2 is : %f MVAR\n", imag(S32));
fprintf(" i)Active Power flow from bus 1 to 3 is : %f MW\n", real(S13));
fprintf(" j)Reactive Power flow from bus 1 to 3 is : %f MVAR\n", imag(S13));
fprintf(" k)Active Power flow from bus 3 to 1 is : %f MW\n", real(S31));
fprintf(" l)Reactive Power flow from bus 3 to 1 is : %f MVAR\n", imag(S31));
fprintf("\n")

fprintf("3. Active and Reactive power losses in lines:\n");


fprintf("2. Active and Reactive power flows in lines:\n");
fprintf(" a)Active Power loss in line(1,2) is : %f MW\n", real(S12) + real(S21));
fprintf(" b)Reactive Power loss in line(1,2) is : %f MVAR\n", imag(S12) + imag(S21));
fprintf(" c)Active Power loss in line(2,3) is : %f MW\n", real(S23) + real(S32));
fprintf(" d)Reactive Power loss in line(2,3) is : %f MVAR\n", imag(S23) + imag(S32));
fprintf(" e)Active Power loss in line(1,3) is : %f MW\n", real(S13) + real(S31));
fprintf(" f)Reactive Power loss in line(1,3) is : %f MVAR\n", imag(S13) + imag(S31));
fprintf("\n")

fprintf("4. Active and Reactive power supplied by slack bus:\n")


fprintf(" a)Active power supplied by slack bus is : %f MW\n", real(S12) + real(S13));
fprintf(" b)Active power supplied by slack bus is : %f MVAr\n", imag(S12) + imag(S13));

MATLAB Output:

Observations:

 In the Gauss method, we assume the voltage for all the buses except the slack bus where the voltage
magnitude and phase angle are specified and remain fixed.
 Normally, we assume the voltage magnitude and phase angle of these buses are equal to that of the slack bus
and work in a per-unit system.
 In the case of the Gauss-Seidel method, the value of bus voltages calculated for any bus immediately replace
the previous values in the next step while in the case of the Gauss method, the calculated bus voltages replace
EELR17 Power Systems Laboratory 4
the earlier value only at the end of the iteration. Due to this Gauss-Seidel method converges much faster than
that of the Gauss method compared to the Gauss method.

EELR17 Power Systems Laboratory 5

You might also like