Introduction

Cold spraying is a promising technology for coating sensitive metals and composites, and it is widely used in numerous applications, including repairing and surface engineering. Unlike conventional thermal spraying, cold spraying has many advantages such as lack of oxidation, phase transformation, low operating temperature and little heat effect in the processing, and it is especially suitable for forming temperature sensitive materials (Ref 1, 2). In the processing of cold spraying, the critical velocity directly determines whether the particle can deposit on the substrate successfully.

With the increase of particle velocity, the deposition efficiency of powder increases gradually and coating quality can be improved with large plastic strain due to the larger kinetic energy of powder (Ref 3). The critical velocity is defined as the velocity at which powder can be deposited on the substrate successfully (Ref 4). This is also the turning point of particles from erosion to deposition, and the deposition efficiency is zero at this point. Later, research showed that when the deposition efficiency reaches about 50%, the deposition efficiency would increase rapidly, and the variation range of particle velocity keeps in a very narrow interval (Ref 5). At the same time, the particle size in the spraying process is maintained at a range rather than a quantity. Consequently, the velocity corresponding to the deposition efficiency of 50% is widely regarded as the critical velocity of particles. Excessive momentum of powder will result in work hardening and erosion of prior coating, causing the deposition efficiency decreasing from 100% to negative value when the particle velocity exceeds a certain value with about 2 or 3 times critical velocity (Ref 6). Therefore, the velocity of particle is generally within a suitable range in spray processing.

The critical velocity of particle is affected by both external and internal factors, and the internal factors of the material are the main reason that determines the particle whether can be deposited. Generally, the particle which has a lower melting point can easily soften and deform in the spraying processing and easily reach the critical velocity (Ref 7, 8). Meanwhile, the hardness of the particle themselves also plays a key role. The higher the particle hardness, the worse its deformation capacity will be. Therefore, it is difficult to deposit on the surface of the substrate, but easy to cause erosion and impact damage to the substrate (Ref 8, 9). For example, Cr, W and other hard phase particles are difficult to deposit directly by cold spraying. In addition, the degree of oxidation of particles also directly affects the critical velocity. To rupture the oxide film and allow the metal leak out to combine the substrate, some kinetic energy of the particles is consumed, and it leads to a higher critical velocity of the particle (Ref 10). Thus, it can be seen that the factors affecting the critical velocity are mainly the properties of the material itself, especially the ability of plastic deformation. The external factors mainly refer to carrier gas temperature and substrate material. When the same material is deposited on different substrates, the critical velocity required of particle for the harder substrate is small than the soft substrate, which is due to the larger plastic deformation of particle and easier to form self-locking during the impacting on the harder substrate (Ref 11). With increasing the gas temperature, the in-flight particles can be softened further in the laval nozzle and obtain greater plastic deformation when the particles impact on the substrate (Ref 12). Thereby, the critical velocity of the particle can be decreased by increasing the gas temperature below the melting point to prevent the material from melting in the actual forming process.

The measurement and prediction of critical velocity of cold spraying are mainly carried out from two aspects: experiment and numerical simulation. In the course of the experiment, particle velocity is usually measured by the laser pulse generated by the laser diode irradiating on the high-speed particles, and the reflected pulse signal received by the CCD detector is used for image data processing, and then, the actual particle velocity is measured (Ref 13, 14). According to the experimental results and theoretical derivation, researchers have put forward the empirical formula of critical velocity, including density, melting point, tensile stress, reference temperature and other parameters (Ref 6, 15). These formulas further explain that the influence factors of critical velocity are mainly determined by the physical properties of the particles. On the other hand, in view of the development of computer finite element technology, there is an effective means to simulate the impact behavior of high-speed particles, and the instantaneous phenomena which are difficult to be achieved by experiments can be observed accurately. Assadi et al. Ref 15 established the cold spray model based on the Lagrange method and presented that the adiabatic shear instability (ASI) is a standard to anticipate the successful deposition of particles for the first time. Subsequently, other scholars used the same method to simulate the deposition of particles at different speeds (Ref 16). The results show that the velocities of ASI at particle temperature, equivalent plastic strain, equivalent plastic strain rate and equivalent normal stress are very close to the critical velocities obtained by experiments. Therefore, ASI is widely used as a criterion for estimating the critical velocity of cold spraying (Ref 17,18,19). Furthermore, in order to avoid the drawbacks of excessive distortion of the traditional Lagrangian method during large deformation, the smoothed particle hydrodynamics method (SPH), arbitrary Lagrange-Euler method (ALE) and Eulerian method have also been widely applied in the simulation analyses of cold spraying (Ref 20,21,22) based on ASI. However, it takes a lot of time and resources to predict the critical velocity of the particle through experiment or simulation, and it is difficult to consider the influence law under the joint action of many factors at the same time, both of which have great limitations.

The aim of this paper is to propose a new method to predict the critical velocity of particle based on machine learning. Unlike experiments or simulations, feature selection was first used to weigh the influence of different material parameters on the critical velocity. Then the critical velocity was predicted by using artificial neural network (ANN) on the basis of the important features selected by feature selection. Finally, the accuracy of the prediction results was evaluated with root mean square error (RMSE) and mean absolute percentage error (MAPE).

Data Set and Analysis Method

To quantify the critical velocity with material parameters and predict the critical velocity, it is of significant importance to study the contribution of each material parameter to the critical velocity. Figure 1 illustrates the flowchart of predicting the critical velocity. It indicates that the first step is to collect and preprocess the data. The second step is performing the feature analysis, including defining material properties and calculating the contribution of each parameter. The third step is ANN predicting. Details were described in the following sections.

Fig. 1
figure 1

The proposed flowchart for predicting the critical velocity

Data Set

The critical velocity affecting whether particles can be successfully deposited is only related to particles properties under certain conditions of external factors (gas temperature, substrate properties, etc.). For a more comprehensive analysis, mechanical and thermodynamic parameters of different materials are considered as far as possible, and the critical velocity of different materials measured under the same experimental conditions is cited in Table 1. Specifically, the experimental conditions are particles with an average particle size of 25 μm and a corresponding temperature of 20°C. The mechanical characteristics, including the density, modulus of elasticity, Poisson's ratio, tensile strength, yield strength and the bulk speed of sound, and the thermodynamic properties, including the thermal conductivity, specific heat capacity and the melting point temperature of particle materials, are selected as feature selection parameters. In the present study, 8 materials (8 sets of data) are considered accordingly.

Table 1 Parameters and critical velocity of different material (Ref 2), (Ref 23), (Ref 24)

As shown in Table 1, there is a great difference between 1E and 9 to 1E8 in the order of magnitude between different attributes of the particle, which leads to unbalanced weight and has a great impact on the accuracy of machine learning and. Data normalization is one of the commonly used data preprocessing that can significantly improve the similarity in network training, accelerate the convergence, and improve the model accuracy (Ref 25). At present, Z-score standardization and Min-Max Normalization are two common normalization methods. Compared with Z-score standardization, Min-Max Normalization has higher applicability for the data with non-normal distribution which adopted in this study. Using this method, data are normalized to the interval of [0, 1] through the following expression:

$$x_{i}^{*} = \frac{{x_{i} - x_{\min } }}{{x_{{{\text{max}}}} - x_{\min } }}$$
(1)

where xi, xmin, xmax, xi* denote the original, minimum, maximum and the normalized data, respectively.

Feature Selection and Selection Methods

Feature selection is an important part of feature engineering to find the optimal feature subset. By eliminating irrelevant or redundant features, the data dimension can be decreased which result in a higher accuracy and better generalization ability especially in machine vision (Ref 26, 27). Three data-driven algorithms based feature selection for screening out key features about influencing critical velocity of the material in this section, including Gradient boosting regression tree, correlation analysis and SelectKBest.

Gradient Boosting Regression Tree

Gradient boosting regression tree is a mainstream machine learning algorithm for data regression problems. Different from other algorithms (decision tree, random forest, etc.), it uses the boosting integrated model. In the process of model learning, the new decision tree fits the residual of a subset of the original data set (not the original data set), which is obtained by non-return random sampling. The randomness often helps to improve the fitting ability of the model, and the unextracted data can also be used as a verification set. It should be noted that the gradient boosting regression tree measures tree’s contribution to the predicted results through a learning rate (Ref 28).

Gradient boosting regression tree builds the tree in this way until the model reaches the maximum value of the predetermined tree or adding additional trees does not significantly affect the size of the model residuals. The initial prediction that minimizes the loss function is described as follows:

$$F_{0} (x) = \mathop {\arg \min }\limits_{\gamma } \sum\limits_{i = 1}^{n} {L(y_{i} ,\gamma )}$$
(2)

where n is the number of input variables, \({y}_{i}\) is the observed values, γ is the predicted value, and L is the loss function. Furthermore, the residual of each sample is expressed as the deviation of the loss function relative to the predicted value, which can be determined by the following formula:

$$r_{{{\text{im}}}} (x_{i} ) = - \frac{{\partial L(y_{i} ,F_{m - 1} (x_{i} ))}}{{\partial F_{m - 1} (x_{i} )}}$$
(3)

where r is the residual, m is the number of tree , xi is the input values, and i is the number of samples. By modeling the pseudo residual, the weighting factor γm that can be used to build next tree hm(x) is given by:

$$\gamma_{m} = \mathop {\arg \min }\limits_{\gamma } \sum\limits_{i = 1}^{n} {L(y_{i} ,F_{m - 1} (x_{i} ) - } \gamma_{m} h_{m} (x_{i} ))$$
(4)

Finally, making a new prediction for each sample according to the previous learning situation, the predicted value \(F_{m} \left( x \right)\) can be defined as follows:

$$F_{m} (x) = F_{m - 1} (x) + \gamma_{m} h_{m} (x)$$
(5)

SelectKBest

For the sample data set, SelectKBest algorithm, labeled as SKB, could select the most maximum relevance feature based on the mutual information between the features and labels. It takes two parameters as input arguments, k and the score_func, to estimate the relevance of every feature. K is the number of properties that need to be preserved. Score_func uses functions to score the features in the dataset and arranges them in order from high to low, such as chi2 and f_classif for classification problems and f_regression and mutual_info_regression for regression problems (Ref 29, 30). In this paper, the algorithm adopts the scoring function of f_regression and retains all attributes. f_regression can be described as follows:

$$r_{i} = \frac{{(x_{i} - \overline{x} )^{T} (y - \overline{y} )}}{{{\text{std}}(x_{i} ){\text{std}}(y)}}$$
(6)

where ri is the sample correlation coefficient that reflects the importance of the input and output data sets , xi and y are the input values and output values, \(\overline{x}\) and \(\overline{y}\) are their respective averages, std is the standard deviation of the data.

Correlation Analysis

Correlation analysis is used to quantify the association between two variables and the range of correlation coefficient from −1 to 1. The larger the correlation coefficient is, the more related the two variables are. When the correlation coefficient is greater than 0, it means that there is a positive correlation between the two variables; otherwise, there is a negative correlation (Ref 31). In this study, the positive and negative affection between material parameters and critical velocity is ignored and the correlation coefficient can be calculated as follows:

$$r = {\text{abs}}(\frac{{E[(X - {\text{EX}})(Y - {\text{EY}})]}}{{\sqrt {E(X - {\text{EX}})^{2} E(Y - {\text{EY}})^{2} } }})$$
(7)
$${\text{EX}} = \sum\limits_{i = 1}^{N} {X_{i} } /N$$
(8)
$${\text{EY}} = \sum\limits_{i = 1}^{N} {Y_{i} } /N$$
(9)

where r is the linear correlation coefficient, EX and EY represent the mean values of X and Y, respectively.

The above three algorithms are, respectively, used to train the normalized data set. In order to consider the influence of different situations as far as possible, 6 sets of data (75% data) are selected as the training set and 2 sets of data (25% data) as the verification set each time, in a total of 28 (\({\text{C}}_{8}^{6}\)) cases. The influence weight of each parameter is obtained by weighted averaging of the 28 results of each method. Finally, parameters with the influence weight of less than 0.2 are ignored, while remaining parameters are used to quantify the critical velocity. Figure 2 illustrates the flowchart of the abovementioned feature.

Fig. 2
figure 2

Flowchart of the feature analysis method

The Method of Artificial Neural Network

In recently, the ANN is widely applied in a variety of fields due to the good nonlinear fitting ability and this fitting ability is dependent on the number of hidden layers, neurons and hidden functions (Ref 32,33,34). In the model learning, the weights and bias can be updated through the back propagation algorithm to ensure the error between the actual value and predict value is minimum. The mathematical principle of ANN can be simply expressed by Eq. (10).

$$y_{{{\text{predict}}}} = f_{2} [W_{2} \cdot f_{1} (W_{1} \cdot X - B_{1} ) - B_{2} ]$$
(10)

ypredict is the predict value, X is the input value, f1 and f2 are the transport functions of the hidden layer and the output layer, respectively, W1 and W2 are the weight matrix of hidden layer and the output. B1 and B2 are the bias matrix of hidden layer and the output. Through formula calculation, the corresponding results ypredict can be predicted by the input data X.

For the predicted results, the loss function is also needed to measure the accuracy of the model. The mean square error (MAE) of Eq. (11) is a common loss function.

$$J = \frac{1}{N}\sum\limits_{i = 1}^{N} {(y_{{{\text{predict}}}} - y_{{{\text{actual}}}} } )^{2}$$
(11)

ypredict is the predict value, yactual is the actual value, N is the number of the train data. In the actual training process, it is key to reduce the value of loss function as much as possible.

Although the ANN has a great fitting performance, underfitting and overfitting are frequent problems in the actual modeling process. To overcome this phenomenon, the cross-validation method which is effective for small sample analysis is used and also can avoid the noise problems caused by small samples. Similar to feature selection, in the cross-validation, 75% data are set as training data, while the remaining 25% data are set as the validation data. Meanwhile, the number of hidden layers, neurons of each hidden layer and the activation function should be optimized in the data processing to reduce the simulation error between the actual value and the predicted value.

Figure 3 shows the flowchart of the ANN method for predicting the critical velocity. In this paper, all the codes are implemented with Python syntax, and the platform is Jupyter Notebook. The third-party tool library including the tensorflow and sklearn is adopted feature selection and critical velocity prediction.

Fig. 3
figure 3

The flowchart of the ANN method for calculating the critical velocity

Results and Discussions

Material Parameters Contribution Analysis and Selection

Figure 4 shows the schematic diagram of the influence weight of material parameters based on different feature selection algorithms. The mechanical parameters are marked in green, while the thermodynamic parameters are marked in purple. Figure 4a-c shows the results of gradient boosting regression tree, correlation analysis and SelectKBest algorithm, respectively. To unify the results of the three algorithms, weighted averaging is carried out and the results are shown in Fig. 4d.

Fig. 4
figure 4

Parameters influence weight based on feature selection (a) gradient boosting regression tree, (b) correlation analysis, (c) SelectKBest analysis, (d) weighted average results

It is obvious that the weight distribution results of the gradient boosting regression tree with the impurity index of MSE and the SelectKBest with the impurity index of f_regression are in good agreement. The yield strength and tensile strength representing the plastic mechanical properties of materials show a higher influence weight on the critical velocity which is close to 1. The influence of thermal conductivity and melting point representing the thermodynamic properties of materials is second. Although the results calculated by correlation analysis is slightly different, the overall trend remained consistent. From the weighted average results, the influence weight of mechanical property parameters is higher than that of thermodynamic property parameters as a whole. This indicates that the deposition of particles during cold spraying mainly depends on the physical properties of particles, while thermal softening has an auxiliary effect. As mentioned above, the deposition mechanism of cold spraying can be revealed from the perspective of feature selection.

Through the result of feature selection, the feature parameters with influence weights more than 0.2 are selected. Therefore, five parameters including tensile strength, yield strength, thermal conductivity, melting point and bulk speed of sound were selected as input properties for subsequent predictions.

Critical Velocity Prediction

After feature selection, five features, including tensile strength, yield strength, thermal conductivity, melting point and bulk speed of sound, are selected as the inputs, and the critical velocity is set as the output for the ANN. The linear ANN structure is simple and does not contain hidden layers. In contrast, the nonlinear ANN structure needs to consider the effects of the hidden layers and the activation function on the model. Figure 5 shows the influence of different number of hidden layers, number of hidden nodes and activation function on the accuracy of the data model (measured by MAE). The smaller the bubble point is, the better the model effect is. As shown in Fig. 6, when the activation function is sigmoid, the number of hidden layers is 1, and the number of hidden nodes is 3, the model has the highest accuracy.

Fig. 5
figure 5

MAE of nonlinear ANN errors under different parameters

Fig. 6
figure 6

The structure of ANN model: (a) linear ANN model (b) nonlinear ANN model

Figure 6 shows the structure of the linear and nonlinear ANN model which is determined through the analysis and testing according to the step in Figs. 3 and 5. In the linear ANN model, all the inputs are directly connected with the output, and the activation function of the output layer is linear (y=x). Figure 6b shows that the structure of nonlinear ANN model. Moreover, to make the model converge faster, the Adam optimizer function is set in both linear and nonlinear ANN model.

Figure 7 shows the trend of verification loss and verification accuracy based on two ANN models. Compared with linear ANN model, the nonlinear ANN model shows a faster convergence rate and a higher accuracy which indicates that the relationship between critical velocity and material properties is nonlinear. When the number of iterative steps is 2000, the model tends to be stable, the verification loss is maintained at 0.04, and the accuracy is as high as 0.95. In the same case, the linear ANN network needs to continue to iterate to 2000 steps, and the corresponding verification loss and accuracy are 0.5 and 0.8, respectively. With the iterative step increased, the error of the network is increased, and the model have the phenomenon of overfitting.

Fig. 7
figure 7

The trend of verification loss and accuracy with iterations under two ANN models

Furthermore, in order to take into account the coverage of all cases, for 8 sets of data sets, 6 groups (75%data) are taken as training sets, and the remaining 2 groups (25%data) are taken as verification sets. Therefore, there is a total of 28 (\({\text{C}}_{8}^{6}\)) cases. Linear ANN and nonlinear ANN models are used for prediction, and the results are shown in Fig. 8. As for the prediction of the training set, it is shown in Fig. 8a that the prediction points on the linear ANN are more concentrated above the auxiliary lines, indicating that the overall prediction results are too large and the accuracy is poor. In the nonlinear ANN model in Fig. 8b, the prediction point is uniformly located on the auxiliary line, showing a good prediction effect. In the prediction of the verification set, it can be seen from Fig. 8c that the dispersion of the prediction points under the linear model is more obvious, and the overall error is less than ±40%, which is obviously different from that of the training set, and the generalization effect of the model is not ideal. Although the error of the nonlinear model has also increased significantly, most of the errors are kept within ±20% in Fig. 8d. Compared with the linear model, it has better fitting and generalization ability in the performance of the data set, which also means that the particle parameters have strong nonlinear relationship with the critical velocity.

Fig. 8
figure 8

Training and validation results from ANN model

In order to illustrate the feasibility of the nonlinear neural network in predicting the critical speed of the cold spray, two evaluation methods including RMSE and MAPE are used to evaluate the prediction results, which were calculated by Eqs. (12) and (13).

$${\text{RMSE}} = \sqrt {\frac{1}{n}\sum\limits_{i = 1}^{n} {(y_{i}^{*} - y_{p}^{(i)} )^{2} } }$$
(12)
$${\text{MAPE}} = \frac{100\% }{n}\sum\limits_{i = 1}^{n} {\left| {\frac{{y_{i}^{*} - y_{p}^{(i)} }}{{y_{i}^{*} }}} \right|}$$
(13)

Where n is the number of predicted values, yi* and yp(i) are the i-th target and predicted responses, respectively.

Table 2 shows the prediction results of 28 cases under the nonlinear neural network and the prediction value corresponding to each result in detail. The average of MAPE and RMSE of all cases is 7.14% and 45.81, respectively, which all remain within a small range without obvious underfitting and overfitting behaviors.

Table 2 Prediction results of nonlinear ANN model

Furthermore, in order to count the prediction results of the critical velocity of each material, the above results are extracted and the mean value is taken as the final predicted value. In order to facilitate comparison with other studies, an additional empirical formula for calculating critical velocity proposed by Assadi et al. Ref 3 is added. The final result is shown in Fig. 9, and the numerical part is the average error of the critical velocity of each material. It can be seen from the predicted results of the model that except that the Ti error is as high as-12.59%, the critical velocity prediction errors of other materials are kept in single digits, of which Cu has the lowest prediction error of −0.38%. By contrast, the predicted results using empirical formulas are significantly larger, in which the material TC4 with the largest predicted error is as high as −25.74%. Except for Al7075-T6, all the predictions are inferior to those of the nonlinear neural network. Without considering the influence of positive and negative errors, the average error of each material is 4.76% by nonlinear ANN, and the corresponding prediction accuracy is 95.24%. The error and accuracy of the empirical formula are 14.38% and 85.62%, respectively. The prediction accuracy of the nonlinear ANN is nearly 10% higher than that of the empirical formula, which shows that the model has good learning and prediction effect under small sample data.

Fig. 9
figure 9

The results are predicted by nonlinear ANN model and formula

In order to verify the prediction accuracy of the model on new materials, two sets of 316L and Nb data are added as prediction indexes as shown in Table 3. All the 9 data in Table 2 are used as the training set of the nonlinear ANN, and the new two sets of data are used as the prediction. The final results are shown in Fig. 10. From the prediction results of the two metals, the average prediction error is 3.55% and the corresponding accuracy is 96.45%. The overall prediction accuracy is slightly higher than the previous data set, and this means that the nonlinear ANN can still guarantee good accuracy even at the prediction of critical velocity about new materials.

Table 3 New material data samples predicted by nonlinear ANN model (Ref 2)
Fig. 10
figure 10

Prediction results of new materials using nonlinear ANN model

Conclusion

In the present study, an artificial neural network with the feature selection method is used to predict the critical velocity of the cold spray. Moreover, the influence weight of each parameter of materials is calculated based on the feature selection method, and the parameters which have higher influence on the critical velocity are set as the inputs of ANN to predict the critical velocity with different materials. The main conclusions are summarized as follows:

  1. (1)

    The method based on machine learning with feature selection is proposed to predict the critical velocity of the cold spray. It is observed that the proposed method has a high accuracy and short time cost for predicting the critical velocity for pure metal and alloy materials and the best ANN model are established.

  2. (2)

    Feature selection analysis shows that the parameters that make great contribution to the critical velocity are mechanical parameters, especially those representing plastic deformation, followed by thermal parameters. The results show that the effect of large plastic deformation on the critical velocity of materials is greater than that of thermal softening.

  3. (3)

    Compared with the linear neural network and empirical formula, the nonlinear ANN model has higher prediction accuracy and fault tolerance. In the original data set, the prediction accuracy can reach 95.24%, and in the new data set, it can reach 96.45%, which shows that the model has good learning and generalization ability for small data samples.