An intelligent control approach for defect-free friction stir welding

An intelligent control approach is proposed as an alternative for the friction stir welding of an aluminum alloy. A validated empirical model is re-written from transfer functions to a set of ordinary differential equations, allowing to observe the force dynamics as a function of inputs of interest. A defect-free set-point is proposed for exploiting available labeled experimental data which defines operational boundaries and a region in which the probability of achieving defect-free welds with good mechanical properties is the highest. An intelligent controller in the fashion of a recurrent neural network is constructed. Computational experiments were carried out to verify the adequacy in disturbance rejection as well as to visualize the capabilities in achieving the proposed defect-free set-point by the controller. The intelligent approach is compared with a set of decoupled proportional-integral controllers and a linear model predictive control strategy. From this study, it is concluded that the intelligent controller shows superiority and good applicability for the studied problem.


Introduction
The modern world is in constant demand of high-quality lightweight metallic products. Such materials can be found Santiago  in vehicle body shells, aircraft panels, and spaceship components. The need of these goods has encouraged the development of advanced technologies for adequately welding them. In this context, the friction stir welding (FSW) process, which corresponds to a solid-state joining method for metals, has demonstrated effectiveness in achieving high-strength joints not only for lightweight metallic materials but also other materials of different nature [5][6][7]. Moreover, FSW can achieve exceptional post-weld characteristics, which makes it promising for a number of manufacturing applications [22,34]. The FSW process uses a rotating non-consumable tool which is plunged into and passes along the joint between workpieces. The tool rotation against and within the workpieces generates significant heat, and it softens the metallic material allowing the tool to stir the metallic workpieces together for creating a joint. Nevertheless, the selection of the set of welding parameters capable of achieving defect-free welds with high-strength properties remains a challenge. Until today, some procedures rely on trial-and-error approaches for finding the adequate set of parameters [27].
The FSW process is a complex physical phenomenon that includes metallurgical changes, material flow, heat transfer, and thermo-mechanical coupling. The main dynamics analyzed in these processes include two-and threedimensional studies that incorporate the material flow, temperature distributions, and the forces involved in the mechanism [1,9,19,36,38]. In addition, other contributions have focused on predicting the quality of the resultant welds for further decision-making and its monitoring [12,18]. For obtaining simplified FSW models, other studies have performed system identification to construct empirical representations in the Laplace domain based on the dynamics of experimental observations [42]. Such models have the capability of reproducing the system without requiring to know the physical phenomenon that takes place. Other data-based approaches for FSW systems include the use of artificial neural networks (ANN) for mimicking its dynamics and for process monitoring [20,28]. However, some limitations of these empirical models include that they are valid only for the range of data employed and for the particular material under study.
Regarding the control of FSW systems, there are several contributions that have mainly evaluated the effects of temperature as an indirect measurement of the final weld quality. In this context, Fehrenbacher et al. [14,15] implemented real-time wireless temperature measurements as the feedback signal for the control of the shoulderworkpiece interface temperature. Some of the findings include that insufficient shoulder-workpiece contact can cause welds with poor quality due to the lack of penetration. Additionally, the weld quality can be maintained despite external disturbances on the system by controlling the temperature and other welding parameters [16]. Other alternatives such as a proportional-integral-derivative (PID) feedback control and a linear model predictive control (MPC) demonstrated to be suitable control architectures for FSW processes. Indeed, Taysom et al. [33] found that each controller might be preferred under different circumstances because of their particular capabilities on achieving desired control objectives. Finally, Bachmann et al. [2] proposed a model-based adaptive controller for temperature control in FSW systems, obtaining a reduction in the settling time for closed-loop dynamics while avoiding stability issues.
Regarding the use of force control alternatives, different practices and architectures have been explored [25,26]. Among them, Zhao et al. [41] designed and implemented nonlinear force controllers for FSW, keeping the different forces constant to achieve certain control objectives. Davis et al. [11] implemented an observer-based adaptive control approach. Some correlation was observed between the spindle power and axial force allowing power measurements to be used as feedback. Davis et al. [10] studied a multilevel adaptive fuzzy control approach to keep a constant FSW power. Zhao et al. [40] proposed an axial force controller including delay compensation to favor stability and performance. To the best of the authors' knowledge, the literature does not report the use of ANNs or other equivalent intelligent control strategies applied to FSW systems [13]. Furthermore, prior contributions address the control action at a lower level and do not foresee the production of defect-free welds with good mechanical properties.
In this work, an intelligent control approach is explored as an alternative for defect-free FSW. In our practice, the evaluated material corresponds to an aluminum alloy. The experimental data corresponds to Al 6061-T651 [42], and the utilized empirical model considers as material Al 6061-T6 [24]. The consistency of the experimental design is guaranteed because both materials are essentially the same. A validated empirical model is initially translated from transfer functions to a set of ordinary differential equations in time domain. The model permits understanding the force dynamics as a function of certain inputs. For conceptualizing the defect-free set-point, labeled experimental data permits constructing the operational boundaries that define a region in which the probability of achieving defect-free conditions is the highest. Thereafter, the set-point is defined in a three-dimensional force diagram to finally implement the intelligent controller. Computational experiments are carried out to verify the adequacy in disturbance rejection as well as for visualizing the capabilities in achieving the proposed defect-free setpoint. The response of the intelligent controller is compared with a set of decoupled proportional-integral (PI) controllers and a linear MPC strategy to verify its performance, competitiveness, and applicability.

Friction stir welding modelling and defect-free set-point
This section includes the definition of the mathematical model that describes the relationship between the system's inputs and its force outputs. The closed-loop response of the system relies on this. The model relates the plunge depth, path speed, and rotational speed with the plunge force, path force, and normal force. In addition, the set-point of the control system is determined in terms of the force space. The aim is to determine the force combination capable of increasing the probability of achieving defect-free welds with good mechanical properties.

Dynamic model
The model defined in this work is based on the empirical model proposed by Zhao et al. [42]. In general terms, the dynamic model is an in-homogeneous, non-autonomous linear system of differential equations with initial conditions, which represent the dynamic behavior of the mechanical variables of interest (axial, path, and normal forces) and the manipulated variables (plunge depth, path speed, and rotational speed). The model consists in finding the vector of state variables u(t) = (u 1z (t), u 2z (t), F x (t), F y (t)) T such that, where Here F z (t), F x (t), and F y (t) represent the plunge, path, and normal force, respectively, while d(t) is the plunge depth, v(t) the path speed, and ω(t) the rotational speed, as illustrated in Fig. 1. In the proposed model u 1z = F z and u 2z = F z ; the parameters are p 1 , p 2 , τ x , τ y , and the fixed given constants are K x , K y , α x , α y , α z , β x , β y , β z , γ x , γ y , and α z .
The stability analysis of the dynamic model is included in the Appendix section. Such analysis aims to study the Fig. 1 Friction stir welding process long-term behavior of the dynamic response to guarantee its stability.

Defect-free set-point
To determine the defect-free set-point contained in a given force domain (F x , F y , F z ), the experimental data from [24] is processed for drawing regions where there is a higher and a lower probability of achieving defect-free welds. Following the idea proposed by Dewan et al. [12] and Huggett et al. [18], in which a visual representation of welding regions is introduced, the available dataset aims to reconstruct the prior referenced boundaries. Even though the previous works make a distinction between cold and hot welds and correspond to different materials, in our practice, the labeled experimental data shows an analogous pattern. The experimental points denote a region where better welding properties are achieved. Figure 2 illustrates the density of the defect-free welds in which the interior region holds a higher probability of achieving defect-free welds with good mechanical properties. In the exterior regions, the welding properties worsen as they are farther from the center volume. Indeed, some welding defects could be expected. Figure 3 depicts a 3D view of the experimental data in the force space. A good weld is the one that is defectfree and has good mechanical properties. A medium weld is the one that is solely defect-free but its mechanical properties are below a desired threshold. A bad weld is the one that has some undesired defects in its micro-structure or grain. The cross, which is a computed center point that follows a kernel density estimation (KDE) approach on the labeled data points, indicates the point that holds the highest probability of achieving the desired defect-free welds with good mechanical properties. The kernel employed on the  KDE approach followed a Gaussian distribution. The aim was to get a smooth normal density function. Therefore, the KDE estimation is formulated as follows: where K is a proportionality constant, N is the number of data points, w i is the weight associated to the weld quality of a given data point, x i is the data point in the force space, and finally h is the bandwith parameter which is tuned to control the smoothness of the final density function. The cross in Fig. 3 will be utilized as a 3D set-point located in the force domain for testing the different control architectures. Notice that the error signal is calculated as the Euclidean distance between a current position and the desired set-point. The interested reader can refer to the raw experimental data on the original contribution in [24].

An intelligent control architecture
In this work, a neural-net-based intelligent control system is proposed. A neural net is a collection of nodes interconnected with a certain structure. The structure is dependent on the architecture of the network. Every node and connection have associated weights, which are adjusted during the learning process of the network [21]. The learning process takes place through back-propagation [30] or by automatic differentiation if the network is trained in supervised or unsupervised frameworks, and through policies and rewards if it is trained through reinforcement learning approaches [32]. Neural nets are widely used in the fields of computer vision [23,35], recommendation systems [39], and control systems [37], among others.
The architecture is generally chosen according to the particular problem. To appropriately use the available information of the dynamic system under study, the chosen architecture of the controller follows a recurrent neural network (RNN) [17]. The RNN controller has n temporal modules, and it is formulated as follows: Each temporal module of the RNN controller is a gated recurrent unit (GRU) [3]. The GRU mechanism was selected because it requires a smaller quantity of parameters when compared to the long short-term memory (LSTM) RNN [17]. In this sense, its deployment is more suitable for the underlying problem, and it performs the required tasks with less data and dimensionality. The chosen GRU modules correspond to the minimal gated type [8], which combines the update and reset gate into the forget gate. Each unit is formulated as follows: Here, F i is the forget vector,ĥ i is the activation vector, h i is the output vector, σ and φ denote the activation functions, usually sigmoid functions, and D h,i are learnable matrices and vectors, i denotes the current module (0 ≤ i ≤ n), and t is the current control step (Fig. 4). Figure 5 introduces a visual representation of the schematic of a GRU module. In both tasks, the training and inference, the process states and previous process inputs are fed to the controller in a sliding-window scheme of fixed length n. The training takes place off-line.
Given a set of states X and previous inputs U , the new process input U t is determined and fed to a differentiable model. The loss function, which is the mean squared error of the states, is computed and through back-propagation, the controller's learnable weights are updated. In inference, the last step is skipped, performing significantly faster than other optimization-based methods. Indeed, the necessary operations are linear transformations with simple nonlinear activation functions, and the optimization step is no longer required. Figure 4 illustrates the flow of the closed-loop

Results
Computational experiments were carried out using a desktop computer 8 th generation Intel i7 2.2 GHz processor with 8 GB of RAM and an Nvidia GTX 1060 with 6 GB of vRAM. The proposed intelligent control system is compared with two other traditional control strategies, including a set of decoupled PI controllers and a linear MPC [29]. The responses are simulated and evaluated applying similar disturbances in the three different closedloop systems for observing the controllers' performance and dynamic response. The idea is to evaluate the controllers' capability in rejecting disturbances under fair conditions.
The dynamic model was implemented in a Python and a Matlab-Simulink environment. The intelligent controller was designed and trained in the PyTorch deep-learning framework available in Python. The decoupled PI controller was designed with a static decoupling, and the variables were paired in the following combinations, plunge depth (d) and plunge force (F z ), path speed (v) and normal force (F y ), and rotational speed (ω) and path force (F x ). The pairing was performed utilizing the static relative gain matrix approach. This control architecture was fine-tuned for minimizing the error on the system's response against the induced disturbances. The linear MPC was designed to minimize the error in the outputs and, to a lesser extent, to minimize the variability of the manipulated variables. The selected prediction horizon was 10 and the selected control horizon was 3. This controller was also finetuned to respond favorably against process disturbances. Both architectures, the decoupled PI controllers and the linear MPC, were implemented and tested in a Matlab-Simulink environment. Furthermore, the PI controller was also implemented and tested in the Python environment.
The RNN controller was completely designed and tested in Python under the PyTorch framework. The model was transformed to PyTorch tensors to hasten the training and inference processes. The training process consisted on 1000 epochs or iterations of randomly generated perturbations following normal distributions with μ = Y sp . The selected number of GRUs (n) in this work was 4.
For analyzing different operating conditions, two scenarios were defined. In the first scenario, the introduced disturbance time, its time span and its magnitude were predefined beforehand. In the second scenario, the same parameters were randomly selected, aiming to create a more difficult setting than in the first case. Also, the introduced randomness intends to evaluate the robustness of the different control architectures. Figure 6 illustrates the dynamic behavior of the controllers for each evaluated force considering disturbancerejection capabilities, in the first scenario. Similar artificial disturbances were introduced to the system for observing the correspondent responses. In both, the MPC controller and the proposed intelligent control system, the rejection is proficient in keeping the system on its desired set-point while the PI controller performs significantly worse, even with the static decoupling. In the case of the normal force (Fig. 6b), there is a slight delay by the intelligent controller response when it is compared to the MPC response. This could have been induced by a local minima during the training process, which was disregarded in a larger proportion the normal force when compared to the other two forces.
The reader should notice that the initial states for the simulation illustrated in Fig. 6 correspond to the proposed defect-free set-points. These initial conditions were selected because even though the linear MPC and the RNN controller succeed in reaching the proposed set-point, in all cases and for the three forces, the decoupled PI controllers struggled to reach them. This condition was particularly notorious when the system started with initial conditions of F z = 0, F y = 0 and F x = 0.
The responses of the manipulated variables, plunge depth (d), path speed (v), and rotational speed (ω), are displayed in Fig. 7. Here, we can observe that the control action of the decoupled PI controllers is considerably different when compared to the other studied architectures. This is particularly notorious in the case of the path speed, which is significantly different until it reaches 60 s. This behavior is consistent with the unsuccessful set-point accomplishment of the decoupled PI controllers evinced in Fig. 6. The MPC response shows a slight delay in every step, and also it exhibits an overshoot in some of the disturbances while the RNN controller holds a smoother dynamic response. Furthermore, even though the linear MPC and the RNN controller demonstrate a similar behavior, and they converge, more or less, to a same stationary condition in each step, the RNN shows less oscillations, and a better trade-off between aggressiveness and robustness on its control action. In this context, the RNN response could be translated to an optimal control performance which is highly efficient in achieving the proposed defect-free set-point overall. Figure 8 illustrates the effectiveness of the three controllers in achieving the desired set-point under different disturbances in terms of an error percentage. The reader should recall that the set-point definition is explained in Section 2.3. The error is computed as the Euclidean distance between a current location in the force domain and the defect-free set-point coordinates. In this context, what is evaluated is the rapidness and effectiveness in returning to the desired point which has the highest probability of attaining defect-free welds with good mechanical properties. Moreover, Fig. 8a shows the time series of the error percentage for the simulation previously introduced in Fig. 6. It can be observed that the decoupled PI controllers' error dwarves the other controllers' error, especially at 10 s and 40 s. At these time points, disturbances in the plunge force (F z ) are incorporated (see Fig. 6c). In addition, for a better appreciation of the error differences between the linear MPC and the intelligent controller, Fig. 8b shows their error evolution under the different disturbances. It can be observed that the MPC performs better when the normal force (F y ) is the disturbed variable. On the other hand, the intelligent controller performs better when the plunge force is the introduced disturbance. Finally, when the path force (F x ) is the disturbed variable, both controllers appear to respond equally favorable. Table 1 enlists the mean squared error % for all the controllers and a comparison in contrast with the intelligent controller, which performs better overall regardless the induced disturbances and in terms of keeping the defect-free set-point (disturbance rejection). The decoupled PIs strategy performs worse than the other two besides exhibiting significant problems when initiating the system. The MPC demonstrates a higher error than the intelligent controller even though it was fine-tuned and overall exhibits a good response. The fact that both the intelligent controller and the MPC perform well could be attributed to the optimization step. This task was performed offline in the case of the intelligent controller and online in the case of the MPC, considering all the inputs and outputs simultaneously. The improvement percentage of the RNN controller over the two other classical approaches shows that it could be considered as a competitive alternative for FSW systems. The intelligent system achieves 38.10% better performance than the decoupled PI controllers and 12.83% better than the linear MPC. Figure 9 shows the comparison of the different control architectures performance in the second scenario. It can be observed that the disturbances are more dynamic and more aggressive. In all the control systems, stability is not an issue. However, as in the previous scenario, the decoupled  show an important deviation from the desired set-point, with the notable exception of the F x case, in which the peaks of the disturbed system are similar to the PI controllers. Even in more unfavorable conditions, the proposed intelligent control system is able to reject disturbances and keep the defect-free set-point. Table 2 summarizes the results in terms of mean squared error of each control system and the intelligent controller improvement. The error is measured as in the previous scenario. It is attested that even in more challenging

Conclusions and future work
In this work, an intelligent control system with an RNN architecture and GRU modules is proposed. The controller was trained with the aim of achieving defect-free welds with good mechanical properties. The optimal set-point for the FSW process was determined by kernel density estimation on the labeled data points, particularizing it for the case of Al 6061. When comparing the intelligent controller with other common strategies, the RNN controller demonstrates a notably better performance than the decoupled PI controllers in all cases under similar disturbances. It also achieves an overall better performance than the linear MPC, with the exception of the case in which the normal force is the disturbed variable. The improvement percentage of the proposed control system over the other controllers is significant, achieving the lowest cumulative error in the measured output variable.
Future work in the area includes the exploration of online-learning control systems capable of adapting to parameter variations in the plant (e.g., different materials). In addition, the use of policy-based training instead of backpropagation to comprise non-differentiable models, and the implementation of the intelligent controller on a real FSW system could be explored to further validating the model and the proposed approach. Finally, the use of other toolmaterial combinations has the potential of extending the intelligent control capabilities.
Theorem 2 All solutions of the dynamical model in Eq. 1 given by Eq. 5 have the same Lyapunov stability property as the zero solution of homogeneous linear system u (t) = Au(t).
Proof Let u * (t) be a solution of the dynamic model in Eq. 1, whose stability is to be determined. Let u(t) be another solution, a set v(t) := u(t) − u * (t). It follows that v (t) = Av(t) v(0) = u 0 − u * 0 . The Lyapunov stability of u * (t) implies that for all ε > 0, there exists δ > 0 such that u 0 − u * 0 < δ =⇒ u(t) − u * (t) < ε for all t ≥ 0. In terms of v, this is equivalent to v 0 < δ =⇒ v(t) < ε, which is the condition for the Lyapunov stability of the zero solution according to Theorem 1.