Digital twin in CNC metal machining

Digital twin in CNC metal machining

Category: Metalworking

A digital twin of the CNC machining process can improve process optimization at both the planning and machining stages. The quality of the machined product depends on the precision of the machining process and the surface finish at the end of the machining stage.

What influences the quality of the machined part?

The quality of the product after machining is the result of defined process planning parameters and variables occurring during machining. In the process planning stage, the process planner determines cutting parameters such as feed rate, cutting depth and width, spindle speed, which impact the quality of the part’s surface.

Factors such as tool wear and cutting force during the machining process also influence quality. In addition, errors related to machine kinematics, machine vibrations, and factors such as acceleration or jerks also affect machining accuracy and surface quality.

Predictive models for machining accuracy and surface quality can be built based on data from process planning and the machining stage. An example is Vericut software, which relies on its simulation engine. Once the quality is predicted, it can be used as input data for optimizing machining parameters to meet the required quality. Data-driven models predict and optimize machining quality, providing feedback to maintain the required quality in process planning and machining stages by adjusting machining parameters.

In this case, creating such a digital twin absorbs significant resources. The actual machine must be shut down, followed by a series of tests.

Symulating the machining process using digital twin

A full simulation of the machining process using digital twins, based on real or predictive data, can not only optimize the entire process and provide information allowing users, for example, to shorten machining cycle times but also identify faults before they occur.

Purchasing advanced machining centers is a significant investment for companies that need to earn their keep. Achieving full machine efficiency can take a lot of time and experience, especially when dealing with machines such as milling-turning centers and multitasking machining centers. An accurate digital twin of the machining environment allows for better utilization of advanced machining platforms while simultaneously reducing costly errors and downtime.

In the world of machining, a digital twin is a digital representation of the entire machining environment, including the workpiece, semi-finished product, fixtures, clamps, cutting tools, machine tool, controls, auxiliary equipment, continuous and discrete processes. Regarding CAM software, many of them utilize some aspects of the digital twin.

However, most of them do not cover everything. Therefore, they cannot explain how each element interacts with others during part machining. In today’s reality, machine tools are becoming increasingly complex machines capable of performing multiple operations.

How can the CNC machining process using a digital twin look in practice?

Let’s start by understanding how we should perceive the digital twin of a CNC machine. Primarily, we must be aware that a complete digital twin of a machine is based on a digital model of the machine, upon which the real machine is created. Having such data allows us to make a full system configuration (programming, testing, simulation) for both the CNC, PLC, HMI parts, and the mechanical aspect in a virtual environment.

Since CNC machine manufacturers did not previously rely on such models, we can now simulate machining processes based on CAM software, which includes aspects of the digital twin but is not a complete representation as provided by a digital twin. For companies already operating purchased machines, this is undoubtedly a useful solution that can simulate the machining process by reproducing the machine up to a maximum of 80%, although without an identical representation of the machining sequence.

The machining process considers many aspects described below. CAM systems will not precisely simulate where the tool will be — they lack the required data and an appropriate engine to accurately reproduce it.

Let’s start with the solution that the CAM environment provides us.

In practice, CNC machining processes are planned using CAM software during the process planning stage and then executed during the production phase with the generated NC code. The quality assessment in the simulator takes into account the CAD product geometry, the generated toolpath, and machine kinematics information. However, the impact of factors such as feed rate, spindle speed, as well as the influence of parameters like machine vibrations, PLC programming, continuous and discrete process simulation, feedback control, CNC control, and other background processes are not considered in this simulation for evaluating the expected machining quality.

During the execution stage, the machine operator initially sets up the machining order and updates the state of cutting tools on the CNC machine. If necessary, the operator can update cutting parameters in the NC code, such as feed rate and spindle speed, to achieve better machining quality after the machine’s initial setup. However, visualization of quality and feedback on the expected machining quality are not available to the operator. During the machining process on the CNC machine, information about the impact of other factors on machining, such as tool wear or machine vibrations, is also unavailable to the machine operator.

Modern CNC machines are cyber-physical machining systems equipped with communication protocols such as OPC UA and MTConnect, which provide real-time access to information from CNC machines during machining operations. Real-time machining information collected through standard communication protocols, along with data from external machine sensors, can be used to model machine behavior. Digital twin models ultimately rely on the data required to predict machining quality by considering factors influencing machining quality based on data from internal and external CNC machine sensors.

Predictive models are data-driven and built on machine learning foundations. When machining data is available for CAM simulation, it optimizes parameters that can be controlled to maintain the required quality and provides feedback to control the machining process during both the process planning and execution stages.

Initially, quality optimization and prediction are performed during the process planning stage by combining CAM software and CNC machines with an “incomplete” digital twin, which is a digital version of the machine with predictive and optimization modules.

During the process planning stage, CAM software can be connected to the digital twin using an API interface, allowing bidirectional data communication between the CAM software and the digital twin. Also, during machining, the machine is connected to the digital twin using one of the communication protocols, collecting and transmitting data.

For example, Heidenhain has a product in its portfolio called virtualTNC, which is an independent programming station based on a real CNC but operated on a PC. This software is essentially identical to that which powers the TNC control unit on a multi-axis machine.

The programmer can use the PC-based system, utilizing machine kinematics, to create and test programs for part machining precisely as the programmer would on the CNC unit of the machine.

This simulation model is customized by reading performance data from the control unit on the actual machine.

How does it look when we have an environment that is built from the very beginning on a digital model?

One of the latest tools available on the market that simulates a machine virtually is the Run MyVirtual Machine program from Siemens. It replicates a real machine up to 99%. Five years ago, the company conducted pilot implementations with selected machine manufacturers in conjunction with the development of the SINUMERIK ONE control, demonstrating time savings in the implementation of a new machine of up to 30% and a 50% reduction in startup time. Currently, this machine control can be found in over 350 machine tool manufacturers, with many of them producing machines with this control on a mass scale. Rapid implementation is one of the pillars of the modern development of machining with the Create platform and Run MyVirtual Machine.

The latest technology of the digital twin, Run MyVirtual Machine 3D, takes capabilities in the virtual environment to a higher level. Not only can we see critical decisions that the CNC brain will make on our computer, but we can also visualize the entire machine space. The 3D option allows the user to import fixtures and clamping devices to fully emulate the configuration that the program will execute in the machining process.

The digital twin of the machine, running in this program, faithfully reproduces the work environment on the actual machine. It allows simulation of activities such as measurements of the workpiece, risk assessment of potential collisions, taking into account the geometry of the body, casing, heads, tools, fixtures, clamps, and workpieces along with zero point shifts. It is fully compatible with the real controller, allowing for precise determination of the course and times of execution.

For all this to make sense, the digital twin of the CNC machine should be designed and created first in a digital model based on the CAD model of the machine and tested in a virtual environment, rather than being created based on an existing machine. Such an approach allows for the full configuration of the system (programming, testing, simulating) for both CNC, PLC, HMI, and mechanical parts in the virtual environment. These capabilities are provided to manufacturers by the Create MyVirtual Machine tool.


The digital twin in CNC machining is undoubtedly an asset in monitoring and improving part production. Information from the digital twin enables operators and machining department managers to make informed decisions, often in real-time, which would otherwise be beyond their reach.

Simulating on digital twins involves not only observing the cut part but also monitoring and verifying every element of the machine and its movements throughout the entire operation.

When it comes to achieving maximum machine efficiency, a complete digital twin should also provide the user with the ability to quickly see when there is an opportunity to optimize the program. Considering the volume of parts produced, even saving a few seconds on each part can lead to a significant increase in production volume.

Digital simulations in CAM software can provide the necessary image to understand the machining environment, ensuring error-free and efficient NC code, allowing for faster part machining.

However, we must be aware that the difference between CAM simulation with aspects of a digital twin and the simulation of a complete digital twin of the machine lies in the accuracy of reproducing the machine and the processes performed on it. A full digital twin can simulate the machine, the machining technology – simulate the machining of the workpiece, detect collisions, and consider physical phenomena in the process, such as the impact of temperature or pressure.

The CAM environment itself cannot achieve this because it has its own graphics engine, which is based on “assumed” control and does not faithfully reproduce it when simulating G-code, toolpaths generated, for example, by NX. It does not consider data related to PLCs, drives, and the NC core itself.

However, how closely the digital twin must resemble its physical counterpart should be regulated depending on the intended use.

A relatively simple digital twin of the machine may be sufficient for simulating workflow on the production line. A highly detailed and comprehensive digital twin of the machine may be needed for animated simulations of the programmed toolpath to detect potential collisions. In the case of augmented reality applications, a digital twin of the machine may be suitable for training operators or the maintenance department, with varying requirements for the level of detail and realistic visualization formatting.