You are on page 1of 14

University POLITEHNICA of Bucharest

FACULTY OF AUTOMATIC CONTROL AND COMPUTERS


060042 Bucharest, Splaiul Independenţei, nr. 313, sector 6

Master Thesis - Second Semester’s Work

Implementation, Analysis, Optimization and


Parallelization of a Power System Protection
Algorithm

To obtain the title of


Master of Engineer

Specialization: Advance Computer Architectures

by
Buddhika Priyashantha KANDAMULLA ARACHCHIGE

Supervised by
Assoc. Prof. Dr. Ing. Catalin PETRESCU

Presented on 15 th June. 2018


This Bachelor Thesis study was conducted at Faculty of Automatic Control and Computers, UPB
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

CONTENTS

CHAPTER 1 – Intorduction.......................................................................................................3

CHAPTER 2 – Algorithm Description...................................................................................4


2.1 Frequency Calculation..................................................................................................................4
2.2 Amplitude and Phase Angle Calculation.......................................................................................8
2.3 Calculation of Different Parameters for the algorithm..................................................................9

CHAPTER 3 – Algorithm Implementation........................................................................10

CHAPTER 4 – Purposed Work for the Next Semester...............................................13

REFERENCES.................................................................................................................................14

Acronyms

AC Alternative Current
ADC Analog to Digital Converter
API Application Programming Interface
CT Current Transformer
DC Direct Current
DSP Digital Signal Processor
FDC Fault Detection Core
FPGA Field Programmable Gate Array
IEEE Institute of Electronic and Electrical Engineers
MV Medium Voltage
OpenMP Open Multi-Processing
PAC Protection Algorithm Core
RCA Relay Characteristic Angle
SPC Root Mean Square
TDMS Test & Data Management Software
VT Voltage Transformer

2
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

Chapter 1: Introduction

Distance Protection algorithm is widely used in Power System Protection. In this thesis work
it is suggested to implement and analyze this algorithm.

During this semester mostly focused on signal processing of the input signal. Frequency
calculation algorithm is simulated in Matlab in order to verify its correct functionality. After
that the algorithm was implemented in C programming language as a serial programming
code. Here instead of voltage and current inputs, around 6000 ADC values with 12 bit
resolution were used. 24 kHz sampling frequency was used.

Also as future work for next semester, code analyzing Oracle Sun Studio Analyzer. Based on
the analyzer’s result possible optimization methods will be implemented. Also serial will be
transformed in to a parallel code. Fork-Join Model will be used for penalization and
OpenMP will be used as the API.

3
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

CHAPTER 2: Algorithm Description

Algorithm can be divided in to 3 main Segments:


a. Input signal’s frequency calculation
b. Input signal’s amplitude and phase angle calculation using Discrete Fourier
Transform
c. Calculation of Different Parameters for the algorithm

2.1 Frequency Calculation

The goal of this frequency calculation algorithm is to find out time interval between two
successive zero-crossing points t1 and t2 .

t1 t2

Fig.2.1: FDC’s fault detection algorithm

Once two successive zero crossing points are known frequency of the wave can be calculated
as following equation.
1
f =
2(t2 - t1 )

In order to calculate zero crossing point following method is used in the algorithm.

Step 1: As shown in Fig. 2.1, data samples related to a half cycle are save in a memory buffer.
For the next half cycle data values will be rewrite in the same memory buffer. Let’s consider a
50 Hz signal and 24 kHz sampling frequency.

Time for one cycle = 1/50 sec.


Number of samples per sec. = 24 000 samples
24000 1
Nr. Of samples per cycle = � s = 480 samples/cycle
1s 50

4
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

So, there will be around 240 data samples to be saved in the memory buffer.

Saving data samples into memory buffer is done, only when data samples are within V_min
and V_max.

V_max

t1

V_min

Fig.2.2: Data samples between V_min and V_max

So in algorithm first two consecutive V_min and V_max values are sorted. Then only sample
values between V_min and V_max are selected. The condition is fi V_max finds first, then
save in to buffer all values, until V_min is met. If V_min is the first, save all values into
buffer until V_max is met.

Now approximately 240 data samples are find out in ascending or descending order
(depending on which half cycle). But these values are just positive values. Since ADC
samples are 12 bit highest possible value is 4096 and minimum value is 0. So Medium value
is 2048.

To convert data samples above 2048 positive and below 2048 negative, following equation is
used.

V [i] = V [i ] - 2048

Step 2: Choose 17 data samples closest zero crossing point of the input signal
There can be used two methods to find out 17 data samples around zero-crossing point. It is
very important to choose exact 17 data samples, because in matrix calculation it is considered
there are exat 17 data samples in the V[i] matrix.

Method 1: Consider 2048 as medium data point and select 8 data samples above and
below of 2048.

Method 2: Choose 17 data samples which moves from 1 to 240 (1-17, 2-18, 3-19 etc).
In each instance calculate sum of 17 data samples. Observe the sign of the sum and select the
first data sample of which sign of the sum changes. In this thesis this method was
implementd.

5
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

3rd order polynomial to be


interpolate on 17 data samples

Data samples within


this range

Fig.2.3: 17 data samples around zero-crossing point

Step 3: Interpolate a 3rd degree (cubic) polynomial y = Ax 3 + Bx 2 + Cx + D


Here the target is to find out polynomial equation which lie on those selected 17 data samples.
To achieve higher accuracy 3rd order polynomial equation is selected to fitting 17 data
samples.

y = Ax 3 + Bx 2 + Cx + D

Y = V [-8]

X=8

X=-8

V [8]

Fig.2.4: Interpolate a polynomial for 17 data samples around zero-crossing point

6
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

Here the target is to find out polynomial equation which lie on those selected 17 data samples.
To achieve higher accuracy 3rd order polynomial equation is selected to fitting 17 data
samples.

Let’s consider when x = -8. Here X-axis means time axis. So distance between two data
samples (x = -8 and x = -7) is a sampling period.
For x = -8, if voltage value is V [-8], this is the value on Y-axis.

V [-8] = A(-8)3 + B(-8) 2 + C ( -8) + D

If this process is continued from x = -8 to x = 8 data samples, results can be represented in a


matrix form as follows.

(-8)3
� (-8) 2 (-8) 1� �Vn -8 �
� 3 � �
(-7)
� (-7) 2 ( -7) 1� �Vn -7 ��

(-6)3 (-6) 2 ( -6) 1� �Vn -6 �
� 3 � � �
(-5)
� (-5) 2 (-5) 1� �Vn -5 �

(-4)3 (-4) 2 ( -4) 1 � �Vn - 4 �
� 3 � � �
(-3)
� (-3) 2 (-3) 1� �Vn -3 �

(-2)3 (-2) 2 ( -2) 1 � �V �
� � �A � �n - 2 �
(-1)3
� (-1) 2 (-1) 1� � � � Vn -1 �
� ���B� � �
�0 0 0 0� = Vn
�C� � �
�13 12 1 1� � � � Vn +1 �
� 3 �� D� � �
�2 22 2 1� �Vn + 2 �
�33 32 3 1� �Vn +3 �
� 3 � � �
�4 42 4 1� �Vn + 4 �
�53 52 5 1� �V �
� 3 � �n + 5 �
�6 62 6 1� �Vn + 6 �
� 3 � �V �
�7 72 7 1� �n + 7 �

�8
3
82 8 1�� �
�Vn +8 ��

Let’s represent above matrix formula using following equation

C[4][1] = V[17][1]
X [17][4] �
For further simplicity let it denote as
X�C=V

Using least squares method coefficients of the 3rd order interpolant polynomial can be find as
follows:
( )
-1
C = XT X XT . V
1 44 2 4 43
X_const

7
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

Step 4: Calculate Y-axis values, when X-axis values are -8, 8 and centre point of the range.

Y = V [-8]
Zero-crossing point

Y = V [0]
X=8
X=-8 X=0

Y = V [8]

Fig.2.5: Choose the closest data sample to zero-crossing

Let’s study the situation in Fig. 2.5:

Since V[-8] and V[0] have same sign, it is clear zero-crossing point is not within that range.
So we can halve the searching range by removing values from X = -8 to X = 0. By repeating
the process 4 times, we can find out closest two data points (above and below) to the zero-
crossing point.

If we continue the process for the 5th time, then centre point would be half away from each
data point. Let’s consider finally remained X = 1 and X = 2. Then centre point would be
X=1.5. If zero-crossing point is between X=1 and X=1.5. So the closest data point to the zero
crossing point is X=1.

To calculate time stamp ( t1 ) when zero crossing was happened for the first time, a data sample
count from X_min or X_max to X=1 should take. Let’s imagine data sample count is 125.
1000ms
t1 = �125 ADC samples = 5.02ms
24000 ADC samples

2.2 Amplitude and Phase Angle Calculation

Since input signal’s sampling frequency is 24 kHz, there are 480 sampling values per period.
Using discrete Fourier Transform basic component of the signal is calculated.

Let’s consider voltage input signal:


8
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

2 N -1 � 2p i 2p i �
B= ��
N i =0
V(i) �
�cos
� N
- j sin
N �
�; Where N = 480

�Bimag �
Amplitude of the signal is V = Breal
2
+ Bimag
2
and phase angle is q = arctan � �
�Breal �

2.3 Calculation of Different Parameters for the Algorithm

The algorithm can be adapted to any type of short circuit situation of the power system. In this
thesis work, for simplicity only a Single Phase to Ground short-circuit current is considered.
So the impedance used in the algorithm is Phase to ground impedance ( Z P -G ). Also
algorithm needs three phase currents and voltages.

VP -G
Z P -G =
I P -G + 3 �k0 �
I0

To calculate Z P -G , we need several other parameters.

i. Sequential Currents ( I 0 , I1 , I 2 ) and voltages ( V0 , V1 , V2 )

I0 � �
� 1 1 1 �� IA �
� � 1 � 2 �� �
I1 �= �
� 1 a a � �
�I B �Where a = e j 2p 3
3

� � �
I2 � 1 a2 a �
� ��
�IC ��

V0 � �
� 1 1 1 �� VA �
� � 1 � 2 �� �
V1 �= �
� 1 a a �� VB �Where a = e j 2p 3

3

� � �
V2 � 1 a2 a �
� ��
VC �
� �

ii. Sequential Impedances ( Z 0 , Z1 , Z 2 )

V0 V1 V2
Z0 = , Z1 = and Z 2 =
I0 I1 I2

iii. Constant k0
( Z 0 - Z1 )
k0 =
3� Z1

CHAPTER 3: Algorithm Implementation


9
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

Beforehand, the algorithm was tested using MATLAB, in order to verify the accurate
functionality of the algorithm. When algorithm implemented in MATLAB, calculated
frequency values as follows. The result is vary form 50.018 Hz to 50.026 Hz, and it confirms
algorithm is quite accurate.

Fig. 3.1: Measured frequency variation of 50 Hz testing voltage signal

To simplify the implementation of algorithm, there number of assumptions were done.

1. Algorithm is adapted only one single type of fault (Phase to Earth Short-Circuit) can
be occurred in power systems.

2. Currents and Voltages of healthy phases, before the fault and during the steady-state
short current, remain same.

10
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

Pre-fault Fault steady-state

Only current and voltage change in faulted phase was taken into consideration. Current and
voltage of healthy phases are considered as constants.

3. For each current and voltage input signal, two files were created with approx. 6000 of
ADC readings with 12 bit resolution
Approximately 6000 (Approx. for 12 cycles) ADC readings with 12 bit resolution of a 100V
analogue voltage signal were generated to represent voltage signal. These ADC readings are
stored in a text file called “Voltage_measurement.txt” and the programme directly read ADC
values from that file.

12 bit resolution = 212 = 4096

So, 100 V = 4096 and 0V = 0. And the sensitivity is 100V/4096, which is approximately 24
mV. On the other words voltage changes less than 24 mV will not be take into consideration.

As an example:
4096
ADC reading for 68 V = �68 V ; 2785
100 V
11
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

In the same way, another 6000 (Approx. for 12 cycles) ADC readings with 12 bit resolution
for 1A analogue current signals were generated to represent current signal. These ADC
readings are stored in a text file “Current_measurement.txt”.

In each text files for current and voltage, contains around 5300 Pre-fault ADC values and
around 700 Fault Steady-state ADC values of Phase to Earth Short-Circuit.

12
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

CHAPTER 4 – Purposed Work for Next Semester

i. Complete the serial code for whole algorithm


ii. Analyze the serial code using Sun Studio Analyzer of UPB’s NCIT cluster
resource.
iii. Code Parallelization

There are number of methods can be adapted to improve the code performance. Using
assembly language, slower segments of the code can make more efficient. In this particular
case among all other optimization methods, parallelization can be considered as most
important method to improve code efficiency and to reduce computational time.

At the moment code is written as a serial code. In order to transform serial code into a parallel
code, Fork-join Model is selected. OpenMP is chosen as Application Programming
Interface (API)

According to the Fork-join model, in code there would be parallel segments of the code and
parallel segments of the code. Program execution is based on a Master Thread. During serial
regions of the code, there only be master thread and during parallel regions of the code there
will another threads who work parallel with the master thread.

First step of parallelization is to identify where the concurrency in the program. Then
algorithm strategy should be organized. As we discussed earlier this algorithm consist with
three main segments: frequency calculation, Amplitude-Phase angle calculation and
Parameters of algorithm calculation.

13
University POLITEHNICA of Bucharest
FACULTY OF AUTOMATIC CONTROL AND COMPUTERS
Departament of Power Systems Engineering
060042 Bucuharest, Splaiul Independenţei, nr. 313, sector 6

References

[1] Y. Wang, V. Dinawahi; Real-time digital multi-function protection system on reconfigurable


hardware, IET Journals, ISSN 1751-8687, 14th June 2015

[2] Lawrence, D.; Donnal, J. S. ; Leeb, S.; He, Y., Non-contact Measurement of Line Voltage, IEEE
Sensors Journal, Volume: 16(24), pp 8990-8997, 2016,

[3] Abdel-Salama, M., Kamela, R., Sayed, k., Khalafa, M., Design and implementation of a multi-
function DSP-based-numerical relay, Electric Power Systems Research Journal, Volume 143, Pages
32–43, http://dx.doi.org/10.1016/j.epsr.2016.10.033, 2016

[4] G. Benmouyal, M. Meisinger, J. Burnworth, W. Elmore, K. Freirich, P. Kotos, P.Leblanc, P. Lerley,


J. McConnell, J. Mizener, et al., IEEE standard inverse-time characteristic equations for overcurrent
relays, IEEE Trans. Power Deliv. 14 (3)(1999) 868–872.

[5] Over-Current Relay Model Implementation for Real Time Simulation & Hardware-In-the-Loop
(HIL) Validation Muhammad Shoaib Almas, Rujiroj Leelaruji, and Luigi Vanfretti Royal Institute of
Technology (KTH) Teknikringen 33, SE-lOO 44, Stockholm.

[6] Calculation of short-circuit currents, Schneider Electric “Cahier Technique” no 158

[7] Network Protection and Automation Guide (Protective Relays, Measurement & Control),
ALSTOM GRID, May 2011

14

You might also like