Detection and Classiﬁcation of Power Quality Disturbances in Power System Using Modiﬁed-Combination between the Stockwell Transform and Decision Tree Methods

: The detection, mitigation, and classiﬁcation of power quality (PQ) disturbances have been issues of interest in the power system ﬁeld. This paper proposes an approach to detect and classify various types of PQ disturbances based on the Stockwell transform (ST) and decision tree (DT) methods. At ﬁrst, the ST is developed based on the moving, localizing, and scalable Gaussian window to detect ﬁve statistical features of PQ disturbances such as the high frequency of oscillatory transient, distinction between stationary and non-stationary, the voltage amplitude oscillation around an average value, the existence of harmonics in a disturbance signal, and the root mean square voltage at the internal period of sag, swell or interruption. Then, these features are classiﬁed into nine types, such as normal, sag, swell, interruption, harmonic, ﬂicker, oscillatory transient, harmonic voltage sag, and harmonic voltage swell by using the DT algorithm that is based on a set of rules with the structure “if . . . then”. This proposed study is simulated using MATLAB simulation. The IEEE 13-bus system, the recorded real data based on PQube, and the experiment based on the laboratory environment are applied to verify the e ﬀ ectiveness.


Introduction
Power quality (PQ) is a significant issue that has become increasingly important to both electric power utilities and their customers because of financial losses caused by insufficient PQ [1]. PQ disturbance issues and the resulting problems are the consequences of using light flickers in the 1930s; air conditioners in the 1950s; sensitive electronics, computers, power electronics and microelectronics in the 1990s; and nowadays, based on the modern power electronics industry, connecting the distributed generation based on energy sources, controlling heavy non-linear loads, and using the rectifies and inverters in the industrial plant [2]. The Electric Power Research Institute (EPRI) carried out a study in the year 2001 on 24 utilities throughout the United States (US) about the occurring PQ disturbance levels in which they found 46% of power sag; 5% of frequency variations, flicker, noise, and harmonics, respectively; 7% of over voltage and under voltage, respectively; and 10% of swell and spikes, respectively [3]. A report from the Consortium for Electric Infrastructure to Support a Digital Society (CIEDS) shows that the US economy has lost from $15 billion to $24 billion every year due to PQ disturbances [4]. According to [5], almost all the PQ disturbances occur 70% of

•
It is a combination of ST and DT methods for accurately detecting and classifying nine stationary and non-stationary PQ disturbances • It responds to the automatic PQ disturbance classification in real-time analysis The rest of this paper is organized as follows: Section 2 covers the ST method while Section 3 covers the DT method. Section 4 provides the proposed algorithm for detecting and classifying PQ disturbances. A case study, simulation results, and discussion of the results are handled in Section 5. Finally, conclusions are reported in Section 6.

Stockwell Transform Method
The Stockwell transform (ST) method was proposed by Stockwell in 1996 [25] and is a powerful mathematic method for applying the time-frequency multi-resolution analysis. In this paper, the ST method is used as an extension of the WT method based on a moving and scalable localized Gaussian window. The ST is calculated by moving the window function down the signal in time across a range of frequencies and can be defined as [25,33] S where τ is the shift parameter for adjusting the position in the time axis, x(t) is the input signal, and g(f,t) is the Gaussian window function and its width is determined by the examined frequency and can be given as follows in which σ(f ) is the width of the Gaussian window. Similar to a wavelet, its value is inversely proportional to frequency f and can be defined as in Equation (3), a and b are fixed read numbers and b 0. Substituting Equations (2) and (3) into (1) and setting a is equal to zero, the ST can be rewritten as [23,34].
The ST also can be written as operations on the Fourier spectrum X(f ) of Y(t) as Energies 2020, 13 where l, m, k = 0, 1, 2, . . . , N−1; with N is the total number of sampling points and when k is equal to zero, we have and G[k,m] the Gaussian function is derived from the DFT of the Gaussian window function w(f,t), and can be considered as follows: The output of the ST is a complex matrix of the size k × n size called S-matrix, in which the rows express the time-domain distribution of the signal in the particular frequency and the columns express the frequency amplitude characteristics. Each element of the S-matrix is complexly valued. The ST-amplitude (STA) matrix used to analyze PQ disturbances is obtained as

Decision Tree Method
Data classification is the process of controlling the uniformities in a dataset and classifying them into distinctive classes. Recently, DT is one of the most numerously used classification methods. The DT method was developed in 1980 and introduced for applying the field of the power system in 1989 by Breimain and Wehenkel, respectively [26]. There are many DT algorithms such as ID3, CART, C4.5, C5.0, SPRINT, etc. Moreover, the Neyman-Pearson and Bayesian approaches are also used to classify five features, which extracted from ST. The Bayesian-based approach is considered in this study.
Assuming that there are classes (Cl) of disturbances C 0 , C 1 , C 2 , . . . , C Cl−1 , in which Cl is forewarned. Each datum is extracted that records to the feature vector with M-dimensional x = [x 1 x 2 . . . x M ] T and besides it assumes that the probability distribution of x for each class is estimated.
Let Cl hypotheses be {H i , i = 0, 1,..., Cl−1} and the ith hypotheses H i denote that a given feature vector x belongs to the class C i , we have The classification problem under the framework of hypothesis testing given a feature vector x can be regarded as deciding the best H j among the Cl possible hypotheses {H i , i = 0, 1, . . . , Cl−1} under a preselected criterion. If the probability of x being in each class is known, Equation (10) can also be written under the following form where p(x; C i ) is the probability of x being in class C i . It assumes that the conditional probability density functions {p(x|C i ), i = 0, 1, . . . Cl−1} is forewarned and the prior probabilities of all classes are equal P(C i ) = P(C j ), the feature vector x in Equation (11) can be expressed as follows: Energies 2020, 13, 3623

of 30
Under using the Bayesian approach to be the minimum of the overall risk by combining the prior knowledge of each class, the corresponding multiple hypotheses H = {H 0 , . . . , H Cl−1 } are defined as follows H i : x ∼ P(C i x), i = 0, 1, . . . , Cl − 1 (13) in which P(x|C i ) is the posterior probability of x in class C i . The risk for a given feature vector x when deciding H i is here, λ ij is the cost, that incurred for deciding H i when x actually belongs to C j . When λ ij − λ jj is always positive for i j, the overall risk can be obtained as follows Therefore, the Bayes decision rule is to minimize Equation (15) that is equivalent to choose the hypothesis H j as follows

PQ Disturbances Analysis Using ST
In order to detect and classify various PQ disturbances, the signals of PQ disturbances types, including normal voltage, voltage sag, voltage swell, interruption, flicker, oscillatory transient, harmonic, harmonic voltage sag, and harmonic voltage swell are analyzed based on the STA matrix. These disturbance signals were generated in MATLAB based on the mathematical relations introduced in [35] so that to describe the real-time data. They are decomposed using multi-resolution based ST to obtain the STA matrix with the frequency of 50 Hz, 15 cycles corresponding with total 960 points and the sampling frequency of 3.2 kHz corresponding to 64 points/cycle. In this paper, the main plots of nine types can be extracted by using the STA matrix and can be detailed as follows.
(i) Time maximum amplitude (TvA) is a maximum amplitude versus time, searching columns of STA matrix at every frequency, and can be obtained as (ii) Time amplitude of maximum frequency (TvHFA) is the last row of STA matrix.
(iii) Frequency maximum amplitude (FvA) is a maximum amplitude versus frequency, searching rows of STA matrix at every time and can be obtained as where STA ' is the transpose matrix of STA. Therefore, the obtained results are used as the input signals of the proposed detection and classification system.

Features Extraction
The performance of PQ disturbance classification depends on their features. The statistics of features of PQ disturbances are extracted from the proposed ST labeled as F 1 , F 2 , . . . , and F 5 and can be defined as follows: Feature-1 (F 1 ): This presents the existence of the high-frequency component of the oscillatory transient. For the three-phase power system, the most common harmonics are the 5, 7, and 11th Energies 2020, 13, 3623 6 of 30 harmonics and the oscillatory transient mainly includes the high-frequency components. Accordingly, F 1 is used to classify the oscillatory transient with other disturbances. If there is a peak in the proximity of the high frequency (f n ≥ 650 Hz) on FvA plots, then F 1 = 1, otherwise F 1 = 0.
Feature-2 (F 2 ): This distinguishes between stationary and non-stationary signals. If the number of peaks on TvHFA plots is greater than or equal to 2, then F 2 = 1, and if there is no peak, then F 2 = 0. Thus, if F 2 = 0, then the signal is the stationary signal as the normal, harmonic, and flicker. If F 2 = 1 then signal is the non-stationary signal as the sag, swell, interruption, harmonic voltage sag, harmonic voltage swell, and oscillatory transient. Moreover, F 2 is used to identify the start time t s (s) or k s (sample) and the end time t e (s) or k e (sample) which corresponds to the peaks on TvHFA plots of non-stationary signals.
Feature-3 (F 3 ): This presents the voltage amplitude oscillation around the average value. F 3 is determined on TvA plots as follows where mean(.) expresses the mean value of the argument and root(.) expresses the number of roots of the argument. From TvA plots, num zeros is greater than 2 for the flicker signal and num zeros is smaller than 2 for the other disturbances. Therefore, F 3 is used to distinguish the flicker signal from the other ones, if num zeros > 3 the F 3 = 1, else F 3 = 0. Feature-4 (F 4 ): This presents the existence of harmonics in the disturbance signal. F 4 is determined by using FvA plot and the total harmonic distortion (THD V ) factor can be defined as: where V 1 is corresponding to the fundamental frequency amplitude of 50 Hz, N is the number of points in the DFT. F 4 is identified as the following rule, if THD V ≤ 0.05 then F 4 = 0, otherwise F 4 = 1.
So F 4 = 1 if the signal is the voltage harmonic, harmonic voltage sag, or harmonic voltage swell, F 4 = 0 for other signals. Feature-5 (F 5 ): This is the root mean square (RMS) of the signal at the time that is the internal period of voltage sag, swell, or interruption. F 5 is defined by using the half-cycle RMS method at the time k i of sampling signal, and F 5 is calculated as follows 2V RMS (21) in which the half-cycle RMS at the sample time k i of sampling signal can be calculated as follows x 2 (kT) (22) and the sample time k i obtains from between k s and k e of the non-stationary signal as follows where round(.) is the nearest integer of the argument.
Energies 2020, 13, 3623 7 of 30 Using F 5 to distinguish between with/without voltage sag, swell and interruption signals through rules if 0.1 ≤ F 5 ≤ 0.9 then the signal is the sag signal; if 1.1 ≤ F 5 ≤ 1.8 then the signal is the swell signal; otherwise if F 5 ≤ 0.1 then the signal is the interruption signal.
The proposed ST algorithm is described in Figure 1.  (22) and the sample time ki obtains from between ks and ke of the non-stationary signal as follows where round(.) is the nearest integer of the argument. Using F5 to distinguish between with/without voltage sag, swell and interruption signals through rules if 0.1 ≤ F5 ≤ 0.9 then the signal is the sag signal; if 1.1 ≤ F5 ≤ 1.8 then the signal is the swell signal; otherwise if F5 ≤ 0.1 then the signal is the interruption signal.
The proposed ST algorithm is described in Figure 1.
Perform ST using Equations (6) and (7) Time series x(n) Set b value Apply DFT for the signal x(n): Apply DFT for the Gaussian window g(f,t) using Equation (8) Extract five features: F1, F2, F3, F4, and F5 using Equations from (17) to (23) Calculate the STA using Equation (9) Determine the Gaussian window g(f,t) using Equation (

PQ Disturbances Analysis
Case 1: The pure sine voltage waveform and related STA are shown in Figure 2. The amplitude 1 pu of frequency appears as shown in Figure 2d; it is the frequency of 50 Hz. Observing Figure 2a-c shows that the related plots of the pure since voltage obtained based on STA with constant amplitudes. Therefore, in this case, it is considered as a reference signal for detecting and classifying various PQ disturbances.

PQ Disturbances Analysis
Case 1: The pure sine voltage waveform and related STA are shown in Figure 2. The amplitude 1 pu of frequency appears as shown in Figure 2d; it is the frequency of 50 Hz. Observing Figure 2a−c shows that the related plots of the pure since voltage obtained based on STA with constant amplitudes. Therefore, in this case, it is considered as a reference signal for detecting and classifying various PQ disturbances.

Case 2:
The first disturbance is the voltage sag, in the present study, Figure 3 depicts the voltage sag of 20% and various plots related to STA. It can easily detect due to the decrease in the value 0.8 pu of the amplitude of TvA as shown in Figure 3b. It is clear from Figure 3c that the value of the amplitude of TvHFA appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.0775 s to 0.2334 s, respectively). This is the same as in the case of pure sine voltage, the amplitude 1.0 pu of frequency appears as shown in Figure 3d; it is the frequency of 50 Hz.

Case 2:
The first disturbance is the voltage sag, in the present study, Figure 3 depicts the voltage sag of 20% and various plots related to STA. It can easily detect due to the decrease in the value 0.8 pu of the amplitude of TvA as shown in Figure 3b. It is clear from Figure 3c that the value of the amplitude of TvHFA appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.0775 s to 0.2334 s, respectively). This is the same as in the case of pure sine voltage, the amplitude 1.0 pu of frequency appears as shown in Figure 3d; it is the frequency of 50 Hz.

Case 3:
The second disturbance is the voltage interruption, in this case, the voltage interruption of 5% and related STA plots are depicted in Figure 4. This voltage interruption disturbance can be approved from the change in the amplitude of TvA and TvHFA as shown in Figure 4b,c respectively. It is clear from Figure 4c that the amplitude of TvHFA value appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.06906 s to 0.18219 s, respectively).

Case 3:
The second disturbance is the voltage interruption, in this case, the voltage interruption of 5% and related STA plots are depicted in Figure 4. This voltage interruption disturbance can be approved from the change in the amplitude of TvA and TvHFA as shown in Figure 4b,c respectively. It is clear from Figure 4c that the amplitude of TvHFA value appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.06906 s to 0.18219 s, respectively).
Energies 2020, 13, x; doi: FOR PEER REVIEW www.mdpi.com/journal/energies Case 3: The second disturbance is the voltage interruption, in this case, the voltage interruption of 5% and related STA plots are depicted in Figure 4. This voltage interruption disturbance can be approved from the change in the amplitude of TvA and TvHFA as shown in Figure 4b,c respectively. It is clear from Figure 4c that the amplitude of TvHFA value appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.06906 s to 0.18219 s, respectively).

Case 4:
The third disturbance is the voltage swell, in this case, the voltage swell of 30% and related STA plots are depicted in Figure 5. This voltage swell disturbance can be approved from the change in the amplitude of TvA and TvHFA as shown in Figure 5b,c respectively. It is clear from Figure 5c that the value of TvHFA amplitude appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.06594 s to 0.19062 s, respectively).

Case 4:
The third disturbance is the voltage swell, in this case, the voltage swell of 30% and related STA plots are depicted in Figure 5. This voltage swell disturbance can be approved from the change in the amplitude of TvA and TvHFA as shown in Figure 5b,c respectively. It is clear from Figure 5c that the value of TvHFA amplitude appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.06594 s to 0.19062 s, respectively).

Case 4:
The third disturbance is the voltage swell, in this case, the voltage swell of 30% and related STA plots are depicted in Figure 5. This voltage swell disturbance can be approved from the change in the amplitude of TvA and TvHFA as shown in Figure 5b,c respectively. It is clear from Figure 5c that the value of TvHFA amplitude appears abruptly two times and it can effectively be utilized to localize the beginning and ending of voltage sag (0.06594 s to 0.19062 s, respectively).

Case 5:
The fourth disturbance is the harmonic; in this case, the harmonic and related STA plots are depicted in Figure 6. It can be observed from continuous ripples in the amplitude of TvA and TvHFA as shown in Figure 6b,c respectively. It is clear from Figure 6d that the amplitude of FvA value appears the high-level frequency and it can effectively be utilized to detect the harmonic.

Case 5:
The fourth disturbance is the harmonic; in this case, the harmonic and related STA plots are depicted in Figure 6. It can be observed from continuous ripples in the amplitude of TvA and TvHFA as shown in Figure 6b,c respectively. It is clear from Figure 6d that the amplitude of FvA value appears the high-level frequency and it can effectively be utilized to detect the harmonic.

Case 6:
The fifth disturbance is the oscillatory transient; in this case, the oscillatory transient and related STA plots are depicted in Figure 7. It can be observed from continuous ripples in the amplitude of TvA as shown in Figure 7b. In Figure 7c, the amplitude of TvHFA value appears as an oscillatory transient and in Figure 7d, the amplitude of FvA value appears as the high-level frequency, besides the frequency of 50 Hz. Therefore, the presence of oscillatory transient can be observed by significant changes in TvHFA and FvA and that is also the basis for utilization to detect the oscillatory transient voltage signal.
Energies 2020, 13, x; doi: FOR PEER REVIEW www.mdpi.com/journal/energies Case 6: The fifth disturbance is the oscillatory transient; in this case, the oscillatory transient and related STA plots are depicted in Figure 7. It can be observed from continuous ripples in the amplitude of TvA as shown in Figure 7b. In Figure 7c, the amplitude of TvHFA value appears as an oscillatory transient and in Figure 7d, the amplitude of FvA value appears as the high-level frequency, besides the frequency of 50 Hz. Therefore, the presence of oscillatory transient can be observed by significant changes in TvHFA and FvA and that is also the basis for utilization to detect the oscillatory transient voltage signal.

Case 7:
The sixth disturbance is chosen to be the flicker; in this case, the flicker and related STA plots are illustrated in Figure 8. The presence of flicker be observed by a series of circles in TvA and that is the basic to be utilized to detect the flicker voltage signal.

Case 7:
The sixth disturbance is chosen to be the flicker; in this case, the flicker and related STA plots are illustrated in Figure 8. The presence of flicker be observed by a series of circles in TvA and that is the basic to be utilized to detect the flicker voltage signal.

Case 7:
The sixth disturbance is chosen to be the flicker; in this case, the flicker and related STA plots are illustrated in Figure 8. The presence of flicker be observed by a series of circles in TvA and that is the basic to be utilized to detect the flicker voltage signal.

Case 8:
The sixth disturbance is both the voltage sag and harmonic, in the present study, Figure  9 depicts the voltage sag of 50% and various plots related to STA. It is clear from Figure 9c that the value of the amplitude of TvHFA appears abruptly two times and from Figure 9d that the amplitude of FvA value appears the high-level frequency, besides the frequency of 50 Hz. Therefore, it can effectively be utilized to localize the beginning and ending of both the voltage sag 50% and the harmonic (0.06875 s to 0.16375 s) and it can effectively be utilized to detect this disturbance.

Case 8:
The sixth disturbance is both the voltage sag and harmonic, in the present study, Figure 9 depicts the voltage sag of 50% and various plots related to STA. It is clear from Figure 9c that the value of the amplitude of TvHFA appears abruptly two times and from Figure 9d that the amplitude of FvA value appears the high-level frequency, besides the frequency of 50 Hz. Therefore, it can effectively be utilized to localize the beginning and ending of both the voltage sag 50% and the harmonic (0.06875 s to 0.16375 s) and it can effectively be utilized to detect this disturbance.
Energies 2020, 13, x; doi: FOR PEER REVIEW www.mdpi.com/journal/energies Case 8: The sixth disturbance is both the voltage sag and harmonic, in the present study, Figure  9 depicts the voltage sag of 50% and various plots related to STA. It is clear from Figure 9c that the value of the amplitude of TvHFA appears abruptly two times and from Figure 9d that the amplitude of FvA value appears the high-level frequency, besides the frequency of 50 Hz. Therefore, it can effectively be utilized to localize the beginning and ending of both the voltage sag 50% and the harmonic (0.06875 s to 0.16375 s) and it can effectively be utilized to detect this disturbance.

Case 9:
The eighth disturbance is both the voltage swell and harmonic, in the present study, Figure 10 depicts a voltage sag of 65% with harmonic and various plots related to STA. The presence of this case is the value of the amplitude of TvHFA and FvA as shown in Figure 10c,d.

Proposed Method
The proposed algorithm for detecting and classifying features of the PQ disturbances as shown in Figure 11, in which Figure 1 is the proposed ST algorithm and the rest of part is the proposed DT algorithm detailed as follows.
This algorithm is proposed based on the features F1 to F5. These features are extracted using the proposed ST algorithm to make the rules for classifying into nine voltage disturbances.

Proposed Method
The proposed algorithm for detecting and classifying features of the PQ disturbances as shown in Figure 11, in which Figure 1 is the proposed ST algorithm and the rest of part is the proposed DT algorithm detailed as follows.
This algorithm is proposed based on the features F 1 to F 5 . These features are extracted using the proposed ST algorithm to make the rules for classifying into nine voltage disturbances.
The pure sine voltage (C0) will have the values F 1 = 0, F 2 = 0, F 3 = 0, F 4 = 0, and 0.9 ≤ F 5 ≤ 1.1, whereas signals are classified under group G1 called the PQ disturbances (C1 to C8). The signals classified under group G1 are further classified into subgroup G2 and the oscillatory transient based on F 1 . The oscillatory transient voltage (C6) will have the values F 1 = 1, whereas signals are classified under group G2 called the PQ disturbances (C2 to C8).
The signals classified under group G2 are further classified into subgroup G3 (C4 and C5) and G4 (C1, C2, C3, C7, C8) based on F 2 . The group G3 contains the signals with F 2 = 0, whereas the signals with other values of F 1 are classified under group G4.
The two signals under group G3 are further classified based on the value of F 3 . The harmonic (C4) will have F 3 = 0, whereas the Flicker (C5) will have other values of F 3 .
The signals classified under group G4 are further classified into subgroup G5 (C1, C2, and C3) and G6 (C7, C8) based on F 4 . The group G5 contains the signals with F 4 = 0, whereas the signals with other values of F 4 are classified under group G6.
The two signals under group G5 are further classified based on the value of F 5 . The interruption (C2) will have F 5 < 0.1, whereas the signals with F 5 ≥ 0.1 are classified under group G7. The two signals under group G7 are further classified based on the value of F 5 . The swell (C3) will have F 5 ≥ 1.1, whereas the sag (C1) will have F 5 < 1.1. The two signals under group G5 are further classified based on the value of F5. The interruption (C2) will have F5 < 0.1, whereas the signals with F5 ≥ 0.1 are classified under group G7. The two signals under group G7 are further classified based on the value of F5. The swell (C3) will have F5 ≥ 1.1, whereas the sag (C1) will have F5 < 1.1.
According to the above description and the PQ disturbances definition, the feature values of nine types of PQ disturbances are shown in Table 1, which can be the rules of identifying and classifying PQ disturbance types.    According to the above description and the PQ disturbances definition, the feature values of nine types of PQ disturbances are shown in Table 1, which can be the rules of identifying and classifying PQ disturbance types.

Performance Evaluation
In order to evaluate the performance of the proposed method, Matlab/Simulink software is used to generate nine hundred disturbance waveforms (that means in this study 100 waveforms from each type of disturbances are generate) of PQ disturbances with different parameters such as magnitude percentages, durations and instants on waveform according to the signal models in [36]. Then the ST is used to extract the five features given in Figure 1 are calculated. These features, which include F 1 , F 2 , F 3 , F 4 , and F 5 are the input vector of the DT. Finally, the DT structure is shown in Figure 11 is used to classify the various types of PQ disturbances. The performance results of the proposed method are given in Table 2. As shown in Table 2, the ST based DT method which is proposed in this paper has the classification result with high accuracy (99.78%). From Table 2, although the average accuracy is high, but there are also some mistakes in the classification of the voltage interruption signals (98%) because the magnitude percentages of interruption and sag signals are sometimes similar.

Test the PQ Disturbance on Standard IEEE Network
In this section, the IEEE 13-bus test feeder is carried out to test the PQ events as shown in Figure 12 [41]. The test is found similar to the actual power distribution system. This system consists of 50 Hz, 5 MVA two voltage levels of 4.16 kV and 0.48 kV with balanced and unbalanced loads. The load and line parameters of the test system are presented in [41]. The monitor (M) is placed at the bus node 634 to record PQ disturbance types and it placed as shown in Figure 12. These PQ disturbances involve the voltage sag and interruption created by the short circuit fault, the voltage swell created by the switching-off load, the oscillatory transient created by switching on the capacitor, and the harmonics created by the non-linear power electronic converters. In this study, in order to test the proposed method for identifying and classifying PQ disturbance types, it can simulate the following some case studies. Observing the related STA plots at bus node 634 from Figure 13 and comparing with Figure 2, it can conclude that when phase A to ground fault occurs at F.2 the system is bearing a disturbance that is the voltage sag and the amplitude obtained based on monitor M having 0.423 pu as shown in Figure  14.
And observing the related STA plots at bus node 634 from Figure 15 and comparing with Figure  4, it can conclude that when phase A to ground fault occurs at F.1 the system is bearing a disturbance that is the voltage interruption and the amplitude obtained based on monitor M having 0.02142 pu as shown in Figure 16.

Test 1:
The phase A to ground fault occurs at F.1 and F.2 in the line between bus nodes 632 and 671 at 0.7 s and it is cleared after 0.16 s by opening the faulted line. Figures 13 and 14 plot the PQ events at bus node 634 that the system is bearing disturbance when the fault occurs at F.2 and F.1, respectively.
Observing the related STA plots at bus node 634 from Figure 13 and comparing with Figure 2, it can conclude that when phase A to ground fault occurs at F.2 the system is bearing a disturbance that is the voltage sag and the amplitude obtained based on monitor M having 0.423 pu as shown in Figure 15.
And observing the related STA plots at bus node 634 from Figure 14 and comparing with Figure 4, it can conclude that when phase A to ground fault occurs at F.1 the system is bearing a disturbance that is the voltage interruption and the amplitude obtained based on monitor M having 0.02142 pu as shown in Figure 16.
Test 2: Figure 17 plots the PQ event at bus node 634 that the system is bearing disturbance when the three-phase voltage increases from the grid. Observing the related STA plots at bus node 634 from this figure and comparing ones with Figure 5. It can conclude that when the three-phase voltage increases from the grid, the system is bearing a disturbance that is the voltage swell and the amplitude obtained based on monitor M before and after increasing the three-phase voltage 0.943 pu and 1.18 pu respectively as shown in Figure 18. can conclude that when phase A to ground fault occurs at F.2 the system is bearing a disturbance that is the voltage sag and the amplitude obtained based on monitor M having 0.423 pu as shown in Figure  14.
And observing the related STA plots at bus node 634 from Figure 15 and comparing with Figure  4, it can conclude that when phase A to ground fault occurs at F.1 the system is bearing a disturbance that is the voltage interruption and the amplitude obtained based on monitor M having 0.02142 pu as shown in Figure 16.       Figure 17 plots the PQ event at bus node 634 that the system is bearing disturbance when the three-phase voltage increases from the grid. Observing the related STA plots at bus node 634 from   Figure 17 plots the PQ event at bus node 634 that the system is bearing disturbance when the three-phase voltage increases from the grid. Observing the related STA plots at bus node 634 from  Figure 5. It can conclude that when the three-phase voltage increases from the grid, the system is bearing a disturbance that is the voltage swell and the amplitude obtained based on monitor M before and after increasing the three-phase voltage 0.943 pu and 1.18 pu respectively as shown in Figure 18.

Test 3:
We assume that the bank of the capacitor at bus node 675 switches on at 0.07 s. Figure 19 plots the related STA plots at bus node 634. Observing this figure and comparing one with Figure 6, we can conclude that when the bank of the capacitor at bus node 675 switches on, the system bears a disturbance that is the voltage harmonic and the disturbance obtained based on monitor M as shown in Figure 20.

Test 3:
We assume that the bank of the capacitor at bus node 675 switches on at 0.07 s. Figure 19 plots the related STA plots at bus node 634. Observing this figure and comparing one with Figure 6, we can conclude that when the bank of the capacitor at bus node 675 switches on, the system bears a disturbance that is the voltage harmonic and the disturbance obtained based on monitor M as shown in Figure 20.  Based on the above analysis results of the PQ events generated using the IEEE 13-bus system, the proposed combination of the ST and DT method is a highly accurate approach for PQ detection Based on the above analysis results of the PQ events generated using the IEEE 13-bus system, the proposed combination of the ST and DT method is a highly accurate approach for PQ detection and classification.

Test the PQ Disturbance on Recorded Real Data of PQube
In this test case, the PQ disturbances are used for analysis based on the recorded real data of PQube 3 equipment. This equipment is a compact instrument, and is simply the best power monitor and real-time sensor. It is made based on IEC 61000-4-30 standard and used to record all types of Energies 2020, 13, 3623 23 of 30 AC power disturbance including 4 MHz sampling of impulses. Presently, PQube 3 equipment is installed in different positions around the world to record PQ Events. The main purpose is free to study the PQ [42,43]. Figure 21 shows a view of the PQube 3 equipment installed at some locations in Europe [44].
Energies 2020, 13, x; doi: FOR PEER REVIEW www.mdpi.com/journal/energies  Based on the above analysis results of the PQ events generated using the IEEE 13-bus system, the proposed combination of the ST and DT method is a highly accurate approach for PQ detection and classification.

Test the PQ Disturbance on Recorded Real Data of PQube
In this test case, the PQ disturbances are used for analysis based on the recorded real data of PQube 3 equipment. This equipment is a compact instrument, and is simply the best power monitor and real-time sensor. It is made based on IEC 61000-4-30 standard and used to record all types of AC power disturbance including 4 MHz sampling of impulses. Presently, PQube 3 equipment is installed in different positions around the world to record PQ Events. The main purpose is free to study the PQ [42,43]. Figure 21 shows a view of the PQube 3 equipment installed at some locations in Europe [44].
The PQube with ID P007629 installed at a location in the University of Strathclyde, England was chosen to analyze this test case. This located position has line-to-line and phase-to-neutral voltages

Test 4:
We consider the event that snapshotted on 29 June 2020 (15:00:00.010 UTC), and the the line-to-line and phase-to-neutral voltages snapshotted through PQube under the RMS voltage profiles and the voltage waveforms as shown in Figure 22. To apply the proposed method, all data of the event, in this case, are recorded under the ".csv" file considered as the input signal for the proposed DT algorithm. The analyzed result is shown in Figure 23. Observing this figure, the related plots are pure since the voltage is obtained to be constant amplitudes. Therefore, it can determine the PQ disturbance event, namely the pure sine voltage (class C0). The PQube with ID P007629 installed at a location in the University of Strathclyde, England was chosen to analyze this test case. This located position has line-to-line and phase-to-neutral voltages of 400 V and 231 V, respectively, and the sampling frequency is set at the value of 128 samples per cycle corresponding to a sampling time of 156.426 microseconds. This section considers two following test cases.
Test 4: We consider the event that snapshotted on 29 June 2020 (15:00:00.010 UTC), and the the line-to-line and phase-to-neutral voltages snapshotted through PQube under the RMS voltage profiles and the voltage waveforms as shown in Figure 22. To apply the proposed method, all data of the event, in this case, are recorded under the ".csv" file considered as the input signal for the proposed DT algorithm. The analyzed result is shown in Figure 23. Observing this figure, the related plots are pure since the voltage is obtained to be constant amplitudes. Therefore, it can determine the PQ disturbance event, namely the pure sine voltage (class C0).
Test 5: Considering the event that is the voltage sag on 27 June 2020 (04:59:51.987 UTC). The voltage sag occurs at 04:59:51.987 and it is cleared after 0.051 s. The voltage sag magnitude is 12.9% of the norm voltage. For this event, the line-to-line and phase-to-neutral voltages are snapshotted through PQube as shown in Figure 24. The same is true of Test 4, all data of the event, in this case, are recorded under the ".csv" file considered as the input signal for the proposed DT algorithm. Figure 25 depicts the voltage sag and various plots related to STA. It can easily detect due to the decrease in the value 0.9 pu of the amplitude of TvA as shown in Figure 25b. It is clear from Figure 3c that the value of Energies 2020, 13, 3623 24 of 30 the amplitude of TvHFA appears abruptly two times. This is the same as in the case of pure sine voltage, the amplitude 1.0 pu of frequency appears as shown in Figure 3d; it is the frequency of 50 Hz. Therefore, it can determine the PQ disturbance event namely the voltage sag (class C1).

Test 4:
We consider the event that snapshotted on 29 June 2020 (15:00:00.010 UTC), and the the line-to-line and phase-to-neutral voltages snapshotted through PQube under the RMS voltage profiles and the voltage waveforms as shown in Figure 22. To apply the proposed method, all data of the event, in this case, are recorded under the ".csv" file considered as the input signal for the proposed DT algorithm. The analyzed result is shown in Figure 23. Observing this figure, the related plots are pure since the voltage is obtained to be constant amplitudes. Therefore, it can determine the PQ disturbance event, namely the pure sine voltage (class C0).

Test 4:
We consider the event that snapshotted on 29 June 2020 (15:00:00.010 UTC), and the the line-to-line and phase-to-neutral voltages snapshotted through PQube under the RMS voltage profiles and the voltage waveforms as shown in Figure 22. To apply the proposed method, all data of the event, in this case, are recorded under the ".csv" file considered as the input signal for the proposed DT algorithm. The analyzed result is shown in Figure 23. Observing this figure, the related plots are pure since the voltage is obtained to be constant amplitudes. Therefore, it can determine the PQ disturbance event, namely the pure sine voltage (class C0).  Figure 24. The same is true of Test 4, all data of the event, in this case, are recorded under the ".csv" file considered as the input signal for the proposed DT algorithm. Figure 25 depicts the voltage sag and various plots related to STA. It can easily detect due to the decrease in the value 0.9 pu of the amplitude of TvA as shown in Figure 25b. It is clear from Figure  3c that the value of the amplitude of TvHFA appears abruptly two times. This is the same as in the case of pure sine voltage, the amplitude 1.0 pu of frequency appears as shown in Figure 3d; it is the frequency of 50 Hz. Therefore, it can determine the PQ disturbance event namely the voltage sag

Test PQ Disturbance in Laboratory Environment
To verify the effectiveness of the proposed method, a test PQ disturbance in the laboratory environment is applied. Figure 26a shows a tested circuit installed in the laboratory, in which the Fluke Energies 2020, 13, 3623 25 of 30 435 series II is used to analyze PQ, the 400 V, 50 Hz AC three-phase voltage source is used as a supply source, and the fault creator is used to create faults. Figure 26b shows an event that captures from Fluke 435 series II when a three-phase voltage sag 40% occurs and it is cleared after 200 ms. All data of the event are recorded to be considered as the input signal for the proposed DT algorithm. This section considers two following test cases.
Energies 2020, 13, x; doi: FOR PEER REVIEW www.mdpi.com/journal/energies Test 5: Considering the event that is the voltage sag on 27 June 2020 (04:59:51.987 UTC). The voltage sag occurs at 04:59:51.987 and it is cleared after 0.051 s. The voltage sag magnitude is 12.9% of the norm voltage. For this event, the line-to-line and phase-to-neutral voltages are snapshotted through PQube as shown in Figure 24. The same is true of Test 4, all data of the event, in this case, are recorded under the ".csv" file considered as the input signal for the proposed DT algorithm. Figure 25 depicts the voltage sag and various plots related to STA. It can easily detect due to the decrease in the value 0.9 pu of the amplitude of TvA as shown in Figure 25b. It is clear from Figure  3c that the value of the amplitude of TvHFA appears abruptly two times. This is the same as in the case of pure sine voltage, the amplitude 1.0 pu of frequency appears as shown in Figure 3d; it is the frequency of 50 Hz. Therefore, it can determine the PQ disturbance event namely the voltage sag (class C1).

Test PQ Disturbance in Laboratory Environment
To verify the effectiveness of the proposed method, a test PQ disturbance in the laboratory environment is applied. Figure 26a shows a tested circuit installed in the laboratory, in which the Fluke 435 series II is used to analyze PQ, the 400 V, 50 Hz AC three-phase voltage source is used as a supply source, and the fault creator is used to create faults. Figure 26b shows an event that captures

Test 6:
The sixth test is considered for a two-phase voltage sag 40% at 100 ms and it is cleared after 200 ms. The data of the event are recorded as shown in Figure 27a. Figure 27b−d shows the related STA. observing this figure that for this test is the same Test 1 and Case 2. Therefore, it can determine the PQ disturbance event namely the voltage sag (class C1).

Test 6:
The sixth test is considered for a two-phase voltage sag 40% at 100 ms and it is cleared after 200 ms. The data of the event are recorded as shown in Figure 27a. Figure 27b-

Test 6:
The sixth test is considered for a two-phase voltage sag 40% at 100 ms and it is cleared after 200 ms. The data of the event are recorded as shown in Figure 27a. Figure 27b−d shows the related STA. observing this figure that for this test is the same Test 1 and Case 2. Therefore, it can determine the PQ disturbance event namely the voltage sag (class C1).

Test 7:
The seventh test is considered for a single-phase voltage interruption at 100 ms and it is cleared after 300 ms. The data of the event are recorded as shown in Figure 28a. Figure 28b-d shows the related STA. observing this figure that for this test is the same Test 1 and Case 3. Therefore, it can determine the PQ disturbance event, namely the voltage sag (class C2).

Test 7:
The seventh test is considered for a single-phase voltage interruption at 100 ms and it is cleared after 300 ms. The data of the event are recorded as shown in Figure 28a. Figure 28b−d shows the related STA. observing this figure that for this test is the same Test 1 and Case 3. Therefore, it can determine the PQ disturbance event, namely the voltage sag (class C2).

Conclusions
An approach based on the combination of ST and DT methods for detecting and classifying power quality (PQ) disturbances was presented in this research work. The signals of PQ disturbance types like the normal voltage, voltage sag, voltage swell, interruption, flicker, oscillatory transient, harmonic, harmonic voltage sag, and harmonic voltage swell were generated in MATLAB based on the mathematical relations under analysis of the real-time data. These signals are decomposed using multi-resolution-based proposed ST through the STA matrix with a frequency of 50 Hz, 15 cycles corresponding with total 960 points, and a sampling frequency of 3.2 kHz corresponding to 64 points/cycle to obtain five features (F1, …F5). The PQ disturbances are detected based on the time maximum amplitude, the time amplitude of maximum frequency, and the frequency maximum amplitude of the STA matrix. The proposed DT method is used to classify PQ disturbances based on five features to nine voltage disturbances.
The effectiveness of the proposed method is verified on the IEEE 13-bus system, the recorded real data based on PQube, and the experiment based on the laboratory environment. The obtained results show that the proposed algorithm accurately detects and classifies nine stationary and non-

Conclusions
An approach based on the combination of ST and DT methods for detecting and classifying power quality (PQ) disturbances was presented in this research work. The signals of PQ disturbance types like the normal voltage, voltage sag, voltage swell, interruption, flicker, oscillatory transient, harmonic, harmonic voltage sag, and harmonic voltage swell were generated in MATLAB based on the mathematical relations under analysis of the real-time data. These signals are decomposed using multi-resolution-based proposed ST through the STA matrix with a frequency of 50 Hz, 15 cycles corresponding with total 960 points, and a sampling frequency of 3.2 kHz corresponding to 64 points/cycle to obtain five features (F 1 , . . . F 5 ). The PQ disturbances are detected based on the time maximum amplitude, the time amplitude of maximum frequency, and the frequency maximum amplitude of the STA matrix. The proposed DT method is used to classify PQ disturbances based on five features to nine voltage disturbances. The effectiveness of the proposed method is verified on the IEEE 13-bus system, the recorded real data based on PQube, and the experiment based on the laboratory environment. The obtained results show that the proposed algorithm accurately detects and classifies nine stationary and non-stationary PQ disturbances with an accuracy as high as 99.78% and responds to the automatic PQ disturbance classification in real-time analysis.