#### Abstract

This research compares four machine learning techniques: linear regression, support vector regression, random forests, and artificial neural networks, with regard to the determination of mechanical stress in power transformer winding conductors due to three-phase electrical faults. The accuracy compared with finite element results was evaluated for each model. The input data were the transient electrical fault currents of power system equivalents with impedances from low to high values. The output data were the mechanical stress in the conductors located in the middle of the winding. To simplify the design, only one hyperparameter was varied on each machine learning technique. The random forests technique had the most accurate results. The highest errors were found for low-stress values, mainly due to the high difference between maximum and minimum stresses, which made the training of the machine learning models difficult. In the end, an accurate model that could be used in the continuous monitoring of mechanical stress was obtained.

#### 1. Introduction

The determination of electromagnetic forces due to electrical faults in power transformer windings is a crucial activity developed during the design stage [1–3]. This problem is generally solved through numerical methods because of the transformer geometry characteristics and the partial equations involved. Nowadays, the finite element method (FEM) is the most used technique for this task in [4–7].

Internally, FEM divides the medium into triangular or rectangular elements inside which the magnetic field is considered constant [8]. The more variation the field has, the more elements are needed for better accuracy. Since the field value is unknown at the beginning, the first attempt at the disposition of elements is performed according to the geometry of the problem. After that, the elements are iteratively divided and relocated depending on the results of the simulations [9].

Therefore, the whole process takes a long time to find the solution for one set of high and low voltage currents. This time consuming process is not a problem for power transformer design because the simulation is limited to a few cases corresponding to the worst case scenario. However, when conducting a continuous analysis of the effect of the forces or mechanical stress in transformer windings, such as a stress analysis [10, 11], using FEM is unfeasible mainly because the results are needed almost in real-time.

An alternative path to solve this problem is the method of images since it reduces the algebraic operations needed to find the forces. The method of images for magnetic fields was presented by Hammond [12] based on the works introduced by Thomson and Kelvin [13]. Kulkarni and Khaparde suggested its use for the determination of the transformer reactance based on the magnetic field [14]. Minhas utilized the method of images for the determination of forces and winding vibrations in a single phase transformer [15]. In another investigation, the forces acting in the transformer terminal are calculated through the use of the method of images [16]. The method of images assumes that the permeability of the core is constant, and for each winding, the magnetic material extends towards infinite. As an advantage, this method directly gives the forces without the need to calculate the magnetic field. However, it has not been applied to three-phase transformers; hence, it is unclear how the images must be located, mainly for the windings that embrace the middle limb of the core. Another issue is the constant permeability, which does not represent the problem when the transformer phases affect each other.

In a previous work, the application of artificial neural networks (ANNs) for the determination of mechanical stress has been analysed [17]. For training the ANNs, FEM simulations were used, and a good approximation was obtained. The advantage of the method is the time reduction in getting the results. Although FEM is still necessary to get the training data, it is no longer used for the rest of the power transformer lifetime after the model is obtained. The drawback is the difficulty of training the ANNs. They have many hyperparameters that affect the model accuracy [18]. Finding the best combination of hyperparameters could become cumbersome.

This research explores the use of four machine learning techniques for the determination of mechanical stress: linear regression (LR), support vector regression (SVR), random forests (RF), and ANN. The objective is to compare each technique’s accuracy when varying only one hyperparameter, thus simplifying the model design and implementation.

The worst accuracy result found when using ANNs was chosen for comparison purposes, i.e., when the electrical fault faces a high impedance [17].

#### 2. Method

There are two stages in the development of the machine learning tools:(i)Generation of data: the mechanical stress is found for different electrical currents circulating through the windings(ii)Training of the machine learning model: the pair electrical currents-mechanical stress is used to train the model

##### 2.1. Mechanical Stress

The first step towards finding the mechanical stress is the determination of the magnetic induction around the winding conductor. For this, recall that the magnetic vector potential acting in a point obeys the Poisson equation (1), where is the current density circulating through the point and is the permeability of the medium. Then, can be found by equation (2).

For the solution of equation (1), the software FEMM [19], which implements FEM, was used. Table 1 presents the transformer characteristics, while Table 2 presents the geometry entered in FEMM.

The electrical currents considered correspond to electromagnetic transients of electrical faults that face impedances from to . A total of 7839 and 795 training and validation cases were generated, respectively. They belong to faults starting when Phase A, Phase B, and Phase C cross zero. Equation (3) shows the formulation for the low voltage winding transient current, , where is the angular frequency of the system, is the time, is the angle representing the fault starting point, is the angle between phases (120° in a three-phase balanced system), and where and are the equivalent resistance and inductive reactance seen by the fault. The high voltage current is determined with the ratio of the respective windings.

Once was found, the force per volume unit on the conductor was calculated by the following equation:

The radial force in the middle conductors of the windings represents the highest value [17]. Moreover, this force component is the only one that could affect the conductor continuously because the winding internal structure nullifies the axial force effects. Therefore, a simplified model of the winding conductor can be used to determine the stress, where the conductor is modelled as a ring with radius and cross-sectional area . Thus, the force normal to the section of the conductor subjected to a radial force per length and the stress *σ* are calculated by the following equations, respectively:

An additional simplification was to take the whole disk as a conductor. In that way, the FEM discretization was reduced and so was the simulation time to create the training and validation samples.

##### 2.2. Machine Learning Models

The design and implementation of the machine learning models were performed in the Python library scikit-learn 0.24.2. For each technique, Table 3 shows the scikit-learn libraries employed and the modified hyperparameters. Two libraries are needed in LR because the LinearRegression library can model only a straight line. With PolynomialFeatures, a higher degree polynomial, including the products of all the input variables, can be used for the model.

Previous to training, the input and output data were standardized (see equation (7)) so that all the values are in the range from zero to one.

The most suitable hyperparameter value is determined by evaluating the coefficient of determination , defined by equation (8), where is the true value of the output variable, is the output value predicted by the model, and is the mean value of the output variable:

#### 3. Results

##### 3.1. Hyperparameters for the Highest Accuracy

For LR, the polynomial degree was varied from one to nine. Figure 1 shows the accuracy variation. The validation test had the best behaviour between degrees five and eight. The polynomial of degree five was considered for the sake of simplicity.

Figure 2 shows the error for SVR, when the hyperparameter varied from 1 to 400. The minimum error value is located at . The training error was nearly constant for high values of , but the validation error slightly increased, which could indicate overfitting.

In RF, the number of trees was modified (see Figure 3). The error decreased until a number of 100 trees. After that, the error was constant both in the training data and in the validation test. The maximum number of trees was set at 1000 because the training time was too long after that. Moreover, no improvement was seen from 100 to 1000 trees. Hence, 100 trees were chosen for the model.

Figure 4 shows the variation of the error for a different number of units in the hidden layer for ANN. Only one hidden layer was considered because that architecture has the best accuracy for the ANN-based models [17] in the mechanical stress problem. The number of units had a small effect on the training data error. However, the error decreased almost uniformly in the validation test, reaching a minimum at 1625 units. This machine learning technique accentuated the different behaviour between the training data and the validation test. It was clear that increasing the number of units in the layer did not decrease the model’s error.

A comparison of the lowest error is seen in Figure 5. RF had the best behaviour, LR and SVR have similar values, and ANN has the highest error.

##### 3.2. Error Comparison for a Transient Fault Current

The highest error of the ANN model in the determination of the mechanical stress was found for electrical faults with the highest impedance in a previous work. In particular, the case of and was seen as having the worst accuracy [17]. Therefore, that case was analysed in this research for the comparison of the machine learning techniques.

Figure 6 shows the mean absolute percentage error (MAPE) for the determination of stress in the low voltage winding conductors. LR and RF had the lowest MAPE, whereas it was the highest for SVR and ANN models. In general, Phase B has the highest error.

In Figure 7, the MAPE for the mechanical stress in the high voltage winding is shown. LR and RF still present the lowest error. The SVR model has the highest error in Phase B.

To clarify where the differences between the machine learning and FEM models are located, Figures 8 to 11 present the results for the worst cases of each model. All of them belong to the high voltage winding simulations. In general, there is a high difference in low values of the mechanical stress. This may be due to the lower importance that these cases have for the machine learning tool. For the practical use of the model, this behaviour is not an issue because the low mechanical stresses have little effect on the deterioration of the winding conductor.

The ANN model has a particular behaviour, as shown in Figure 11. The error prevails even when close to the steady-state of the transient. The error is high for the first cycles with high and low stresses. For practical analysis, the ANN model has the worst outcome.

#### 4. Discussion

The mechanical stress and the electromagnetic forces in windings have a strong dependence on the electrical currents. For that reason, although the validity tests have cases outside those used in the training process, each machine learning model has presented high accuracy, showing a low level of overfitting. This means that the behaviour seen by the model during training is much related to the behaviour of the validation set of data. Therefore, except for the ANN model, the rest of the validation cases have given even lower errors than those of the training simulations. As is usual in machine learning models, overfitting is possible when the model is more complex, e.g., when augmenting the polynomial degree in LR or the value of hyperparameter in SVR.

In the variation of hyperparameters, the models have a homogeneous behaviour in the validation test. When the model is simple, the error is high and lowers when the model increases its complexity. The error reaches a minimum at some value and then begins to rise, showing signs of overfitting. The exception to this behaviour is ANN, which has skipped in the flow of error when the model is more complex. This characteristic makes it difficult to find the optimal point in the model design. The multiple relations that exist inside the ANN model, with all the weights and activation functions, might be the reason for that unusual behaviour.

The RF model has the best accuracy. This result is seen in the particular case of high impedance simulation for the low voltage winding as well as in the validation test results. The chosen model has 100 trees.

The second technique with the lowest error is LR, which was modelled with a five-degree polynomial. As a result, cross-terms between the six input currents are included in the internal structure of the model. This input data interconnection has allowed the model to represent the nonlinearities of the phenomenon and mainly the influence of the different input currents. It opens the possibility of improving the predictions for other machine learning models if some combination of the winding currents is included as input data.

#### 5. Conclusions

Four machine learning techniques have been compared with regard to accuracy. Only one hyperparameter has been varied for each technique so that the design process is simplified.

This study demonstrates that the appropriate machine learning technique improves the accuracy of the model. For the determination of mechanical stress in transformer windings, the random forest proved to be the best model, even for the high impedance electrical fault, which was the worst case in our previous research presented in [17].

All the models present the highest error in low values of stress. There is a high difference in the stress values during the transient period. This affects the behaviour of the machine learning models even though the input data are standardized before the training process. Nonetheless, this is not such an issue since the mechanical stress with the highest value is the one that could cause damage to the conductor.

By finding the right machine learning technique, the utilities might have a powerful tool that allows the continuous monitoring of the mechanical stress behaviour. Thus, in the future, policies of fatigue analysis to determine the deterioration of the winding conductor could be established.

#### Data Availability

The CSV files with the training and validation data used to support the findings of this study are available from the corresponding author upon request.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.