# Power Quality Disturbances Recognition Based on Grammatical Inference

Tiago Fonseca, João F. Martins

► To cite this version:

Tiago Fonseca, João F. Martins. Power Quality Disturbances Recognition Based on Grammatical Inference. 2nd Doctoral Conference on Computing, Electrical and Industrial Systems (DoCEIS), Feb 2011, Costa de Caparica, Portugal. pp.474-480, 10.1007/978-3-642-19170-1_52. hal-01566567

HAL Id: hal-01566567

https://inria.hal.science/hal-01566567

Submitted on 21 Jul 2017

HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Power Quality Disturbances Recognition Based on
Grammatical Inference

Tiago Fonseca¹ and João F. Martins²,

¹ Faculdade de Ciências e Tecnologia, FCT, Universidade Nova de Lisboa, 2829-516 Caparica, Portugal

² CTS, Uninova, Dep.ª de Eng.ª Electrotécnica, Faculdade de Ciências e Tecnologia, FCT, Universidade Nova de Lisboa, 2829-516 Caparica, Portugal
{tdf19282,jf.martins}@fct.unl.pt

**Abstract.** A new approach in detecting and identifying power quality disturbances is presented. The use of Formal Language Theory, already exploited in other fields, was used to develop an innovative tool to identify patterns in electrical signals. The Concordia transform is applied to the 3-phase electrical system, composing a 2-D signal. The obtained signal is computed with a “healthy” 3-phase composed signal, retrieving new data. A Formal Language based inference algorithm is used to infer a grammar from this new data. Each type of fault has its own grammar, which allows the developed algorithm to easily detect and identify the disturbances.

**Keywords:** Power Quality, Formal Languages, Grammatical Inference, Pattern recognition

# 1 Introduction

Monitoring power quality (PQ) has been an issue with great increase of relevance in the past years, part of which is due to the growth of electrical energy consumers, whether domestic or industrial. Most of today's loads are electronic based and therefore quite susceptible to disturbances. Occurrence of a power disturbance can cause several problems such as equipment malfunction/damage and losses in productivity. Power quality issues are addressed in IEEE 1159-1995 standard [1], where recommendations for PQ monitoring are also considered. Several monitoring methods analyse power line disturbances using different methodologies to detect and identify the disturbance. While some of them use mathematical morphologies [2] [3], there is also a strong emphasis on the use of multiresolution analysis such as the wavelet [4] [5].

In [6], voltage sag is defined as a brief decrease in the rms line-voltage as the voltage swell is an increase of the rms line-voltage. An interruption is a reduction of the line-voltage or current to less than 0,1pu. Voltage fluctuations are relatively small variations in the rms line-voltage. The variation in the 3-phase voltage amplitudes, relatively to one another, is described as a voltage imbalance. Harmonic distortion is the effect in the waveform by the existence of harmonics.

The research for a method that fits in all disturbances and computational requests is still in progress. Some methods work well on some disturbances and not so well
on others, where other methods have high processing costs. For example the wavelets approach needs to be decomposed many times to retrieve a significant conclusion.

This paper intends to be a contribution to this problem, presenting a new approach in detecting PQ disturbances. The objective is to detect and analyse 3-phase systems using grammatical inference learning algorithms. Formal language theory was initially presented by Chomsky [7] and has been used in distinct domains, such as detection of ECG signals [8], control of electrical devices [9], Chinese character recognition [10] or image parsing [11].

The basic idea is to infer one grammar for each type of PQ disturbances.

## 2 Contribution to sustainability

The renewable de-centralized power production poses new and interesting problems concerning power quality. The quality of the delivered power often depends on the mechanical/electric/electronic power interfaces, their control strategies and its directly connected with the sustainability of the power delivery system. On the other hand, electronic loads are also a strong source of power quality disturbances. Due to their nonlinear nature, these loads inject harmonics current into the power system and cause voltage harmonics distortion. In order to keep the sustainability of the power delivery system it is important to understand how power quality disturbances influence the system's performance. An important issue is development of techniques capable of detecting and overcoming power quality disturbances in system-equipment interactions. The presented power quality detection method is a contribution for the power quality detection problem and thus for the sustainability of the power delivery system.

## 3 Formal Language Concepts

### 3.1 Grammar

The grammar of the language is a set of rules that specifies all the words in the language and their relationships. Once the grammar is found, the grammar itself is a model for the source. To define a grammar (G), one specifies a terminal alphabet, a nonterminal alphabet, a start symbol, and a set of productions.(1)

$$G = \{\Sigma_T, \Sigma_N, S, P\}. \qquad (1)$$

* $\Sigma_T$, represents the terminal alphabet, a set of symbols that create words, where a word is a string of symbols.

* $\Sigma_N$, Is the nonterminal alphabet, set of auxiliary symbols that will produce words by the production rules.

* S Being the start symbol, a special nonterminal symbol to start the production of words.
• P, productions are the set of substitution rules, creating words that fit in the specific language.

Example of a grammar representation:

$$ \Sigma_N = \{S, A\} \quad \Sigma_T = \{a, b\} \quad P = \{S \to aS, S \to aA, A \to bA, A \to b\} $$

Retrieving the following language:

$$ L(G) = \{a^n b^m | n \ge 1, m \ge 1\} \Rightarrow \{ab, naab, naaab, naabb, ...\} $$

According to the Chomsky hierarchy, grammars are classified in 4 different types. (see Table 1)

<table><caption>Table 1 - Chomsky's hierarchy of grammar types</caption><thead><tr><td>Type</td><td>Name</td><td>Production Rules</td></tr></thead><tbody><tr><td>0</td><td>Unrestricted</td><td>No restrictions</td></tr><tr><td>1</td><td>Context-sensitive</td><td>αAβ → αγβ</td></tr><tr><td>2</td><td>Context-free</td><td>A → γ</td></tr><tr><td rowspan="2">3</td><td rowspan="2">Regular</td><td>A → aβ</td></tr><tr><td>A → a</td></tr></tbody></table>

For this work only type 3 grammar are considered: regular grammars which can be represented by finite state automata.

The basic idea is that the use of the grammar allows the decision if a given word is part of the language defined by that grammar, being this the basis for the pattern recognition methodology presented in this paper.

## 3.2 Grammatical inference

Grammatical inference is an algorithm that can identify the grammar from a set of positive and negative examples. Obviously the quality of the inferred grammar is directly connected with the quantity and quality of the learning examples.

In this work, the developed algorithm will search electrical signals samples for signs of the recursive rules that will characterise the grammar being sought. At the possibility of a recursion being identified, a step in the inference algorithm is completed by substituting the substring. The sample will be rewritten several times, each time the recursion will be substituted by a symbol based on regular expression theory. In the end the method returns an expression that represents the grammar inferred from the sample.

A simple example of the algorithm is presented below:
Considering the sample, $I^2 = (x_1, x_2, x_3)$

$$x_1 = aabaaabababcabc \quad x_2 = abcabaababc \quad x_3 = aaaaabc$$

The sample is analysed to find recursive parts,

$$x_1 = (a)^2 baaabababcabc$$

$$x_1 = aab(a)^2 babcabc$$

$$x_1 = aabaa(ab)^2 cabc$$

$$x_1 = aabaa.b(abc)^2$$

$$x_2 = abcab(a)^2 bcabc$$

$$x_2 = abcabaa(bc)^2$$

$$x_2 = (a)^5 bc$$

Possible matches: a, ab, abc, bc

Choosing hypothesis: *a*. Rewriting: $z = a^+$

$$x_1 = zbzbzbzczb \quad x_2 = zbczbzbcbc \quad x_3 = zbc$$

Analyse:

$$x_1 = (zb)^3 czbc$$

$$x_1 = zbzb(zbc)^2$$

$$x_2 = zbc(zb)^2 cbc$$

$$x_2 = zbczbz(bc)^2$$

Possible matches: zb, bc, zbc

Choosing hypothesis: *zb*. Rewriting: $y = (zb)^+$

$$x_1 = ycyc \quad x_2 = ycycbc \quad x_3 = yc$$

One possibility: *yc*. Rewriting: $x = (yc)^+$

$$x_1 = x \quad x_2 = xbc \quad x_3 = x$$

Final expression, retrieved from the sample:

$$x + xbc = ((a^+b)^+c) + ((a^+b)^+c)^+bc$$

The choice of the alphabet is of extreme importance to retrieve useful results. As an example Table 2 contains the explanation of an alphabet that can be used in a ECG<fnref n="1" /> signal piece (note that the fact that some symbols are in uppercase has nothing to do with non-terminal symbols and should be ignored in the scope of the example). Fig. 1 shows how the alphabet is applied.

<footnote n="1">¹ Electrocardiogram</footnote>
<table><caption>**Table 2** - Primitives used for the alphabet, Δ is a minimum slope values specified beforehand, adapted from [12]</caption><thead><tr><td>Primitive Name</td><td>Symbol</td><td>Description</td></tr></thead><tbody><tr><td>Horizontal</td><td>h</td><td>A segment of constant value</td></tr><tr><td>Up slope</td><td>u</td><td>An upward segment with slope &lt; Δ</td></tr><tr><td>Down slope</td><td>d</td><td>A downward segment with slope &gt; -Δ</td></tr><tr><td>Strong up slope</td><td>U</td><td>An upward segment with slope ≥ Δ</td></tr><tr><td>Strong down slope</td><td>D</td><td>A downward segment with slope ≤ -Δ</td></tr></tbody></table>

<figure><img src="image_2.png" /><figcaption>**Fig. 1** - Piecewise linear approximation of an ECG signal [12]</figcaption></figure>

# 4 Implementation and Results

## 4.1 Preparing the electrical signals

Since we are working with 3-phase systems, Concordia transform was chosen to get the presentation of the electrical signal in 2-D space. By applying the Concordia transform to an undisturbed electrical signal and to a disturbed one, it's possible to retrieve a new representation which consists of the difference between the two transformed signals. Fig. 2**Error! Reference source not found.**, presents a disturbed electrical signal (voltage fluctuation) and an undisturbed one.
<figure><img src="image_3.png" /><figcaption>Fig. 2 - Disturbed and undisturbed signal</figcaption></figure>

Since de analysis is on a 3-phase system, applying the Concordia Transform makes it possible to analyse the system in a 2-D scenario. Implementing the transform into each signal and overlapping the results, one gets the signal shown in Fig. 3: a perfect circle corresponding to the normal signal and another one corresponding to the faulty signal product. Determining the radial distance between both results along the signal sampling, the outcome is presented in Fig. 4. Each type of PQ disturbance grammar will be inferred from this composed signal.

<figure><img src="image_4.png" /><figcaption>Fig. 3 - Overlapping transforms</figcaption></figure>

<caption>Fig. 4 – Time evolution of the radial distance</caption>

## 4.2 Inferring the grammar

As stated before, the chosen alphabet will highly affect the final result in the inferred grammar. For this work a 4 level alphabet, {a,b,c,d} was chosen. Applying this alphabet to the composed signal presented in Fig. 4, one obtains the word sequence, as exemplified in Fig. 5 with a random signal.
<figure><img src="image_5.png" /><figcaption>Fig. 5 - Representation of the used alphabet</figcaption></figure>

Using the proposed methodology in different disturbances of the same type, gives us a sample of strings to analyse and infer the respective grammar. The obtained grammars for each disturbance are presented below, with the pattern that characterises each disturbance (showed in the regular expression form):

<table><tr><td>Voltage imbalance</td><td>((bc)<sup>+</sup>(ba)<sup>+</sup>)<sup>+</sup></td></tr><tr><td>Harmonic distortion</td><td>((abc)<sup>+</sup>)</td></tr><tr><td>Voltage fluctuations</td><td>((cb)<sup>+</sup>)</td></tr><tr><td>Interruption</td><td><i>bcd</i></td></tr><tr><td>Sag</td><td><i>bcd</i></td></tr><tr><td>Swell</td><td><i>ab</i><i>b</i></td></tr></table>

## 5 Conclusion

This work presented the development of a novel algorithm based on the use of formal languages in detecting power quality disturbances. The grammatical inference algorithm was developed in order to retrieve the grammars that characterise each disturbance, being each disturbance characterised by one, and only one, grammar. Being the grammars established is possible to detect and classify the disturbances, analysing them by means of an automata or inferring the grammar of a given signal.
6 References

[1]. IEEE Recommended Practice for Monitoring Electric Power Quality. *IEEE Recommended Practice for Monitoring Electric Power Quality*. 1995.

[2]. *PQ Monitoring System for Real-Time Detection and Classification of Disturbances in a Single-Phase Power System*. Radil, Tomás, et al. 2008, IEEE TRANSACTIONS ON INSTRUMENTATION AND MEASUREMENT, Vol. 57, pp. 1725-1733.

[3]. *Automated Power Quality Monitoring System for On-line Detection and Classification of Disturbances*. Matz, Václav, et al. s.l.: IEEE, 2007. pp. 1-6.

[4]. *Wavelet-based neural network for power disturbance recognition and classification*. GAING, Zwe-Lee. 2004, IEEE Transactions on Power Delivery, Vol. 19, pp. 1560-1568.

[5]. *Power quality disturbances analysis based on EDMRA method*. He, Haibo, Shen, Xiaoping and Starzyk, Janusz A. 2009, Electrical Power and Energy Systems, Vol. 31, pp. 258-268.

[6]. Kusko, Alexander and Thompson, Marc T. *Power Quality in Electrical Systems*. s.l.: MacGraw-Hill, 2007.

[7]. Chomsky, Noam. *Aspects of the theory of syntax*. s.l.: MIT Press, 1965.

[8]. *Syntatic pattern recognition of the ECG*. Trahanias, Panagiotis and Skordalakis, Emmanuel. 1990. IEEE Computer Society. Vol. 12, pp. 648-657.

[9]. *Language Identification of Controlled Systems: Modeling, Control and Anomaly Detection*. Martins, J. F., et al. 2001, IEEE Transactions on Systems, Man, and Cybernetics—Part C: Applications and Reviews, Vol. 31, pp. 234-242.

[10]. *Large scale on-line handwritten Chinese character recognition using improved syntactic pattern recognition*. Kuroda, K., Harada, K. and Hagiwara, M. 1997. Vol. 5, pp. 4530-4535.

[11]. *Bottom-up/top-down image parsing by attribute grammar*. Han, Feng and Zhu, Song-Chun. 2005. Vol. 2, pp. 1778-1785.

[12]. *Marques, J. P. Pattern Recognition, Concepts, Methods and Applications*. s.l.: Springer, 2001.