You are on page 1of 75

Numerical algorithms for power

system protection
Prof. dr. sc. Ante Marui, doc. dr. sc. Juraj Havelka
University of Zagreb
Faculty of Electrical Engineering and Computing
ante.marusic@fer.hr, juraj.havelka@fer.hr

2010/2011.
Introduction
Quality of digital relays depends on:
Numerical algorithm quality (software)
Hardware quality
General digital relay characteristics:
selectivity, stability, satisfactory trip time
and sensitivity
Lecture parts
First part
Types of signals
Sampling theory
Sampling and A/D circuits
Numerical methods: Interpolation formulas
numerical integration and differentiation,
curve fitting, Fourier analysis and digital
filtering
Lecture parts
Second part
Sinus wave based algorithms
Fourier based algorithms
Least squares based algorithms
Differential equation based algorithms
Lecture parts
Third part: Real time algorithm testing
50 Hz Signal
Simulated short circuit
Real short circuit
Signal classification hierarchy
Digital signals
1-0 (On Off or TTL) signal
Pulse train (counters, timers)
Analog signals
DC signal (slow)
Signal in time domain (fast)
Signal in frequency domain
Signali
Digitalni
Analogni
1-0 (On-Off)
Pulsirajui signal
DC
Vremensko podruje
Frekvencijsko podruje
TTL
Brojai i uklopno
isklopni satovi
ADC/DAC
(Sporo)
ADC/DAC
(Brzo)
ADC
(Brzo)+Analiza
1
0
t
t
t
t
f
Basic elements of digital
protection
AD converter resolution
Nyquists theorem
Analog filters
Transducers
Sample and hold circuit

Let us assume that numerical values of some
function x(t) are given at equally spaced
intervals every At seconds.
1/At is then called sampling frequency.
Signal can then be represented by discrete
set of samples:
[x(0), x(At), x(2At), , x(kAt),]
AD converter resolution
Every sample of analog signal is
converted in to digital value with final
number of bits
Conversion is preformed in AD
converter
3 bit resolution; 2
3
=8 combinations,
which means 8 discrete divisions that
analog signal can be represented with
Nyquists theorem
Sampling frequency
(how often is AD conversion preformed)
Nyquists theorem
To avoid signal alias sampling
frequency must be at least two times
higher then maximum frequency
component in analog signal
For accurate waveform representation
sampling frequency should be at least 5
to 10 times higher then maximum
frequency component in analog signal
Analog filtering
I
z
l
a
z

f
i
l
t
e
r
a
I
z
l
a
z

f
i
l
t
e
r
a
frekvencija
Prijelazno
podruje
f1 f2 f1
a) b)
R
L
C
R
U1 U2
Transducers and surge
protection circuits
Reduce voltages and currents (10 V
and 20 to 40 mA) to suit hardware
requirements
Protect hardware from overvoltages
Signal distortion is the problem (current
transducers saturation)
Sample and Hold circuit
Tc T
Vc
C
S
f(t)
transducer
Surge
protective
circuit
LP Filter
AMUX
Signal conditioning subsystem
Sample and
Hold circuit
AD conv.
DMUX
Conversion subsystem
Digital processing
relay subsystem
Basic components of digital relay
Numerical differentiation
Derivatives in point k is
k k k
f
h
x f f
|
.
|

\
|
+ V + V + V =
'
=
'

3 2
3
1
2
1 1
) (
1
2
1

V V = V
= V
k k k
k k k
f f f
f f f
1
1 1


V V = V
k
n
k
n
k
n
f f f
Numerical integration
( ) ( )
( )
( ) ( )
[
[
[
=
=
= =
=
=
=

= =
n
i
n
j
i j
n
i
n
j
i j
j i i
n
j
j
i
j i
j
i n
x x x x
x x
y
x x
x x
y x L x g
0
0
0
0
0
( )
( )
( ) ( )
( )
( ) ( )

}

[
[
}

[
[
}
= =
=
=
=
=
=
=
=
=

~
n
i
b
a
n
i
i i
n
j
i j
j i i
n
j
i
i
b
a
n
i
n
j
i j
j i i
n
j
i
i
b
a
A y dx
x x x x
x x
y dx
x x x x
x x
y dx x f
0 0
0
0
0
0
0
Lagrange interpolation formula
Trapezoidal formula
( ) ( ) ( )
} }
+ + + + + ~ =

b
a
x
x
n n
n
y y y y y
h
dx x f dx x f
0
1 2 1 0
2 2 2
2

Curve fitting
Linear fit:

Exponential fit:

General polynomial fit:

General linear fit:

Levenberg-Marquardt fit:
i i
x a a y
1 0
+ =
i
x a
i
e a y
1
0
=
+ + + =
i
i i
x a x a a y
2
2 1 0
+ + + = ) ( ) (
2 2 1 1 0 i i i
x f a x f a a y
) , , , , (
2 1 0
a a a x f y
i i
=
Least square method
vertikalna udaljenost izmeu
izmjerene toke i toke na
krivulji dobivene metodom
najmanjih kvadrata
krivulja dobivena metodom
najmanjih kvadrata
x
y
(x
n
, y
n
)
) (
i i i
x u y = c
( ) | |

= =
+ + + + = =
N
i
m
i m i i i
N
i
i
x a x a x a a y S
1
2
2
2 1 0
1
2
c
0 =
c
c
k
a
S
(k=0, 1, 2, ..., m)
(
(
(
(
(
(

=
(
(
(
(
(
(

(
(
(
(
(
(




+ +
+
i
m
i
i i
i
m
m
i
m
i
m
i
m
i
m
i i i i
m
i
i i
y x
y x
y
a
a
a
x x x x
x x x x
x x x N






1
0
2
2 1
1 3 2
2
Fourier analysis
Fourier series

Fourier transform

=
+ + =
1 1
0 0
0
) sin( ) cos(
2
) (
n n
n n
t n b t n a
a
t f e e
}

= dt e t f F
t je
e ) ( ) (
Discrete Fourier transform DFT
Samples of signals from AD: time domain
No need for curve fitting
Use DFT: frequency domain
| | | |

=
1
0
2
1
N
k
ik
N
j
e k X
N
i x
t
| | | |

=
1
0
2
N
i
ik
N
j
e i x k X
t
k=0N-1
Smoothing Windows
period T
diskontinuiteti
Smoothing Windows
|
.
|

\
|
=
N
n
n w
t 2
cos 46 . 0 54 . 0 ) (
n=0, 1, , N-1
Digital filters
Input signal is discrete
They are software programmable
They are stable and predictable
They do not drift with temperature or humidity
and do not require precision components
They have superior performance to cost ratio
They do not age
Digital filters
Signal generator
Control loop
ALGORITHM
te
xt
ALGORITHM
te
xt
te
xt
Measure Calculate Measure Calculate Measure
t=1/fs
Sine wave based algorithms
Waveform is assumed to be sinusoidal
They predict amplitude at every moment
They can be used for impedance calculation
Six are presented:
Sample and first derivative with two points
Sample and first derivative with three points
First and second derivative
Two sample technique
Three sample technique
R i X calculation with three sample technique
Sample and first derivative
with two points
) sin( ) (
0 1 1
t I t s e =
) cos( ) (
0 1 0 1
t I t s e e =
'
k k
i
h
i
|
.
|

\
|
+ V + V + V =
'

3 2
3
1
2
1 1
) (
1
1
~
'
k k k
i i
h
i
2
1 2 2
2
|
|
.
|

\
|
A

+ =

t f
i i
i I
o
k k
k k
t
2
0
1
2
1
2
1
) (
) (
|
|
.
|

\
| '
+ =
e
t s
t s I
Sample and first derivative
with two points
Sample and first derivative
with three points
( )
2 1
4 3
2
1

+
A
=
'
k k k k
i i i
t
i
2
2 1 2 2
4
4 3
|
|
.
|

\
|
A
+
+ =

t f
i i i
i I
o
k k k
k k
t
Sample and first derivative
with three points
First and second derivative
( ) t V t v
0
sin ) ( e =
t V v
0 0
cose e =
'
t V v
0
2
0
sine e =
' '
( ) (
(

|
|
.
|

\
|
A
+
+
|
.
|

\
|
A

=
+ +
2
2
0
1 1
2
1 1
2
0
2
2
2
1
t
v v v
t
v v
V
k k k k k
e
e
( )
(
(

|
|
.
|

\
| ' '
+
'
=
2
0
2
2
0
2
1
e e
v
v V
First and second derivative
Two sample technique
k k
t I i
0
sine =
) ( sin sin
0 1 0 1
t t I t I i
k k k
A + = =
+ +
e e
t t I t t I i
k o k k
A + A =
+ 0 0 0 1
sin cos cos sin e e e e
2
0
0 1
2
1
2
2
) (sin
cos 2
t
t i i i i
I
k k k k
A
A +
=
+ +
e
e
( )
( )
)

A
A + +
= O
+ + + +
2
0
0 1 1 1 1 1
sin
cos
cos
t IV
t v i v i v i v i
k k k k k k k k
e
e
R i X calculation with three
sample technique
k k
t V v
0
sine =
( ) t t V v
k k
A + =
+ 0 0 1
sin e e
( ) t t V v
k k
A + =
+ 0 0 2
2 sin e e
( ) O + =
k k
t I i
0
sin e
( ) O + A + =
+
t t I i
k k 0 0 1
sin e e
( ) O + A + =
+
t t I i
k k 0 0 1
2 sin e e
( )
2
2
2
2 2 1 1
2
2
+ +
+ + + +


=
k k k
k k k k k k
f
i i i
i v i v i v
R t
i i i
i v i v
X
k k k
k k k k
A

=
+ +
+ + + +
0
2
2
1
1 2 2 1
sine
R i X calculation with three
sample technique
Fourier algorithms
Waveform does not have to be pure sine
The basic assumption is that the waveform is periodic
The principle of work is moving frame
Moving frame is constant in size which means that it
always contains the same number of points
t
4
t
1
t
2
t
3
A
m
p
l
i
t
u
d
a
Vrijeme
t A
Fourier series with whole
period

=
+ + =
1 1
0 0
0
) sin( ) cos(
2
) (
n n
n n
t n b t n a
a
t v e e
}
+
=
T t
t
n
dt t n t v
T
a
0
0
) cos( ) (
2
0
e
}
+
=
T t
t
n
dt t n t v
T
b
0
0
) sin( ) (
2
0
e
t td t v
T
a V
T t
t
x
}
+
= =
0
0
0 1
cos ) (
2
e ( )
N N
y y y y y
x
I 2 2 2 2
2
1 2 1 0
+ + + + +
A
=

( )
N N N N x
t v t v t v t v
t
t N
V
0 1 0 1 1 0 1 0 0 0
cos cos 2 cos 2 cos
2
2
e e e e + + + +
A

A
=

j
N
t j
T
t
j
t t
e
2
cos
2
cos cos
0
= A =
j=0 do N
If fs is 600 Hz then in one period of 20 ms there are 12 samples.
Weighting factors are calculated in advance for fixed samplin frequency.
( ) ( )
(

+ + + + + =
8 4 11 1 7 5 10 2 6
12 0
2
3
2
1
2 2 6
1
v v v v v v v v v
v v
V
x
Fourier series with whole
period
Fourier series with whole
period third harmonic
n=3
t td t v
T
V
T t
t
x
}
+
=
0
0
0 3 ,
3 cos ) (
2
e t td t v
T
V
T t
t
y
}
+
=
0
0
0 3 ,
3 sin ) (
2
e
|
|
.
|

\
|
+ + =

=
1
1
, 3
0
3 ,
2 2
2
N
j
j x j
N
x
W v
v v
N
V

=
=
1
1
, 3 3 ,
2
N
j
j y j y
W v
N
V
za f
s
=600 Hz
|
.
|

\
|
+ + + =
10 8 6 4 2
12 0
3
2 2 6
1
v v v v v
v v
V
x
( )
11 9 7 5 3 1 3
6
1
v v v v v v V
y
+ + =
2
3
2
3 3 y x
V V V + =
Fourier series with whole
period third harmonic
Fourier series with half period
( ) ( )
(

+ + =
4 1 5 2
6 0
2
2
3
2
1
2 2 3
1
v v v v
v v
V
x
( ) ( )
(

+ + + + =
4 2 5 1 3
2
2
3
2
1
3
1
v v v v v V
y
FFT algorithm
Least squares based
algorithms
All components of measured waveform must
be predicted in mathematical model.
After curve fitting data about amplitude,
harmonics, angle, etc. are obtained
Downside is large number of calculations
They are complex
Four of them are presented:
Algorithm with general polynomial fit
LSQ 1, 3 multivariable algorithm
LSQ 1, 3, 5 multivariable algorithm
LSQ 1, 3, 5 ,7 multivariable algorithm



General polynomial fit
algorithm
) sin( ) (
0
O + = t K t v e
O + O = sin cos cos sin ) (
0 0
t K t K t v e e
! 3
) (
sin
3
0
0 0
t
t t
e
e e ~
! 2
) (
1 cos
2
0
0
t
t
e
e ~
3
0
2
0 0
) (
6
cos
) (
2
sin
) ( cos sin ) ( t
K
t
K
t K K t v e e e
O

O
O + O =
3
3
2
2 1 0
) ( x a x a x a a x f + + + =
(
(
(
(
(

=
(
(
(
(

(
(
(
(
(





3
2
3
2
1
0
6 5 4
3
5 4 3 2
4 3 2
3 2
i i
i i
i i
i
i i i
i
i i i i
i i i i
i i i
x v
x v
x v
v
a
a
a
a
x x x x
x x x x
x x x x
x x x N
i i
t x =
0
e
t i t
i
A = i
f
f
f
i x
s s
i
= =
0
0
2 1 t
e
t
4
t
1
t
2
t
3
A
m
p
l
i
t
u
d
a
Vrijeme
t A
2
1
2
0
a a K + =
General polynomial fit
algorithm
LSQ 1, 3 multivariable
algorithm
( ) ( ) ( )
3 0 3 1 0 1
3 sin sin O + + O + = t K t K t v e e
( )
1 0 3 3 1 0 3 3 1 0 1 1 1 0 1 1 1
3 cos sin 3 sin cos cos sin sin cos t K t K t K t K t v e e e e O + O + O + O =
( )
4 14 3 13 2 12 1 11 1 1
x a x a x a x a t v S + + + = =
( )
( )
( )
( )
(
(
(
(

=
(
(
(
(

(
(
(
(

4
3
2
1
4
3
2
1
44 43 42 41
34 33 32 31
24 23 22 21
14 13 12 11
t v
t v
t v
t v
x
x
x
x
a a a a
a a a a
a a a a
a a a a
1 1 1
cosO = K x
1 1 2
sinO = K x
3 3 3
cosO = K x
3 3 4
sin O = K x
2 0 21
sin t a e =
2 0 22
cos t a e =
2 0 23
3 sin t a e =
2 0 24
3 cos t a e =
t
4
t
1
t
2
t
3
A
m
p
l
i
t
u
d
a
Vrijeme
t A
0
1
= t t t A =
2
t t A = 2
3
t t A = 3
4
LSQ 1, 3 multivariable
algorithm
LSQ 1, 3, 5 multivariable
algorithm
( ) ( ) ( ) ( )
5 0 5 3 0 3 1 0 1
5 sin 3 sin sin O + + O + + O + = t K t K t K t v e e e
( )
6 16 5 15 4 14 3 13 2 12 1 11 1 1
x a x a x a x a x a x a t v S + + + + + = =
( )
( )
( )
( )
( )
( )
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(

6
5
4
3
2
1
6
5
4
3
2
1
66 65 64 63 62 61
56 55 54 53 52 51
46 45 44 43 42 41
36 35 34 33 32 31
26 25 24 23 22 21
16 15 14 13 12 11
t v
t v
t v
t v
t v
t v
x
x
x
x
x
x
a a a a a a
a a a a a a
a a a a a a
a a a a a a
a a a a a a
a a a a a a
2
6
2
5 5
x x K + =
|
|
.
|

\
|
= O

5
6 1
5
tan
x
x
LSQ 1, 3, 5 multivariable
algorithm
LSQ 1, 3, 5, 7 multivariable
algorithm
( ) + O + O + O + O =
1 0 3 3 1 0 3 3 1 0 1 1 1 0 1 1 1
3 cos sin 3 sin cos cos sin sin cos t K t K t K t K t v e e e e
1 0 7 7 1 0 7 7 1 0 5 5 1 0 5 5
7 cos sin 7 sin cos 5 cos sin 5 sin cos t K t K t K t K e e e e O + O + O + O +
( )
( )
( )
( )
( )
( )
( )
( )
(
(
(
(
(
(
(
(
(
(
(

=
(
(
(
(
(
(
(
(
(
(
(

(
(
(
(
(
(
(
(
(
(
(

8
7
6
5
4
3
2
1
8
7
6
5
4
3
2
1
88 87 86 85 84 83 82 81
78 77 76 75 74 73 72 71
68 67 66 65 64 63 62 61
58 57 56 55 54 53 52 51
48 47 46 45 44 43 42 41
38 37 36 35 34 33 32 31
28 27 26 25 24 23 22 21
18 17 16 15 14 13 12 11
t v
t v
t v
t v
t v
t v
t v
t v
x
x
x
x
x
x
x
x
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
a a a a a a a a
LSQ 1, 3, 5, 7 multivariable
algorithm
Differential equation based
algorithm
There is no need to assume that the waveform is sine
The fundamental approach is based on the fact that
all protected equipment can be represented by
differential equations of first or second order.
The methods are described by reference to
transmission line
Three algorithms are presented:
Integration algorithm
Third harmonic filtration algorithm
Differential algorithm
Integration algorithm
R L
v(t)
i(t)
dt
di
L Ri v
y
x
+ =
( ) ( )
} } }
= +
2
1
2
1
2
1
t
t
t
t
t
t
dt t v di L dt t i R
( ) ( )
} } }
= +
4
3
4
3
4
3
t
t
t
t
t
t
dt t v di L dt t i R
( ) t
v v
i i L t
i i
R A
+
= + A
+
2 2
1 2
1 2
1 2
( ) t
v v
i i L t
i i
R A
+
= + A
+
2 2
3 4
3 4
4 3
( )( ) ( )( )
( )( ) ( )( )
4 3 1 2 3 4 2 1
4 3 1 2 3 4 2 1
i i i i i i i i
v v i i i i v v
R
+ +
+ +
=
( )( ) ( )( )
( )( ) ( )( )
2 1 3 4 4 3 1 2
4 3 2 1 4 3 2 1
2 i i i i i i i i
v v i i i i v v t
L
+ +
+ + + +

A
=
Integration algorithm
Third harmonic filtration
algorithm
Elimination of m and n harmonics:
( ) ( )
( )
( )
( )
} } }
+ +
+ +
0
0
0 0
0
0
e t o
e t
e o e t o
e t
m
m
n
n
dt t i dt t i dt t i
For fs=600 Hz :
( ) ( ) ( ) ( )
(
(

+ =
(
(

+ +
(
(

+
} } } } } }
+ + + 6 3
3
6
0
6 3
3
6
0
6 3
3
6
0
t t
t
t t t
t
t t t
t
t
dt t v dt t v di di L dt t i dt t i R
( )( ) ( )( )
( )( ) ( )( )
5 4 3 2 2 3 0 1 4 5 2 3 3 2 1 0
5 4 3 2 2 3 0 1 4 5 2 3 3 2 1 0
i i i i i i i i i i i i i i i i
v v v v i i i i i i i i v v v v
R
+ + + + + + + +
+ + + + + + + +
=
( )( ) ( )( )
( )( ) ( )( )
3 2 1 0 4 5 2 3 5 4 3 2 2 3 0 1
5 4 3 2 3 2 1 0 5 4 3 2 3 2 1 0
2 i i i i i i i i i i i i i i i i
v v v v i i i i i i i i v v v v t
L
+ + + + + + + +
+ + + + + + + + + + + +

A
=
Third harmonic filtration
algorithm
Differential algorithm
( ) ( )
( )
dt
t di
L t Ri t v + =
t
i i
dt
di
k k
A

~
+
2
1 1
( )
t
i i
L Ri v
k k
k k
A

+ ~
+
2
1 1
( )
t
i i
L Ri v
k k
k k
A

+ ~


2
2
1 1
(

=
(

(
(
(

+
+
+
+
1
2
1
1 1
2
2
k
k
k k
k
k k
k
v
v
L
R
t
i i
i
t
i i
i
( ) ( )
( ) ( )
3 1 1 2 2
3 1 1 2 2




~
k k k k k k
k k k k k k
i i i i i i
i i v i i v
R
( )
( ) ( )
3 1 1 2 2
2 1 1 2
2




A ~
k k k k k k
k k k k
i i i i i i
v i v i
t L
Differential algorithm
Differential algorithm
Algorithms and Real-Time
operation
System is operating in real-time if it can
guarantee fulfillment of various tasks in
specific time
OS in real-time
Hardware and software in real time
Control loop time
Algorithms and Real-Time
operation
regulacijski
transformator
napona od 0 do
maksimalno
10V
ulazni podaci izlazni podaci memorija CPU 2 GHz
DA pretvornik
proradni
signal
sustav za podeenje i
prilagodbu signala
sustav za pretvorbu
analognog signala u
digitalni
sustav za digitalnu obradu
signala (raunalo)
Izvor napona od 220 V
efektivno i frekvencije 50
Hz
DAQ Ploica
PCI-MIO-16E-4
Proizvoa:
National
Instruments
Power system signal
Sine wave based algorithms
Fourier based algorithms
Least squares based algorithms
Differential equation based
algorithms
Short circuit
t
e
x
t
t
e
x
t
t
e
x
t
t
e
x
t
t
e
x
t
t
e
x
t
P
380 V 380 V
Z=R+jX
N
1
:N
2
=2
SC
Sinus wave based algorithms
Fourier based algorithms
Least squares based algorithms
Differential equation based
algorithms

You might also like