## 3 Envelope Detector-Aided, Machine Learning-Based Fault Type Detection Model
### Machine Learning-Based Fault Presence and Type Detection Models
#### 3.2.1 Feature Extraction Techniques  
Because the investigated recorded signal contains various types (i.e., voltage and current) and phases (i.e., \(A\), \(B\), and \(C\)), the features of the ML input are established considering all types. Thus, \(\mathbf{z}_{\ell}\) is one of the recorded signals so that \(\ell\in\{1,2,\ldots,6\}\) define the type and phase of the signal as given in Table 4.  
Notably, the feature extraction methods are expressed by considering that the CNN architecture is used in the ML blocks in the algorithm. For this reason, the feature extraction methods' outcomes are designed as matrix forms; however, they can easily be converted to vector forms using vector conversion algorithms and applied to other ML algorithms (SVM, DT, and RFC). In this technique, the input data of the ML model are prepared without any signal processing techniques to observe the achievement or drawbacks of any signal processing techniques. Therefore, the input matrix for the ML block is ready for raw data by combining whole types and phase-in together as  
\[\mathbf{X}_{\text{raw}}=\left(\mathbf{z}_{1},\mathbf{z}_{2},\ldots,\mathbf{z }_{6}\right)^{T}\in\mathbb{R}^{6\times N}. \tag{8}\]  
Fast Fourier Transform  
The FFT process is employed to observe the frequency behavior of fundamental signals and harmonics with noise. These signals and harmonics are used as inputs for ML models to find changes based on fault. Thus, the DFT operation is employed to obtain the frequency domain components of the analyzed signal, which is also used in (1) as [49]:  
\[\mathbf{Z}_{\ell}[k]=\sum_{n=1}^{N}\mathbf{z}_{\ell}[n]\exp\Big{(}-j2\pi \frac{(k-1)(n-1)}{N}\Big{)}. \tag{9}\]  
Before the creation of the feature matrix model for FFT, half of \(\mathbf{Z}_{\ell}\) is removed as \(\mathbf{Z}_{\ell}^{c}[\mathbf{\alpha}]=\mathbf{Z}_{\ell}[\mathbf{\alpha}]\), where \(\mathbf{\alpha}=1,2,\ldots,\lfloor N/2\rfloor+1\) because the \(\mathbf{Z}_{\ell}\) includes the same positive and negative sides of the frequency domains. Then, the feature matrix model is created for FFT as  
\[\mathbf{X}_{\text{FFT}}=\left(\Re\{\mathbf{Z}_{1}^{c}\},\Im\{\mathbf{Z}_{1}^{ c}\},\Re\{\mathbf{Z}_{2}^{c}\},\Im\{\mathbf{Z}_{2}^{c}\},\ldots,\Re\{\mathbf{Z}_{6}^{c}\}, \Im\{\mathbf{Z}_{6}^{c}\}\right)^{T}\in\mathbb{R}^{12\times(\lfloor N/2 \rfloor+1)}. \tag{10}\]  
The effect of fault can easily be observed in the amplitude and phase values of a signal that behaves differently than usual. Thus, the amplitude and phase information of the signal is used to establish the matrix model as  
\[\mathbf{X}_{\text{ar}}=\left(\mathbf{Z}_{1}^{A},\mathbf{Z}_{1}^{D},\mathbf{Z }_{2}^{A},\mathbf{Z}_{2}^{P},\ldots,\mathbf{Z}_{6}^{A},\mathbf{Z}_{6}^{P} \right)^{T}\in\mathbb{R}^{12\times N}, \tag{11}\] \begin{table}
\begin{tabular}{c c} \hline \hline
**Recorded Signal** & **Signal Types** \\ \hline
**z\({}_{1}\)** & Voltage of phase A \\
**z\({}_{2}\)** & Voltage of phase B \\
**z\({}_{3}\)** & Voltage of phase C \\
**z\({}_{4}\)** & Current of phase A \\
**z\({}_{5}\)** & Current of phase B \\
**z\({}_{6}\)** & Current of phase C \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Defined numbers of various signal types and phases used in the feature extraction process. where \(\mathbf{Z}_{\ell}^{A}=\left|\mathbf{Z}_{\ell}\right|\) shows the amplitude of signal, and \(\mathbf{Z}_{\ell}^{p}=\arctan\left(\frac{\Im\left\{\mathbf{z}\right\}}{\Re\left\{ \mathbf{z}\right\}}\right)\). Autocorrelation Function  
The ACF obtains repeated patterns in a noisy environment. As a result, the ACF can be used for feature extraction methods.