Next Article in Journal
Simulation Analysis of Onshore and Offshore Wind Farms’ Generation Potential for Polish Climatic Conditions
Previous Article in Journal
Multi-Market Coupling Mechanism of Offshore Wind Power with Energy Storage Participating in Electricity, Carbon, and Green Certificates
Previous Article in Special Issue
Correction: Shi et al. Parameter Estimation Method for Virtual Power Plant Frequency Response Model Based on SLP. Energies 2024, 17, 3124
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Detection and Classification of Power Quality Disturbances Based on Improved Adaptive S-Transform and Random Forest

1
Electric Power Science Research Institute, State Grid Shanxi Electric Power Company, Taiyuan 030001, China
2
Shanxi Key Laboratory of Mining Electrical Equipment and Intelligent Control, Taiyuan University of Technology, Taiyuan 030024, China
3
College of Electronic Information Engineering, Taiyuan University of Science and Technology, Taiyuan 030024, China
*
Author to whom correspondence should be addressed.
Energies 2025, 18(15), 4088; https://doi.org/10.3390/en18154088 (registering DOI)
Submission received: 3 June 2025 / Revised: 18 July 2025 / Accepted: 21 July 2025 / Published: 1 August 2025

Abstract

The increasing penetration of renewable energy into power systems has intensified transient power quality (PQ) disturbances, demanding efficient detection and classification methods to enable timely operational decisions. This paper introduces a hybrid framework combining an Improved Adaptive S-Transform (IAST) with a Random Forest (RF) classifier to address these challenges. The IAST employs a globally adaptive Gaussian window as its kernel function, which automatically adjusts window length and spectral resolution based on real-time frequency characteristics, thereby enhancing time–frequency localization accuracy while reducing algorithmic complexity. To optimize computational efficiency, window parameters are determined through an energy concentration maximization criterion, enabling rapid extraction of discriminative features from diverse PQ disturbances (e.g., voltage sags and transient interruptions). These features are then fed into an RF classifier, which simultaneously mitigates model variance and bias, achieving robust classification. Experimental results show that the proposed IAST–RF method achieves a classification accuracy of 99.73%, demonstrating its potential for real-time PQ monitoring in modern grids with high renewable energy penetration.

1. Introduction

In recent years, the integration of a large amount of renewable energy has posed significant challenges to power quality. In addition, the increasing penetration of power electronic devices, nonlinear loads, and electric vehicles has led to more frequent power quality disturbances [1,2,3], with increasingly complex disturbance types. These disturbances have resulted in greater economic losses and safety risks for power users [4]. Efficiently extracting the features of various power quality disturbances and accurately classifying them plays a critical role in the assessment and mitigation of power quality issues.
Time–frequency analysis is a fundamental technique for detecting power disturbance signals. Several signal processing-based time–frequency analysis methods have been applied in the field of power quality disturbance detection [5], such as Short-Time Fourier Transform (STFT) [6], Wavelet Transform [7,8], Hilbert Transform [9], and S-Transform [10,11,12], among others. Among these, the S-Transform (ST) can be viewed as a combination of STFT and Wavelet Transform. Its time–frequency matrix is highly effective in representing both time-domain and frequency-domain disturbance characteristics of power quality.
However, the conventional S-Transform (ST) relies on a Gaussian window whose standard deviation varies inversely with frequency, limiting its adaptability for diverse PQ disturbances. Alternatives such as Blackman [13], Bohman [14], and Kaiser windows [15] can improve flexibility but sacrifice the Gaussian window’s superior time–frequency resolution [16]. The Generalized S-Transform (GST) introduces modulation factors to adjust window width [17,18], yet lacks a systematic parameter-selection scheme and still underperforms over wide frequency spans. Multi-segment approaches further enhance local resolution by applying different Gaussian windows per band [19,20,21,22,23], but their complex structures demand frequent parameter switching, increasing computational overhead and hindering simultaneous detection of composite disturbances [24]. A concise solution that balances resolution, adaptability, and efficiency remains necessary.
Classification is the second key step, used to accurately assign each power quality (PQ) disturbance to its corresponding category. The performance of classification models generally depends on the dataset, the dimensionality of the dataset, and parameter tuning to avoid overfitting. Artificial Neural Networks (ANN) [25,26], Support Vector Machines (SVM) [27], and Decision Trees (DT) [28,29] are among the most widely used classification models for PQ disturbance classification.
ANN-based classifiers have fast learning processes, and their weight adjustments do not require iteration, offering quick response times. This makes ANN classifiers widely used. However, they tend to perform slowly when classifying new disturbances, requiring a significant amount of training data and sometimes necessitating retraining, which limits their applicability in real-time systems. On the other hand, SVM has the advantage of a simple structure and can achieve good generalization with relatively few training samples. However, when there are many disturbance types, feature aliasing can lead to an increased error rate in classification. DT-based classifiers are relatively easy to implement, but their performance can be negatively affected by irrelevant data, and their classification accuracy decreases when dealing with more complex disturbance types.
In this paper, a method for detecting and classifying power quality disturbances based on improved adaptive S-transform and random forest is proposed. A global adaptive Gaussian window is constructed as the kernel function for IAST, accompanied by corresponding parameter selection and a fast calculation scheme. By applying IAST to quickly and accurately perform time–frequency analysis on power quality disturbances, four feature quantities that can characterize various types of power quality disturbances are extracted. On this basis, a random forest classifier is used to classify different disturbance signals. Due to the high efficiency of IAST, the efficiency of the random forest classifier is also guaranteed. Finally, the effectiveness of the method proposed in this paper is verified through experiments, and 16 types of power quality disturbance signals are generated. Results confirm that the proposed method accurately detects and classifies disturbances under both noise-free and noisy conditions. Its effectiveness for real-time PQ monitoring is validated by experiments, with future work focusing on field deployment.

2. Improved Adaptive S-Transform and Random Forest

2.1. Traditional ST and Other Improved ST

S-Transform is an invertible time–frequency analysis method. For any time-domain signal x(t), the definition of the S-Transform is given by the following equation:
S ( τ , f ) = x ( t ) ω ( τ t , f ) e j 2 π f t d t
The window function of ST is as follows:
ω S ( τ t , f ) = 1 σ S ( f ) 2 π e ( τ t ) 2 2 σ s ( f ) 2
The standard deviation of the Gaussian window is as follows:
σ S ( f ) = 1 / f
where ω S ( τ t , f ) represents the Gaussian window function of the S-Transform, and Equation (2) provides its explicit expression. The parameter τ is the time-shifting factor that controls the position of the window in the time domain, while the standard deviation σ S ( f ) is a function of the signal frequency f.
From Equation (3), it can be seen that in the traditional S-Transform, the standard deviation of the window is inversely proportional to the frequency f, which results in poor adaptability between the window and the detected signal, limiting the detection range. To increase the degree of freedom in controlling the window’s standard deviation, the generalized S-Transform (GST) was proposed in [13]. The window function in GST is defined as
ω GST ( τ t , f ) = α f β 2 π e α 2 f 2 β ( τ t ) 2 2
The GST introduces an amplitude stretching factor α and a frequency scaling factor β based on the structure of Equation (2), which enhances the flexibility of adjusting the time–frequency resolution. Considering the detection requirements of disturbance features, the goal is to achieve high time resolution when detecting low frequencies and high frequency resolution when detecting high frequencies. However, this method does not fundamentally change the inverse proportional relationship between window width and detection frequency. As the detection frequency increases, the window width narrows, and the trend of change in time–frequency resolution is opposite to the detection requirements, leading to a decrease in the accuracy of time–frequency feature extraction.
To address this issue and allow the window function to adapt to the time–frequency analysis requirements of disturbances across different frequency ranges, a dual-window detection method, the Double Resolution S-Transform (DRST), was proposed in [15]. It is defined as
D R S T = x ( t ) g l f 2 π e ( τ t ) 2 g l f 2 e j 2 π f t d t     f 1.5 f 0   g l > f x ( t ) g h f 2 π e ( τ t ) 2 g h f 2 e j 2 π f t d t f > 1.5 f 0   g h < f
The DRST divides the frequency range of the disturbance signal into low-frequency and high-frequency regions, using different window width adjustment factors g l and g h for each region. This modification helps alter the fixed inverse proportional relationship between window width and frequency, thus improving the time–frequency resolution for disturbances in different frequency bands. However, this method increases the complexity of both the window function structure and the algorithm, leading to lower detection efficiency.

2.2. Improved Adaptive S-Transform

To improve the adaptability of the window function to disturbances across various frequencies, this paper proposes a globally adaptive Gaussian window, which has a single structure that meets the time–frequency analysis requirements of complex disturbances. It enables more efficient time–frequency transformations of disturbance signals.
In time–frequency signal analysis, there exists a fundamental trade-off between time and frequency resolution: a narrower analysis window yields better time resolution at the cost of frequency resolution, while a wider window improves frequency resolution but compromises time resolution. This trade-off makes it impossible to simultaneously achieve optimal resolution in both domains, which necessitates careful window design in time–frequency transforms. According to the Heisenberg uncertainty principle, a narrower window width provides higher time resolution but reduces frequency resolution. Conversely, a wider window width offers higher frequency resolution but reduces time resolution. It is impossible to achieve optimal time and frequency resolution simultaneously. To make the detection algorithm more efficient, the proposed window function maintains a single window structure, and its width is adaptively adjusted based on the standard deviation σ(f) for the detection frequency.
The designed window function is as follows:
ω ( τ t , f ) = 1 σ ( f ) 2 π e ( τ t ) 2 2 σ 2 ( f )
where σ ( f ) represents the standard deviation of the Gaussian window, defined as
σ ( f ) = 1 / λ 1 f + λ 2
The standard deviation can be flexibly controlled by two window width adjustment factors λ l and λ 2 . By setting λ l to be less than 0 and combining it with λ 2 to ensure that the overall value λ l f + λ 2 remains positive, the standard deviation σ ( f ) can be adjusted as described in Equation (7). As the detection frequency f increases or decreases, σ ( f ) will increase or decrease accordingly, causing the window width to expand or contract. This approach ensures that as the detection frequency increases, the frequency resolution also improves, providing accurate frequency resolution for detecting oscillatory transients, harmonics, and other frequency-domain disturbances. On the other hand, it also ensures that a high time resolution is maintained at the fundamental frequency, allowing for precise monitoring of voltage amplitude changes and their occurrence time. Figure 1 shows the time-domain window width and frequency spectrum of the adaptive Gaussian window.
As shown in Figure 1a, when the standard deviation is 0.5, the effective window width in the time domain is relatively narrow. In contrast, Figure 1b corresponds to a wider main lobe and lower amplitude side lobes, providing higher time resolution. As the detection frequency increases, the standard deviation increases to 1.5, causing the main lobe in the frequency response to narrow, thus providing high frequency resolution. Therefore, the proposed globally adaptive Gaussian window can meet the time–frequency analysis requirements of complex disturbances, while maintaining a low okcomplexity for the window function.
Based on the globally adaptive Gaussian window, the improved adaptive S-Transform is defined as
I A S T ( τ , f ) = x ( t ) λ 1 f + λ 2 2 π e ( τ - t ) 2 λ 1 f + λ 2 2 2 e j 2 π f t d t
Using the convolution theorem and the inverse fast Fourier transform (IFFT), one can obtain the following:
I A S T ( τ , f ) = X ( α + f ) e 2 π 2 α 2 λ 1 f + λ 2 2 e j 2 π α τ d α
where X ( α + f ) is the Fourier transform of signal x ( t ) following a frequency-domain shift of α .
From the characteristics of the different forms of S-Transforms discussed above, it can be seen that the IAST addresses the issues of poor time–frequency resolution in the generalized S-Transform and the complex window function structure with low detection efficiency in multi-resolution S-Transforms. The IAST is able to balance both the accuracy of the detection algorithm and its execution efficiency.
In this paper, the standard deviation of the Gaussian window is linearly defined as σ ( f ) = 1 / λ 1 f + λ 2 to ensure adaptive time–frequency resolution across a wide frequency band. Compared with traditional inverse proportional forms, the proposed linear formulation facilitates both time resolution at low frequencies and frequency resolution at high frequencies. Parameters λ1 and λ2 are determined by an energy concentration optimization scheme, balancing the trade-off between time and frequency resolution.

2.3. Parameter Selection and Fast Calculation Scheme

2.3.1. Parameter Selection Scheme

Currently, many methods lack a systematic basis for parameter selection and fail to fully consider the intrinsic properties of the detected signal, such as its time-varying frequency distribution and energy distribution characteristics (i.e., energy concentration), which are essential for accurate time–frequency localization. To address this, this paper proposes a parameter optimization scheme with the goal of enhancing the energy concentration of the IAST signal as an objective function, thereby improving both the energy concentration in signal detection and the adaptability between the window function and the signal.
The energy concentration [30] applied to the improved adaptive S-Transform is defined as
E C M IAST ( λ 1 , λ 2 ) = 1 I A S T λ 1 , λ 2 ¯ ( τ , f ) d τ d f
where normalized IAST matrix is given by the following:
I A S T λ 1 , λ 2 ¯ ( τ , f ) = I A S T λ 1 , λ 2 ( τ , f ) I A S T λ 1 , λ 2 ( τ , f ) 2 d τ d f
In time–frequency signal analysis, there exists a fundamental trade-off between time and frequency resolution: a narrower analysis window yields better time resolution at the cost of frequency resolution, while a wider window improves frequency resolution but compromises time resolution. This trade-off makes it impossible to simultaneously achieve optimal resolution in both domains. Therefore, while enhancing energy concentration, it is necessary to consider the trade-off between time and frequency resolution as a constraint. The parameter values under these conditions are key to ensuring that the window can adapt to complex disturbance signals.
The following constraints are set first:
σ low σ ( f ) σ up
In the equation, σ ( f ) represents the standard deviation of the global adaptive Gaussian window, and σ low and σ up determine the upper limits of time resolution and frequency resolution, respectively. For discrete signal sampling sequences, σ low can be replaced by n T s , where T s is the sampling period of the signal and n is an integer greater than or equal to 1. In this paper, n is set to 5. Therefore, the left-hand side of Equation (12) can be converted into the following constraint condition:
1 / λ 1 f min + λ 2 n T s
where f min < f < f max , with f max determined by the detection signal based on the sampling theorem, and the minimum frequency f min set to 1 Hz, Equation (13) is transformed into
n T s * ( λ 1 f min + λ 2 ) 1 0
Similarly, the right-hand side of Equation (12) can be transformed into constraint condition 2:
1 / λ 1 f max + λ 2 u T s 0
In this paper, the value of u is set to 300, which results in u T s = 0.06. In addition to constraining based on time and frequency resolution, it is also necessary to impose reasonable limits on the parameters themselves to improve the speed of parameter optimization. The overall parameter optimization scheme is as follows:
max   arg λ 1 , λ 2 1 M A S T λ 1 , λ 2 ¯ ( τ , f ) d τ d f s . t .     n T s * ( λ 1 f min + λ 2 ) 1 0        1 / ( λ 1 f max + λ 2 ) u T s 0        λ 1 ( 0.1 , 0.0015 )        λ 2 ( 15 , 35 )
The interior-point method is used to obtain parameter solutions that enhance energy concentration while balancing the trade-off between time–frequency resolution, resulting in satisfactory performance in composite disturbance detection. In the experiments, the optimized parameters a = –0.0016 and b = 21.84 yielded the highest energy concentration (ECM = 0.0046).
In this study, n is set to 5 to ensure sufficient temporal resolution while maintaining computational efficiency, based on empirical testing and recommendations from related literature [30]. Likewise, u is set to 300 to restrict the upper bound of σ up to 0.06, which ensures acceptable frequency resolution without degrading energy concentration.

2.3.2. Fast Calculation Scheme

For a disturbance signal with a length of N points, the traditional ST has a time complexity of O ( N 3 ) . By utilizing the Fourier transform in the frequency domain, this can be reduced to O ( N 2 log 2 N ) [31]. However, based on reasonable parameter selection, most of the energy in the actual signal analysis is concentrated near the main frequency points. In contrast, the other frequency points mainly contain non-essential feature information, which still consumes a significant amount of computational resources. Therefore, in this paper, an automatic thresholding method based on the Fourier spectrum is used to filter out non-dominant frequency points, and time–frequency calculations are only performed on the dominant frequency points. An improved adaptive fast S-Transform (IAFST) is then constructed.
As an example, consider a signal that includes voltage sag and three different harmonic components with varying amplitudes. The principle of the automatic thresholding method is to first perform a Fourier transform on the disturbance signal to obtain its frequency spectrum, which allows for a preliminary assessment of the frequency distribution. Based on the characteristics of the actual disturbance signal, a threshold is set, and frequency components with amplitudes exceeding this threshold are defined as dominant frequency points. The remaining non-dominant frequency points are automatically filtered out. The basic process is shown in Figure 2. In consideration of removing the impact of noise interference and the fact that some disturbance frequencies with short durations may have smaller spectral amplitudes, the threshold is set to 0.02 pu in this paper. Only the selected dominant frequency points are subjected to improved time–frequency analysis. For a signal of length N, the time complexity of calculating all frequency points sequentially is O ( N 2 log 2 N ) . However, the number of dominant frequency points v determined by the automatic thresholding method is much smaller than N, which reduces the time complexity of the IAST calculation to O ( N log 2 N ) .
Another advantage of using the automatic thresholding method is that there is no need to separately compute the Fourier spectrum, as the FFT of the disturbance signal is an inherent step in the S-Transform, thus further reducing the computational workload.
To reduce computation and support real-time feasibility, the discrete form of the IAFST algorithm is derived for efficient implementation. For an input signal with a sampling period T s and a sampling length N, the time variable t and frequency f in Equation (9) are discretized as m T s and k / N T s , respectively, where m and k are the indices of discrete time and discrete frequency. By calculating only the main frequency points, the discrete form of the IAFST can be expressed as
I A F S T ( m T s , k i N T s ) = l = 0 N 1 X ( l + k i N T s ) W ( l N T s , k i N T s ) e j 2 π l m N
where k i represents the main frequency points selected by the automatic thresholding method, while m and l range from 0, 1, 2, …, N − 1 and i ranges from 1, 2, …, v. X ( ( l + k i ) /   N T s ) is the discrete form of X α + f from Equation (9), and W l /   N T s , k i /   N T s represents the discrete Fourier transform of the adaptive Gaussian window. The detailed implementation flow of the IAFST algorithm is shown in Figure 3.

2.4. Basic Principle of Random Forest

The random forest classification algorithm is a large ensemble classification model composed of multiple tree-based classification models. It is a combination of the Bagging algorithm and the random subspace method. The basic building block of random forest is the decision tree, and the fundamental principle is to improve the accuracy of classification predictions through the aggregation of multiple decision trees. Typically, the decision trees used in random forest are binary trees [32]. The randomness in data sampling and the collective voting process of numerous decision trees ensure that random forest exhibits resistance to overfitting and achieves high accuracy. The basic principle is illustrated in Figure 4. This paper combines IAST and RF for the detection and classification of power quality disturbances.

3. Detection Capability of the Proposed IAST

3.1. Time–Frequency Analysis of Composite Disturbance

Considering that voltage waveform distortions can arise from events such as fault-induced transients and the integration of large-scale renewable energy, resulting in the coexistence of multiple frequency components [33], this paper first designs a composite disturbance test scheme, which includes voltage sag, oscillatory transients, and harmonics, to verify the performance of the IAST detection algorithm.
Based on the IEEE power quality monitoring standard IEEE Std 1159-2019 [34], the mathematical model of the composite disturbance signal set in MATLAB (2019) is shown in Equation (18). The sampling frequency is set to 5 kHz with 1000 sampling points. Under identical experimental conditions, the time–frequency analysis effects of different algorithms are compared.
x ( t ) = ε ( t 0 & t < 0.08 t > 0.16 ) × sin ( 2 π f 0 t )      + 0.6 × ( ε ( t 0.08 ) ε ( t 0.16 ) ) × sin ( 2 π f 0 t )      + [ ε ( t 0.08 ) ε ( t 0.18 ) ] × 0.7 × sin ( 5 * 2 π f 0 t )      + [ ε ( t 0.02 ) ε ( t 0.12 ) ] × sin ( 14 * 2 π f 0 t )      + 1.3 e t 0.11 0.03 ( ε ( t 0.11 ) ε ( t 0.14 ) )      × sin ( 29 * 2 π f 0 ( t 0.14 )
where f 0 represents the system frequency of 50 Hz, and ε t is the step function. The signal includes a voltage sag with a magnitude of 0.6 pu occurring from 0.08 to 0.16 s, accompanied by time-varying harmonics of the 5th and 14th order within the time intervals of 0.08–0.18 s and 0.02–0.12 s, respectively, as well as a transient oscillation with a frequency of 29 times the system frequency between 0.11 and 0.14 s. The composite disturbance signal was subjected to time–frequency analysis using GST, DRST (high-frequency structural parameters), and IAST. The resulting 2D time–frequency transformation is shown in Figure 5.
Figure 5 shows that IAST, optimized via energy concentration, provides superior time–frequency resolution and feature extraction compared to GST and DRST. Specifically, after optimization, the window width adjustment factors for IAST are λ 1 = 0 . 0016 and λ 2 = 21 . 84 .

3.2. Detection of Power Quality Disturbances

Based on the 2D time–frequency matrix, the specific feature information of the disturbance signal can be further extracted. In practical detection, the fast version of the proposed algorithm, IAFST, will be used to perform time–frequency analysis and extract feature information solely for the main frequency components. Figure 6 shows the extracted feature information curves for each of the three algorithms in their respective 2D time–frequency matrices.
As shown in Figure 6, for composite disturbance signals containing multiple frequency components, GST exhibits good performance in detecting the fundamental frequency amplitude. However, as the detection frequency increases, its frequency resolution gradually decreases, even leading to frequency aliasing, which prevents accurate detection of high-frequency components. DRST (high-frequency structure) improves frequency resolution in the high-frequency range compared to GST; however, its fundamental frequency amplitude curve deviates significantly from the actual disturbance signal waveform, making it unable to accurately detect the disturbance intensity at the fundamental frequency. Furthermore, switching to DRST’s low-frequency structure parameters reduces frequency detection accuracy. In contrast, the fundamental frequency amplitude curve of IAFST closely matches the actual signal waveform. While accurately extracting disturbance amplitude, IAFST also demonstrates good frequency detection capabilities for high-frequency components, without the need to switch window parameters during the detection process. Thus, it can be concluded that IAFST efficiently meets the time–frequency analysis requirements for various types of disturbances.
To further verify the accuracy of IAFST, accuracy tests were conducted using IAFST, DRST, and GST. The characteristic information of five types of disturbances, such as amplitude, frequency components, and duration, was extracted. The final results are shown in Table 1.
As shown in Table 1, both IAFST and DRST maintain relatively small detection errors. IAFST does not require parameter switching and can maintain good adaptability across the entire frequency range of disturbances. In contrast, DRST ensures high accuracy only by continuously switching between high and low-frequency structure parameters, making the algorithm more complex and reducing detection efficiency. Although GST also does not require switching window parameters, its detection accuracy is significantly lower than that of IAFST. As the detection frequency increases, its frequency resolution continually decreases, leading to frequency detection errors. Additionally, the amplitude recognition errors for high-order harmonics and the fundamental frequency disturbances are also relatively large.
The execution speed of power quality disturbance detection algorithms is a key factor in ensuring detection and classification efficiency. This study tested the execution times of different algorithms in detecting various disturbances using MATLAB. The test results are shown in Table 2.
Table 2 shows that IAFST achieves the fastest execution speed due to its universal adaptive window and efficient computation scheme. Since DRST requires frequent switching of window parameters based on detection frequency, and GST lacks a fast computation scheme, both have longer execution times compared to IAFST. Additionally, combining the results from Table 1, it can be concluded that IAFST offers the highest detection efficiency.

4. Power Quality Disturbances Classification Based on Random Forest

4.1. Feature Extraction

The accuracy and dimensionality of feature extraction directly affect the classification accuracy of the random forest. Moreover, feature selection plays a crucial role in the construction of fandom forest trees. Therefore, it is essential to first extract features that can effectively characterize various types of disturbances to serve as inputs for the classification model.
By extracting features such as the energy and standard deviation of the Fundamental Frequency Amplitude (FFA) curve, the types of time-domain disturbance signals, including voltage sag, swell, interruption, and flicker, can be determined. On the other hand, the kurtosis coefficient of the overall signal and the proportion of disturbance time for non-fundamental frequency components can be used to distinguish some composite power quality disturbances. In this study, four types of disturbance features—F1, F2, F3, and F4—are selected as inputs for the classification model. The specific mathematical expression for feature selection is shown in Table 3.

4.2. Disturbance Signal and Classification Framework

In this study, 16 types of disturbance signals are used to train and test the performance of the proposed classification method. The specific disturbance types used are shown in Table 4.
The IAFST algorithm first extracts four features from each disturbance signal. These are then input into the trained random forest model to classify the disturbance type. The overall framework based on IAFST and RF for disturbance classification is shown in Figure 7.

4.3. Classification of Power Quality Disturbances

There are several key parameters that need to be set during the training of the random forest, such as the number of decision trees and maximum number of decision splits per tree. The number of decision trees in a random forest directly affects classification performance. Therefore, this study evaluates the classification accuracy under different tree counts, as shown in Figure 8.
As shown in Figure 8, the classification accuracy peaks when the number of trees is 70, and it improves with a higher proportion of training data. However, increasing the number to 120 or 150 leads to a drop in accuracy due to overfitting in individual trees.
The tree depth is constrained by the maximum number of splits. Too few splits may cause underfitting and reduce accuracy. This study compares classification performance under five different split limits, as shown in Figure 9.
As shown in Figure 9, the highest classification accuracy is achieved with a maximum split number of 40. A split limit of 20 results in underfitting, while 60 causes overfitting, reducing performance. Therefore, 40 provides the best balance. In summary, based on classification accuracy, the final model uses 70 trees with a maximum split number of 40.
During model training, 200 samples were selected for each disturbance type, with the disturbance parameters randomly generated. In total, 70% of the samples were used as the training set. The final average classification accuracy results are shown in Table 5, and are compared with the traditional ST and SVM methods.
As shown in Table 5, the classification accuracy of the proposed IAFST–RF method is 99.73%, which is higher than the classification accuracy of 98.65% achieved by combining IAFST with SVM. On the other hand, using IAFST as the feature extraction method yields a significantly higher accuracy compared to using ST, further demonstrating the effectiveness of the proposed detection and classification method. In addition, to evaluate the performance of IAFST–RF in noisy environments, classification accuracy was tested at 20 dB, 30 dB, and 40 dB, and the results are shown in Table 6.
As shown in Table 6, the proposed method still maintains a high classification accuracy in noisy environments, which proves that the method not only has high feature extraction efficiency but also demonstrates good classification performance in both normal and noisy environments.

5. Conclusions

This paper proposes a method that can efficiently detect and classify power quality disturbances. The main conclusions are as follows:
(1)
A global adaptive Gaussian window was designed to automatically adjust width and spectral characteristics based on the detection frequency, enabling efficient time–frequency analysis with a simplified structure and lower computational complexity.
(2)
The window function adjustment factor was determined using an enhanced energy concentration parameter tuning scheme. An automatic thresholding method was then employed in the fast IAST algorithm. This approach significantly reduces computational load while maintaining detection accuracy, thereby improving algorithm execution efficiency.
(3)
The proposed IAFST–RF classification method achieves 99.7% average accuracy under noise-free conditions and over 99% in noisy environments, demonstrating both robustness and efficiency.
The proposed method enables fast and accurate classification of PQ disturbances, supporting real-time monitoring and informed decision-making in power systems. This study is based on simulated data, and future work will focus on validating the method using real-world measurements and exploring its deployment on embedded systems for real-time applications.

Author Contributions

Conceptualization, D.Y.; data curation, D.Y. and S.L.; methodology, D.Y. and S.L.; validation, D.Y. and J.W.; writing—original draft, L.Z. and Y.G. All authors have read and agreed to the published version of the manuscript.

Funding

This paper is supported by the Natural Science Foundation of Shanxi Province 202403021211215 and 202203021211201.

Data Availability Statement

Data are available upon request.

Conflicts of Interest

Authors Dongdong Yang and Shixuan Lü were employed by the Electric Power Science Research Institute, State Grid Shanxi Electric Power Company. The remaining authors declare that the research was conducted in the absence of any commercial or financial relationships that could be construed as a potential conflict of interest.

Abbreviations

PQPower Quality
IASTImproved Adaptive S-Transform
RFRandom Forest
STS-Transform
GSTGeneralized S-Transform
DRSTDouble Resolution S-Transform
IAFSTImproved Adaptive Fast S-transform

References

  1. Gonzalez-Abreu, A.D.; Osornio-Rios, R.A.; Elvira-Ortiz, D.A.; Jaen-Cuellar, A.Y.; Delgado-Prieto, M.; Antonino-Daviu, J.A. Power Disturbance Monitoring through Techniques for Novelty Detection on Wind Power and Photovoltaic Generation. Sensors 2023, 23, 2908. [Google Scholar] [CrossRef] [PubMed]
  2. Bernardes, H.; Minussi, C.R. Detection and Classification of Voltage Disturbances in Electrical Power Systems Based on Multiresolution Analysis and Negative Selection Algorithm. Energies 2024, 17, 3403. [Google Scholar] [CrossRef]
  3. Perez-Anaya, E.; Jaen-Cuellar, A.Y.; Elvira-Ortiz, D.A.; Romero-Troncoso, R.D.; Saucedo-Dorantes, J.J. Methodology for the Detection and Classification of Power Quality Disturbances Using CWT and CNN. Energies 2024, 17, 852. [Google Scholar] [CrossRef]
  4. Lee, C.Y.; Shen, Y.X. Optimal Feature Selection for Power-Quality Disturbances Classification. IEEE Trans. Power Deliv. 2011, 26, 2342–2351. [Google Scholar] [CrossRef]
  5. Yang, S.; Shan, T.; Yang, X. Interpretable DWT-1DCNN-LSTM Network for Power Quality Disturbance Classification. Energies 2025, 18, 231. [Google Scholar] [CrossRef]
  6. Huang, J.; Qu, H.; Li, X. Classification for hybrid power quality disturbance based on STFT and its spectral kurtosis. Power Syst. Technol. Press 2016, 40, 3184–3191. [Google Scholar]
  7. Ray, P.K.; Kishor, N.; Mohanty, S.R. Islanding and Power Quality Disturbance Detection in Grid-Connected Hybrid Power System Using Wavelet and S-Transform. IEEE Trans. Smart Grid 2012, 3, 1082–1094. [Google Scholar] [CrossRef]
  8. Yang, L.; Guo, L.; Zhang, W.; Yang, X. Classification of Multiple Power Quality Disturbances by Tunable-Q Wavelet Transform with Parameter Selection. Energies 2022, 15, 3428. [Google Scholar] [CrossRef]
  9. Sahani, M.; Dash, P.K. FPGA-based online power quality disturbances monitoring using reduced-sample HHT and class-specific weighted RVFLN. IEEE Trans. Ind. Informat 2019, 15, 4614–4623. [Google Scholar] [CrossRef]
  10. Wang, H.H.; Wang, P.; Liu, T. Power Quality Disturbance Classification Using the S-Transform and Probabilistic Neural Network. Energies 2017, 10, 107. [Google Scholar] [CrossRef]
  11. Khoa, N.M.; Van Dai, L. Detection and Classification of Power Quality Disturbances in Power System Using Modified-Combination between the Stockwell Transform and Decision Tree Methods. Energies 2020, 13, 3623. [Google Scholar] [CrossRef]
  12. Ravi, T.; Kumar, K.S.; Dhanamjayulu, C.; Khan, B. Utilization of Stockwell Transform and Random Forest Algorithm for Efficient Detection and Classification of Power Quality Disturbances. J. Electr. Comput. Eng. 2023, 1, 6615662. [Google Scholar] [CrossRef]
  13. Li, J.; Qin, G.; Li, Y.; Dong, J.; Sun, W. Feature Extraction Based on S-transform of Blackman Window and Window Ratio in Power Quality Disturbances. High Volt. Eng. 2020, 46, 2769–2779. [Google Scholar]
  14. Yuan, L.; Zhang, C.; Yin, B.; Li, B.; Zuo, L. Accurate and Fast Feature Extraction Method of Power Quality Disturbances Based on Modified S-Transform of Optimal Bohman Window. J. Electron. Inf. Technol. 2022, 44, 3796–3805. [Google Scholar]
  15. Liang, C.B.; Teng, Z.S.; Li, J.M.; Yao, W.X.; Hu, S.Y.; Yang, Y.; He, Q. A Kaiser Window-Based S-Transform for Time-Frequency Analysis of Power Quality Signals. IEEE Trans. Ind. Inform. 2022, 18, 965–975. [Google Scholar] [CrossRef]
  16. Liang, C.B.; Teng, Z.S.; Li, J.M.; Yao, W.X.; Wang, L.; He, Q.; Hu, S.Y. Improved S-Transform for Time-Frequency Analysis for Power Quality Disturbances. IEEE Trans. Power Deliv. 2022, 37, 2942–2952. [Google Scholar] [CrossRef]
  17. Huang, N.T.; Zhang, S.X.; Cai, G.W.; Xu, D.G. Power Quality Disturbances Recognition Based on a Multiresolution Generalized S-Transform and a PSO-Improved Decision Tree. Energies 2015, 8, 549–572. [Google Scholar] [CrossRef]
  18. Lan, J.; Zhu, G.; Li, S. Detection method of transient and steady state harmonics based on generalized S-transform mutation recognition. Power Syst. Prot. Control 2020, 48, 40–46. [Google Scholar]
  19. Li, J.; Lin, H.; Liang, C.; Teng, Z.; Cheng, D. Detection Method of Power Quality Disturbances Based on Double Resolution S Transform and Learning Vector Quantization Neural Network. Trans. China Electrotech. Soc. 2019, 34, 3453–3463. [Google Scholar]
  20. Tang, Q.; Qiu, W.; Zhou, Y.C. Classification of Complex Power Quality Disturbances Using Optimized S-Transform and Kernel SVM. IEEE Trans. Ind. Electron. 2020, 67, 9715–9723. [Google Scholar] [CrossRef]
  21. Yang, J.; Jiang, S.; Shi, G. Classification of composite power quality disturbances based on piecewise-modified S transform. Power Syst. Prot. Control 2019, 47, 64–71. [Google Scholar]
  22. Wu, Y.; Tang, Q.; Teng, Z.; Li, N.; Wang, X. Feature extraction method of power quality disturbance signals based on modified s-transform. Proc. Chin. Soc. Electr. Eng. 2016, 36, 2682–2689. [Google Scholar]
  23. Jiang, Z.; Wang, Y.; Li, Y.; Cao, H. A new method for recognition and classification of power quality disturbances based on IAST and RF. Electr. Power Syst. Res. 2024, 226, 109939. [Google Scholar] [CrossRef]
  24. Mozaffari, M.; Doshi, K.; Yilmaz, Y. Real-Time Detection and Classification of Power Quality Disturbances. Sensors 2022, 22, 7958. [Google Scholar] [CrossRef] [PubMed]
  25. Valtierra-Rodriguez, M.; Romero-Troncoso, R.D.; Osornio-Rios, R.A.; Garcia-Perez, A. Detection and Classification of Single and Combined Power Quality Disturbances Using Neural Networks. IEEE Trans. Ind. Electron. 2014, 61, 2473–2482. [Google Scholar] [CrossRef]
  26. Turović, R.; Dragan, D.; Gojić, G.; Petrović, V.B.; Gajić, D.B.; Stanisavljević, A.M.; Katić, V.A. An End-to-End Deep Learning Method for Voltage Sag Classification. Energies 2022, 15, 2898. [Google Scholar] [CrossRef]
  27. Huang, J.S.; Jiang, Z.H.; Rylands, L.; Negnevitsky, M. SVM-based PQ disturbance recognition system. IET Gener. Transm. Distrib. 2018, 12, 328–334. [Google Scholar] [CrossRef]
  28. Zhong, T.; Zhang, S.; Cai, G.W.; Li, Y.; Yang, B.J.; Chen, Y. Power Quality Disturbance Recognition Based on Multiresolution S-Transform and Decision Tree. IEEE Access 2019, 7, 88380–88392. [Google Scholar] [CrossRef]
  29. Kubendran, A.K.P.; Loganathan, A.K. Detection and classification of complex power quality disturbances using S-transform amplitude matrix-based decision tree for different noise levels. Int. Trans. Electr. Energy Syst. 2017, 27, e2286. [Google Scholar] [CrossRef]
  30. Moukadem, A.; Bouguila, Z.; Abdeslam, D.O.; Dieterlen, A. A new optimized Stockwell transform applied on synthetic and real non-stationary signals. Digit. Signal Process 2015, 46, 226–238. [Google Scholar] [CrossRef]
  31. Yuan, L.; Li, S.; Yin, B.; Li, B.; Zuo, L. Accurate and Fast ElectroCardioGram Classification Method Based on Adaptive Fast S-Transform and XGBoost. J. Electron. Inf. Technol. 2023, 45, 1464–1474. [Google Scholar]
  32. Reddy, M.V.; Sodhi, R. A Modified S-Transform and Random Forests-Based Power Quality Assessment Framework. IEEE Trans. Instrum. Meas. 2018, 67, 78–89. [Google Scholar] [CrossRef]
  33. Kumar, Y.V.P.; Rao, S.; Padma, K.; Reddy, C.P.; Pradeep, D.J.; Flah, A.; Kraiem, H.; Jasinski, M.; Nikolovski, S. Fuzzy Hysteresis Current Controller for Power Quality Enhancement in Renewable Energy Integrated Clusters. Sustainability 2022, 14, 4851. [Google Scholar] [CrossRef]
  34. IEEE Std 1159-2019[S]; IEEE Recommended Practice for Monitoring Electric Power Quality. IEEE: New York, NY, USA, 2019.
Figure 1. Global adaptive Gaussian window time domain window width and spectrum. (a) Window width under different σ ( f ) . (b) Frequency spectrum of window.
Figure 1. Global adaptive Gaussian window time domain window width and spectrum. (a) Window width under different σ ( f ) . (b) Frequency spectrum of window.
Energies 18 04088 g001
Figure 2. Schematic for automatic thresholding method.
Figure 2. Schematic for automatic thresholding method.
Energies 18 04088 g002
Figure 3. Flowchart of IAFST algorithm.
Figure 3. Flowchart of IAFST algorithm.
Energies 18 04088 g003
Figure 4. Schematic diagram of random forest.
Figure 4. Schematic diagram of random forest.
Energies 18 04088 g004
Figure 5. Time–frequency analysis results of Equation (18) signal with different algorithms. (a) GST (ECMGST = 0.0025). (b) DRST (ECMDRST = 0.0042). (c) IAST (ECMIAST = 0.0046).
Figure 5. Time–frequency analysis results of Equation (18) signal with different algorithms. (a) GST (ECMGST = 0.0025). (b) DRST (ECMDRST = 0.0042). (c) IAST (ECMIAST = 0.0046).
Energies 18 04088 g005aEnergies 18 04088 g005b
Figure 6. Feature extraction curves of three algorithms. (a) Fundamental frequency amplitude plot. (b) Frequency maximum amplitude plot.
Figure 6. Feature extraction curves of three algorithms. (a) Fundamental frequency amplitude plot. (b) Frequency maximum amplitude plot.
Energies 18 04088 g006
Figure 7. Classification framework based on IAFST-RF.
Figure 7. Classification framework based on IAFST-RF.
Energies 18 04088 g007
Figure 8. Model accuracy under different tree quantities.
Figure 8. Model accuracy under different tree quantities.
Energies 18 04088 g008
Figure 9. Model accuracy under different maximum numbers of splits.
Figure 9. Model accuracy under different maximum numbers of splits.
Energies 18 04088 g009
Table 1. Comparison of the accuracy of different perturbation detection algorithms.
Table 1. Comparison of the accuracy of different perturbation detection algorithms.
Disturbance TypesAmplitude Error/%Duration Error/%Frequency Error/Hz
IAFSTDRSTGSTIAFSTDRSTGSTIAFSTDRSTGST
Swell0.0230.0380.4900.0250.52000
Interruption0.0540.0543.170.010.020.63000
Swell + Oscillatory0.0420.0482.30.0570.0520.2004.9
Sag + 27th harmonics0.0180.0214.10.030.030.5004.9
Sag + 9th and 19th harmonics0.0190.045.20.010.020.4007.5
Table 2. Comparison of execution time of different detection algorithms (in milliseconds).
Table 2. Comparison of execution time of different detection algorithms (in milliseconds).
Disturbance TypesExecution Time/ms
IAFSTDRSTGST
Swell4.49.644.7
Interruption4.29.752.9
Swell + Oscillatory5.113.853.6
Sag + 27th harmonics4.717.149.7
Sag + 9th and 19th harmonics5.519.856.3
Table 3. Extracted features.
Table 3. Extracted features.
FeaturesMathematical ExpressionDescription of Features
F 1 F 1 = n = 0 N FFA ( n ) 2 F 1 : Energy of FFA
F 2 F 2 = Std ( FFA ) F 2 : Standard of FFA
F 3 F 3 = T n T sum F 3 : The proportion of non-fundamental disturbance duration
F 4 F 4 = k u r t o s i s ( x ( t ) ) F 4 : Kurtosis coefficient of PQ signal
Table 4. Types of power quality disturbances.
Table 4. Types of power quality disturbances.
Type NumberDisturbanceType NumberDisturbance
C1SagC9Oscillatory + Harmonics
C2SwellC10Flicker + Swell
C3InterruptionC11Flicker + Sag
C4OscillatoryC12Flicker + Harmonics
C5HarmonicsC13Oscillatory + Swell
C6FlickerC14Oscillatory + Sag
C7Sag + HarmonicsC15Sag + Harmonics + Oscillatory
C8Swell + HarmonicsC16Swell + Harmonics + Oscillatory
Table 5. Classification accuracy of different algorithms.
Table 5. Classification accuracy of different algorithms.
Detection TechniquesClassification MethodAverage Accuracy/%
STSVM68.39
STRF76.41
IAFSTSVM98.65
IAFSTRF99.73
Table 6. Classification accuracy of IAFST–RF under additive white Gaussian noise for 16 disturbance types.
Table 6. Classification accuracy of IAFST–RF under additive white Gaussian noise for 16 disturbance types.
SNR (dB)
203040
Accuracy (%)99.1299.4699.62
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Yang, D.; Lü, S.; Wei, J.; Zheng, L.; Gao, Y. Detection and Classification of Power Quality Disturbances Based on Improved Adaptive S-Transform and Random Forest. Energies 2025, 18, 4088. https://doi.org/10.3390/en18154088

AMA Style

Yang D, Lü S, Wei J, Zheng L, Gao Y. Detection and Classification of Power Quality Disturbances Based on Improved Adaptive S-Transform and Random Forest. Energies. 2025; 18(15):4088. https://doi.org/10.3390/en18154088

Chicago/Turabian Style

Yang, Dongdong, Shixuan Lü, Junming Wei, Lijun Zheng, and Yunguang Gao. 2025. "Detection and Classification of Power Quality Disturbances Based on Improved Adaptive S-Transform and Random Forest" Energies 18, no. 15: 4088. https://doi.org/10.3390/en18154088

APA Style

Yang, D., Lü, S., Wei, J., Zheng, L., & Gao, Y. (2025). Detection and Classification of Power Quality Disturbances Based on Improved Adaptive S-Transform and Random Forest. Energies, 18(15), 4088. https://doi.org/10.3390/en18154088

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop