## 5 Fault-Detection Algorithm  
The differential currents are calculated from the simulated signals, and the resulting current signals are retrieved using the DWT, which is a subtraction of the primary current and the secondary current in all three phases and the zero sequence. The coefficients from each scale of DWT can be considered and used in fault detection through numerous trial-and-error processes based on the differential current of all three phases.  
The DWT is applied to the \(1/4\) cycle of current waveforms after the fault initiation, based on a trial-and-error procedure. To decompose the high-frequency components from the current signals, the Daubechies 4 (db4) mother wavelet [54; 55; 56; 57] is used. The coefficients of the signals obtained from the DWT are squared and studied in each scale. As shown in Figures 6-8, when a fault develops, the coefficients of high-frequency components change abruptly compared to those before the fault occurs. This abrupt change is employed as a predictor of fault occurrence.  
Figure 6 depicts an internal fault at 20% of the winding length, while Figure 8 depicts an exterior fault at 20% of the transmission line length. The input signal is represented in Figure 6 on the top trace of the figure. As shown in Figure 6, the input signal is a multi-signal trace from each high-pass filter that corresponds to a certain scale parameter. Figures 6 and 7 indicate that the coefficients of high-frequency components change abruptly when a fault occurs compared to those before the fault occurs; yet, as shown in Figure 8, the coefficient in each scale of the DWT does not change.  
Figure 4: Internal fault simulation’s primary and secondary currents: (**a**) the scenario of a high-voltage winding malfunction; (**b**) the scenario of a low-voltage winding malfunction.  
Figure 5: External fault simulation’s primary and secondary currents: (**a**) the scenario of a high-voltage winding malfunction; (**b**) the scenario of a low-voltage winding malfunction.  
The similarity between the fault signals' waveforms from Figures 6 and 7 can be seen. The result obtained from the fault-detection algorithm presumes that these signals are in their fault condition. Figure 8 shows that the coefficient at each scale of the DWT does not change. Therefore, the result obtained from the fault-detection algorithm presumes that these signals are in their normal condition. Fault detection is necessary for the decision algorithm to detect and discriminate between the power transformer's internal and external faults. Thus, the classification of fault detection is considered. The coefficient in scale 1 from the DWT appears to be enough to indicate the fault inception, according to numerous simulations [50; 51]. The coefficient in scale 1 from the DWT is utilized in many simulations [50; 51] and appears to be sufficient to identify the occurrence of a fault; therefore, the coefficient in scale 1 is sufficient to train and test processes for the probabilistic neural network (PNN) without the higher-scale coefficients.  
Figure 8: In the case of normal conditions, DWT of differential currents from scale 1 to scale 5.  
Figure 6: In the event of an external winding problem, DWT of differential currents from scale 1 to scale 5: (**a**) analysis of high-voltage winding faults; (**b**) analysis of low-voltage winding faults.  
Figure 7: In the event of an external short circuit, DWT of differential currents from scale 1 to scale 5: (**a**) analysis of high-voltage winding faults; (**b**) analysis of low-voltage winding faults.