An online monitoring method of milling cutter wear condition driven by digital twin

Real-time online tracking of tool wear is an indispensable element in automated machining, and tool wear directly impacts the processing quality of workpieces and overall productivity. For the milling tool wear state is difficult to real-time visualization monitoring and individual tool wear prediction model deviation is large and is not stable and so on, a digital twin-driven ensemble learning milling tool wear online monitoring novel method is proposed in this paper. Firstly, a digital twin-based milling tool wear monitoring system is built and the system model structure is clarified. Secondly, through the digital twin (DT) data multi-level processing system to optimize the signal characteristic data, combined with the ensemble learning model to predict the milling cutter wear status and wear values in real-time, the two will be verified with each other to enhance the prediction accuracy of the system. Finally, taking the milling wear experiment as an application case, the outcomes display that the predictive precision of the monitoring method is more than 96% and the prediction time is below 0.1 s, which verifies the effectiveness of the presented method, and provides a novel idea and a new approach for real-time on-line tracking of milling cutter wear in intelligent manufacturing process.

conditions, and the results show that the method can reliably assess the wear state and remaining service life of the tool.Sun et al. 14 utilized long and short-term memory network prediction and residual convolutional neural networks combined with raw signals acquired during machining to achieve tool state monitoring.Kong et al. 15 used the feature downscaling technique to obtain features that can better characterize the tool wear state, combined with gaussian process regression (GPR) to achieve tool wear state monitoring.Nie et al. 16 proposed an improved particle swarm optimized (IPSO) least squares support vector machine (LS-SVM) prediction model for tool wear status monitoring.However, the above literature often uses a single prediction model for tool wear prediction, which makes it easy to ignore the indispensable information in the tool wear process and the results have a certain degree of chance.
To address the issue of single-model prediction, some experts have adopted ensemble algorithms to study tool wear.The ensemble algorithm, as a branch of machine learning, relies on multiple base learners and corresponding weights to comprehensively extract tool wear process information and improve the stability of model prediction.Nasir et al. 17 used multi-sensor signals, combined with random forest (RF) and extreme gradient boosting (XGBoost) algorithm to predict tool wear status.Yuan et al. 18 utilized the variational modal decomposition algorithm for signal processing, combined with an ensemble algorithm to establish a classification prediction model to enhance the accuracy of the tool wear prediction model.Li et al. 19 adopted the gradient boosting decision tree (GBDT) to choose the best subset of features for tool wear status identification and combined GBDT with hybrid classification RBM (H-ClassRBM) to construct a prediction model.The experimental findings reveal that the ensemble model has better identification accuracy and stability compared to an individual model.Although the ensemble algorithm can enhance the accuracy and stability of tool wear prediction, the algorithm is based on offline historical data and ignores the influence of uncertainty factors such as the internal of CNC machine tools and equipment on tool wear, which leads to the inevitable bias of the prediction model.
In recent years, the DT has received great attention from scholars, and domestic and foreign scholars have been actively exploring the application of DT technology in the visualization and monitoring of intelligent workshops, real-time fault diagnosis of equipment, and full life cycle control of products 20,21 .DT technology with a high degree of physical information fusion and virtual reality synchronization is capable of depicting and modeling the features, actions, and performances of physical spatial objects during the whole process of lifecycle 22,23 .Guo et al. 24 utilize the improved GJK collision detection algorithm to detect the collision model of the tool and the machine tool, combined with the collection of tool wear data, to realize the online prediction of tool wear and reduce the risk of tool collision.Liu et al. 25 presented an online real-time monitoring method for milling cutter wear status based on the DT and clarified the five-layer system architecture of the DT.Zhang et al. 26 used DT technology, combined with tool wear monitoring in the cutting process, to realize real-time online management and control of tool wear.Zhang et al. 27 utilized a transfer learning strategy and combined DT technology to construct a tool wear monitoring model for varying operating conditions.However, the above scholars only focus on the application of digital twins in tool wear and do not study the combination of multimodel tool wear prediction methods and digital twins.
In the actual cutting process, there are individual tool wear prediction models with errors and unstable results, as well as the DT model based on historical data makes it difficult to realize real-time tool wear monitoring.Therefore, this paper presented a digital twin-driven ensemble learning milling tool with wear online monitoring method.On the one hand, DT technology is used to address the problem that real-time online monitoring cannot be realized based on offline historical data, and on the other hand, the accuracy and stability of model prediction can be improved by using ensemble learning.

System architecture
The digital twist-driven ensemble learning milling tool wear online monitoring method introduced in this paper is displayed in Fig. 1.Firstly, the twin virtual machine tool of the physical machine tool is established, combining different sensors to collect real-time data and the attribute data of the CNC machine tool itself to get the twin data of the CNC machine tool.Then, the twin data processing system is established by using data processing technology.The milling tool wear prediction model is constructed by the ensemble algorithm, and the milling tool wear is mutually verified by combining the model prediction results.Finally, based on the DT and ensemble algorithms to build the milling cutter wear state real-time mapping, milling cutter wear status real-time visualization and analysis, as well as tool change decision-making and compensation, and dynamic control of the physical CNC machine tool real-time parameter adjustment and tool wear optimization, to achieve the real-time dynamic monitoring of milling cutter wear in the actual cutting process of the CNC machine tool.
(1) Twin data acquisition: real-time data acquisition is the basis for the operation of the digital twin system.
Static data such as machining process parameters, equipment information, and tool types are acquired through the manufacturing equipment system (MES).The coordinates of tools and workpieces are acquired through open interfaces to the machine's numerical control system.The dynamic data such as vibration and cutting force are acquired by using external sensors.The data in the cutting process of the machine tool is collected in real-time and uploaded to the digital twin system.(2) Tool wear model prediction: using the XGBoost ensemble model to predict the tool wear value and wear state online is the core.The dynamic data of the machine tool is collected in real-time, and then the data is input into the digital twin multi-level data processing system for data processing and feature downscaling, and the processed features are input into the XGBoost ensemble model of tool wear to predict the tool wear value and wear state online.(3) Real-time online tool wears monitoring and mutual verification of tool wear: the tool wear curve is drawn online through the tool wear value, and the tool compensation strategy is formulated online in real time.
The tool wear status is utilized to identify tool wear online and develop tool change decisions.At the same time, the predicted tool wear state and the predicted tool wear value are mutually verified to improve the accuracy of digital twin tool wear monitoring.

DT system development and configuration
In this paper, Creo 6.0, Unity 3D 2021, and 3ds Max 2017 software are used to develop a DT system for detecting the wear status of milling tools on CNC machine tools.Firstly, Creo 6.0 is used to model the Mikron UCP 800 5-axis machining center in 3D according to the size scale.Then the model is imported into 3ds Max 2017 software to create cutting and machining process animation as well as rendering the CNC machine model.Finally, Unity 3D 2021 is employed to design the system interface and program interaction.The data from the actual CNC machine is fed to the tool wear DT through TCP/IP communication protocol.

Methodology study for modeling DT mechanisms
The geometric model and physical model support the tool behavior model 5 , and the behavior model is the reference of the rule model 28 , so the twin mechanism model reflecting the characteristics of the actual tool is constructed by an ensemble of the four sub-models.www.nature.com/scientificreports/

Geometric models
The tool geometric model mainly includes parameters such as tool rake angle and tip radius 29 .From Eq. (1), it can be seen that the tool wear rate is mainly affected by the front and back angles of the tool.
where dV B dt is the tool wear rate; W is the wear volume; α n is the front Angle of the tool; γ n is the back Angle of the tool; ω is the angular velocity of the tool rotation.

Physical models
The physical model mainly reflects the material attributes of the tool and the workpiece, and the construction of the physical model comprehensively reflects the macroscopic properties of the material, mainly the relationship among the parameters of the material, such as stress, strain, temperature, etc 30 .The Johnson-Cook model is used, and its expression is as follows: where A is the yield strength of the material; B is the hardening modulus of the material; C, m, n is the material coefficient; ε pl is the material equivalent plastic strain; . ε is the material reference strain rate; .pl ε is the material equivalent plastic strain rate; T m is the melting point of the material; T g is the ambient temperature.

Behavioral models
The friction generated by tool and chip interaction seriously affects the quality of the workpiece's appearance 31 .A hybrid friction model is adopted to represent the contact friction situation with the following equation: where µ is the friction coefficient; a k is the contact normal stress.
The chip separation criterion and fracture criterion are established based on the separation criterion and rupture stress criterion of equivalent plastic strain.In this paper, the J-C fracture criterion is selected as shown in Eq. ( 4).
where ε f p is cumulative damage; d a , d b , d c , d d are the material coefficient; σ is the material tensile stress; σ e is the material equivalent stress; . σ n is the corresponding plastic stretch; . σ p is the corresponding plastic stretch when the element fails; T is the deformation temperature; T m is the melting point of the material; T g is room temperature.

Rule models
To reflect the milling cutter wear degradation principle, this paper adopts the rule modeling based on the milling cutter wear mechanism.The material of the milling cutter is a carbide three-tooth face milling cutter, and the workpiece material is a TC4 titanium alloy plate.The wear mechanism to get the milling cutter wear corresponds to the degradation model 32 , as shown in Eq. ( 5).
where M, Q are cutting constants; f is the amount of tool feed; ν is the cutting speed of tool; R is the temperature constant; T is the universal gas constant; g is the cutting activation energy constant.

Digital twin-driven multi-level data processing of milling cutter wear
The DT data processing system is used to remove interfering information and improve the characterization of twin data.Figure 2 displays the multi-level data processing of the DT system for milling cutter wear.

Twin data pre-processing
Due to the periodic cutting in and out of the tool teeth during milling, the cutting vibration signal also shows periodicity, so the low-frequency part of the acquired signal is mainly the effective vibration signal, while the high-frequency part is the interference noise signal 33 .Fourier transform is employed to convert the time-domain signal into the frequency-domain signal, which is convenient to observe the frequency information of the signal 34 .A low-pass filter is used for filtering, and the noise signal is concentrated above 1000 HZ, so the window function low-pass filter is selected, the window function is Balckman window, and the cutoff frequency is 1000 Hz, as shown in Fig. 3a. Figure 3b shows the spectrum of the X-direction vibration signal after denoising.After data preprocessing, the twin data information is obtained that better mirrors the tool wear course.
(1)   Ensemble learning feature selection algorithms all use their algorithms themselves to rank the importance of features, and different algorithms have different indicators of the importance of the signal.Therefore, RF and XGBoost algorithms are employed for multi-algorithm feature selection.Randomly selected four features in the above selection of features for plotting, as shown in Fig. 4a, the screening features basically maintain an upward trend and there is a powerful positive association with the actual tool wear curve.However, as can be seen from Fig. 4, the features after the feature selection show different degrees of decreasing trends (marked with red dashed lines in Fig. 4a).
For the problem of decreasing trend of features in feature selection, it is necessary to further optimize the features for downscaling.By first feature selection and then feature fusion multi-level feature downscaling, the importance of feature information can be effectively avoided from being lost.Finally, the original feature matrix is reduced to one dimension, and the compressed feature fusion downscaling results in between (0, 1).Although the twin data features after LE downgrading conform to the tool wear process as a whole, there are still small local fluctuations.The feature vectors after downscaling are optimized by feature post-processing to improve the characterization effect of the features on tool wear.Exponential smoothing and order-preserving regression are carried out for feature post-processing.Exponential smoothing eliminates localized sudden rises and falls, making the trend of the curve smoother.The combination of order-preserving regression can ensure that the curve is monotonically non-decreasing.As shown in Fig. 4b, the curve after feature post-processing is smoother and shows an overall upward trend, and effectively alleviates the trend of feature decline, which can better reflect the actual process of tool wear.

Online prediction model of milling cutter wear for digital twins based on ensemble learning
An ensemble learning-based DT milling cutter wear prediction method is proposed.First, the sensor acquisition constructs twin data, and the ensemble learning model input is obtained using the twin data multi-level processing system.Then, the parameters of the XGBoost ensemble learning model are optimized by the grid search (GS) algorithm.Finally, the milling cutter wear value and wear status are predicted from both regression and classification of the ensemble prediction model, and the milling cutter wear is mutually verified based on the prediction results to enhance the milling cutter wear status recognition accuracy further.

Optimization of prediction model parameters based on GS
XGBoost model hyperparameters are more, but only part of the hyperparameters play a role in determining the model, and the rest of the hyperparameters take the default value.The impact of XGBoost hyperparameters on the model and the optimal range of values are combined to determine the hyperparameters that need to be optimized.Considering that GS is an exhaustive optimization algorithm, with the increase of hyperparameters, the model computation grows explosively.To reduce the amount of modeling calculations, this paper adopts a two-by-two combination of hyperparameters, combined with the iteration step of each hyperparameter, to determine the specific values of model parameters.The detailed process is described in Fig. 5.

The milling cutter wears an online prediction model
In this paper, the XGBoost ensemble learning model is based on updating the weights to obtain a strong learner, which in turn predicts the milling cutter wear status and milling cutter wear values.The ensemble model prediction principle is illustrated in Fig. 6.
Compared to the conventional ensemble algorithm, the main advantages of the XGBoost algorithm are listed below: First, the algorithm is based on the GBDT algorithm model to optimize the loss function, increase the base classifiers, and add regularization terms, which makes the XGBoost algorithm more accurate in prediction, more flexible, and effective in preventing the model from overfitting.
Secondly, the XGBoost algorithm supports multi-threaded parallel computing and self-pruning, which can effectively improve the speed of model prediction and prevent the model from falling into local optimal solutions 35 .

The case study Introduction to the experiment
In this paper, the milling wear experiment was implemented on a Mikron UCP 800 5-axis machining center in a temperature-controlled workshop at 25 °C.Two types of sensors were employed to track the wear of the milling cutter.The Kistler 8636C vibration acceleration sensor was mounted on the workpiece.The Kistler 9265B threeway force gauge was mounted between the table and the workpiece.The experimental setup and its mounting position are shown in Fig. 7.
The workpiece is a TC4 titanium alloy plate with a size specification of 100 mm × 80 mm × 16 mm.The milling tool is a coated carbide three-tooth face milling cutter with a diameter of 8mm.The signals collected from different sensors are fed into the DEWEsoft data acquisition system, and the data are fed into the DT milling cutter wear monitoring system.After each tool run of the milling cutter, the wear value of the milling cutter is observed and recorded using an FM1.6 microscope to obtain the wear value of the whole process of tool wear and the tool wear status.Considering the use of a three-tooth face milling cutter in this experiment, three points are set on each tooth to measure the wear value, and the maximum wear value is used as the cutter's wear value VB .The twin milling cutter wear compensation strategy is utilized to compensate for the physical milling cutter wear in different wear statuses.A total of 270 tool walks were performed in this experiment, and the experimental equipment parameters and machining parameters are provided in Table 1.

Data name Data description Sample frequency
Vibration signals Wear values V = {VB} 1 piece of data per tool travel Processing parameters D = n, a p , a e , V c , F, z, f z

Model prediction and analysis of results
Milling cutter wear values and wear status are important indicators of milling cutter wear condition.Milling cutter wear values prediction can directly predict the specific wear values of the milling cutter, provide a reference for milling cutter wear compensation, and improve the machining quality of the workpiece.Therefore, this paper establishes an ensemble prediction model from both the regression model and classification model, the regression ensemble prediction model can get the milling cutter wear value, and the classification ensemble prediction model can get the milling cutter wear state.Multiple metrics were used to evaluate regression and classification models.The root mean square error (RMSE) and determination coefficient R 2 were used to evaluate the prediction accuracy of the regression model.Accuracy and f1 values are used to evaluate the classification accuracy of the model.At the same time, the model www.nature.com/scientificreports/ is compared from the time dimension, and the model prediction speed is judged by comparing the model prediction time.Ensemble models such as RF, GBDT, XGBoost, light gradient boosting machine (LGBM), and Stacking models are used to predict milling cutter wear from both regression and classification aspects, as shown in Table 6.
In terms of model R 2 , RF, XGBoost and Stacking models perform better with R 2 above 95%, and the XGBoost model has the highest R 2 and the smallest RMSE, which indicates the model with highly accurate prediction.From the perspective of model prediction time XGBoost, GBDT, and LGBM models perform better, and the XGBoost model takes the least time to predict and has the fastest prediction speed.Therefore, from the ensemble model forecast time and accuracy comprehensive analysis XGBoost model performs best.As reflected in Fig. 8, there is a small and smooth absolute error in the predicted and real wear curves, and the model prediction errors are all controlled within 5%.
From each model f1 value, there is the XGBoost model with the highest f1 value and accuracy of 96.23%, which proves that the accuracy of classification of the XGBoost model based on GS is better.Comparing the model classification time, the difference between the prediction time of the XGBoost model and the prediction time of the LGBM model is small, but the performance of the XGBoost model is improved by about 39% compared to the LGBM.Therefore, the XGBoost model also has a better performance in tool wear classification.The classification prediction results of the ensemble models of RF, GBDT, XGBoost, and Stacking models are visualized and reflected in Fig. 9.As observed in Fig. 9a, on the test set the XGBoost model misclassifies only two samples with true labels 2 and 4 as 3.
To illustrate the generalizability of the XGBoost model, this paper utilizes the PHM 2010 tool wear experimental dataset and combines the method proposed in this paper to verify the generalizability of the XGBoost model in terms of model regression and classification.Comparing the RF, GBDT, LGBM, and Stacking models, the evaluation metrics of the model prediction results are shown in Table 7.
From the regression and classification model prediction results, it can be seen that XGBoost has a better performance in model prediction accuracy and prediction speed compared with other prediction models (RF, GBDT, LGBM, and Stacking model).Meanwhile, the XGBoost model still performs better in 270 sets of experimental sample data done in this paper, which shows that the XGBoost model has good generalization.
To verify the effectiveness of the DT milling cutter wear online monitoring model based on the ensemble algorithm, this paper will compare the machine learning algorithm support vector machine (SVM), and deep learning algorithm convolutional neural network (CNN).From the two aspects of the regression prediction model and classification prediction model, combined with the accuracy and prediction time evaluation index, the XGBoost ensemble model is compared and analyzed.Using the 270 sets of the experimental dataset and related settings in this paper, the model forecast results are displayed in Fig. 10   time is reduced by nearly an order of magnitude.Therefore, online monitoring of milling cutter wear based on the ensemble algorithm can better predict the milling cutter wear.

Conclusion
A digital twin-driven ensemble learning milling cutter wear online monitoring method is presented.Firstly, the DT model of the CNC machine tool is built, and the feature signals of the cutting tool machining process are gathered through sensors in real-time, and the information on the milling tool machining parameters is considered.Then, combined with the DT data multi-level processing system, the collected feature data are selected and downscaled.Finally, the ensemble model is used to predict the milling cutter wear state and wear value, which is reflected in the DT system in real-time, providing a powerful reference for tool change decisions and tool compensation strategy.The primary innovations of this paper are below: (1) The DT system for online monitoring of milling cutter wear on CNC machine tools is constructed to monitor the milling cutter situation online in real-time and analyze the milling cutter wear data visually.The predicted milling cutter wear value and wear state are mutually verified to increase the accuracy of the DT system milling cutter wear condition identification.(2) A multi-level processing system of DT milling cutter wear data is built to process the collected milling cutter wear signals online using the real-time nature of the DT.The multi-level data processing method of pre-processing, feature extraction, feature screening, and fusion optimization is adopted to ensure the integrity of feature information while minimizing feature redundancy, effectively decreasing the prediction model's calculation burden, and enhancing the speed of online monitoring of milling cutter wear by DT. (3) The ensemble algorithm is utilized to predict milling cutter wear online, which is better than other algorithms in both models predicting time and accuracy as shown by comparative analysis.The ensemble algorithm integrates multiple weak learners, so that the model stability is better, and provides strong support for the DT milling cutter wear monitoring system.
This paper utilizes digital twin technology to achieve tool wear state prediction and identification, but there are some deficiencies in this paper's research, meanwhile analyzing the limitations that exist in the research so as to point out the future research direction of this team, specifically as follows: (1) This paper is aimed at the prediction of digital twin milling cutter wear under single working conditions, when facing the prediction of digital twin milling cutter wear under variable working conditions (change of milling parameter) may not be very mature, then the team will carry out in-depth research on the digital twin cutter wear under multi-case working condition.(2) The research in this paper is carried out in the laboratory environment, involving less machining materials and the laboratory environment is more ideal, and the method proposed in this paper will have some problems in the actual operation of the factory environment.In the future, we will carry out research on digital twin tool wear monitoring for practical applications in factories.

Figure 1 .
Figure 1.A methodological framework for online monitoring of DT milling cutter wear.
14:4956 | https://doi.org/10.1038/s41598-024-55551-2www.nature.com/scientificreports/Twin data feature selection and feature fusion The time-domain, frequency-domain, and time-frequency-domain features of the vibration signals and cutting force signals are extracted, of which the time-domain features are 8, the frequency-domain features are 4, and the time-frequency-domain features are 16.At the same time, each signal corresponds to the X, Y, and Z directions, and a total of (8 + 4 + 16)× 2 × 3 = 168 features are extracted.These 168 features constitute a 168-dimensional features vector reflecting the tool wear.

Figure 2 .
Figure 2. Multi-level data processing system for DT milling cutter wear.

Figure 3 .
Figure 3.A three-way vibration signal to remove noise.(a) Frequency distribution of vibration signal noise (b) Frequency distribution of vibration signal after denoising.

Figure 4 .
Figure 4. Features results.(a) Features selection results.(b) Features fusion and features post-processing.

Figure 5 .
Figure 5. Optimization of XGBoost integration model parameters based on GS.

Table 1 .
Experimental equipment and milling machining parameters.

Table 2 .
Data set details.

Table 3 .
Geometric model parameter settings.

Table 4 .
Physical model parameter settings.

Table 5 .
Behavioral model parameter settings.

Table 6 .
Evaluation metrics of model prediction results.