0% found this document useful (0 votes)
22 views63 pages

Pe Lab Record-Final

The document outlines a series of experiments related to power flow analysis, including methods such as the Newton Raphson method and the Fast Decoupled method. It details the algorithms, formulas, and MATLAB code necessary for conducting load flow problems and voltage stability analysis. Additionally, it includes characteristics of various energy systems like solar PV, wind energy, and fuel cells.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views63 pages

Pe Lab Record-Final

The document outlines a series of experiments related to power flow analysis, including methods such as the Newton Raphson method and the Fast Decoupled method. It details the algorithms, formulas, and MATLAB code necessary for conducting load flow problems and voltage stability analysis. Additionally, it includes characteristics of various energy systems like solar PV, wind energy, and fuel cells.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

1

CONTENTS

EX.NO. DATE Pg.No. TITLE SIGNATURE

POWER FLOW ANALYSIS BY


1. 18-01-21 4 NEWTON RAPHSON METHOD

POWER FLOW ANALYSIS BY FAST


2. 25-01-21 14 DECOUPLED METHOD
DISTRIBUTION LOAD FLOW
3. 30-01-21 20 ANALYSIS: LADDER
ITERATIVE TECHNIQUE
CONTIGENCY ANALYSIS:
GENERATION SHIFT FACTORS
4. 15-03-21 24
AND LINE OUTAGE
DISTRIBUTION FACTORS
STATE ESTIMATION BY
5. 06-03-21 28 WEIGHTED LEAST SQUARE
METHOD
VOLTAGE STABILITY: PV AND VQ
6. 08-03-21 33 CURVES

CHARACTERISTICS OF SOLAR PV
7. 08-02-21 36 SYSTEM

CHARACTERISTICS OF WIND
8. 15-02-21 40 ENERGY CONVERSION SYSTEM

CHARACTERISTICS OF FUEL CELL


9. 22-02-21 45 BASED ENERGY SOURCE
POWER MANAGEMENT IN HYBRID
10. 01-03-21 53 POWER SYSTEM

2
DIGITAL OVERCURRENT
11. 22-03-21 59 RELAY SETTING AND RELAY
COORDINATION

3
Ex. No. 1
18/01/2021

Power Flow Analysis by Newton Raphson Method


1. Aim:
To write MATLAB code to solve load flow problem using Newton Raphson method and to
determine amount of reactive power support needed to maintain voltage profile in a PQ bus.

2. Formulae:
1. Real Power at bus ‘i’:
𝑛
𝑃𝑖 = ∑ |𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ cos(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗=1
2. Reactive Power at bus ‘i’:
𝑛
𝑄𝑖 = − ∑ |𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ sin(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗=1
3. Real and Reactive Power Mismatch:
Δ𝑃𝑖 = 𝑃𝑠𝑐ℎ𝑑 − 𝑃𝑖,𝑐𝑎𝑙𝑐
Δ𝑄𝑖 = 𝑄𝑠𝑐ℎ𝑑 − 𝑄𝑖,𝑐𝑎𝑙𝑐
4. Correction Matrix:
Δ𝛿 𝐽 𝐽2 −1 Δ𝑃
[ ]=[1 ] ∗[ ]
Δ|𝑉| 𝐽3 𝐽4 Δ𝑄
5. Jacobian:
5.1 J1 :
𝜕𝑃𝑖
Diagonal: = ∑𝑛𝑗=1;|𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ sin(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝜕𝛿𝑖
𝑗≠𝑖
𝜕𝑃𝑖
Non-Diagonal: 𝜕𝛿 = −|𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ sin(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗

5.2 J2 :
𝜕𝑃𝑖
Diagonal: = (2 ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑖 | ∗ cos 𝜃𝑖𝑖 ) + ∑𝑛𝑗=1;|𝑉𝑗 | ∗ |𝑌𝑖𝑗 | ∗ cos(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝜕𝑉𝑖
𝑗≠𝑖
𝜕𝑃𝑖
Non-Diagonal: 𝜕𝑉 = |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ cos(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗

5.3 J3 :
𝜕𝑄𝑖
Diagonal: = ∑𝑛𝑗=1;|𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ cos(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝜕𝛿𝑖
𝑗≠𝑖
𝜕𝑄𝑖
Non-Diagonal: 𝜕𝛿 = −|𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ cos(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗

5.4 J4 :
𝜕𝑄𝑖
Diagonal: = (−2 ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑖 | ∗ sin 𝜃𝑖𝑖 ) − ∑𝑛𝑗=1;|𝑉𝑗 | ∗ |𝑌𝑖𝑗 | ∗ sin(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝜕𝑉𝑖
𝑗≠𝑖
𝜕𝑄𝑖
Non-Diagonal: 𝜕𝑉 = −|𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ sin(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗
6. Line Flows:

4
𝑆𝐿,𝑖𝑗 = 𝑆𝑖𝑗 + 𝑆𝑗𝑖 𝑆𝑖𝑗 = 𝑉𝑖 ∗ 𝐼𝑖𝑗∗ 𝑆𝑗𝑖 = 𝑉𝑗 ∗ 𝐼𝑗𝑖∗
𝐼𝑖𝑗 = (𝑉𝑖 − 𝑉𝑗 ) ∗ 𝑦𝑖𝑗 𝐼𝑗𝑖 = −𝐼𝑖𝑗

3. Algorithm:

Step-1: Start

Step-2: Read the bus and line data

Step-3: Compute the Y Bus using the given line data

Step-4: Set the iteration count ‘k’ to 0 and initialize the bus voltages to 1∠0 for PQ bus and voltage
angle (δ) to 0 for PV bus.

Step-5: Compute power mismatch vector using the appropriate formulae

Step-6: Check for convergence. If converged, go to Step-12.

Δ𝑃𝑘
[ ]≤ 𝜀
Δ𝑄 𝑘

Step-7: Compute Qi for all PV buses.

Step-8: Check for Q limit violation. If there is a violation, convert those PV buses to PQ buses.

Step-9: Calculate Jacobian matrix.

Step-10: Determine the corrected values.

𝑉𝑖𝑘+1 = 𝑉𝑖𝑘 + Δ𝑉𝑖𝑘

Step-11: Set k=k+1 and go to step-5.

Step-12: Compute the power loss, reactive power generation and line flows.

4. System Data:

Base MVA=100MVA

Line Details:

5
Bus Details:

Bus No. Type P Q |V| δ

Pg Pd Qg Qd

1 Slack - - - - 1.05 0

2 PQ 0 4 0 2.5 - -

3 PV 2 0 - - 1.04 -

5. Program:
clc
% sb eb r x
linedata = [1 2 0.02 0.04
1 3 0.01 0.03
2 3 0.0125 0.025];
% bus type V del Pg Qg Pd Qd Qmin Qmax
busdata = [ 1 1 1.05 0 0 0 0 0 0 0;
2 2 1 0 0 0 4 2.5 0 100;
3 3 1.04 0 2 0 0 0 0 0];
%Ybus matrix
sb = linedata(:,1);
eb = linedata(:,2);
r = linedata(:,3);
x = linedata(:,4);
z = r + 1i*x;
y = 1./z;

nbus = 3;
nl = max(eb);
Y = zeros(nbus,nbus);

for k = 1:nl
Y(sb(k),eb(k)) = Y(sb(k),eb(k)) - y(k);
Y(eb(k),sb(k)) = Y(eb(k),sb(k))-y(k);

6
Y(sb(k),sb(k))= Y(sb(k),sb(k))+y(k);
Y(eb(k),eb(k))= Y(eb(k),eb(k))+y(k);
end
Y

[thetha, rho] = cart2pol(real(Y), imag(Y));


rho= abs(Y);
thetha= rad2deg(angle(Y));

bus= busdata(:,1);
type= busdata(:,2);
V = busdata(:,3);
del = busdata(:,4);
Pg = busdata(:,5);
Qg = busdata(:,6);
Pl = busdata(:,7);
Ql = busdata(:,8);
Qmin = busdata(:,9);
Qmax = busdata(:,10);
Psp = Pg - Pl;
Qsp = Qg - Ql;
G= real(Y);
B= imag(Y);
pv = find(type == 3);
pq = find(type == 2);
npv = 1;
npq = 1;

Tol=0.001;
Iter=1;
while(Tol>0.0001)
Iter=Iter
Vcomp=zeros(nbus,1);
P= zeros(nbus,1);
S= zeros(nbus,1);
for i = 1:nbus
Vcomp(i)= V(i)*exp(i*del(i));
end
Q= zeros(nbus,1);
for i= 2:nbus %to calculate Pcal and Qcal
for k= 1:nbus
P(i)=P(i)+(V(i)*V(k)*(G(i,k)*cos(del(i)-del(k)) + B(i,k)*sin(del(i)-
del(k))));
S(i)= S(i)+ conj(Vcomp(i))*Vcomp(k)*Y(i,k);
Q(i)= Q(i)+(V(i)*V(k)*(G(i,k)*sin(del(i)-del(k)) - B(i,k)*cos(del(i)-
del(k))));
end

end
delP=Psp-P;
delQ=Qsp-Q;
k = 1;
dQ = zeros(npq,1);
for i = 1:nbus
if type(i) == 2
dQ(k,1) = delQ(i);
k = k+1;
end
end
dP= delP(2:nbus);
M=[dP;dQ]; %delta P and delta Q

7
M
%J1
J1 = zeros(nbus-1,nbus-1);
for i = 1:(nbus-1)
m = i+1;
for k = 1:(nbus-1)
n = k+1;
if n == m
for n = 1:nbus
J1(i,k) = J1(i,k) + V(m)* V(n)*(-G(m,n)*sin(del(m)-del(n)) +
B(m,n)*cos(del(m)-del(n)));
end
J1(i,k) = J1(i,k) - V(m)^2*B(m,m);
else
J1(i,k) = V(m)* V(n)*(G(m,n)*sin(del(m)-del(n)) -
B(m,n)*cos(del(m)-del(n)));
end
end
end

% J2
J2 = zeros(nbus-1,npq);
for i = 1:(nbus-1)
m = i+1;
for k = 1:npq
n = pq(k);
if n == m
for n = 1:nbus
J2(i,k) = J2(i,k) + V(n)*(G(m,n)*cos(del(m)-del(n)) +
B(m,n)*sin(del(m)-del(n)));
end
J2(i,k) = J2(i,k) + V(m)*G(m,m);
else
J2(i,k) = V(m)*(G(m,n)*cos(del(m)-del(n)) + B(m,n)*sin(del(m)-
del(n)));
end
end
end

% J3
J3 = zeros(npq,nbus-1);
for i = 1:npq
m = pq(i);
for k = 1:(nbus-1)
n = k+1;
if n == m
for n = 1:nbus
J3(i,k) = J3(i,k) + V(m)* V(n)*(G(m,n)*cos(del(m)-del(n)) +
B(m,n)*sin(del(m)-del(n)));
end
J3(i,k) = J3(i,k) - V(m)^2*G(m,m);
else
J3(i,k) = V(m)* V(n)*(-G(m,n)*cos(del(m)-del(n)) -
B(m,n)*sin(del(m)-del(n)));
end
end
end

% J4
J4 = zeros(npq,npq);
for i = 1:npq

8
m = pq(i);
for k = 1:npq
n = pq(k);
if n == m
for n = 1:nbus
J4(i,k) = J4(i,k) + V(n)*(G(m,n)*sin(del(m)-del(n)) -
B(m,n)*cos(del(m)-del(n)));
end
J4(i,k) = J4(i,k) - V(m)*B(m,m);
else
J4(i,k) = V(m)*(G(m,n)*sin(del(m)-del(n)) - B(m,n)*cos(del(m)-
del(n)));
end
end
end

J = [J1 J2; J3 J4];


J %jacobian matrix
X= J\M;
X %state Vector
ddel = X(1:nbus-1);
ddel %change in voltage angle
dVmag = X(nbus:end);
dVmag %change in voltage magnitude
%for 2nd iteration:
% Update State Vectors
del(2:nbus) = ddel + del(2:nbus)
k = 1;
for i = 2:nbus
if type(i) == 2
V(i) = dVmag(k)*V(i) + V(i)
k = k+1;
end
end
Tol=max(abs(M));
Iter=Iter+1;
end

% Bus Current Injections


Iij = zeros(nbus,nbus);
Sij = zeros(nbus,nbus);

%Line Current Flows..


for n = 1:nl
p= sb(n);
q = eb(n);
Iij(p,q) = (Vcomp(p) - Vcomp(q))*Y(p,q);
Iij(q,p) = (Vcomp(q) - Vcomp(p))*Y(q,p);
end
cIij= conj(Iij); %taking conjugate
cIij
Iijr = real(Iij);
Iiji = imag(Iij);
% Line Power Flows..
for m = 1:nl
p=sb(m);
q=eb(m);
Sij(p,q) = Vcomp(p)*(cIij(p,q));
Sij(q,p)=Vcomp(q)*(cIij(q,p));
end
Sij

9
Pij = real(Sij);
Qij = imag(Sij);
% Line Losses..
Lij = zeros(nl,1);
for m = 1:nl
p = sb(m); q = eb(m);
Lij(p,q) = Sij(p,q) + Sij(q,p);
end
Lij
Lpij = real(Lij);
Lqij = imag(Lij);
%slack bus power
SBP=0;
for i=1
for j=2:nl
SBP=SBP+Sij(i,j);
end
end
SBP

6. Output:
Ybus matrix:

20.0000 -50.0000i -10.0000 +20.0000i -10.0000 +30.0000i

-10.0000 +20.0000i 26.0000 -52.0000i -16.0000 +32.0000i

-10.0000 +30.0000i -16.0000 +32.0000i 26.0000 -62.0000i

Iteration 1:

Mismatch
-2.8600
1.4384
-0.2200

Jacobian
54.2800 -33.2800 24.8600

-33.2800 66.0400 -16.6400

-27.1400 16.6400 49.7200

State Vector
-0.0453
-0.0077
-0.0265

New Delta
0
-0.0453
-0.0077

New Voltage magintude

10
1.0500
0.9735
1.0400
Iteration 2:
Mismatch
-0.0992
0.0217
-0.0509

Jacobian
51.7247 -31.7656 21.3026

-32.9816 65.6564 -15.3791

-28.5386 17.4028 48.1036

State Vector
-0.0018
-0.0010
-0.0018

New Delta
0
-0.0471
-0.0087

New Voltage magnitude


1.0500
0.9717
1.0400
Iteration 3:
Mismatch
-0.0012
0.0008
-0.0024

Jacobian
51.5992 -31.6954 21.1499

-32.9355 65.5992 -15.3516

-28.5496 17.3978 47.9597

State Vector
1.0e-04*

-0.0385
-0.0239
-0.5133

New Delta

11
0
-0.0471
-0.0087

New Voltage magnitude


1.0500
0.9717
1.0400
Iteration 4:
Mismatch
1.0e-04 *

-0.3076
0.2228
-0.6971

Jacobian
51.5965 -31.6937 21.1472

-32.9338 65.5975 -15.3516

-28.5482 17.3969 47.9546

State Vector
1.0e-05 *

-0.0001
-0.0001
-0.1454

New Delta
0
-0.0471
-0.0087

New Voltage magnitude


1.0500
0.9717
1.0400
Power flow in the lines:
S12 S13 S23 S21 S31 S32

1.7936 + 0.3906 + -2.2903 - -1.7097 - -0.3888 - 2.3888 +


1.1873i 0.2212i 1.4805i 1.0194i 0.2157i 1.6774i

Line Losses:
SL12 SL13 SL23

0.0839 + 0.1679i 0.0018 + 0.0055i 0.0985 + 0.1969i

Slack bus power:

12
-2.1862 - 1.4078i

7. Result:
MATLAB code to solve load flow problem using Newton Raphson has been successfully executed and
reactive power support for maintaining voltage profile is also determined.

13
Ex. No. 2
25/01/21

Power Flow Analysis by Fast Decoupled Method


1. Aim:
To write MATLAB code to solve load flow problem using Fast Decoupled method and to
determine amount of reactive power support needed to maintain voltage profile in a PQ bus.

2. Formulae:
7. Real Power at bus ‘i’:
𝑛
𝑃𝑖 = ∑ |𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ cos(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗=1
8. Reactive Power at bus ‘i’:
𝑛
𝑄𝑖 = − ∑ |𝑉𝑗 | ∗ |𝑉𝑖 | ∗ |𝑌𝑖𝑗 | ∗ sin(𝜃𝑖𝑗 + 𝛿𝑗 − 𝛿𝑖 )
𝑗=1
9. Real and Reactive Power Mismatch:
Δ𝑃𝑖 = 𝑃𝑠𝑐ℎ𝑑 − 𝑃𝑖,𝑐𝑎𝑙𝑐
Δ𝑄𝑖 = 𝑄𝑠𝑐ℎ𝑑 − 𝑄𝑖,𝑐𝑎𝑙𝑐
10. Correction Matrix:
[Δ𝛿] = [𝐵′]−1 ∗ [∆𝑃/|𝑉|]
[Δ𝑉] = [𝐵"]−1 ∗ [∆𝑄/|𝑉|]
B' corresponds to suceptances of all buses except slack bus.
B'' corresponds to susceptances of PQ buses.
11. Line Flows:
𝑆𝐿,𝑖𝑗 = 𝑆𝑖𝑗 + 𝑆𝑗𝑖 𝑆𝑖𝑗 = 𝑉𝑖 ∗ 𝐼𝑖𝑗∗ 𝑆𝑗𝑖 = 𝑉𝑗 ∗ 𝐼𝑗𝑖∗
𝐼𝑖𝑗 = (𝑉𝑖 − 𝑉𝑗 ) ∗ 𝑦𝑖𝑗 𝐼𝑗𝑖 = −𝐼𝑖𝑗
3. Algorithm:

Step-1: Start

Step-2: Read the bus and line data

Step-3: Compute the Y Bus using the given line data

Step-4: Compute the B' and B'' matrix from Y Bus

Step-5: Set the iteration count ‘k’ to 0 and initialize the bus voltages to 1∠0 for PQ bus and voltage
angle (δ) to 0 for PV bus.

Step-6: Compute power mismatch vector using the appropriate formulae

Step-7: Check for convergence. If converged, go to Step-12.

∆𝑃𝑘
[ 𝑘] ≤ ε
∆𝑄

14
Step-8: Compute Qi for all PV buses.

Step-9: Check for Q limit violation. If there is a violation, convert those PV buses to PQ

buses.

Step-10: Determine the corrected values.

𝑉𝑖𝑘+1 = 𝑉𝑖𝑘 +∆𝑉𝑖𝑘

𝛿𝑖𝑘+1 = 𝛿𝑖𝑘 +∆𝛿𝑖𝑘

Step-11: Set k=k+1 and go to step-5.

Step-12: Compute the power loss, reactive power generation and line flows

4. System Data:

Base MVA=100MVA

Line Details:

Bus Details:

Bus Type Voltage Delta Pg Qg Pd Qd Qmin Qmax

1 1 1.05 0 - - - - - -

2 2 1 0 0 0 4 2.5 - -

3 3 1.04 0 2 0 0 0 0 100

15
Line data:

Starting Bus Ending Bus Resistance Reactance

1 2 0.02 0.04

2 3 0.01 0.03

1 3 0.0125 0.025

5. Program:
clc
% sb eb R X
linedata = [ 1 2 0.02 0.04
1 3 0.01 0.03
2 3 0.0125 0.025];
% Bus Type V del Pg Qg Pl Ql Qmin Qmax
busdata = [1 1 1.05 0 0 0 0 0 0
0;
2 2 1 0 0 0 4 2.5 0
100;
3 3 1.04 0 2 0 0 0 0
0];

sb = linedata(:,1);
eb = linedata(:,2);
r = linedata(:,3);
x = linedata(:,4);
z = r + 1i*x;
y = 1./z;

nbus = 3;
nl = max(eb); %no of lines
Y = zeros(nbus,nbus);

for k = 1:nl
Y(sb(k),sb(k))= Y(sb(k),sb(k))+y(k);
Y(eb(k),eb(k))= Y(eb(k),eb(k))+y(k);
Y(sb(k),eb(k)) = Y(sb(k),eb(k))- y(k);
Y(eb(k),sb(k)) = Y(eb(k),sb(k))-y(k);
end

[thetha, rho] = cart2pol(real(Y), imag(Y));


rho= abs(Y);
thetha= rad2deg(angle(Y));
G= real(Y);
B= imag(Y);
Y

bus= busdata(:,1);
type= busdata(:,2);
V = busdata(:,3);
del = busdata(:,4);
Pg = busdata(:,5);
Qg = busdata(:,6);
Pl = busdata(:,7);
Ql = busdata(:,8);
Qmin = busdata(:,9);
Qmax = busdata(:,10);
Psp = Pg - Pl;
Qsp = Qg - Ql;

16
slackbus= find(bus==1);
pv = find(bus == 3);
pq = find(bus == 2);
npv = 1;
npq = 1;

Tol=0.001
Iter=1;
while(Tol>0.0001)
Iter=Iter
Vcomp=zeros(nbus,1);
P= zeros(nbus,1);
for i=1:nbus
Vcomp(i)= V(i)*exp(i*del(i));
end
for i= 2:nbus
for k= 1:nbus
P(i)=P(i)+(V(i)*V(k)*(G(i,k)*cos(del(i)-del(k)) + B(i,k)*sin(del(i)-del(k))));
end
end

%finding del P by V
for i=1:nbus
delP(i,1)= (Psp(i)-P(i));
dPbyV(i,1)= delP(i,1)/V(i,1);
end
delPbyV=dPbyV(2:3);
delPbyV
%B prime
bp= -B;
bp(slackbus,:) = [];
bp(:,slackbus) = [];
bp
xdel=inv(bp)*delPbyV;
xdel
%Update state vector
del(2:nbus)=del(2:nbus)+xdel
ddel=del(2:nbus)*(180/pi)
%to calculate Qcal
Q= zeros(nbus,1);
for i= 2:nbus
for k= 1:nbus
Q(i)= Q(i)+(V(i)*V(k)*(G(i,k)*sin(del(i)-del(k)) - B(i,k)*cos(del(i)-del(k))));
end
end
%finding del Q by v
c=0;
for i=1:nbus
if type(i)==2
c=c+1;
delQ(c,1)= (Qsp(i)-Q(i));
dQbyV(c,1)= delQ(c,1)/V(i,1);
end
end
dQbyV
%to find B double prime
bpp= -B;
K=[find(type==1);find(type==3)];
bpp(K,:)=[];
bpp(:,K)=[];
bpp
cVmag= inv(bpp)*dQbyV;
cVmag
%update the state vector
k = 1;
for i = 2:nbus
if type(i) == 2
V(i) = cVmag(k) + V(i)

17
k = k+1;
end
end
M=[xdel;cVmag];
M
Tol=max(abs(M));
Iter=Iter+1;
end
% Bus Current Injections
Iij = zeros(nbus,nbus);
Sij = zeros(nbus,nbus);

%Line Current Flows


for n = 1:nl
p= sb(n);
q = eb(n);
Iij(p,q) = -(Vcomp(p) - Vcomp(q))*Y(p,q);
Iij(q,p) = -(Vcomp(q) - Vcomp(p))*Y(q,p);
end
cIij= conj(Iij); %taking conjugate
cIij
Iijr = real(Iij);
Iiji = imag(Iij);
% Line Power Flows
for m = 1:nl
p=sb(m);
q=eb(m);
Sij(p,q) = Vcomp(p)*(cIij(p,q));
Sij(q,p)=Vcomp(q)*(cIij(q,p));
end
Sij
Pij = real(Sij);
Qij = imag(Sij);
% Line Losses
Lij = zeros(nl,1);
for m = 1:nl
p = sb(m);
q = eb(m);
Lij(p,q) = Sij(p,q) + Sij(q,p);
end
Lij
Lpij = real(Lij);
Lqij = imag(Lij);
%slack bus power
SBP=0;
for i=1
for j=2:nl
SBP=SBP+Lij(i,j);
end
end
SBP

6. Output:
Ybus Matrix
20.0000 -50.0000i -10.0000 +20.0000i -10.0000 +30.0000i

-10.0000 +20.0000i 26.0000 -52.0000i -16.0000 +32.0000i

-10.0000 +30.0000i -16.0000 +32.0000i 26.0000 -62.0000i

18
B prime
52 −32
[ ]
−32 −6
B double prime
[ 52 ]

Iteration results
Iteratio Del P by V Change in delta Del Q by Change in
n no (in radians) V Voltage
Δ𝑃2 /𝑉2 Δ𝑃3 /𝑉3 Δ𝛿2 Δ𝛿3 Δ𝑄2 /𝑉2 Magnitude
𝑉3𝑛𝑒𝑤 = 𝑉3𝑜𝑙𝑑 +
Δ𝑉3

1 -2.8600 1.3831 -0.0605 -0.0089 - 0.9655


1.7951
2 0.8382 -0.5023 -0.0442 -0.0086 0.3887 0.9730
3 - -0.0477 - 0.9714
0.1778 0.1032 0.0087 -
0.0804
4 0.0375 -0.0215 -0.0469 -0.0087 0.0171 0.9717
5 -0.0080 0.0046 -0.0471 -0.0087 -0.0036 0.9717
6 0.0017 -0.0010 -0.0471 -0.0087 7.6869e- 0.9717
04

Line Power Flow


S12 S13 S21 S23 S31 S32
-1.7943 - -0.3907 - 1.7103 + 2.2913 + 0.3888 + -2.3898 -
1.1873i 0.2212i 1.0194i 1.4804i 0.2157i 1.6775i

Line Losses
SL12 SL13 SL23
-0.0840 - 0.1680i -0.0018 - 0.0055i -0.0985 - 0.1971i

Slack Bus Power

-2.1850 - 1.4085i

7. Result:
MATLAB code to solve load flow problem using Fast Decoupled has been successfully executed and
reactive power support for maintaining voltage profile is also determined.

19
Ex. No. 3 01/02/2021
Distributed Load Flow Analysis by Ladder Iterative Method

1. Aim:
To write MATLAB code to solve distributed load flow problem using ladder iterative method.

2. Formulae:
 Backward sweep:

Node Current:
𝐼∗ = 𝑆 ∗/ 𝑉 ∗
 Forward sweep:
Line drop
𝑉𝐿 = 𝐼𝐿 x 𝑍𝐿

Receiving end voltage


𝑉𝑅 = 𝑉𝑠 - 𝑉𝐿
3. Algorithm:

Step 1 : Start
Step 2 : Set the iteration count 'k' equal to 0.Initialize the initial current to zero and Initial voltage
to 1+j0.

Step 3 : Compute the Node current using the appropriate formulae


Step 4 : Compute the Branch current Ib using Kirchhoff current law
Step 5 : Calculate the Line drop
Step 6 : Compute the Bus voltages based on the line drop

Step 7 : Check for convergence: if V≤ 𝜀,if converged got to next step or set k=k+1 and
go to step-3

4. System Data:
LINE DATA:

STARTING BUS ENDING BUS RESISTANCE REACTANCE


1 2 0.08 0.06
2 3 0.1 0.09
2 4 0.12 0.1
LOAD DATA:
Bus No Voltage Delta Pg Pd

1 1 0 0.6 0.2

2 0.98 0 0.5 0.2

20
3 0.98 0 0.3 0.1

4 0.98 0 0.5 0.2

5. Program:
clc
% sb eb R X
linedata= [ 1 2 0.08 0.06;
2 3 0.1 0.09;
2 4 0.12 0.1];
% Bus Type V del Pg Qg Pd Qd Qmin
Qmax
busdata = [1 1 1 0 0 0 0.6 0.2 0 0;
2 2 0.98 0 0 0 0.5 0.2 0 0;
3 2 0.98 0 0 0 0.3 0.1 0 0;
4 2 0.98 0 0 0 0.5 0.2 0 0];
sb= linedata(:,1);
eb= linedata(:,2);
R=linedata(:,3);
X=linedata(:,4);
Z= R+1i*X;
Y= 1./Z;
V= busdata(:,3);
del= busdata(:,4);
Pd= busdata(:,7);
Qd= busdata(:,8);
S=Pd+1i*Qd;
nline=size(linedata);
nline=nline(1);%no of lines
nbus= size(busdata);
nbus=nbus(1);%no of buses

Iter=1;
while(Iter<5)
Iter=Iter
Iij=zeros(nline,1);
I=conj(S./V);
I
for i=nline:-1:1
crb=eb(i);%current recieving bus
icrb=find(sb==crb);%Current recieving bus as sending bus
Iij(i)=I(crb)+sum(Iij(icrb));
end
Iij
Voldmag=V
for i=2:nbus
cbus=find(eb==i);%currentbus/recieving bus
s_cbus=sb(cbus);%currentbus as sending bus
V(i)=V(s_cbus)-(Iij(cbus).*Z(cbus));
end
V %New Voltage
if(all(abs((Voldmag-V)./Voldmag)<0.001))

21
break;
end
Iter=Iter+1;
end
%Line Current FLow
Iij=zeros(nbus,1);
for i=1:nline
p=sb(i);
q=eb(i);
Y=inv(Z(i));
Iij(p,q)=(V(p)-V(q)).*Y;
Iij(q,p)=(V(q)-V(p)).*Y;
end
cIij=conj(Iij)
%Line Power Flow
Sij=zeros(nbus,1);
for i=1:nline
p=sb(i);
q=eb(i);
Sij(p,q)= V(p).*(cIij(p,q));
Sij(q,p)= V(q).*(cIij(q,p));
end
Sij
%Line Losses
Lij=zeros(nbus,nbus);
for i=1:nline
p=sb(i);
q=eb(i);
Lij(p,q)=Sij(p,q)+Sij(q,p);
end
Lij

6. Output:
Bus Current
Iteration 𝐼2 𝐼3 𝐼4
1 0.5102 - 0.3061 - 0.5102 -
0.2041i 0.1020i 0.2041i
2 0.5676 - 0.3544 - 0.6140 -
0.2572i 0.1456i 0.3072i
3 0.5879 - 0.3715 - 0.6579 -
0.2646i 0.1521i 0.3279i
4 0.5932 - 0.3758 - 0.6697 -
0.2691i 0.1560i 0.3400i

Branch Current
Iteration 𝐼12
1 1.3265 - 0.5102i
2 1.5361 - 0.7099i
3 1.6173 - 0.7446i
4 1.6387 - 0.7650i

Voltage Magnitude

22
Iteration 𝑉2 𝑉3 𝑉4
1 0.8633 - 0.0388i 0.8235 - 0.0561i 0.7816 - 0.0653i
2 0.8345 - 0.0354i 0.7860 - 0.0527i 0.7301 - 0.0599i
3 0.8259 - 0.0375i 0.7751 - 0.0557i 0.7142 - 0.0639i
4 0.8230 - 0.0371i 0.7714 - 0.0553i 0.7086 - 0.0633i

Line Power Flow


𝑆12 𝑆23 𝑆24 𝑆21 𝑆32 𝑆42
1.6387 + 0.3151 + 0.5638 + -1.3770 - -0.2985 - -0.4961 -
0.7650i 0.1145i 0.2549i 0.5688i 0.0996i 0.1985i

Line Losses
𝐿12 𝐿23 𝐿24
0.2616 + 0.1962i 0.0166 + 0.0149i 0.0677 + 0.0564i

7. Result:
The distribution load flow analysis of a given network is performed using Ladder iterative method
in MATLAB.
1) The Bus voltages.
2) Line flows.
3) Line losses are determined.

23
Ex no. 4
08/02/2021

Characteristics of Solar PV System


1. Aim:
To simulate and obtain VI and PV Characteristics of solar cell using MATLAB.

2. Theory:

a. Introduction

The extraction of electrical energy directly from the sun without any intermediate process is known as solar
energy. A solar cell is a semiconductor device used to capture the light from sun. The working of solar cell
depends on photovoltaic effect, hence a solar cell is known as photovoltaic cell. It is independent of incident
light striking on it but the current capacity is almost proportional to the intensity of incident light as well as
to the area of the cell that is exposed to the light.

b. Equivalent circuit of solar cell

The equivalent circuit of a PV cell consists of a diode in parallel with an ideal current source along with shunt
and series resistors to account for the loss.
𝑰𝑳 = current from the ideal current source
𝑰𝑫 = diode current
𝑰𝒔𝒉 = shunt current
𝑰 = output current
𝑹𝒔𝒉 = shunt resistor
𝑹𝒔 = series resistor
I = IL - ID - Ish

The ideal current source delivers current proportional to amount of solar light falling on the cell. There are
two conditions for the actual PV cell and for the equivalent circuit working, which are:
a. Current that flows when the terminals are short circuited (short circuit current, 𝐼𝑠𝑐 )
b. Voltage across the terminals when the terminals are left open (open-circuit voltage,𝑉𝑂𝐶 )

Short Circuit Current (𝑰𝒔𝒄 )

The maximum current that a solar cell can deliver when short circuiting the output terminals at the most
optimised condition for producing maximum output. The optimised condition here means the maximum
amount of light a cell can capture at a particular position and angle, as the current production depends on the
surface area of the cell exposed to light. This current is known as Maximum Current Density expressed by

𝐽𝑠𝑐 = 𝐼𝑠𝑐 / A

where A is the area of the solar cell.

24
Open-circuit Voltage (𝑽𝑶𝑪 )

The open-circuit voltage is measured by measuring the voltage at the terminals when no load is connected
across it. The voltage doesn’t depend on the intensity of the light and the area of the cell. Normally the open-
circuit voltage of a solar cell is approximately 0.5 to 0.6V.

c. I-V and P-V characteristics of solar cell

The solar cell I-V characteristics are plotted by first noting the open-circuit voltage (𝑉𝑂𝐶 ). A load is then connected
and gradually increased, hence some amount of current starts flowing. Load voltage is noted down for each load
current. Then the cell is short circuited and corresponding short circuit voltage is noted. P-V characteristics are
obtained multiplying each value of PV cell voltage with corresponding current flowing through it.

Maximum Power Point of solar cell

From the characteristics, the maximum power occurs for one particular value of terminal voltage and current. It
will occur at the bend point of the characteristic curve.

Fill Factor of solar cell

Fill Factor is defined as the ratio of product of current and voltage at maximum power point to the product of
short circuit current and open-circuit voltage.

Fill Factor = (𝑉𝑚𝑝 x 𝐼𝑚𝑝 ) / (𝑉𝑂𝐶 x 𝐼𝑠𝑐 )

Efficiency of solar cell

The efficiency of solar cell is defined as ratio of maximum electrical power output to the radiation power input in
the cell. The radiation power is considered as 1000 watt/square meter. If the exposed area of the cell is A, then
total radiation power of the cell will be 1000 A watts.

Efficiency = (𝑃𝑚 / 1000 A) * 100

3. MATLAB Model

25
4. Output

I-V Characteristics:

P-V Characteristics:

26
5. Result:
Solar Cell has been modelled and the I-V, P-V characteristics are obtained through simulation in MATLAB.

27
Ex no. 5
08/02/2021

Characteristics of Wind Energy Conversion System


2. Aim:
To simulate and obtain Characteristics of Wind Energy Conversion System using MATLAB.

3. Theory:

c. Introduction
The kinetic energy available in wind is captured and converted in rotational mechanical energy by wind
turbine. This mechanical energy of wind turbine is given to generator which converts the mechanical energy
into electrical energy.

Where,
ρair(kg/m3) is the density of air,
Rblade (m) is the radius of the blade,
Ablade (m2) is the area covered by the blade,
Cp is the coefficient of performance of turbine,
β (degree) is the pitch angle,
λ is the tip speed ratio, ωw (rad/s) is the wind speed,
ωr(rad/s) is the turbine rotor speed.

d. Types of WECS

1. Based on operational speed:


a. Fixed speed WECS
b. Variable speed WECS
2. Based on Axis:
c. Horizontal Axis
d. Vertical Axis
3. Based on type of Generator:
e. Squirrel Cage (suitable for Fixed speed type)
f. Doubly Fed Induction Generator (DFIG)
g. Permanent Magnet Synchronous Generator (PMSG)

e. Parts of WECS

1. Rotor Blade
2. Rotor Hub
3. Nacelle
4. Generator
5. Pitch Control
6. Yaw Control
7. Anemometer
8. Gear Box

f. Definitions

28
1. Cut-in Speed: This is the minimum wind speed required for the wind turbine to start rotating for
power production.
2. Cut-Out Speed: This is the maximum wind speed above which the turbine is completely stopped so
that the turbine is within safe operating conditions.
3. Betz's coefficient: This is the theoretical maximum ratio of power that can be extracted from the wind
energy by wind turbine. Theoretically this value is 16/27 (59.3%).
4. Tip Speed Ratio: It is the ratio of tangential velocity of tip of wind turbine blade to the wind speed. It
is denoted by lambda.
5. Pitch Angle: It is the angle at which wind contacts the blades of the wind turbine. It is denoted by
beta.
6. Co-efficient of Performance: It is the ratio of power output of the unit to the power available in the
wind. It is a function of tip-speed ratio and pitch angle.

g. Variable Speed WECS

To extract maximum power from wind, the wind turbine should run at optimal value of coefficient of
performance. This optimal value of coefficient of performance is obtained at optimal tip speed ratio which
in turn depends on rotor speed for a particular wind speed. This optimal tip speed ratio is constant for all
wind speeds for a given turbine. So, for a particular wind speed the rotor must rotate at a particular optimal
value. Thus rotor speed must be varied continuously for each wind speed so that Cp is always at its optimal
maximum value.

Since the generator's rotor speed is varied, the frequency of the AC output varies. So it cannot be
interfaced directly to grid. For this reason, a back to back converter is employed to convert variable
frequency AC to DC and then inverting this DC to AC of grid frequency.

h. Wind Turbine Power Characteristics

29
3. MATLAB Model:

4. Output:

Rotor Speed, Rotor angle and Torque characteristics

30
𝑉𝑎𝑏𝑐 and 𝐼𝑎𝑏𝑐 characteristics

𝑉𝑎𝑏𝑐_𝑖𝑛𝑣 and 𝐼𝑎𝑏𝑐_𝑖𝑛𝑣 characteristics

Wind Turbine Characteristics

31
Generator Characteristics

5. Result:
MATLAB-SIMULINK is used to create a Permanent Magnet Synchronous Generator based Wind Energy
Conversion System model and the results are obtained.

32
Ex no. 6
15/02/2021

Characteristics of Fuel Cell based Energy Sources


3. Aim:
To simulate and obtain Characteristics of Fuel Cell based Energy Sources using MATLAB.

4. Theory:

a. Introduction
Fuel cells are electrochemical cells which convert chemical energy into electrical energy. The raw material
used is 𝐻2 and the base product is water and heat. The efficiency of conversion in fuel cells is around 70%.

b. Parts of Fuel Cell

1. Anode: The negative terminal of the fuel cell where oxidation takes place is called as Anode. It
conducts the electrons that are freed from hydrogen molecules so that they can be used in an external
circuit.

2. Cathode: The positive terminal of the fuel cell is called Cathode. It distributes the oxygen to the
surface of the catalyst. Not only that, it conducts electrons back from the external circuit to the
catalyst, where they can recombine with the hydrogen ions and oxygen to form water.

3. Catalyst: A chemical substance which increases the rate of reaction. It is made of platinum powder
very thinly coated onto carbon paper or cloth.

4. Electrolyte: It is otherwise known as Proton Exchange Membrane. A substance that conducts charged
ions from one electrode to the other in a fuel cell. It conducts only positively charged ions.

c. Working of Fuel Cell


A fuel cell consists of two electrodes namely anode and cathode. Hydrogen and Oxygen are fed into the
cell. The catalyst at anode causes hydrogen atoms to give up electrons leaving only the protons. Oxygen
ions at cathode attract the hydrogen protons. The protons then pass through electrolyte membrane. The
electrons are redirected to cathode through external circuit thus producing electric current.

d. Types of Fuel Cell

1. PAFC: Phosphoric Acid Fuel Cell


2. PEMFC: Proton Exchange Membrane Fuel Cell
3. AFC: Alkaline Fuel Cell
4. MCFC: Molten Carbonate Fuel Cell
5. SOFC: Solid Oxide Fuel Cell

e. Losses in Fuel Cell


1. Activation Losses
2. Ohmic Losses
3. Concentration Losses

f. Fuel Cell Characteristic Curve

33
As shown, fuel cell I-V characteristic curve is divided into three regions: R-1, R-2, and R-3. The point at
the boundary of regions R-2 and R-3 is known as maximum power density point or knee/optimum
point. Loading the fuel cells above the maximum power point (MPP) current will shift the operating point
right of the optimum point (region R-3) causing a sudden collapse of the fuel cell voltage to zero.
Therefore, no power could be drawn from the cell. Extended operation in region R-3 may damage the fuel
cell. Fuel cells are generally operated in the region R-2 of the characteristics shown in the figure.

3. MATLAB Model:

4. Output:

Voltage-Current characteristics of fuel cell:

34
5. Result:
Thus the Characteristics of Fuel Cell based Energy Sources using MATLAB/Simulink is simulated and
obtained.

35
Ex. No. 7 27/11/2019

Power Management in Hybrid Power System

1. Aim: To simulate and obtain the Characteristics of Hybrid Power System using MATLAB.

2. Theory:

A hybrid system is a dynamical system that exhibits both continuous and discrete dynamic behaviour – a system
that can both flow (described by a differential equation) and jump (described by a state machine or automaton).
Often, the term "hybrid dynamical system" is used, to distinguish over hybrid systems such as those that combine
neural nets and fuzzy logic, or electrical and mechanical drivelines. A hybrid system has the benefit of
encompassing a larger class of systems within its structure, allowing for more flexibility in modelling dynamic
phenomena.

In general, the state of a hybrid system is defined by the values of the continuous variables and a discrete mode.
The state changes either continuously, according to a flow condition, or discretely according to a control graph.
Continuous flow is permitted as long as so-called invariants hold, while discrete transitions can occur as soon as
given jump conditions are satisfied. Discrete transitions may be associated with events.

With the rapid increase in demand of energy due to the increasing of load, it is very difficult for the electrical grid
to fulfil the energy demand. For supplying the power and to avoid the failure of grid, the grid system does the
load shedding and fulfils the energy demand. But this process is obvious and fails to fulfil the energy demand of
each and every customer. By doing so, the electrical grid system will be free from the stress of fulfilling the
energy demand by performing the load shedding. This hybrid system is connected with the electrical grid near
the load to fulfil the load demand by supplying the power from the electrical grid to the load.

The hybrid power solution allows for the integration of one or more renewable power generation assets with
tailored energy storage systems. When there is a high demand in load and generation is not sufficient, this storage
system can deliver power to the load thus maintaining stability. Also when there is high generation and demand
is low, the same storage system can absorb excess generated power.

3. MATLAB Model:

36
Subsystem:

4. Output:
Battery SOC,Voltage and Current

VSC Voltage and Current

37
Grid Voltage and Current

Load Voltage and Current

Load,Grid and VSC Power

38
5. RESULT: MATLAB-SIMULINK is used to model a Hybrid Power System and the required output is
obtained.

39
Ex. No.8
06/03/2021
Voltage Stability: PV and VQ Curves

1. Aim:
To analysis the voltage stability by obtaining the PV and QV curves using MATLAB programming.

2. Theory:
Voltage stability in the power system is defined as the ability of a power system to maintain
acceptable voltages at all bus in the system under normal condition and after being subjected to a
disturbance. Voltage instability stems from the attempt of load dynamics to restore power
consumption beyond the capability of the combined transmission and generation system. Loads are
the driving force of voltage instability, and for this reason this phenomenon has also been called load
instability.

a. Power-Voltage Relationships

PV CURVES OR NOSE CURVES

For a given load power below the maximum, there are two solutions: one with higher voltage and lower current,
the other with lower voltage and higher current. The former corresponds to "normal" operating conditions, with
voltage V closer to the generator voltage E. Permanent operation at the lower solutions is unacceptable. As the
load is more and more compensated (which corresponds to smaller tan φ), the maximum power increases.
However, the voltage at which this maximum occurs also increases. This situation is dangerous in the sense that
maximum transfer capability may be reached at voltages close to normal operation values. Also, for a high degree
of compensation and a load power close to the maximum, the two voltage solutions are close to each other and
without further analysis it may be difficult to decide if a given solution is the "normal" one. For over-compensated
loads (tan φ < 0), there is a portion of the upper PV curve along which the voltage increases with the load power.
The explanation is that under negative tan φ, when more active power is consumed, more reactive power is
produced by the load. At low load, the voltage drop due to the former is offset by the voltage increase due to the
latter. The more negative tan φ is, the larger is the portion of the PV curve where this takes place.
Generator Reactive Power Requirement

40
Generators are treated as voltage sources of constant magnitude. The main defect of this assumption lies
in the limited reactive power capability of generators. It is therefore of interest to determine how the
reactive generation increases with load.

In the lossless case R = 0, the generator reactive production as the sum of the load and the network
losses:

normal operating points – lower side

These curves are similar to the PV curves, except that normal operating points now lie on the lower
part of the curves. Starting from open-circuit conditions (P = 0, 𝑄𝑔 = 0) and increasing the load, the
reactive generation increases nonlinearly with P up to the maximum power. Beyond this point, P
decreases while reactive losses continue to increase, up to the point (P = 0, 𝑄𝑔 = E2/x) which
The line current I relates to the generator apparent power Sg through:

In the absence of real power losses:

short circuit

corresponds to a short circuit at the load bus. Note finally that all the maximum power points are
characterized by:

The reactive power to be absorbed or inject to reach the operating point should be calculated.

3. Program:

41
PV curve program
%PV curve
clear all
X=0.8;
E=1;
tanpf=-0.2;
temp=1;
temp1=54;
for i=1:1
for P=0:0.03:0.78
Q=P* tanpf;
Vx =sqrt((E^2/4) -(P*X)^2-(X*Q*E^2));
Vhv=sqrt((E^2/2) -(Q* X)+Vx);
Vlv =sqrt((E^2/2) -(Q*X)-Vx);
x1(temp)=P*X/(E^2);
x1(temp1)=P*X/(E^2);
y1(temp)=Vhv/E;
y1(temp1)= Vlv /E;
temp=temp+1;
temp1=temp1 -1;
end
tanpf=tanpf+0.2;
end
plot(x1,y1) ;
legend(" Real Power ");
ylabel("Voltage");
xlabel("Power");

VQ curve program

%VQ curve

clc

clear all

P=0;

E=1;

X=0.1;

V=0.0001;

for j=1:3

P=P+2;

Q=P*tan((25.84*3.1416/180));

V=0.0001;

for i=1:22

theta=asin(P*X/E*V);

42
Qc=Q+(V*V/X)-(E*V/X)*cos(theta);

V=V+0.05;

x1(j,i)=V/E;

y1(j,i)=Qc*X/(E*E);

yy(i)=0;

end

end

plot(x1(1,:),yy,x1(1,:),y1(1,:),x1(2,:),y1(2,:),x1(3,:),y1(3,:));

legend('Reactive Power','V1','V2','V3')

ylabel("Voltage")

xlabel("Reactive Power")

4. Output:
OUTPUT GRAPH FOR PV CURVE

OUTPUT GRAPH FOR VQ CURVE

43
5. Result:
A MATLAB program for analysing voltage stability is coded and the following graphs are obtained.
1. P-V Curve.
2. Q-V Curve.

44
Ex no. 9 08/02/2021

State Estimation by Weighted Least Square Method


4. Aim:
To create a MATLAB program to find the state estimation of a network

5. Formula Used:

ΔX=

3. Algorithm:

45
4. System Data:

LINE DATA:
Line From To Resistance Reactance
1 1 2 0 0.1000
2 2 3 0 0.2500

METER DATA:

S.No Type Value (p.u) SD


1 P12 0.888 0.008
2 P13 1.173 0.008
3 P2 -0.501 0.010
4 Q12 0.568 0.008
5 Q13 0.663 0.008
6 Q2 -0.286 0.010
7 V1 1.006 0.004
8 V2 0.968 0.004

5. Program:
clc
% sb eb r x
linedata = [1 2 0.01 0.03
1 3 0.02 0.05
2 3 0.03 0.08];
% bus type V
busdata = [ 1 1 1.00
2 2 1.0
3 3 1.00];
% Measurement,i Type Value(p.u) From To Rii
measurementdata= [ 1 1 0.888 1 2 0.008
2 1 1.173 1 3 0.008
3 2 -0.501 2 0 0.010
4 3 0.568 1 2 0.008
5 3 0.663 1 3 0.008
6 4 -0.268 2 0 0.010
7 5 1.006 1 0 0.004
8 5 0.968 2 0 0.004];
%Ybus matrix
sb = linedata(:,1);
eb = linedata(:,2);
r = linedata(:,3);
x = linedata(:,4);
z = r + 1i*x;
y = 1./z;

46
nbus = 3;
nl = max(eb);
Y = zeros(nbus,nbus);
for k = 1:nl
Y(sb(k),eb(k)) = Y(sb(k),eb(k)) - y(k);
Y(eb(k),sb(k)) = Y(eb(k),sb(k))-y(k);
Y(sb(k),sb(k))= Y(sb(k),sb(k))+y(k);
Y(eb(k),eb(k))= Y(eb(k),eb(k))+y(k);
end
Y

[thetha, rho] = cart2pol(real(Y), imag(Y));


rho= abs(Y);
thetha= rad2deg(angle(Y));
G= real(Y);
B= imag(Y);
G
B
g(1,2)=10;
g(1,3)=6.9;
g(2,3)=4.1;
b(1,2)=-30;
b(1,3)=-17.2;
b(2,3)=-10.9;
P12=measurementdata(1,3);
P13=measurementdata(2,3);
P2=measurementdata(3,3);
Q12=measurementdata(4,3);
Q13=measurementdata(5,3);
Q2=measurementdata(6,3);
V1=measurementdata(7,3);
V2=measurementdata(8,3);
V3=1.0;

%initializing state vector


X0=[ 0 ; 0; 1; 1; 1];
DEL1=0;
DEL2=X0(1,1);
DEL3=X0(2,1);
V1MAG=X0(3,1);
V2MAG=X0(4,1);
V3MAG=X0(5,1);
GS1=0;
BS1=0;
Iter=1;
while( Iter<4)
Iter=Iter

%JACOBIAN MATRIX%
%To calculate Pij
H(1,1)=-V1MAG*V2MAG*((g(1,2)*sin(DEL1-DEL2))-(b(1,2)*cos(DEL1-DEL2)));
H(1,3)=-V2MAG*((g(1,2)*cos(DEL1DEL2))+(b(1,2)*sin(DEL1-DEL2)))+2*(g(1,2)+GS1)*V1MAG;
H(1,4)=-V1MAG*(g(1,2)*cos(DEL1-DEL2)+(b(1,2)*sin(DEL1-DEL2)));
H(2,2)=-V1MAG*V3MAG*((g(1,3)*sin(DEL1-DEL3))-(b(1,3)*cos(DEL1-DEL3)));
H(2,3)=-V3MAG*((g(1,3)*cos(DEL1-DEL3))+(b(1,3)*sin(DEL1-DEL3)))+2*(g(1,3)+GS1)*V1MAG;

47
H(2,5)=-V1MAG*(g(1,3)*cos(DEL1-DEL3)+(b(1,3)*sin(DEL1-DEL3)));
%To calculate Pi
H(3,1)=V2MAG*V1MAG*(-G(2,1)*sin(DEL2-DEL1))+(B(2,1)*cos(DEL2-
DEL1))+V2MAG*V2MAG*(-G(2,2)*sin(DEL2-DEL2))+(B(2,2)*cos(DEL2-
DEL2))+V2MAG*V3MAG*(-G(2,3)*sin(DEL2-DEL3))+(B(2,3)*cos(DEL2-DEL3))-
(V2MAG*V2MAG*B(2,2));
H(3,2)=-V2MAG*V3MAG*(G(2,3)*sin(DEL2-DEL3)+B(2,3)*cos(DEL2-DEL3));
H(3,3)=V2MAG*(G(2,1)*cos(DEL2-DEL1)-B(2,1)*sin(DEL2-DEL1));
H(3,4)=(V1MAG*(G(2,1)*cos(DEL2-DEL1)+B(2,1)*sin(DEL2-DEL1)))+(V2MAG*(G(2,2)*cos(DEL2-
DEL2)+B(2,2)*sin(DEL2-DEL2)))+(V3MAG*(G(2,3)*cos(DEL2-DEL3)+B(2,3)*sin(DEL2-
DEL3)))+(V2MAG*G(2,2));
H(3,5)=(V2MAG*(G(2,3)*cos(DEL2-DEL3)+B(2,3)*sin(DEL2-DEL3)));
%To calculate Qij
H(4,1)=V1MAG*V2MAG*((g(1,2)*cos(DEL1-DEL2))+(b(1,2)*sin(DEL1-DEL2)));
H(4,3)=-V2MAG*((g(1,2)*sin(DEL1-DEL2))-(b(1,2)*cos(DEL1-DEL2)))-2*(b(1,2)+BS1)*V1MAG;
H(4,4)=-V1MAG*(g(1,2)*sin(DEL1-DEL2)-(b(1,2)*cos(DEL1-DEL2)));

H(5,2)=V1MAG*V3MAG*((g(1,3)*cos(DEL1-DEL3))+(b(1,3)*sin(DEL1-DEL3)));
H(5,3)=-V3MAG*((g(1,3)*sin(DEL1-DEL3))-(b(1,3)*cos(DEL1-DEL3)))-2*(b(1,3)+BS1)*V1MAG;
H(5,5)=-V1MAG*(g(1,3)*sin(DEL1-DEL3)-(b(1,3)*cos(DEL1-DEL3)));
%To calculate Qi
H(6,1)=(V2MAG*V1MAG*(G(2,1)*cos(DEL2-DEL1))+(B(2,1)*sin(DEL2-
DEL1)))+(V2MAG*V2MAG*(G(2,2)*cos(DEL2-DEL2))+(B(2,2)*sin(DEL2-
DEL2))+(V2MAG*V3MAG*(G(2,3)*cos(DEL2-DEL3))+(B(2,3)*sin(DEL2-DEL3))-
(V2MAG*V2MAG*G(2,2))));
H(6,2)=-V2MAG*V3MAG*(G(2,3)*cos(DEL2-DEL3)+B(2,3)*sin(DEL2-DEL3));
H(6,3)=V2MAG*(G(2,1)*sin(DEL2-DEL1)-B(2,1)*cos(DEL2-DEL1));
H(6,4)=(V1MAG*(G(2,1)*sin(DEL2-DEL1)-B(2,1)*cos(DEL2-DEL1)))+(V2MAG*(G(2,2)*sin(DEL2-
DEL2)-B(2,2)*cos(DEL2-DEL2)))+(V3MAG*(G(2,3)*sin(DEL2-DEL3)-B(2,3)*cos(DEL2-DEL3)))-
(V2MAG*B(2,2));
H(6,5)=V2MAG*(G(2,3)*sin(DEL2-DEL3)-B(2,3)*cos(DEL2-DEL3));
%To find Voltage
H(7,3)=V1MAG;
H(8,4)=V2MAG;
H

%standard deviation, R inverse


R= diag(measurementdata(:,6));
R1=inv(R)*inv(R);
H1=transpose(H);
G1=H1*R1*H
%To calculate residual
r(1,1)=P12-(V1MAG*V1MAG*(g(1,2)+GS1))+(V1MAG*V2MAG*(g(1,2)*cos(DEL1-
DEL2))+b(1,2)*sin(DEL1-DEL2));
r(2,1)=P13-(V1MAG*V1MAG*(g(1,3)+GS1))+(V1MAG*V3MAG*(g(1,3)*cos(DEL1-
DEL2))+b(1,3)*sin(DEL1-DEL2));
r(3,1)=P2-(V2MAG*V1MAG*(G(2,1)*cos(DEL2-DEL1)+B(2,1)*sin(DEL2-DEL1)))-
(V2MAG*V2MAG*(G(2,2)*cos(DEL2-DEL2)+B(2,2)*sin(DEL2-DEL2)))-
(V2MAG*V3MAG*(G(2,3)*cos(DEL2-DEL3)+B(2,3)*sin(DEL2-DEL3)));
r(4,1)=Q12+(V1MAG*V1MAG*(b(1,2)+BS1)+V1MAG*V2MAG*(g(1,2)*sin(DEL1-DEL2)-
b(1,2)*cos(DEL1-DEL2)));
r(5,1)=Q13+(V1MAG*V1MAG*(b(1,3)+BS1)+V1MAG*V3MAG*(g(1,3)*sin(DEL1-DEL2)-
b(1,3)*cos(DEL1-DEL2)));

48
r(6,1)=Q2-(V2MAG*V1MAG*(G(2,1)*sin(DEL2-DEL1)+B(2,1)*cos(DEL2-DEL1)))-
(V2MAG*V2MAG*(G(2,2)*sin(DEL2-DEL2)+B(2,2)*cos(DEL2-DEL2)))-
(V2MAG*V3MAG*(G(2,3)*sin(DEL2-DEL3)+B(2,3)*cos(DEL2-DEL3)));
r(7,1)=V1-V1MAG;
r(8,1)=V2-V2MAG;
r
%To calculate right hand side vector t
t=H1*R1*r
DELX=inv(G1)*t
%updating values for next iteration
X=DELX+X0
V1MAG=X(3,1)
V2MAG=X(4,1)
V3MAG=X(5,1)
Iter=Iter+1;
end

6. Output:
Ybus Matrix
16.8966 -47.2414i -10.0000 +30.0000i -6.8966 +17.2414i

-10.0000 +30.0000i 14.1096 -40.9589i -4.1096 +10.9589i

-6.8966 +17.2414i -4.1096 +10.9589i 11.0061 -28.2003i

Iteration 1:
G
107
3.4392 -0.5068 0.0137 0.0000 -0.0137

-0.5068 0.6736 -0.0137 0.0137 0.0000

0.0137 -0.0137 3.1054 -2.9324 -0.1668

0.0000 0.0137 -2.9324 3.4455 -0.5068

-0.0137 0.0000 -0.1668 -0.5068 0.6736

T
105
-4.9489

-1.9987

8.4052

-5.8746

-2.5469

∆x

49
-0.0213

-0.0452

-0.0004

-0.0256

-0.0576

X (STATE VARIABLE)
-0.0213

-0.0452

0.9996

0.9744

0.9424

Iteration 2:
G
107
3.1770 -0.4423 0.0161 -0.0039 -0.0114

-0.4423 0.5917 -0.0123 0.0119 0.0000

0.0161 -0.0123 3.1965 -2.8883 -0.2159

-0.0039 0.0119 -2.8883 3.3133 -0.4763

-0.0114 0.0000 -0.2159 -0.4763 0.6663

T
105
-3.7776

-2.1627

2.3973

-3.2546

0.8903

∆x
-0.0189

-0.0505

50
0.0048

-0.0038

0.0119

X (STATE VARIABLE)
-0.0189

-0.0505

1.0048

0.9962

1.0119

Iteration 3:
G
107
3.4179 -0.5076 0.0180 -0.0061 -0.0119

-0.5076 0.6939 -0.0138 0.0136 0.0000

0.0180 -0.0138 3.1373 -2.9360 -0.1709

-0.0061 0.0136 -2.9360 3.4071 -0.4977

-0.0119 0.0000 -0.1709 -0.4977 0.6777

T
105
-3.7231

-2.3780

8.5902

-6.0304

-2.5426

∆x
-0.0181

-0.0470

51
-0.0004

-0.0263

-0.0572

X (STATE VARIABLE)
-0.0181

-0.0470

0.9996

0.9737

0.9428

7. Result:
A MATLAB program for state estimation has been coded and the residual and 𝑋𝑒𝑠𝑡 value is obtained.

52
Ex. No.10 8/03/2021
Contingency Analysis: Generation Shift Factors and Line Outage Distribution Factors
AIM: To perform contingency analysis for Generator shift factors and line outage distribution factor.

FORMULAE:

1. Basic required matrices:

[X]=[B’]-1
θ= XP
2. PTDF:

3. LODF:

4. Change in power flow:

5. Required change to reduce outage.


For Generator Outage:

For Transmission Line Outage:

∆𝑓𝑙 = [𝑃𝑇𝐷𝐹𝑖,𝑗,𝑙 + 𝑃𝑇𝐷𝐹𝑖,𝑗,𝑘 𝐿𝑂𝐷𝐹𝑙,𝑘 ] ΔP𝑖,𝑗

ALGORITHM:

Step 1 : Set system model to initial conditions


Step 2 : Set i=1
Step 3 : Simulate an outage of generator i using the system model.
Step 4 : Check any line flows exceed limits, if yes display alarm message and go to Step 5. Or else go
to Step 5 directly.
Step 5 : Check any bus voltages outside limit, if yes display alarm message and go to Step 6. Or else go
to Step 6 directly.
Step 6 : Check last generator done. If no go to Step 3. If yes go to Step 7
Step 7 : Set l=1.
Step 8 : Simulate an outage of line l using the system model.
Step 9: Check any line flows exceeds limit. If yes display alarm message and go to Step 10. Or else go to Step
10 directly.

Step 10: Check any bus voltage outside limit. If yes end the process. If no set l=l+1 and go to Step 8.

53
SYSTEM DATA:

FROM BUS TO BUS REACTANCE MW LIMIT


1 2 0.20 35.0
1 3 0.30 35.0
1 4 0.30 25.0
2 3 0.30 40.0
3 4 0.40 25.0

STARTING ENDING MW LINE LINE GENERATOR POWER


NODE NODE RESISTANCE REACTANCE LIMIT OUTAGE NUMBER CHANGE SHIFT
1 2 0 0.2 0.35 0 1 0 1
1 3 0 0.3 0.35 0 2 1 0
1 4 0 0.3 0.25 0 3 0 0
2 3 0 0.3 0.4 0 4 0 0
3 4 0 0.4 0.25 0 5 0 0
PROGRAM:

clc
%FROM TO REACTANCE MW LIMIT
linedata=[1 2 0.20 35.0
1 3 0.30 35.0
1 4 0.30 25.0
2 3 0.30 40.0
3 4 0.40 25.0 ];
% sb eb R X Half MW Limit Line Line Gen Power_Shift
% charge outage No Change
busdata=[1 2 0 0.2 0 0.35 0 1 0 1
1 3 0 0.3 0 0.35 0 2 1 0
1 4 0 0.3 0 0.25 0 3 0 0
2 3 0 0.3 0 0.4 0 4 0 0
3 4 0 0.4 0 0.25 0 5 0 0 ];
s = linedata(:,1);
e = linedata(:,2);

54
x = linedata(:,3);
z = 1i*x;
y = 1./z;
nbus = max(max(busdata(:,1)),max(busdata(:,2))) %no of bus
nl = max(e)+1; %no of lines
Y = zeros(nbus,nbus);

for k = 1:nl
Y(s(k),s(k))= Y(s(k),s(k))+y(k);
Y(e(k),e(k))= Y(e(k),e(k))+y(k);
Y(s(k),e(k)) = Y(s(k),e(k))- y(k);
Y(e(k),s(k)) = Y(e(k),s(k))-y(k);
end

[thetha, rho] = cart2pol(real(Y), imag(Y));


rho= abs(Y);
thetha= rad2deg(angle(Y));
G= real(Y);
B= imag(Y);
Y

sb=busdata(:,1);
eb=busdata(:,2);
L=busdata(:,6); %MW Limit
Gsh=busdata(:,9); %Gen Change
ne=length(busdata(:,1));%number of branches in system
ns=max(linedata(:,1));
type= linedata(:,2);
pv=find(type==2|type==3);
slackbus=min(sb);
P=[ 0.30;-0.30;-0.30];
%B prime
bp= -B;
bp(slackbus,:) = [];
bp(:,slackbus) = [];
bp
X= inv(bp)
del= X*P

P_line=zeros(nl,1); %Power Flow


del= [0;
0.0177;
-0.0456;
-0.0710];

for i=1:length(sb)
n=sb(i);
m=eb(i);
Pline(i)=(del(n)-del(m))/x(i)*100;
end
Pline
Xd=zeros(nbus,nbus);
for i=2:nbus
for k=2:nbus
Xd(i,k)=Xd(i,k)+X(i-1,k-1);

55
end
end
Xd
b=1./x
ptdf=zeros(ne,ne); %PTDF
for i=1:ne
for k=1:ne
ptdf(i,k)=b(i)*((Xd(sb(i),sb(k))- Xd(sb(i),eb(k)))-(Xd(eb(i),sb(k))-Xd(eb(i),eb(k))));

end
end
ptdf

lodf=zeros(ne,ne); %LODF
for i=1:ne
for k=1:ne
lodf(i,k) = ptdf(i,k)/(1-b(k)*((Xd(sb(k),sb(k))-Xd(sb(k),eb(k)))-(Xd(eb(k),sb(k))-Xd(eb(k),eb(k)))));
end
end
for i=1:ne
lodf(i,i)=-1;
end
lodf
%change in flow with putage of line 1-2
cif= zeros(ne,1);
cif= Pline(1,1)*lodf(:,1)
net_flow= zeros(ne,1);
net_flow(1,1)=0;
net_flow(2,1)=Pline(1,2)+cif(2,1);
net_flow(3,1)=Pline(1,3)+cif(3,1);
net_flow(4,1)=Pline(1,4)+cif(4,1);
net_flow(5,1)=Pline(1,5)+cif(5,1);
net_flow
if(net_flow>linedata(:,4))
fprintf('There is a limit violation');
else
fprintf('There is no limit violation');
end
%Limit violation in the line 3-4
df=linedata(5,4)-net_flow(5,1);
dP14=df/(-ptdf(5,3))+ptdf(5,4)*lodf(5,1)
fprintf('amount of gen reduced= 3.3558');

OUTPUT:

Ybus

0.0000 -11.6667i 0.0000 + 5.0000i 0.0000 + 3.3333i 0.0000 + 3.3333i

0.0000 + 5.0000i 0.0000 - 8.3333i 0.0000 + 3.3333i 0.0000 + 0.0000i

0.0000 + 3.3333i 0.0000 + 3.3333i 0.0000 - 9.1667i 0.0000 + 2.5000i

0.0000 + 3.3333i 0.0000 + 0.0000i 0.0000 + 2.5000i 0.0000 - 5.8333i

56
B Prime

8.3333 -3.3333 0.0000

-3.3333 9.1667 -2.5000

0.0000 -2.5000 5.8333

0.1437 0.0592 0.0254

0.0592 0.1479 0.0634

0.0254 0.0634 0.1986

Del

0.0177

-0.0456

-0.0710

Pline =

-8.8500 15.2000 23.6667 21.1000 6.3500

PTDF

0.7183 0.2958 0.1268 -0.4225 -0.1690

0.1972 0.4930 0.2113 0.2958 -0.2817

0.0845 0.2113 0.6620 0.1268 0.4507

-0.2817 0.2958 0.1268 0.5775 -0.1690

-0.0845 -0.2113 0.3380 -0.1268 0.5493

LODF

0.0000 0.5833 0.3750 -1.0000 -0.3750

0.7000 0.0000 0.6250 0.7000 -0.6250

57
0.3000 0.4167 0.0000 0.3000 1.0000

-1.0000 0.5833 0.3750 0.0000 -0.3750

-0.3000 -0.4167 1.0000 -0.3000 0.0000

Net Flow

0.0000

9.0050

21.0117

29.9500

9.0050

dP14 = -47.2805

amount of gen reduced= 3.3558

RESULT:
A MATLAB program to perform contingency analysis for Generator shift factors and line outage distribution
factor is coded and output is verified.

58
EX.No 11
DIGITAL OVER CURRENT RELAY SETTING AND RELAY COORDINATION

AIM:

To study about over current relay setting and relay co-ordination using MATLAB software.

SOFTWARE USED:

MATLAB

THEORY:

In an over current relay or o/c relay the actuating quantity is only current. There is only one current operated
element in the relay, no voltage coil etc. are required to construct this protective relay.

WORKING PRINCIPLE OF OVER CURRENT RELAY:

In an over current relay, there would be essentially a current coil. When normal current flows through this
coil, the magnetic effect generated by the coil is not sufficient to move the moving element of the relay, as in this
condition the restraining force is greater than deflecting force. But when the current through the coil increases,
the magnetic effect increases, and after a certain level of current, the deflecting force generated by the magnetic
effect of the coil, crosses the restraining force. As a result, the moving element starts moving to change the
contact position in the relay. Although there are different types of overcurrent relays but basic working principle
of overcurrent relay is more or less same for all.

TYPES OF OVER CURRENT RELAY:

Depending upon time of operation, there are various types of Over Current relays, such as,

1. Instantaneous over current relay.


2. Definite time over current relay.
3. Inverse time over current relay.

Inverse time over current relay or simply inverse OC relay is again subdivided as inverse definite minimum
time (IDMT), very inverse time, extremely inverse time over current relay or OC relay.

INSTANTANEOUS OVER CURRENT RELAY:

Construction and working principle of instantaneous over current relay is quite simple. Here generally
a magnetic core is wound by a current coil. A piece of iron is so fitted by hinge support and restraining spring in
the relay, that when there is not sufficient current in the coil, the NO contacts remain open. When the current in
the coil crosses a pre-set value, the attractive force becomes enough to pull the iron piece towards the magnetic
core, and consequently, the no contacts get closed.

We refer the pre-set value of current in the relay coil as pickup setting current. This relay is referred as
instantaneous over current relay, as ideally, the relay operates as soon as the current in the coil gets higher than
pick upsetting current. There is no intentional time delay applied. But there is always an inherent time delay

59
which we cannot avoid practically. In practice, the operating time of an instantaneous relay is of the order of a
few milliseconds.

DEFINITE TIME OVER CURRENT RELAY:


This relay is created by applying intentional time delay after crossing pick up the value of the current. A
definite time overcurrent relay can be adjusted to issue a trip output at an exact amount of time after it picks up.
Thus, it has a time setting adjustment and pickup adjustment.

INVERSE TIME OVER CURRENT RELAY:


Inverse time is a natural character of any induction type rotating device. Here, the speed of rotation of
rotating part of the device is faster if the input current is more. In other words, time of operation inversely varies
with input current. This natural characteristic of electromechanical induction disc relay is very suitable for
overcurrent protection. If the fault is severe, it will clear the fault faster. Although time inverse characteristic is
inherent to electromechanical induction disc relay, the same characteristic can be achieved in microprocessor-
based relay also by proper programming.

RELAY CO-ORDINATION:
The relay co-ordination is nothing but a tripping of protecting relay in a sequence or order in electrical
power system. Relay coordination is very difficult task for relay engineers. Relay co- ordination is required to
isolate the faulty part with minimized relay & circuit breaker operation.

Consider four number of substations, Substation A, Substation B, Substation C, Substation D. Here


Substation A is generation station and B, C and D are distribution stations. In this, if the fault (short circuit or
earth fault) occurs in Substation D means, the substation D relay has to operate, instead of that, the substation A
relay operated means such system said to be poor relay coordinated power system. It causes the total power
system shutdown or unnecessary zone trips. Because, there is no fault on substation A, B and C but the substation
operates unnecessarily. In order to avoid such relay operation, we have to set co- ordination between all 4
substations.

RELAY CO-ORDINATION PROCEDURE FOR EARTH FAULT:

All the substation relays current, voltage setting and time setting values will be noted and tabulated.
Check the current setting and operating time of the relay which is associated with the fault. i.e. if you are
coordinating for earth fault means, you should consider all the earth fault setting. Adjust the setting i.e. the
substation D should have minimum operating time and current or voltage setting. Then only substation D
operates. If the value is higher than the remaining substation, the substation D relay does not operate under fault

60
condition. The coordinated setting values would be substation A > Substation B > substation C > Substation D.
Also, the setting value of substation should not be exceeded its safe limit.

PROGRAM:

clear all; clc;

No_of_relays= 2; primary_of_ct= 1000;

secondary_of_ct= 5; plug_setting_R1= 1;

plug_setting_R2= 1.25;

TSM_R1= 0.3;

TSM_R2= 1;

Time_margin=0.5; fault_current= 5000;

Relay_current_setting_R1= plug_setting_R1*secondary_of_ct;

Relay_current_setting_R2= plug_setting_R2*secondary_of_ct;

CT_secondary_current= fault_current*(secondary_of_ct/primary_of_ct);

PSM_R1=(CT_secondary_current/Relay_current_setting_R1);

PSM_R2=(CT_secondary_current/Relay_current_setting_R2);

a=input( 'enter no') if a==1 fprintf('IEC

STANDARD INVERSE')

T1=TSM_R1*(0.14/((PSM_R1)^0.02-1))

t2=TSM_R2*(0.14/((PSM_R2)^0.02-1));

T2=T1+Time_margin

TMS_R2= T2/t2 end

if a==2 fprintf('VERY INVERSE')

T1=TSM_R1*(13.5/(PSM_R1-1))

t2=TSM_R2*(13.5/(PSM_R2-1));

T2=T1+Time_margin TMS_R2= T2/t2 end

if a==3 fprintf('EXTREMELY INVERSE')

T1= TSM_R1*(80/((PSM_R1)^2-1)) t2=

TSM_R2*(80/((PSM_R2)^2-1));

61
T2=T1+Time_margin TMS_R2= T2/t2 end if

a==4 fprintf('LONG TIME EARTH FAULT')

T1=TSM_R1*(120/(PSM_R1-1))

t2=TSM_R2*(120/(PSM_R2-1));

T2=T1+Time_margin

TMS_R2= T2/t2 end

OUTPUT:

enter no1

IEC STANDARD INVERSE

T1 = 1.2839

T2 =1.7839

TMS_R2 = 0.3582

enter no2

VERY INVERSE

T1 = 1.0125

T2 = 1.5125

TMS_R2 = 0.3361

enter no3

EXTREMELY INVERSE

T1 = 1

T2 =1.5000

TMS_R2 = 0.2813

enter no4

LONG TIME EARTH FAULT

T1 =9

62
T2 = 9.5000

TMS_R2 = 0.2375

RESULT: MATLAB software is used to design and study over current relay setting and relay coordination

63

You might also like