Design and research of digital twin machine tool simulation and monitoring system

The numerical control machine tool is an important part of manufacturing. The speed and accuracy of the machine tool simulation and the monitoring of machine physical model movement, model collision, and operation health are the most common bottlenecks. The previous studies on these problems are discrete and poor in real time. In this paper, combined with the digital twin (DT) technology, a perception-monitor-feedback system architecture is constructed. Based on the improved Gilbert–Johnson–Keerthi (GJK) distance algorithm, the collision information of tool and machine tool can be better detected during the simulation and monitoring of machine tool movement, and the more real workpiece shape can be displayed. Based on the model synchronous motion driven by the production perception data and its potential information extraction, the tool wear online monitoring is carried out. The tool wear online monitoring is performed based on the production perception data–driven model synchronous movement and extraction of its potential information. Finally, the usability and efficiency of the system are verified by an example of a typical shaft part processed by a numerical control machine tool.


Introduction
In recent years, with the rapid development of industrialization in different countries, the production workshop has gradually performed intelligence and informationization, which has improved the production efficiency of manufacturing enterprises to a certain extent [1]. The CNC machine tools are the basic unit of manufacturing process and an indispensable part of intelligent and informationized manufacturing. They are also known as "industrial machine tools." In addition, as one of the most important equipment in manufacturing process, their intelligence has an important influence on the implementation of intelligent manufacturing [2]. However, their complex structure, low monitoring degree, and the fact that they are prone to failure affect the machining efficiency [3].
The existing machine tool simulation and monitoring systems are mostly separated, and they have some problems such as low simulation speed, single monitoring form, and low visualization degree. In the aspect of machine tool monitoring, the studies on collision detection and health information prediction of key components are not satisfactory, which is mainly reflected in the accuracy of collision detection and real-time health information pred.
As one of the ten strategic technology trends for 2020 [4], the digital twin technology is an approach for solving the interconnection and convergence of the physical world and the information world [5]. It has been widely used in several fields, and plays a crucial role in many aspects such as design, production, and fault prediction [6][7][8]. At present, the concept of digital twin has been applied and verified in some fields. For instance, Corradini et al. [9] provide different real-time functions for process monitoring, state monitoring, and geometric precision control with sensor data and G code as input. They also detect the load on key components and checked wear. Gao et al. [10] propose a digital dual-function automated yard scheduling framework for uncertain port scheduling, and use the digital twin technology to establish virtual reality storage fields and their connections, thus improving the flexibility of scheduling.
Wang et al. [11] discuss the digital twin technology and cloud collaboration in future battery management systems. A cloud collaborative four-layer network architecture for battery management system is also proposed, and the digital twin model of battery, which performs its fine and safe management in the whole life cycle, is developed. Liu et al. [12] propose a digital dual-drive surface roughness prediction and adaptive optimization method for process parameters, in order to solve the real-time and predictability requirements of process parameter optimization in intelligent manufacturing. They also perform the organic combination of real-time monitoring, accurate prediction, and optimization decision of machining process. Bielefeldt et al. [13] also develop a model based on the digital twin model for detecting and monitoring damage in aircraft structures. They demonstrate that this model is more efficient in the case of aircraft wings.
In terms of machine tool monitoring, Ghosh et al. [14] proposes two kinds of computer systems, digital twin construction system and digital twin adaptation system, which seamlessly interact with real-time sensor signals and automatically perform monitoring and troubleshooting tasks. The efficiency of the two systems is verified by the example of milling torque signal. Yang et al. [15] develop a DT model based on meta-behavior theory, and perform real-time monitoring and digital simulation of machine tool transmission unit accuracy driven by DT data. Navas et al. [16] integrate the machine tool and machining process with the cyber-physical machine tools (CPMT) technology using computing and network technology, providing technical support for production planning, preventive maintenance, and energy consumption analysis. Desforges et al. [17] propose an intelligent actuator service design approach for machine tools in order to achieve monitoring and control tasks. Schmucker et al. [18] develop an efficient system structure, which can perform the data collection inside the machine, the high-frequency sampling of external sensors, and the monitoring of the machine current based on these data. Denkena et al. [19] monitor the machine parts based on data. They use the sensor data of normal state of the machine for semi-supervised anomaly detection training, and obtain high-quality spindle torque information by comprehensively considering the characteristics of power spectral density and peak value of fast Fourier transform. For tool wear, Qiao et al. [20] propose a data-driven digital twin model and a hybrid model prediction method based on deep learning, which improves the accuracy of the numerical model of the tool system and greatly improves the accuracy of fault prediction. Christiand et al. [21] develop a tool wear monitoring system based on digital twin method, which can integrate real-time data of machining process into an advanced simulation system. Li et al. [22] propose a fuzzy neural network (FNN) for mechanical fault prediction and monitoring, which integrates fuzzy logic reasoning into neural network structure, accelerates the learning process of traditional complex neural network structure, and improves the prediction accuracy and convergence speed. By considering the tool life prediction in dry milling as example, the feasibility of fuzzy neural network in tool condition monitoring is verified. Ultrasonic machining is an unconventional machining method [23]. Singh and Khamba [24] study the ultrasonic machining of titanium and its alloys. The effects of different input parameters on tool wear rate, surface roughness, and material removal rate in ultrasonic machining are studied. The results show that the hardness of abrasive particles should be greater than that of workpiece in order to obtain higher MRR. Ratava et al. [25] analyze tool failures and use accelerometers to detect chip and small fractures at tool edges. Pandiyan et al. [26] use genetic algorithms to optimize the sensor signals obtained by acceleration sensors, acoustic sensors, and force sensors, in order to predict the tool life in real time based on a support vector machine approach. Based on the analysis of vibration signals, Guo et al. [27] estimate the tool state in the highspeed micro-machining process of PCB milling machine and analyze the collected vibration signals, which improves the service life of the instrument.
In terms of machine tool simulation and collision detection, Jiang et al. [28] introduce digital twinning into heavy bed collision detection NC machine to drive the evolution of twinning model by sensing data, so as to predict the potential interference phenomenon in NC machine tool processing. Cao [29] constructs the virtual simulation processing system of machine tool through the VERICUT platform, and judges whether the structure design of the machine tool is reasonable by combining error information such as interference and collision in the simulation process. Shigematsu et al. [30] propose a tool collision detection method based on the disturbance observer theory, and successfully estimate the collision force using servo information. Cheng et al. [31] propose the method of classification and selection of inclination-based bounding boxes, which constructs compact bounding boxes according to the real-time selection of the motion state of each axis in the processing process. They also judge whether the two models intersect by the position relationship between the bounding box and the nearest plane, so as to improve the detection efficiency.
These researches have made important contributions to the development of numerical control machine tool simulation and monitoring system. However, there are still some shortcomings. First of all, in terms of machine tool monitoring, the machine tool prediction information in a small part of the above studies is still in a lag state compared with users, and the prediction information is not transmitted in time. But a number system is not just two or more functions; it is an object map. This paper considers the process of behavior monitoring, data monitoring, and information prediction from the simulated G code in the processing stage to the actual process. In addition, in the aspect of machine tool simulation and collision detection, the above paper will simulation collision detection function is applied to the machine tool code or monitoring operation of collision detection; this paper comprehensively considers the influence of the three, combined with three kinds of actual machining sequence to build a numerical control machine tool simulation and monitoring system.
In order to solve these problems, this paper uses the perception-monitoring-feedback system framework to combine collision detection, machine tool simulation, and machine tool monitoring, and develops a set of machine tool simulation and monitoring system based on digital twin technology. The system uses the most commonly used CNC code as the simulation object, monitoring the behavior of machine tools, tool collision information, tool wear, and other operation data information, and the establishment of a more close to the real application of the digital twin model, to provide guidance for production and processing activities. The main contents of this paper include the following: (1) building the collision detection model of machine tool and tool based on the improved GJK collision; (2) for machine tool model reconstruction, the G code is used to quickly simulate the impact effect; (3) real-time monitoring of machine tools, including behavior and movement monitoring, key operation data monitoring, and tool wear monitoring.
The remainder of this paper is organized as follows. Section 2 presents the system architecture. Section 3 introduces the collision detection algorithm. Section 4 details the main methods of system function realization. Section 5 considers the machine tool as example to verify the proposed method. Finally, the conclusions and future work are drawn in Sect. 6.

System architecture
Although at present enterprises through the Internet and other technologies for manufacturing workshops to provide a lot of help, but there are still some problems in some large processing workshops. To solve these problems, this paper develops a set of numerical control machine tool simulation and monitoring system based on digital dual machine technology, which constructs the digital representation of physical entities and the dynamic performance of environmental perception. More precisely, in real-time sensory data driven, the model is continuously updated, the actual machining process model of high-fidelity mapping is performed, and the real-time collision detection and monitoring of the health of the cutting tool is developed. In order to perform an efficient simulation and monitoring of machine tools, a perception-monitoring-feedback twinning system based on digital twinning is proposed. This system consists of physical machine tools (PM), virtual machine tools (VM), system services (Ss), digital data (DD), connection (CN), and front-end display (FD) [32]. Its framework is shown in Fig. 1.
The system involves key technologies such as 3D digital representation of physical machine tools, G code extraction and simulation, collision detection of machine models, synchronous movement of models driven by perception data, and real-time prediction of tool wear.

Physical machine tools (PM)
They are mainly responsible for the perception of tools, workpiece coordinates, other processing elements, information transmission and exchange between wired or wireless network and virtual machine window, receiving and executing production tasks and control instructions issued by the service system.

Virtual machine tools (VM)
This is a three-dimensional digital representation of physical machine tool in digital space. It can map physical machine tool in geometry and rules by reconstructing the model and constructing the collision detection model.

System services (Ss)
The service refers to the collection of services required by the implementation process of digital twin system, which is mainly provided by the industrial Internet of Things platform, 3D modeling software, and virtual reality development software [33]. This service system mainly includes the machine tool movement visualization, G code simulation, collision detection model in machine tool processing, and real-time tool wear prediction.

Twin data (DD)
Twin data is the basis of digital twin operations. The virtual machine tool analyzes the running state of the machine tool through the real-time data transmission model of the physical machine tool. The twin data includes data from perceptual sensors, machine tool data, and local database data.

Connection (CN)
CN is the data connection. The key is to perform the interconnection of all the parts of the system. The system uses a communication protocol and PLC to complete the connection of each part of the data.

Front-end display (FB)
FB is a display of different services and data of machine tools. It is a real-time display of machine information and attributes through the status panel; the behavior visualization, state visualization, and data visualization of machine tool manufacturing process are performed by a 3D virtual model. The use of the augmented reality technology to achieve the machine tool in color and other details that are more consistent with the physical machine tool increases the sense of user experience.

Realization of data communication and monitoring function
Data communication is the basis of digital twinning. Three approaches mainly exist to achieve data acquisition for CNC machine tools. The first one consists in collecting data from CNC side. The second one consists in collecting data from PLC and its connected I/O modules. The third one consists in directly collecting data from the body side of machine tools themselves. The CNC side has a communication interface for transmitting information to external devices, such as network connection, RS232, DNC, and OPC. The ladder diagram program compiled by PLC is used to drive the machine tools according to certain logic [38]. Due to the fact that this system uses communication protocol and PLC to complete data transmission together, the feedback emergency stop function uses PLC to control the machine tool by sending simple signals to PLC from PC. The physical machine tool and virtual machine tool are connected by PLC, as shown in Fig. 7.
The system data and sensor data of the CNC machine tools are first collected, and the data are uploaded to the database and system platform by means of communication protocol and PLC. The data are then divided into display data, driving data, and algorithm data in the system platform. The display data are displayed in the form of data reports and two-dimensional charts through ECharts. The driving data are used to drive the virtual model in real time to monitor its behavior. The algorithm data are used to input the algorithm data. Through the real-time data, the running status and health of the machine tool can be analyzed in

Fast simulation of CNC code path
The machine tool is the basic industry in manufacturing industry. Its level and quality are very important for the development of manufacturing industry. At present, the automation technology of the machine tool industry is relatively mature. However, future-oriented intelligent manufacturing still requires improvements. Therefore, the digitization of machine tool industry has become one of the mainstream trends. The existing simulation system cannot meet the requirements of gradual development. At present, almost all the simulation software can simulate cutting paths, which has the advantage of simplicity and ease of use. However, the safety of the machine tools and the characteristics related to controllers cannot be reflected. By developing the virtual model of machine tool, the tool machining path can be verified by simulation, and the CNC code can be directly analyzed and executed in order to avoid the collision and interference between mechanical parts. In addition, the simulation time can be significantly shortened by simulating one action every 0.02 s. The realization process is summarized as follows.
Step 1-the SolidWorks software is used for 3D modeling of the parts of the controlled equipment. After all the parts are matched together, STEP format is output to the 3D max software to endow the parts with materials and maps. The Polygon Cruncher is used to optimize the number of triangular patches in the model, export them as FBX format files after optimization, and import them into Unity 3D [39,40].
Step 2-the model is reorganized in Unity 3D. The reconstructed model can be divided into fixed parts, moving parts, and rotating parts according to grades and components. The method of reorganizing model can efficiently reduce the workload of virtual model coordination, the number of sensors, the amount of circulating data, and the system delay. It can also improve the running speed of the system. Since the machine tool already has the assembly relationship when imported into Unity 3D, it is not possible to directly move and rotate the model to destroy the original assembly relationship. The reorganization model method is summarized as follows. Firstly, make clear which parts are fixed parts, moving parts, and rotating parts. Secondly, add collision box characteristics to machine tools, and then classify them according to multi-level directory. Afterwards, the whole machine tool is moved to the target position, and the sub-files in the fixture directory are fixed relative to the world coordinate system by adding scripts. Finally, in the form of step 2, a third-level directory and a fourth-level directory are created under the second-level directory, and finally the smallest unit of the machine tool is driven with a single data source.
Step 3-adding scripts to read CNC files in MySQL line by line. The keywords are extracted in CNC code, the keywords are corresponded to the reorganized model, and the data behind the keywords are used to drive the model simulation [41]. Rigid body components and rigid body collision detection are added to the virtual model, and the name and location of the part that collided with it after the collision occurs are returned.

Implementation of collision detection algorithm
In the process of machine simulation and machining, there may be a collision due to the error of G code or the misoperation of the operator. Therefore, this paper constructed a collision body enveloping box for the machine tool and the tool to continuously detect the position of the tool to determine whether the collision occurred during simulation and machining. In the virtual model, the material removal work is also completed by the collision between the bounding box and the workpiece.

Method comparison
In general, the research content of collision detection algorithm consists in how to faster and better detect the collision between different objects in virtual scene. The collision detection between virtual scene and physical scene is the key to test the past feasibility [34]. The existing collision detection algorithms are mainly divided into three main methods: spatial partition method, hierarchical bounding box method, and GJK method. The spatial partition method takes a long time to preprocess and tends to produce a large number of polygons that are not suitable for the virtual space of large-scale scenes. Therefore, this paper mainly compares the hierarchical bounding box method and the GJK method [35]. The two-dimensional diagram of the four bounding boxes is shown in Fig. 2, and the comparison of the methods is shown in Table 1: Based on this comparison and the existing research results, most researchers use the detection method of AABB bounding box for collision detection. This is due to the fact that it is fast in constructing collision model and fast in updating and can meet most of the requirements in packaging tightness. However, in the process of machine tool collision detection, it is necessary to protect the tool, which requires a higher detection accuracy. In addition, when the tool cuts the workpiece, the shape of the virtual workpiece after cutting is inconsistent with that of the actual workpiece due to the large difference between the collision enclosing model and the actual model. Therefore, this paper uses the GJK collision detection algorithm, which is more closely surrounded by the model. However, it has more iterations and slower update speed when determining whether a collision occurs. In order to solve these problems, improve the judgment speed of the algorithm, and meet the purpose of real-time collision detection of machine tools, this paper simplified the judgment collision conditions on the basis of the original algorithm, and the algorithm improvement process is as follows.

Collision detection algorithm based on improved GJK
This algorithm is first proposed by Gilbert, Johnson, and Keerthi, and therefore, it is referred to as GJK algorithm. This model is based on calculating the distance between two objects, so as to detect the collision. Assuming that two convex bodies A and B are represented by d (A,B), the distance between A and B can be expressed as: The GJK algorithm can calculate the nearest two points A and B between two objects, which meet the following requirements: Let v(C) represents the point closest to the origin in convex set c, that is, v(C) ∈ C and satisfies the following: The distance between A and B can then be expressed by the Minkowski difference: where C = A,B. According to Eqs. (1), (2), (3), and (4), the minimum distance between objects A and B is equal to the minimum distance from the convex hull formed by the Minkowski difference ( C (C = A,B )) between objects A and B to the origin. The trajectory space obstacle (TSO) is a convex hull formed by the Minkowski difference of two point sets, which represents a set of all the shapes of objects colliding with obstacles. As shown in Fig. 3, the distance between two triangles A and B is equal to the distance from their Minkowski difference C to the origin.
This algorithm is based on the calculation of the distance between two objects for collision detection. The calculation of the distance between convex bodies A and B is equivalent to the calculation of the distance between the Minkowski difference C(C = A-B) and the origin [36,37]. In general, the algorithm based on GJK model is mainly a gradual descent method to gradually find the nearest point to the origin on TSO (A-B). In each iteration, a new simplex is created in TSO, which is closer to the origin than the simplex created in the previous iteration. The so-called simplex is a convex hull formed by an affine independent point set, which generally contains 1 to 4 vertices. Therefore, the simplex can be a point, a line segment, a triangle, or a tetrahedron. When the estimation error of the calculated distance reaches a given error, the algorithm will be immediately terminated.
When judging whether there is an origin in C, due to the complexity of the machine tool model and the large number of fixed points and to the insufficient number of iterations, the results may be wrong. In addition, the selection of initial points also affects the correctness of the algorithm. The most important thing is that the reaction speed is affected in the case of a large number of points. In this study, the collision model between machine tool and props cannot collide. That is, the two models should design a distance threshold (M), which requires the original algorithm to calculate the distance from the Minkowski difference between objects to the origin, compared with the threshold (M), which is relatively troublesome. In order to solve these problems, an improved GJK collision detection algorithm is proposed. It is summarized as follows.
The Minkowski difference between computer (a) and the tool is computed as: At this time, the distance between A and B is C; a circle D with threshold M is made as radius and the origin as center. In addition, the Minkowski difference between convex body set C and circle (D) is computed as: For convenience of calculation, circle D is replaced by regular octagon E. The distance between C and E is shown in Fig. 4, and the Minkowski difference between C and E is shown in Fig. 5: The area sum method is used to judge whether the convex body set f includes the origin.
The polygon composition area is given by: It is judged whether the triangle area sum formed by the origin and each side of the polygon is equal to the polygon area. If it is equal, the origin is inside the polygon, and then model C collides with model E. If it is not equal, model C does not collide with model E.
Based on the GJK collision detection algorithm and the most commonly used AABB bounding box collision detection algorithm, the collision detection bounding box is constructed with the tool, as shown in Fig. 6. In the case where the tool is completely surrounded, the bounding box in Figure A is smaller than that in Figure B, which is more accurate for collision detection. In addition, in the surrounding of the tool head, the GJK impact box can perfectly surround the tool head, allowing it to have a better accuracy in both detection and cutting.

Case study
In this paper, a simulation and monitoring system based on digital twin machine tool is developed, by considering a certain turning process of key parts of marine diesel engine as example. The framework of the system is designed as a six-layer structure. The detailed structure diagram is shown in Fig. 1. This system performs the twin modeling of physical machine tool, using the front display to show the data

Machine tool simulation realization
As the necessary preparation before the machine tool runs, the simulation can ensure the safer operation of the machine  Fig. 8. A C# script is created to read the CNC file in MySQL. The keywords are extracted in CNC code and matched with the restructured model (cf. Table 2).
The CNC code instructions often have more than one line. Therefore, how to deal with code input and compilation between each line is also a problem that should be considered. This study tried three approaches for the code, as shown in Fig. 9. One scheme requires to read data several times in order to process a piece of CNC code. Practice has proved that reading a large number of data across carriers will reduce the reliability of the software. The third scheme involves a large number of parameters passing on time during the machine tool operation. This method is bound to generate a large amount of data accumulation, increase the development difficulty of the drive module, and also affect the operation of the machine tool, which results in sluggish response.
In this paper, the second scheme is used in which all the CNC codes are input at one time. It also reads sentence by sentence, and compiles and runs sentence by sentence. The burden of reading and writing data between different programs, the difficulty of compiling the driver module, and the possibility of machine tool running errors are reduced. The model driving simulation is performed by reading row-byrow driving with keywords and the data behind them. For example, S800 indicates that the spindle speed is 800 r/min.
The twin machine adjusts the position of the tool rest according to the perceptual information, and performs the simulation of turning processing after the analysis of the G code, as shown in Fig. 10. In order to detect tool collision information during machining, a tool collision boundary frame was constructed. When a collision occurs, objects are highlighted with color to help the operator modify the program or clamping method.
In the cutting process of the workpiece, this study splices countless small cubes into the shape of the axis to be machined. In order to minimize the appearance and reduce the number of cubes, the precision is set as the side length of a single small cube is 0.1 mm. In Fig. 11, the left picture is a cylindrical interface composed of small cubes, and the right picture is a cylinder having a diameter of 10 mm. This algorithm is used to build a collision enveloping model for the tool. When the small cube overlaps with the collision model, the small square disappears, so as to complete the material removal picture. The model size diagram and processing effect diagram are shown in Fig. 12. Although defects still exist in small parts, the effect can be achieved in overall shape and esthetics, and the usability of the algorithm is also verified.

Machine tool data monitoring
In this paper, the ECharts chart is individually developed based on the JavaScript language, and the graph and tachometer are designed to meet the data display requirements. The methods of integrating ECharts charts into Unity3D platform are as follows. Firstly, personalized front-end development of ECharts charts through JavaScript can meet the data display requirements. In addition, the Hyper Text Markup Language (HTML) file of ECharts is deployed on the local side. The back-end then queries the vibration signals in the database through the C# program, and converts them into Json format readable by ECharts. Afterwards, the connection between the front-end and the back-end is realized by asynchronous communication. Finally, the deployed ECharts chart webpage is integrated into the browser plug-in of Uni-ty3D, so as to display the collected vibration data accordingly. The specific process is shown in Fig. 13, and the main interface of the system is shown in Fig. 14: The system can be divided into real-time machining data, historical statistical data, CNC code display, tool position data, and system operation. The real-time machining data include the cutting speed, cutting force, and load. The historical data include A blank quantity, A completed quantity, B blank quantity, B completed quantity, and damaged quantity. The system operation includes CNC code simulation, tool wear prediction, and machine tool start-stop operation.

Machine tool behavior monitoring
With the communication method proposed in Sect. 4.1, sensors are used to acquire data for the speed or position of moving parts, spindle, screw, tool turntable, tool slide table, and

Realization of tool wear value prediction
Tool life prediction is mainly based on the installation of different types of sensors on the main components of the machine tool, preprocessing and feature extraction of multimodal signals, and finding the mapping between features and tool wear [42]. In order to predict tool wear online, VMware Workstation's sub-operating system is used to train the model in the background integration algorithm. After the training, the database content is dynamically read and the current wear value is predicted according to the continuously input data. Finally, real-time predicted values are integrated into Unity3D based on Flask framework to complete information integration.
This paper uses the open Data Contest dataset provided by PHM Society in 2010 to verify [43]. All cutting forces mentioned in this data set are milling forces. A Hampel  filtering is performed on the sampled data to eliminate the intermediate outlier data. Figure 15 shows the comparison results before and after removing the intermediate outliers from the signal of the 001st cut of Y axis cutting force, in the C1 dataset (the circle is the outlier data point).
After all the abnormal data in C1 are eliminated, a feature extraction is performed. The extraction method in this paper refers to the studies in [44,45]. Through the optimal feature selection process, the features with better wear value of flute1 can be obtained, as shown in Table 3. A multi-layer neural network is built to fuse features. One input layer, one output layer, and two hidden layers are used to establish the relationship between features and tool wear, as shown in Fig. 16. There are 9 neurons in the input layer and 1 neuron in the output layer. The number of neurons in the two hidden layers is 6 and 2, respectively. A total of 418 samples are selected from C1, C4, and C6. The number of training samples is 70%, and the number of test samples is 30%.
The root mean square error (RMSE) is used to express the fluctuation range of the error between the predicted value and the true value, which is expressed in Eq. (9), where N represents the number of observations, observed t denotes the observed value, and predicted t represents the predicted value. According to Eq. (9), the root mean square error range of this method is between 5.0 and 6.5. The error between the predicted value and expected value of the test set is shown in Fig. 17. The accuracy is 100% in the 25-micron error range, and 95.2% in the 10-micron error range.
Y axis of vibration signal Square root amplitude Vibration signal z axis Standard deviation, absolute average amplitude In this paper, VMware Workstation's sub-operating system is used to train the model in the background integration algorithm, and after the training, the database content is dynamically read to predict the current wear value. Finally, the real-time predicted value is integrated into Unity3D based on the Flask framework to achieve the purpose of real-time prediction.

Conclusion and future work
In order to solve the problems of slow machine simulation speed, insufficient tool collision data, and poor monitoring effect, this paper proposes a set of digital twin machine simulation and monitoring system based on perceptionmonitoring-feedback framework. The physical model is first reconstructed, and the collision body model is then constructed for the tool and machine tool. Compared with the traditional collision detection algorithm, the proposed collision detection algorithm is more accurate to the tool and has a higher accuracy in the collision detection and workpiece cutting. Afterwards, the model movement is driven by the sensing sensor data and local data. The usability and efficiency of the proposed system are verified by an example of a typical shaft part processed by a numerical control machine tool. Using this method, the cutting simulation and collision detection of G code can be carried out with 0.02 s action, which not only improves the simulation speed, but also improves the collision detection accuracy. In the actual machine tool processing, it can also realize the synchronization of the model movement, monitor the movement progress, predict the tool wear condition online, and provide guidance for production and processing.
This study still has limitations. Firstly, since the machining model is composed of countless small cubes during model cutting, it will take a long time to construct the machining model. Moreover, if the workpiece is too large, the number of cubes will lead to computer lag. Furthermore, the system has too few functions, such as the stress during processing, workpiece processing quality, and other aspects of monitoring with blind spots. The future work will focus on these two defects.

Data availability
The datasets used or analyzed during the current study are available from the corresponding author on reasonable request.
Code availability Not applicable.

Declarations
Ethics approval Not applicable.

Consent to participate Not applicable.
Consent to publish Written informed consent for publication was obtained from all participants.

Conflict of interest
The authors declare no competing interests.