Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

EXP 4: CONTINGENCY ANALYSIS BY

GENERATOR SHIFT FACTOR AND LINE OUTAGE


DISTRIBUTION FACTOR METHODS
AIM:

To develop a MATLAB program for performing contingency analysis on the


given system using Generator Shift Factor (GSF) and Line Outage
Distribution Factor (LODF).

APPARATUS:

S.no Software Version

1. MATLAB R2022a

ALGORITHM:

1. Formulate the susceptance matrix, i.e., the B matrix, by taking bus 4 as


reference/slack bus.

2. Evaluate B-1, i.e., the inverse of B matrix.

3. Eliminate the 4th row and 4th column of the B-1 matrix, as bus 4 is the slack
bus. This is done because for slack bus, 𝜃4 = 0, by definition.

4. Evaluate the powers of buses 1 to 3 by:

𝛉𝟏 𝐏𝟏
−𝟏
[𝛉𝟐 ] = 𝐁 [𝐏𝟐 ]
𝛉𝟑 𝐏𝟑
5. Calculate the initial power flows in the lines using the angles using the below
equation:
𝛉𝐢 − 𝛉𝐣
𝐏𝐢𝐣 =
𝐱 𝐢𝐣

6. Compute Generator Shift Factor (GSF) by assuming that generator 1 has


tripped.
𝐁𝐍𝐢 −𝟏 − 𝐁𝐌𝐢 −𝟏
𝐆𝐒𝐅, 𝐚𝐥,𝐢 =
𝐱 𝐍𝐌

where 𝑙 is a line connected between buses 𝑁 and 𝑀 and 𝑖 is the bus to which
the tripped generator is connected.

7. Compute the revised power flow given by:

𝐏𝐥,𝐧𝐞𝐰 = 𝐏𝐥,𝐨𝐥𝐝 + 𝐆𝐒𝐅 × ∆𝐏𝐢

where ∆𝐏𝐢 = −𝐏𝐢 is the change in generation at bus 𝑖 and 𝐏𝐥,𝐨𝐥𝐝 is the power
flow through line 𝑙 before the generator on bus 𝑖 fails.

8. Compute Line Outage Distribution Factor (LODF) and revised power flow by
using LODF for the remaining buses. Assume lines 1-2 and 1-4 undergo an
outage.
𝟏
− 𝐗 𝐣𝐧 + 𝐗 𝐣𝐦 − 𝐗 𝐢𝐦 )
𝐱 𝐢𝐣 (𝐗 𝐢𝐧
𝐝𝐥,𝐤 =
𝟏
𝟏− (𝐗 − 𝟐𝐗 𝐧𝐦 + 𝐗 𝐦𝐦 )
𝐱 𝐧𝐦 𝐧𝐧

where: 𝑙 is the line with the outage consisting of buses 𝑛 and 𝑚,


𝑘 is the line between buses 𝑖 and 𝑗,
𝑥𝑖𝑗 is the line admittance, and
𝑋𝑖𝑗 is taken from the modified susceptance matrix.
9. Calculate revised power flow using:

𝐏𝐥,𝐧𝐞𝐰 = 𝐏𝐥,𝐨𝐥𝐝 + 𝐝𝐥,𝐤 × 𝐏𝐤

where: 𝑃𝑙,𝑜𝑙𝑑 is the power flow in line 𝑙 before the outage.

MATLAB CODE:
clc;clear;
format shortG; format compact;

linedata=[1 1 2 0.5;
2 2 3 0.75;
3 3 4 0.4;
4 4 1 0.9;];

P=[ 0.75;
-0.5;
-1.1 ];

nlines=length(linedata(:,1));
FrontBus=linedata(:,2);
ToBus=linedata(:,3);
nbuses=max(max(FrontBus),max(ToBus));

B_total=zeros(nbuses);
B=zeros(nbuses-1);
theta=zeros(nbuses,1);

P_initial=zeros(nbuses,1);

%susceptance
for k=1:nlines
l=linedata(k,2);
m=linedata(k,3);
B_total(l,l)=B_total(l,l)+1/linedata(k,4);
B_total(m,m)=B_total(m,m)+1/linedata(k,4);
B_total(m,l)=-1/linedata(k,4);
B_total(l,m)=B_total(m,l);
end

% 4x4 to 3x3
for i=1:nbuses-1
for j=1:nbuses-1
B(i,j)=B_total(i,j);
end
end
B;

B_inverse=inv(B);
theta=B_inverse*P;
theta(4,1)=0; % slack bus

% Initial Power Flow


i=0;
j=1;
while(1)
i=i+1;
j=j+1;
P_initial(i)=(theta(i)-theta(j))/linedata(i,4);
j=mod(j,nbuses); % brings j from 4 to 1
if (i==nbuses && j==1)
break;
end
end
P_initial;

A=zeros(nbuses,1);
B_inverse1=B_inverse;

% Accounting for slack bus


for k=1:nbuses
B_inverse1(k,4)=0;
B_inverse1(4,k)=0;
end

% GSF
i=0;
j=1;
while(1)
i=i+1;
j=j+1;
A(i)=(B_inverse1(i,1)-B_inverse1(j,1))/linedata(i,4);
j=mod(j,nbuses); % brings j from 4 to 1
if (i==nbuses && j==1)
break;
end
end
A;

DelP1=-0.75;

for i=1:4
P_rev(i)=P_initial(i)+(A(i)*DelP1);
end
P_rev
% Line 1-2 is tripped

X=B_inverse1;

% LODF
i=1;
j=2;
denom=1-((1/linedata(1,4))*(X(1,1)-2*X(1,2)+X(2,2)));
while(1)
i=i+1;
j=j+1;
D(i-1)=((1/linedata(i,4))*(X(i,1)-X(j,1)+X(j,2)-
X(i,2)))/denom;
j=mod(j,nbuses); % brings j from 4 to 1
if (i==nbuses && j==1)
break;
end
end
D;

% Revised Power Flow


for i=2:4
P_rev1(i-1)=P_initial(i)+(D(i-1)*P_initial(1));
end
P_rev1

% Line 1-4 is tripped


% LODF
i=0;
j=1;
denom=1-((1/linedata(4,4))*(X(1,1)-2*X(1,4)+X(4,4)));
while(1)
i=i+1;
j=j+1;
D(i)=((1/linedata(i,4))*(X(i,1)-X(j,1)+X(j,4)-
X(i,4)))/denom;

if (i==nbuses-1 && j==nbuses)


break;
end
end

% Revised Power Flow


for i=1:3
P_rev1(i)=P_initial(i)+(D(i)*-P_initial(4));
end
P_rev1
OUTPUT:
P_rev =
0.39804 -0.10196 -1.202 0.39804

%Line 1-2 is tripped


P_rev1 =
-0.5 -1.6 -0.75

%Line 1-4 is tripped


P_rev1 =
0.75 0.25 -0.85

RESULT:

Thus, contingency analysis using generation shift factor and LODF was
carried out using MATLAB and the results were verified.

You might also like