FPGA-Based Online PQD Detection and Classification through DWT , Mathematical Morphology and SVD

Power quality disturbances (PQD) in electric distribution systems can be produced by the utilization of non-linear loads or environmental circumstances, causing electrical equipment malfunction and reduction of its useful life. Detecting and classifying different PQDs implies great efforts in planning and structuring the monitoring system. The main disadvantage of most works in the literature is that they treat a limited number of electrical disturbances through personal computer (PC)-based computation techniques, which makes it difficult to perform an online PQD classification. In this work, the novel contribution is a methodology for PQD recognition and classification through discrete wavelet transform, mathematical morphology, decomposition of singular values, and statistical analysis. Furthermore, the timely and reliable classification of different disturbances is necessary; hence, a field programmable gate array (FPGA)-based integrated circuit is developed to offer a portable hardware processing unit to perform fast, online PQD classification. The obtained numerical and experimental results demonstrate that the proposed method guarantees high effectiveness during online PQD detection and classification of real voltage/current signals.


Introduction
Non-linear loads and environmental circumstances might induce power quality disturbances (PQD) in electric distribution networks [1], which produce equipment malfunction and useful life reduction.International standards as the IEEE 1159 [2], and IEC 61000-4-30 [3] establish the requirements of quality, control, and reliability for electric distribution systems, i.e., power quality indexes (PQI).The most common electrical disturbances are voltage sag/swell, interruptions, wave faults, and harmonic distortion.For diminishing power quality (PQ) problems, it is important to determine the components provoking the problems in the distribution signal [4,5].This demands thorough and effective PQ monitoring and classification, making it an open subject for research since the detection and classification of electrical disturbances causing PQDs are difficult tasks that require a high level of engineering [6].
Many methodologies have been proposed in the literature for PQD classification.For instance, in [7], two empirical-mode, decomposition-based techniques are used for signal denoising in PQD classification.In [8], automatic disturbance analysis and fault location are performed utilizing statistical and multilevel signal processing.In [9], different static-compensator topologies are investigated for reactive power compensation, harmonic elimination, load balancing, and neutral current compensation.In [10], an algorithm that uses wavelet transform (WT) and S-transform, along with RELIEFF feature selection for the assessment and recognition of flickers in wind turbines is presented.WT is among the most commonly used techniques for PQ analysis.For instance, Reference [11] classifies the wavelet-based methods that are applied for discrimination, classification and phase selection during fault identification of transmission systems.In [12], a technique based on an adaptive wavelet neural networks for low-order harmonic estimation is presented.In [13], wavelet decomposition that provides additional coefficients with border distortion is proposed to detect induced transients.Other approaches use different signal analysis techniques during PQD classification [5].In [14], a review of the main contributions to PQ in ships is presented, considering the instrumentation and regulations for electrical installations.In [15], empirical-mode decomposition and Hilbert transform are used to classify PQDs.In [16], voltage flickers are classified by extracting the fundamental signal from the voltage envelope and its spectral analysis.Digital signal processing (DSP) plays an important role, since the electrical power supply signal must be analyzed to obtain useful attributes for PQD classification [17,18].In [19], a rule-based approach using discrete wavelet transform (DWT) and fast Fourier transform is proposed for detecting PQDs.In [20], a reconfigurable system is developed that applies short-term Fourier transform and DWT to the current and voltage signals supplied to industrial equipment.In [21], electrical disturbances are identified through wavelet decomposition, hidden Markov model, and Dempster-Shafer classification.In [22], a technique based on spectral kurtosis and artificial neural networks (ANNs) is used to classify sags, swells, interruptions, oscillation transients, and impulsive transients.In this regard, ANNs are a common method used for PQD classification [5,23].Among many different ANN structures, the multilayer perceptron trained through the back-propagation algorithm, named back-propagation network (BPN), is the most popular [24,25].In [26], a multilayer-perceptron ANN is used for the harmonic compensation of the electric current signal.In [27], a multilayer-perceptron ANN is used to detect grid voltage disturbances and enhance the performance and stability of a rectifier.In [28], a multilayer-perceptron ANN is used to correct the power factor and regulate the zero voltage in a three-phase distribution static compensator, under nonlinear loads.On the other hand, mathematical morphology is concerned with the shape of a signal waveform in the time domain [29].Mathematical morphology has gained applications in the study of power system faults/disturbances, where the interaction with disturbances modifies the waveform information of a signal [30].For instance, in [31], broken rotor bars are detected using mathematical morphology and motor current signature analysis.In [32], a technique applying empirical mode decomposition and mathematical morphology for partial discharge signal denoising is proposed.The main disadvantage of the above described works is that they rely on personal computer (PC)-based techniques that make it difficult to perform a portable, online PQD classification in real-time.
The novel contribution of this work is a methodology for PQD detection and classification through DWT, singular value decomposition (SVD), and statistical analysis.Mathematical morphology is used to emphasize the characteristics of the analyzed signal to achieve an effective PQD classification using an ANN.On the other hand, the timely and reliable classification of different PQDs is necessary.In this regard, field programmable gate arrays (FPGA), which use spatial computations, offer an appropriate high-performance and low-cost solution for several applications compared to other implementation platforms, such as digital signal processors and microcontrollers [33,34].Hence, a portable FPGA-based hardware processing unit, suitable for implementation on devices from different vendors, was developed to show the usefulness of the proposed method to perform fast, online classification of pure sine, sag, swell, outage, harmonic, harmonic with sag, harmonic with swell, high frequency transient, and low frequency transient.The numerical and experimental results validate the efficacy of the introduced approach when applied to computer models and acquired voltage/current signals from real experiments, reaching an accuracy of more than 99% in identifying and classifying the treated PQDs.

Discrete Wavelet Transform
Discrete wavelet transform (DWT) has been extensively used to analyze non-stationary signals [35][36][37].In DWT computation, a digital signal is decomposed into a series of approximations (AC k ), and details (DC k ) per decomposition level k, corresponding to the analyzed signal's lowand high-frequency bands, respectively.Hence, the AC k and the DC k series are produced by examining the signal x(n) through a low-pass filter h p (k, l) and a high-pass filter l p (k, l); and subsequently applying a down-sampling operation, where l represents the transformation-node.Once the required decomposition levels L are obtained, the reconstruction process to recreate the corresponding frequency-band signal is performed by applying an up-sampling procedure followed by the corresponding h p (k, l) and l p (k, l) filters.The DWT process described above is known as the Mallat algorithm [38], and is depicted in Figure 1, where f s is the sampling frequency, and the filter backs h p (k, l) and l p (k, l) are associated to a wavelet mother function ψ(t) [39].

Mathematical Morphology
Mathematical morphology is an approach to analyzing digital signals based on their shape.It is related to image processing; however, it can be used in a large number of different applications, since its concepts can be applied to signals of any dimensions.Dilation and erosion are elemental operations in mathematical morphology [29,40].

Dilation
Dilation expands the shape of a signal using a given structuring element.If I N denotes the collection of all points P = [x 1 , x 2 , . . ., x N ] in an Euclidean space with N-dimensions, the binary dilation of F by G, where F ⊂ I N , and G ⊂ I N , is given by In ( 1), OR and AND describe the basic binary operations, n and m represent the horizontal and vertical indexes respectively, and i and j represent their corresponding displacement.

Erosion
Erosion is a morphological transformation where a given signal is probed as to how a structuring element fits it.The binary erosion of F by G, where F ⊂ I N , and G ⊂ I N , is given by In this work, F stands for the signal to be analyzed, e.g., "Signal with disturbances", and G represents the structuring element, which is chosen by the user.Therefore, the operations F ⊕ G and F θ G represent transformed signals.

Singular Value Decomposition SVD
The singular value decomposition (SVD) of a of a matrix M with dimensions n × m is given as where U and V are orthogonal matrices with the dimensions n × n and m × m, respectively; S is a diagonal matrix with dimensions n × m that contains non-negative real number σ 1 , σ 2 , . . ., σ n on its diagonal, which are called singular values of M [41].For a non-square matrix, if r = rank(M), at least r of the singular values are non-zeros and non-negatives.Current SVD algorithms use orthogonal transformations and diagonalization processes by rotation to obtain a numerical approximation of the SVD.

Jacobi Rotations
The matrix J, known as the Jacobi rotation matrix, is used to produce a diagonal matrix A D from a matrix A S , which is symmetric [42].
If M in (3) is not symmetric, it can still be made into a diagonal matrix by utilizing rotations to make it symmetric A s , followed by further rotations to make it diagonal A D .
A S = J T M. (5)

Hestenes-Jacobi Algorithm
In the Hestenes-Jacobi algorithm [43], if a non-symmetric matrix M with dimensions n × m is multiplied by a matrix U that is orthogonal, a matrix D-whose rows are orthogonal-is obtained where the square norm of each row of D is contained in the diagonal matrix S. On the other hand, the orthonormal matrix V is obtained by dividing the rows in D by their corresponding square norm.Hence, (7) can be rewritten as where the singular values (σ 1 , σ 2 , . . ., σ n ) of M are the root squares of s 1 , s 2 , . . ., s n , which are the elements in the diagonal matrix S.

Artificial Neural Networks
There are different architectures for artificial neural networks (ANNs); however, one of the most well-known architectures is multilayer perceptron (MLP), which maps data at the input w i (i = 1, 2, . . ., k) to a group of wanted outputs y j (j = 1, 2, . . ., p).The information in the MLP flows from the input layer of neurons, through the hidden layer, to the nodes at the output, as depicted in Figure 2. In general, the MLP carries out a nonlinear transformation of the information from previous layers, applying weighted summations.The MLP is typically trained using the supervised learning method of back propagation (BP).The BP algorithm maps input data to required outputs by reducing the error between the wanted and computed outputs [44].A MLP with BP has characteristic attributes that are suitable for real-time electric-power disturbance classification: (a) Since the output can be computed using parallel operations, MLP can be suitable for real-time applications.(b) MLP can produce coherent results for distinct combinations of inputs for which the network has not been trained (surveillance applications).(c) Their implementation in hardware is straightforward in terms of conventional pattern recognition methods.

ANN Architecture
In this paper, an ANN with MLP architecture-which contains 16 input neurons, 22 neurons in the hidden layer, and 9 neurons at the output-is implemented to identify and classify PQDs in electric power systems.Each PQD is associated with an output node.The activation function log-sigmoid (LS) defined in (9), is used for the neurons in the hidden and output layers, where the weighted-input summation to the nodes is represented by η.The Levenberg-Marquardt learning method was used in the back-propagation algorithm to train the network offline, with randomly-set initial weights and biases, and a mean square error of 1 × 10 −8 as the learning rate.The BP algorithm was used to train the MLP in the proposed approach because of its straightforward hardware implementation in an FPGA. (9)

Proposed Methodology
In the proposed methodology, the input voltage/current signal is decomposed and reconstructed into seven frequency levels utilizing DWT and inverse DWT (IDWT), obtaining eight frequency bands.DWT decomposition and reconstruction are used to emphasize the intrinsic characteristics of the voltage/current signal at different frequency bandwidths, which might vary according to the PQD.Mathematical morphology (dilatation and erosion) is applied to the eight frequency bands to remove the imperfections generated during pre-processing by taking into account the form and structure of the signal.Erosion refines the characteristics of the signal, whereas dilation highlights them.Therefore, the average between dilation and erosion provides a signal with balanced geometric characteristics (filtered signal).To find out intrinsic characteristics of form and reduce the information being processed, the filtered signal in each frequency band is arranged into a 16 × 256 matrix, and the corresponding singular values are computed.The obtained 16 singular values from the eight matrices are statistically analyzed by computing their mean and variance (µ 1 , υ 1 , µ 2 , υ 2 , . . ., µ 8 , υ 8 ).Finally, the used MLP ANN takes these 16 statistical parameters (two for each frequency band) as inputs to identify and classify the PQD.The proposed methodology is depicted in Figure 3.The complete scheme is implemented in an FPGA device, for online detection and classification of PQD in real time, utilizing the very high speed integrated circuit hardware description language (VHDL).

Experiment Setup
A group of nine numerically-simulated signals, and a second group of nine signals obtained through real experimentation were used to validate the introduced methodology for detecting and classifying different PQDs.

Numerical Simulation of PQDs
For the numerical validation of the proposed methodology through computer models, nine different signals that might be present in a power distribution system were generated following the mathematical descriptions in Table 1, which are defined by international standards for monitoring electric PQ [2,45]-namely, pure sine, sag, swell, outage, harmonic, harmonic with sag, harmonic with swell, high frequency transient and low frequency transient, are considered; 300 signals from each type, with different noise level-were generated to train the ANN.A total of 300 other cases were produced to test the methodology.The sampling window was 200 ms, which is the standard sampling period for PQD assessment [2,3], with a sampling frequency of 20.48 KHz.Each sampled signal contained 4096 discrete values, as shown in Figure 4.
Table 1.The power quality (PQ) disturbances and its models.1.

Benchmark for Real PQD
To show the effectiveness of the introduced method for PQD identification and classification, it was necessary to construct a real experimental test bench.In this case, a programmable alternating current (AC) power supply was used as a PQD generator, the Chroma Power Source model 61703 [46].This power source has the characteristics of producing several PQDs, such as harmonics, interharmonics, sags, swells, flickers, frequency variations and others.Disturbances can be single phase or three phase.On the other hand, to test the harmonics behavior, a three-phase diode rectifier was used to obtain a real harmonic current pattern based on a non-linear load.The power consumption of the non-linear load was 5kVA with 27.23% of total harmonic distortion (THD).The data acquisition system (DAS) consists of one analog-to-digital converter model ADC128S022-this chip has eight channels with 12 bits in a serial configuration.The system instrumentation obtained 4096 samples at a sampling rate of f 0 = 20.48kHz.The experimental setup for voltage/current signal acquisition is shown in Figure 5.
On the laboratory test bench, the real voltage or current signal was measured using a voltage divider or a hall-effect sensor, respectively, per phase leg.The sampled signal was adjusted for processing by the analog-to-digital converter in the DAS.The synchronization and control signals were provided by the FPGA.Once the acquired signal had been processed, the DAS forwarded it to a PC via an USB interface; i.e., the DAS works as link between the proposed FPGA-based monitoring system and a PC.Real signals with PQDs, captured utilizing the experimental test bench, are shown in Figure 6.

Hardware Implementation
The FPGA-based hardware implementation figures for the proposed method for detecting and classifying PQDs in a power distribution system are summarized in Table 2.A Daubechies 1 wavelet mother function was used for DWT and IDWT computation.To demonstrate the independence of the technology to the FPGA-based hardware realization for the developed methodology, two different platforms were used: (a) The Xilinx Virtex-6 ML605 (Xilinx, Inc., San Jose, CA, USA); and (b) Altera Stratix-III DE3 EP3SE260 (Altera Corporation, San Jose, CA, USA).Table 2 shows the percentage ratio of used resources, and the maximum operational frequency reached when a 16-bit resolution was considered for implementation on each device.The corresponding response time for each implementation is shown in Table 3; from which it can be seen that the PC-based software counterpart of the introduced method-implemented on a 3.30 GHz Intel Core i7 processor utilizing MATLAB-was outperformed by the two FPGA implementations by at least three orders of magnitude.The introduced FPGA-based hardware processing unit consumed 197,615 clock cycles to perform the PQD detection and classification, which is equivalent to around 2.99 ms in an FPGA Virtex 6 from Xilinx and 2.57 ms in an FPGA Stratix-III from Altera.At this point, it is worthwhile to note that an electric power distribution system has a slow response to transient events; hence, the proposed system response of 2.99 ms surpasses by far that required by international standards, namely one quarter of a cycle (4.1667ms) [47].

Validation of Classification Results
The performance regarding identifying and classifying PQD through the introduced methodology was assessed using the common sensitive metrics, true positive (TP), true negative (TN), false positive (FP), and false negative (FN) rates to compute its accuracy by The TP, TN, FP, and FN values were computed as the incidence of the correctly and incorrectly recognized results during a signal classification, namely true (properly classified) and false (wrongly classified) outcomes [48].Table 4 shows the accuracy of the recognition and classification of diverse PQDs performed by the ANN under the proposed methodology, with different noise levels.Figure 7 depicts the receiver operating characteristic (ROC) curve that shows the diagnostic ability of the presented scheme in distinguishing and classifying PQDs.From these plots, it can be seen that the proposed methodology ensures high certainty when identifying all treated PQDs.

Numerical Simulation Results
The detection and categorization results for diverse PQDs in voltage/current signals, utilizing the introduced approach, are shown in Table 5, when noise contamination is considered in a signal-to-noise ratio (SNR) that goes from 20 dB to 50 dB.The signals used for verifying the introduced approach were obtained through their corresponding mathematical models in Table 1, and they were different from those used for training the ANN.

Experimental Results
The obtained results for the PQD detection and classification of real experimental voltage/current signals collected through the test bench described in Section 4 are shown in Table 6, where 50 different trials were considered for each class.The outcomes demonstrate the high efficacy of the introduced FPGA-based hardware processing unit during online PQD recognition and classification in a power distribution system.

Discussion of Results
The proposed FPGA-based method for PQD identification and categorization is compared with respect to previously-introduced techniques from the consulted bibliography outlined in Table 7.This table shows the effectiveness of each approach; it is evident that the high certainty of the introduced hardware processing unit during the online detection and classification of different PQDs.Moreover, the best reported performance for the previously-proposed techniques outlined in Table 7 was compared against the corresponding effectiveness degree of the introduced approach.
From Table 7, it is should be noted that although some previous contributions reach high effectiveness, most of them do not consider all the different PQDs detected and classified in this work, and those that do reach a similar effectiveness as that of the numerical (software-based) version of the introduced approach.From this, it can be assumed that the proposed method will reach an effectiveness as high as the highest method reported in the literature.On the other hand, considering the results of the FPGA-based hardware realization of the proposed technique for PQD detection and classification of real voltage/current signals, a 100% effectiveness can be guaranteed.Furthermore, all previously-reported methods are implemented in a software and usually applied offline, as described in Table 8, whereas the introduced approach can perform online, fast detection and classification of PQDs, thanks to its FPGA-based implementation, which takes around 3 ms to process the information.In this way, our method surpasses all previous approaches to reviewing information by at least one order of magnitude, as they require, in the best case, 10 ms to perform the signal processing.

Conclusions
In a power distribution system, it is very important to estimate the factors responsible for PQDs quickly and with high effectiveness.This demands classification schemes that perform rapid and efficient PQ monitoring.Most of the previously-proposed approaches described in the literature are designed to treat a limited number of PQDs, and their computation is usually performed on a PC, which makes it difficult to perform online classification.Therefore, in this work, a new method based on DWT, mathematical morphology, SVD, and statistical analysis was introduced for the fast, online detection and classification of PQD.The obtained results from numerical simulations, as well as from real voltage/current signals, demonstrate the high efficacy of the introduced method.Its realization via a FPGA-based integrated circuit ensures high certainty when detecting and classifying different PQDs in power distribution systems.The performed experiment demonstrates that the introduced approach can carry out an online, fast detection and classification of PQD in real-time, even under different noise-level contamination.In this way, our method outperforms previous PC-based approaches described in the reviewed literature by at least one order of magnitude, as they are usually applied offline, and by far surpasses the requirements established by international standards.

Figure 1 .
Figure 1.Graphical description of the wavelet-transform reconstruction and decomposition utilizing the Mallat algorithm.

Figure 5 .
Figure 5. Experiment setup for assessing the detection and classification of PQD utilizing the proposed field programmable gate array (FPGA)-based methodology.(a) Programmable alternating current (AC) power source form Chroma Systems solutions.(b) Voltage/current signal acquisition.

Figure 6 .
Figure 6.Acquired signal from the experimental setup with PQDs.

9 Figure 7 .
Figure 7. Receiver operating characteristic (ROC) curves that depict the trade-offs between the true positive and false positive classification of the proposed scheme for each class of power quality disturbance (PQD).

Table 2 .
Resource utilization in fiel programmable gate array (FPGA) from two different vendors.

Table 3 .
Implementation response time for each implementation case.

Table 4 .
Artificial neural network (ANN) Classification accuracy for power quality disturbance (PQD) signals with noise.

Table 5 .
Classification accuracy at different levels of signal to noise ratio (SNR).

Table 6 .
Assessment of the introduced FPGA-based system for detecting and classifying PQDs.

Table 7 .
Comparative assessment of the proposed FPGA-based methodology and previous approaches.

Table 8 .
Comparison chart of the introduced methodology against previous studies of PQD identification.