## 4 Simulations  
BCTRAN is a well-known ATP/EMTP subroutine for computing the primary and secondary windings in each phase of a two-winding, three-phase transformer. [PERSON] et al. [61] proposed modifying the BCTRAN subroutine to look at the transformer's inherent problems. In general, the BCTRAN represents a transformer with a 6 \(\times\) 6 matrix of inductances, but under internal fault circumstances, the matrix is changed to 7 \(\times\) 7 dimensions to incorporate winding to ground failures. The following is a summary of the internal fault simulation procedure using the BCTRAN subroutine:  
First step: create 6 \(\times\) 6 matrices (\(R\)) and (\(L\)) to depict the transformer based on the manufacturer's test data without taking into account internal faults. \[[R]=\left[ \begin{array}{ccc}R_{1}&\dots&0\\ \vdots&\ddots&\vdots\\ 0&\dots&R_{6}\end{array} \right] \tag{4}\]  
\[[L]=\left[ \begin{array}{ccc}L_{1}&L_{12}&\dots&L_{16}\\ L_{21}&L_{2}&\dots&L_{26}\\ \vdots&\vdots&\ddots&\vdots\\ L_{61}&L_{62}&\dots&L_{6}\end{array} \right] \tag{5}\]  
Second step: to obtain the new internal winding fault matrices, modify Equations (4) and (5) as illustrated in Equations (6) and (7) [61]. \[[R]^{*}=\left[ \begin{array}{cccccc}R_{a}&0&0&0&0&0&0\\ 0&R_{b}&0&0&0&0&0\\ 0&0&R_{2}&0&0&0&0\\ 0&0&0&R_{3}&0&0&0\\ 0&0&0&0&R_{4}&0&0\\ 0&0&0&0&0&R_{5}&0\\ 0&0&0&0&0&0&R_{6}\end{array} \right] \tag{6}\]  
\[[L]^{*}=\left[ \begin{array}{cccccc}L_{a}&M_{ab}&M_{a2}&M_{a3}&M_{a4}&M_{a5}& M_{a6}\\ M_{ba}&L_{b}&M_{b2}&M_{b3}&M_{b4}&M_{b5}&M_{b6}\\ M_{2a}&M_{2b}&L_{2}&M_{23}&M_{24}&M_{25}&M_{26}\\ M_{3a}&M_{3b}&M_{32}&L_{3}&M_{34}&M_{35}&M_{36}\\ M_{4a}&M_{4b}&M_{42}&M_{43}&L&M_{45}&M_{46}\\ M_{5a}&M_{5b}&M_{52}&M_{53}&M_{54}&L_{5}&M_{56}\\ M_{6a}&M_{6b}&M_{62}&M_{63}&M_{64}&M_{65}&L_{6}\end{array} \right] \tag{7}\]  
Third step: by adding lumped capacitances to the transformer's terminals, the inter-winding and earth capacitances of the HV and LV windings can be replicated [61]. After, at a sampling rate of 200 kHz, the ATP/EMTP program is used to replicate the fault's transient signal. Figure 2[62] depicts the examined architecture as part of Thailand's power transmission and distribution infrastructure. To simulate all characteristics by a manufacturer setup, a 50 MVA, 115/23 kV, two-winding, three-phase transformer is utilized as a model as shown in Figure 3.  
In addition, external faults of the transformer (on transmission lines) are simulated with varied conditions as follows:  
* The angles of the voltage waveform in phase A at the instants of fault inception were 0-150\({}^{\circ}\) (in 30\({}^{\circ}\) step). * The fault types consist of single line to ground, double line to ground, line to line, and three-phase faults (AG, BG, CG, ABG, BCG, CAG, AB, BC, CA, and ABC). * The fault locations on the transmission lines are determined at lengths of 10%, 20%, 30%, 40%, 50%, 60%, 70%, 80%, and 90% of the transmission line length. The primary and secondary current waveforms are simulated using ATP/EMTP and interfaced to the MATLAB/Simulink program to construct the fault-diagnosis process. In Figures 4 and 5, the fault signals of the transformer primary and secondary currents are shown and correspond to the two protection zones. In the case of an internal fault condition, the primary and secondary current waveforms obtained for a winding to ground fault are shown in Figure 4, whereas cases of external faults are shown in Figure 5.  
Figure 2: Diagram of the suggested fault-classification algorithm in simplified form. Figure 3: The winding of three-phase transformer faults. The transformer, as shown in Figure 2, is a step-down transformer that connects two sub-transmission sections. The transformer simulation is carried out by altering the system parameter condition as follows: the angles of the voltage waveform in phase A at the instants of fault inception were 0-330\({}^{\circ}\) (in 30\({}^{\circ}\) steps).