## 2 PQD Feature Detection System Model Using WPTM-Based Metrics
### System Model  
This paper proposes a PQD detection algorithm with adaptive impulsive denoising, whose flowchart is shown in Figure 1. In the proposed algorithm, if the noise type is \"impulsive\" (\(N_{c}=1\)), we use both an SM filter [22], for removing the impulsive noise components \(n_{i}[i]\), and a wavelet denoising filter, for removing the Gaussian noise components \(n_{a}[i]\); otherwise (i.e., if the noise type is \"Gaussian\" (\(N_{c}=0\))), we only use a wavelet denoising filter. In the classification of the noise type (see Step 3 in Figure 1), the noise type of the input signal is determined using a threshold (\(th\)). In this step, the 3-sigma threshold, that is, \(th=3\sigma\), is used, where \(\sigma\) is the standard deviation of the output samples (see \(\hat{g}[i]\) in (6)) from Step 2. That is, \(N_{c}=1\) if \(\hat{y}[i]\geq th\) and \(0\) if \(\hat{y}[i]<th\).  
In what follows, the proposed algorithm procedure based on the flowchart shown in Figure 1 is explained in detail, where an 80% \(pu\) sag signal (Figure 1(a)), which is added with Gaussian plus impulsive noise (i.e., under impulsive noise channel (IMPN) conditions; the signal is shown in Figure 1(b)), is used as an example.  
Step 1: Obtain the estimated (extracted) noise plus distortion component signal, denoted as \(y[i]=q[i]+n[i]\) (Figure 1(c)), by directly subtracting the power source signal \(s_{0}[i]\) from the input signal \(x[i]\), as follows:  
\[y[i]=x[i]-s_{0}[i]. \tag{5}\]  
Step 2: Apply a wavelet-based denoising filter to \(y[i]\) for the removal of Gaussian noise. As a result, we obtain a denoised (estimated) distortion component signal (Figure 1(d)), as follows:  
\[\hat{y}[i]=y[i]-\hat{n}_{a}[i]. \tag{6}\]  
Step 3: Classify the estimated distortion component signal into two noise types: impulsive noise type (\(N_{c}=1\)), if the output samples of Step 2 are above 3-sigma, and otherwise, non-impulsive type (\(N_{c}=0\)). If \(N_{c}=1\), then go to Step 4; otherwise, go to Step 5.  
Although this SM filter, which is a type of nonlinear filter, is simple, it has an excellent impulse noise cancelation function [22].  
Step 5: Finally, execute the presented PQD localization process using WPTM metrics (whose pseudocode is presented in Algorithm 1 [for MV metric] or Algorithm 2 [for RMS metric]), which improves the robustness of the proposed PQD detection system over nonstationary noisy power signal channels [7].  
In the wavelet-based Gaussian denoising step (Step 2), we choose a Daubechies wavelet with a five-coefficient filter (DB5), which is relatively better than the other Daubechies wavelet filters (e.g., three-coefficient (DB3), six-coefficient (DB6), or eight-coefficient (DB8)) in terms of the recovered SNR (for simplicity, the comparison of numerical results among these filters is omitted here). That is, in this Gaussian denoising step (Step 2), we first use DB5 with a universal threshold \(th=\sigma_{w}\sqrt{2\log|N|}\) (where \(N\) is the size of the WT sample vector \(\mathbf{W}_{1}^{l}\) and \(\sigma_{w}=\text{med}\left(\mathbf{W}_{1}^{l}\right)/0.6745\)) [9]. Then, if the estimated noise type in Step 3 is impulsive, that is, \(N_{c}=1\), in Step 4, we use an SM filter that removes the impulsive noise.  
Figure 1: Flowchart of the proposed PQD feature detection with adaptive impulsive denoising.  
Figure 2: _Cont._  
After the Gaussian and impulsive denoising process (Steps 2-4 in Figure 1), the WPTM-based PQD detection process (Step 5 in Figure 1) is performed, for which [PERSON]'s WPT with DB3 is assumed to be used. The presented PQD detection scheme using WPTM-based metric (MV or RMS) is detailed in the next subsection.