## 3 Envelope Detector-Aided, Machine Learning-Based Fault Type Detection Model
### Envelope Detector-Based Fault Region Detection Model  
The envelope detector is a well-known method used in various fields to capture changes in the amplitude of a signal. This study extracts the amplitude behaviors of recorded data from relays and meters, which are referred to as the signal's envelope. We then employ a fault region (start/end times) detection mechanism based on user-defined thresholds. Because the algorithm processes signals without prior knowledge of the input, the algorithm's precision could be adjusted based on the investigated signal and user preferences. The fault region detection using an envelope detector is established in two steps, analytical signal conversion and fault detection as shown in Figure 8. The first part involves obtaining the analytic signal, and the second part involves extracting the region of the fault area. The algorithm described in [37] has yet to be investigated with noisy recorded signals under different sample rates. Therefore, beyond the study in [37], the algorithm in this work is improved by applying a band-pass filter with a new configuration. This improvement is necessary because the analytical conversion is directly affected by the noise and harmonics caused by a power grid system, meters, or relays. As presented in Figure 8, relays and meters apply the band-pass filter to the recorded data. Assuming that the recorded signal is defined as \(\mathbf{s}\), the band-pass filter's outcomes can be defined as \(\mathbf{s}_{uv}=\text{BPF}\left\{\mathbf{s}\right\}\), where \(\text{BPF}\{\cdot\}\) is the band-pass filter operation that removes the noise and harmonics by considering the fundamental frequency of input signal (\(f_{s}=60\,\text{Hz}\)). The operation of the analytical signal extraction is named the Hilbert Transform in Figure 8. It fundamentally removes the negative mirror side of the signal and doubles the positive side's power of the signal in the frequency domain. Thus, the discrete Fourier transform (DFT) operation is employed to filter the signal to obtain its frequency domain as  
\[\mathbf{S}[k]=\sum_{n=1}^{N}\mathbf{s}_{uv}[n]\exp\Big{(}-j2\pi\frac{(k-1)(n-1) }{N}\Big{)},\text{ for }k=1,2,\ldots,K, \tag{1}\]  
where \(N\) denotes the number of samples of the recorded signal, and \(K\) indicates the length of DFT operation that equals the number of samples, \(K=N\), in this study. Then, the  
Figure 7: The block diagram of the proposed envelope detector-aided, ML-based fault type detection model. analytic part of the signal is evaluated by making the negative mirror frequency side of the signal equal to zero:  
\[\mathbf{S}_{\mathrm{s}_{\mathrm{A}}}[k]= \begin{cases}2\mathbf{S}[k],&k=2,\ldots, M\\ \mathbf{S}[k],&k=1\\ 0,&\mathrm{Otherwise}\end{cases} , \tag{2}\]  
where \(M=N/2\) if \(N\) is an even number, and \(M=\lfloor N/2\rfloor+1\) if \(N\) is an odd number. Therefore, the analytical signal of the recorded signal can be obtained with inverse discrete Fourier transform operation as  
\[\mathbf{s}_{\mathrm{s}_{\mathrm{A}}}[n]=\sum_{k=1}^{K}\mathbf{S}_{\mathrm{a} }[k]\exp\Bigl{(}j2\pi\frac{(n-1)(k-1)}{K}\Bigr{)},\text{ for }n=1,2,\ldots,N. \tag{3}\]  
As shown in Figure 8, the complex magnitude operation is applied to obtain the envelope behavior of the analytic signal as \(\mathbf{s}_{\mathrm{inv}}=\left|\mathbf{s}_{\mathrm{a}}\right|\). Because we do not have prior knowledge of the investigated signal, the fault detection part of the algorithm examines the signal's envelope to find the fault region's start/end points. Therefore, the average value of the envelope signal is calculated as \(\zeta=(1/N)\sum_{n=1}^{N}\mathbf{s}_{\mathrm{a}}[n]\), and then the borders are defined based on the user-defined threshold:  
\[\zeta_{\mathrm{min}}= \zeta-\frac{\tau\times\zeta}{100}, \tag{4}\] \[\zeta_{\mathrm{max}}= \zeta+\frac{\tau\times\zeta}{100}, \tag{5}\]  
where \(\tau\) denotes the threshold value that can be defined by the user.