## 2 PQD Feature Detection System Model Using WPTM-Based Metrics
### PQD Feature Detection Using WPTM-Based Metrics
#### 2.3.4 PQD Feature Detection Using RMS Metric  
Next, we define and use the WPTM-based detection scheme with the RMS metric:  
\[\mathbf{M}=\mathbf{M}_{rms}=\left\{M_{rms}[n]\left|n=1,\ldots,N\right.\right\}, \tag{19}\]  
where,  
\[M_{rms}[n]=\sqrt{\frac{1}{P}\sum_{p=1}^{P}\left|W^{p}[n]\right|^{2}}.\]  
For RMS-based PQD detection, the proposed algorithm procedure in Figure 1 calls the WPTM-based PQD detection function using the RMS metric (see Algorithm 2; whose pseudocode is shown below), where the following modified threshold is used:  
\[TH_{M}=th=k\times\text{med}(M)\sqrt{2\log\left|N\right|}/0.6745. \tag{20}\]  
Figure 5: Snapshots of WPTM-based detection using MV: (**a**) voltage swell signal with \(110\%\)\(pu\), (**b**) wavelet packet \(W^{1}\), (**c**) \(W^{2}\), (**d**) \(W^{3}\), (**e**) \(W^{4}\), (**f**) \(W^{5}\), (**g**) \(W^{6}\), (**h**) \(W^{7}\), (**i**) result of MV detection (\(accF\)).  
While the MV metric uses \(P\) measures (one measure per packet), the RMS metric exploits a single combined measure to detect the PQD event. The denoised wavelet packets undergoing the impulsive and/or Gaussian denoising process (Step 2 to Step 4 in Figure 1) are used to obtain the RMS metric, as observed in (19).  
In the presented double-edge detection procedure, \(C_{det}\) becomes \"TRUE\" only if both \(C_{fdet}\) and \(C_{bdet}\) are enabled \"1\". For instance, if the RMS value \(M[t]\) at the two edge points is greater than or equal to the threshold \(th\), then the PQD event is detected (i.e., \(C_{det}\) = \"TRUE\"). In addition, if \(M[t]\) is greater than or equal to \(th\) at the outside (or remaining) window \(T_{op_{PQ}}\), \(C_{false}\) is enabled (i.e., \(C_{false}\) = \"TRUE\").  
As an example, Figure 6a shows snapshots of RMS-based feature detection for a sag signal with 80% \(pu\) at SNR = 40 dB. Assuming \(l=3\), Figure 6b-d, respectively, shows the first, second, and seventh wavelet packets (or WPCs) (the other packets are omitted for simplicity) of the PQD signal. Figure 6e is the resulting subplot of the WPTM-based RMS metric, that is, \(\mathbf{M}=\mathbf{M}_{rms}\) in (19). A PQD event is detected when the RMS value is larger than the red-dotted threshold line (\(th=TH_{M}\)).  
Table 3 summarizes the difference between the two metrics (MV and RMS) of the proposed scheme and the wavelet-correlation metric of conventional (\"Conv\") scheme [1], in terms of complexity, strength, and the \(k\) factor values over the simulated different noise channels. While the MV metric compares each \(P\) (=\(2^{l}-1\)) wavelet packet with its corresponding threshold \(th\) and collects the accumulated result for PQD detection, the RMS metric directly compares a single RMS value derived from \(P\) packets with \(th\) for PQD detection. Thus, the MV metric is more complex than the RMS metric, but exhibits relatively better DR and worse FER than the RMS metric. On the other hand, the existing scheme [1] using wavelet correlation-based metrics has much higher complexity due to the additional scale adjustment procedure (see Step 4, page 1989 of [1] for the details). In addition, it has lower DR and higher FER than our scheme; their numerical results are compared in detail in the next section.  
Figure 6: Snapshots of WPTM-based detection using RMS: (**a**) voltage sag signal with 80% \(pu\) after denoising, (**b**) wavelet packet \(W^{1}\), (**c**) \(W^{2}\), (**d**) \(W^{7}\), (**e**) result of RMS detection.