Machining Digital Twin using real-time model-based simulations and lookahead function for closed loop machining control

The future of machining lies in the fully autonomous machine tool. New technologies must be developed that predict, sense and action intelligent decisions autonomously. Digital twins are one component on this journey and are already having significant impact in the manufacturing industries. Despite this, the implementation of machining Digital Twins has been slow due to the computational burden of simulating cutting forces online resulting in no commercially available Digital Twin that can automatically control the machining process in real time. Addressing this problem, this research presents a machining Digital Twin capable of real-time adaptive control of intelligent machining operations. The computational bottleneck of calculating cutter workpiece engagements online has been overcome using a novel method which combines a priori calculation with real-time tool centre point position data. For the first time, a novel online machine-induced residual stress control system is presented which integrates real-time model-based simulations with online feedback for closed loop residual stress control. Autonomous Digital Twin technologies presented also include chatter prediction and control and adaptive feed rate control. The proposed machining Digital Twin system has been implemented on a large-scale CNC machine tool designed for high-speed machining of aerostructure parts. Validation case studies have been conducted and are presented for each of the machining Digital Twin applications.


Introduction
The digital transformation from legacy systems of CNC machine tools to Industry 4.0 within the machining sector is crucial to achieving higher productivity, reducing costs and working towards circular economies. The introduction of concepts like Digital Twins(DT) [1] and virtual manufacturing [2] have become instrumental in adding value to the production cycle by predicting manufacturing process conditions and optimising both real-time and future processes. A Digital Twin for machining is a real-time digital replica of the process; within machining this comprises real-time data, datadriven digital models or model-based simulations updated in real-time with information from the computer numerically controlled (CNC) machining centre.
Digital twins, by virtue of the real-time simulations, enable users to access process information without the requirement for a full suite of sensors. The use of "virtual sensors" results in an ability to add intelligent machining capabilities to an existing machining centre without the need for installation of expensive sensors (such as dynamometers), additional maintenance or calibration. This research presents Digital Twin capabilities for machining, which include a novel machining-induced residual stress (MIRS) control, chatter detection and control and adaptive feed rate control. A brief survey on the state of the art of these functions is hereby presented.

MIRS control
MIRS represents a crucial factor that influences fatigue life, distortion and other aspects of the mechanical properties of the materials such as their strength, plasticity or surface quality of a machined part. Whilst experimental methods exist to measure residual stress values in machined parts post-machining, a significant challenge in research has been to predict them accurately through modelling techniques [3]. In the prediction of MIRS, an important advantage of analytical models is the capability of processing data within short time scales enabling their use in the real-time domain as opposed to slower analysis techniques such as numerical finite element analysis. These analytical models have been generated for various machining conditions and platforms, including the prediction of MIRS in turning and milling machining operations. In the turning process, analytical models have been developed for orthogonal cutting of various materials by looking at the mechanical stresses and the thermal loads involved [4,5], whereas other pieces of research have also included the influence of the thermal stresses [6]. Similarly, in the milling process, analytical models have been developed for both orthogonal [7,8] and oblique cutting [9][10][11][12]. These analytical methods have shown good progress in research in terms of accuracy and efficiency for MIRS predictions. However, the existing applications of experimental measurements and simulation methods are offline techniques. Hence, the application of online MIRS simulation methods can have broad prospects for the characterisation of the development of residual stresses and their control during machining, which is a gap in literature. This research demonstrates the bases of a Digital Twin system for the prediction and control of MIRS in real time using online machining data.

Chatter detection and control
Chatter is a self-excited vibration experienced during machining [13]. In marginal cases, where the spindle speed is close to the stability boundary, chatter may result in poor surface finish; but in the most severe cases, it can damage cutting tools [14], workpieces and even spindles. As it can severely limit the performance of machining, the ability to detect and mitigate against chatter is essential. Prior to machining, cutting parameters for stable machining conditions are selected based upon stability lobe diagrams (SLDs). The SLDs are generated from tap testing the tool/holder in situ and using frequency response data to predict stable conditions [15]. However, with this offline simulation and optimisation prior to machining, chatter may still occur due to poor process models, incorrect testing, poorly calibrated equipment and/or positiondependent machine tool dynamics. This has led to the requirement for online chatter detection and control [16].
During chatter, vibrations occur at both the tool passing frequency and chatter frequency. The objective of detection methods is to decouple these chatter vibrations and identify the chatter frequency from the frequency spectrum. Two main sources of signals have been widely adopted in research: external data from additional sensors and internal data from the numerical controller (NC). The external measurement approaches mainly use signals such as sound measurements from microphones [17,18] and cutting force data and acceleration from accelerometers [19][20][21]. The internal measurement approaches use high frequency data from the machine tool. Accessing high-speed data can require special modifications, in particular to access the current loop and signals of the spindle or feed drives. Recent research has also included the use of observers [22,23] to uncouple the effects of structural dynamics and servo dynamics from the internal NC data. Most research has focused on internal or external measurement-based chatter detection where additional sensors or very high frequency controller signals are required. There is a gap in literature, which considers real-time chatter simulations as virtual sensors for inputs to closed loop feedback systems. Moreover, the above online chatter control methods are based on the measurement when chatter has already happened and left chatter marks on the workpiece surface. In this research, with the lookahead and lookup function, the online chatter control methods were able to predict and control the stability of the process before chatter occurred.

Adaptive feed rate control
Standard machine tools employ classical cascaded control loops to control the feed drives. The controller parameters are designed based on position and velocity feedback, and not on the drive or spindle loads. The controller gains are designed such that large loads from cutting forces will not affect the performance of the drives in terms of position accuracy or deviation from commanded feed rate. Despite this, there is a desire for adaptive machining, and for the machine tool to respond online to changing process conditions. Benefits such as improved surface quality, reduced manufacturing cycle times and prevention of tool breakage drive the requirement for such functions.
Early work on adaptive machining control was based on integrating cutting force and feed rate control systems. The research focused on the design of fixed controller gains and the stability of the systems as the process parameters varied for simple machining operations. A common thread to the early work was the use of online identification methods to model the cutting process in order to generate a system transfer function for controller design. These models formed the basis of model reference adaptive control [24]. Several parameter adaptive control strategies were researched to regulate the cutting forces in end milling under varying conditions most using online system identification via recursive least squares methods [25]. The online methods were complemented with offline calculated cutting forces via computer-aided design (CAD)-based models [26,27]. Adding further fidelity, the servo models of the drives were integrated into the modelling process for both direct adaptive control [28] and real-time tool breakage monitoring using servo drive currents [29]. Subsequently, many adaptive control methodologies have been applied to machining such as quantitative feedback theory [30], Kalman filters for state estimation [31], neural networks and fuzzy control [32], model-based control [33,34], optimal control [35] and model predictive control [36].

Digital Twin and Virtual Machine Tools
In addition to measurement-based process control and monitoring, utilising real-time model-based simulations or virtual models with live process data has demonstrated improved performance during the machining process. The integration of real-time NC data with advanced cutting force models [1,37,38] has been successful in predicting real-time cutting forces for 5-axis machining operations [39], which provided a valuable tool for process visualisation and a method to improve process design. This smart approach enabled cutting force prediction without the need for direct measurement. Further exploiting the range of NC data, machine drive currents were used to support a Digital Twinbased system able to predict tool breakage and adaptively control the feed rate to constrain tool deflections [40]. The research removed the requirement for expensive dynamometers and for the first time provided virtual model-based feedback directly to the machine tool. More recently, the online prediction of flank wear width was successfully demonstrated combining synchronised process simulation, real-time NC data and machine learning [41].
Despite the successful previously highlighted applications of machining Digital Twins, the use of online feedback to optimise machining processes remains in its infancy. A roadblock to progression has been the computational burden when simulating cutting force models in real time [42] as the calculation of cutter workpiece engagements (CWEs) for complex tool geometries and toolpaths requires significant computing power thereby limiting the bandwidth of the system. This research addresses and overcomes this limitation and by doing so enables multiple machining applications to benefit from the fast online calculation of cutting forces. The research objective of the presented Digital Twin is to accurately model the machining process online and automatically update the machining parameters to satisfy a control objective, further progressing the route to the fully autonomous machine tool.
This paper presents a real-time machining Digital Twin for autonomous closed loop control applications. Significantly, a novel online machine-induced residual stress control system has been developed for the first time; this is presented alongside a Digital Twin-based chatter detection and control system capable of predicting and preventing chatter during machining operations. Also presented is an adaptive feed rate control system which supports the Digital Twin-based feedback system by appropriately tuning the feedback gain based on predicted tool load. The Digital Twin machining applications have been implemented on a CNC machining centre and validated by machining experimental trials.
The paper is presented as follows. Section 2 gives an overview of the architecture of the integrated Digital Twin. Section 3 describes the theory and modelling behind the cutting force model, method to address the associated computational bottleneck, descriptions of machine-induced residual control system, chatter detection and control system and adaptive feedback control system. Section 4 presents the experimental validation of the proposed machining applications, and section 5 closes the paper with research conclusions.

Architecture of the integrated Digital Twin
The proposed machining Digital Twin, as shown in Fig. 1, consists of the physical CNC machining centre, a monitoring system, realtime model-based simulations and a closed loop control system providing online feedback. The physical positions and velocities of the machine drives are sent from the NC via the monitoring system to the model-based simulations. The blue and red arrows represent the real-time and offline components to the system respectively. The NC code is the external input to the system and does not form part of the closed loop system. The simulations are, however, updated in real time and create a synchronised Digital Twin of the machining process. The Digital Twin is able to feedback to the machining process through closed loop control of both the spindle speed and feed rate. The type of feedback is dependent upon the machining application. The digital machining platform consists of a number of modules, and three of these are presented in this paper, namely an online MIRS control system, chatter detection and control system and adaptive feed rate control system.

Simulated cutting force model
Estimating cutting forces within the Digital Twin was realised by integrating a developed cutting force model [38] with real-time controller data from the NC. The real-time model uses position information from the NC in conjunction with a CAD workpiece model to determine the CWEs at the tool centre point (TCP) position. The instantaneous spindle speed and feed rate data from the NC are coupled with the CWEs to generate the real-time simulated cutting force and power at each cutter location (CL) throughout the toolpath. These are then subsequently used within the closed loop Digital Twin control applications.
A brief overview of the cutting force model is presented; however, further details are described in Berglind [38] and Armendia [1]. To simulate the milling process, cutting forces are modelled considering the contribution of the edge forces and the chip load-dependent cutting force components. The cutting force model calculates these components for each element of a discretised tool and sums the effects each element has on the global cutting forces. Geometric software calculates the CWE for a discretised tool for each CL along the toolpath.
The cutting forces F el for each element of the tool mesh are calculated from the sum of the edge and cutting forces, which are calculated by multiplying the respective cutting force coefficients (CFCs), edge K e, rta and cutting force K c, rta , with the effective chip width, b el , and uncut chip thickness, h el , as follows in Eq. 1: The cutting force equations can be represented as a function of local feed vector, f xyz , in the tool coordinate system as shown in Eq. 2.
The real-time NC data stream provides the individual axis feeds for the local feed vector. Therefore, Eq. 2 represents the method for calculating the simulated cutting forces for both the online and offline CWE methods, with the main difference whether the calculation of edge force vector F e, XYZ and cutting force matrix Q XYZ is done prior to or during machining. As the values in the cutting force vector and matrix in Eq. 2 change throughout the toolpath as the CWEs vary, then globally the simulated cutting force becomes a function of TCP position, p.
In summary, the cutting force matrices are calculated for each element of a discretised tool mesh. Following coordinate Fig. 1 System architecture of the digital machining platform transformations from the local coordinate system (CS) to the tool CS, the element cutting forces as a function of feed are generated. The effects of active cutting elements engaged within the cut are then summed up to calculate the cutting forces. The proposed method of computing online simulated cutting forces is applied to the digital machining control applications.

Lookahead and lookup functions
Prior to machining, the CWEs are calculated along the toolpath, and a CWE map is generated and indexed by the high-resolution CL positions. The pre-calculation of CWEs removes the computation restrictions on sizes of mesh discretisation, complexity of tool and workpiece geometry and toolpath/CL resolution. During machining, the module looks ahead at the indexed CL positions and calculates the Euclidian distance between the current TCP position from real-time NC data, and the local and future CL points in the CWE map. The number of points included in the calculation is determined by the lookahead value; this is indicated by the red highlighted portion of the toolpath in Fig. 2a. The local minimum shown in Fig. 2c corresponds to indexed pre-calculated data for the current TCP position as shown in Fig. 2b. The CWE for the current TCP position is then looked up from the data (Fig. 2c). The online simulated cutting forces are calculated from the CWE for the TCP position, and the live feed rate and spindle speed from the NC data. The additional benefit of this approach is that it enables complex toolpaths with repeating passes over the same CL to be used. for example in trochoidal milling. The method extracts the CWE on the first pass and would return a different CWE on the second pass eliminating multi-solution issues. The lookahead and lookup functions are used within the three digital machining applications; they are described in the following sections.

MIRS real-time model-based simulation and control
To demonstrate the capabilities of the current real-time digital machining platform, an analytical model was generated to predict elastic MIRS behaviour from computed mechanical and thermal loading during a milling operation based on the release boundary conditions for the strain rates ε r ij and γ r ij and the stresses σ r ij and τ r ij . The release boundary conditions are as follows: The stress and strain increments, Δσ zz , Δτ xz and Δε xx , and cutting temperature increment ΔT are relaxed in M steps, as expressed by Eq. 4 in order to calculate the stress increments under the elastic release Δσ r x and Δσ r y described by Eq. 5: where E is the elastic modulus, v is the Poisson's ratio and α w is the expansion thermal coefficient of the workpiece. This model was integrated with the online cutting force simulation model described in Section 3.1 to calculate and update machining cutting forces and thus find a set of machining parameters that would generate acceptable MIRS behaviour. This MIRS control module is illustrated in Fig. 3, where actual feed rates and spindle speeds are used to simulate cutting forces and elastic MIRS. If the simulated elastic MIRS are higher than a reference, the feed rate and spindle speed are updated to calculate new cutting forces and elastic MIRS. This iteration is continued until a feed rate and spindle speed are found to induce lower elastic stresses than the reference.

Chatter real-time model-based simulation and control
The objective for this application is to predict the chatter throughout the toolpath and automatically prevent it occurring. As stated in Section 1.2, previous research in literature focused on internal or external measurement-based chatter detection to predict the process stability and change the spindle speed before chatter occurs. Here, the proposed Digital Twin capabilities demonstrate a proactive system and not reactive, ensuring that the required workpiece surface quality is maintained.
At the heart of the software is the stability roadmap (SRM), which is a time or spatial coordinate-based stability representation of the machining process [1]. As shown in Fig. 4, the SRM provides a visual method of selecting stable spindle speeds throughout a toolpath as engagements vary. The SRM is able to select stable cutting conditions by avoiding chatter frequencies. Chatter frequencies correspond to eigenvalues over the threshold value of 0.5 when the maximum real eigenvalues are calculated over a range of frequencies for each CWE. The start and end chatter frequencies ω c, (1,2) for each of the j lobes for each engagement correspond to stability boundaries. A stable cutting process is shown as the white regions in the SRM. The spindle speeds for these frequencies are calculated to provide a map of stable and unstable cutting conditions as expressed in Eq. 6.
The proposed chatter stability simulation and control system is shown in Fig. 5. As machining starts, the system reads the real-time spindle speed and TCP position data from the NC. The lookahead method, as described in Section 3.2, searches n positions ahead using the live TCP position and indexed CLs. The closest indexed CWE is identified, and thus the Digital Twin extracts the CWE for the current TCP position. The online system then calculates the SRM based on the lookahead CWEs to find a stable spindle speed range. Once the stable spindle speed is selected, the control system automatically sends the new spindle speed command to the machine tool controller and the spindle speed automatically changes. The benefit of this approach is that the spindle speed can adapt online to varying conditions throughout the toolpath. The automated process removes the requirement for the machine operator to modify the spindle speed as the process predicts chatter and mitigates against it prior to chatter occurring.

Closed loop feedback
The generalised method of generating the closed loop feedback, as presented in Fig. 6, is as follows. First, the feed rate is set within the NC code and then interpolated within the numerical controller unit (NCU). The NCU generates the nominal feed rate, b f nom , which is multiplied with the feed rate override command [43,44] from the Digital Twin adaptive control function. The commanded feed rate, b f com , commands the feed drives, and the actual feed rate b f act is measured and read in real time by the high-speed monitoring system. The actual feed rate is then used to calculate the simulated cutting forces online. The lookahead and lookup function, fed by position data from the NC, calculates the TCP position and CWE gain. The real-time simulated cutting force is then calculated at the exact TCP position using the actual feed rate.
The online simulated cutting force (or power), F sim ¼ Q XY p ð Þ k k 2 Á b f act , is compared against a reference value. The cutter location-based reference F ref (p) is calculated a priori based on a desired cutting force or power by a reference generator. The error signal is multiplied by the CWE-based gain K(p) to provide the feedback signal, as described in Eq. 7.
The adaptive feed rate function is able to modulate the feed rate command to compensate for changes in the CWEs and simulated cutting force or power through the CWE-dependent feedback gain. This method also prevents fast entries and exits from the part, protecting both the tool and workpiece.

Digital machining applications
The previous section described the machining Digital Twin, lookahead and lookup function and the three integrated intelligent machining applications. The following section describes the experimental setup and case studies for each of the 3 applications.

Experimental setup
The research was conducted on a Starrag Scharmann Ecospeed 2538 5-axis high performance machining centre controlled by a Siemens 840D Power Line controller (Fig.  7). The commercial machining centre, designed for machining large aluminium aerospace structural components, has been modified to add capability for externally generated control inputs and high-speed monitoring. The Digital Twin system is controlled from MATLAB which runs the simulation and control applications. To support this, the machining centre was retrofitted with four fast analogue input/output (IO) modules installed on a NC unit terminal Bus. The IO modules are connected by coaxial cable to a multi-function data acquisition device (NI USB-6343) controlled by a local computer running the Digital Twin software. Externally generated inputs from the Digital Twin software are transmitted from the analogue The system is fitted with Siemens ADAS monitoring which has the capability to send up to 30 pre-selected axis data streams to a computer fitted with a communications processor card. The device acts as a slave for the PROFIBUS cycle, transferring data equal to the position controller cycle of 250Hz. The selected data consisting of actual and commanded drive positions and velocities, spindle speed and drive currents streamed directly in to MATLAB in real time. The monitoring and control components described synchronise the Digital Twin model with the machining centre and the physical process. Alongside the Digital Twin system, during the machining trials, a Kistler 9255C dynamometer was used for recording and validating cutting force data.
Two experimental setups were implemented to demonstrate the Digital Twin platform. For the MIRS control experimental case study, aluminium (Al7050 T7451) coupons sized 250 × 190 × 40 mm were used for the high-speed milling trials. The milling trials were performed under minimum quantity lubrication (MQL) cutting conditions; and the toolpath strategy of the milling operation consisted of a fiveaxis roughing operation, followed by a high-performance roughing toolpath and a spiral out toolpath finishing operation to produce a thin plate. The finishing operation was the focus of the MIRS case study; the toolpath and finished workpiece are shown in Fig. 8a and b, Fig. 8c and d, respectively. A 16 mm solid end mill (Sandvik 2P121-1600-NC-H10F) was used for the chatter and feed rate case studies along with flood coolant.
The cutting force coefficients used for the testing were derived from previous machining trials conducted on the target material and tool system, but under different cutting conditions; these were as follows (Table 1): where Ktc, Krc and Kac represent the tangential, radial and axial cutting force coefficients and Kte, Kre and Kae represent the edge force coefficients.

Discussions of the machining-induced residual stress control
The objective of MIRS case study is to demonstrate a reduction in MIRS online by the use of a novel real-time modelbased simulation and online feedback from the predicted elastic MIRS. The control objective of the case study was an automatic 30% reduction in MIRS during the finishing operation. The MIRS of the high-performance roughing operation was neglected in this study due to its low magnitude induced into the finishing surface, as shown in Fig. 9. It was assumed that the finishing pass with an axial depth of cut of 0.25 mm would wipe out those remaining roughing residual stresses instantaneously, which in reality would be a gradual removal and a level of re-distribution of induced stresses. Therefore, the MIRS control was focused on the final residual stress state of the part produced by the finishing operation.
The initial machining parameters for the finishing operation were set at 30000 rpm spindle speed and 14400 mm/min feed rate. When machining, the lookahead and lookup function calculated the CWE using the real-time position information (Fig. 10a). The online simulated cutting force was calculated using the position-based CWE and real-time feed rate Fig. 7 Inside Ecospeed machining centre (AMRC, Sheffield, UK), hardware and IO modules (Fig. 10b). The MIRS module is automatically triggered after calculating the maximum simulated cutting force, and the online calculation of elastic MIRS commenced. The MIRS module iteratively calculated new machining parameters until a predicted 30% online reduction in MIRS was achieved. This was achieved after four iterations, as shown in Fig. 10c, where the four predicted elastic MIRS trends at the four sets of machining parameters are shown. The maximum elastic MIRS were reduced from 113 to 64 MPa by automatically commanding the initial parameters to a modified spindle speed of 18750 rpm and 5760 mm/min feed rate as shown in Fig.  10d. The decrease in residual stress could mean a significant reduction in distortions, especially for monolithic thin-walled aluminium components [45,46], regardless of the loss in productivity by reducing speed and feed rate.
Due to online computation of elastic stresses, a number of passes using the initial machining parameters were conducted prior to updating the controller. These are shown in the red box in Fig. 10. Despite latency of the MIRS simulation, the control of the machining parameters was successfully executed during the cut, and the machining within the region highlighted with the blue box in Fig. 10 was conducted at the modified parameters. On completion of machining, the residual stresses on the workpiece were measured using a targeted strain gauge hole drilling technique [47] at points located in each one of these sections at half the distance of the maximum coupon length.  Overall, there was an acceptable level of stress distribution, and the objective of achieving at least 30% reduction in MIRS was accomplished. As Fig. 11 shows, the measured residual stress on the aluminium coupons was successfully decreased from 96 to 40 MPa demonstrating a 58% reduction in MIRS. The prediction presented a root mean-squared error (RMSE) of 26.9 MPa. This prediction error, which was more evident between the depths of 20 to 80 μm, might be contributed by the fact that only elastic MIRS were calculated as discussed in Section 3.3. However, the predicted elastic MIRS trend reasonably matched the measured values, particularly in terms of the maximum stress magnitudes on the part surface, showing that the model-based simulation was successful in providing a reference for real-time MIRS control.

Discussions of the chatter detection and control
The stability control module was implemented during roughing milling trials using the hardware configuration described in Section 3.4. The nominal spindle speed in the NC programme was 18700 rpm, and nominal feed rate was 0.05 mm/tooth. Axial depth of cut was 10mm and radial depth of cut was changing along the toolpath. Figure 12 shows the SRM for the initial section of the toolpath. It shows that at 18700 rpm, the SRM predicts the presence of chatter with a frequency around 4000 Hz. Then the controller automatically modified the spindle speed to a stable spindle speed. For example, at the beginning and end, the controller changed the spindle speed to 19675 rpm to avoid this according to the SRM. Figure 11 shows the commanded spindle speed avoided unstable machining parameters. Figure 13 shows the validation workpiece where machining was conducted during two roughing stages, the first at 18700 rpm with 10mm depth of cut and the second at 19675 rpm with the same 10mm depth of cut. The surface quality demonstrating the two cases is presented alongside the associated fast Fourier transform FFTs. For the 18700 rpm case, the dominant chatter frequency is shown at 4591 Hz, and the corresponding chatter marks are visible. The dominant frequency during the roughing process at 19675 rpm was at the tooth passing frequency 656 Hz, as demonstrated by the smooth surface condition, showing that the process is stable, thereby validating the stability road map.

Discussion of the feed rate control
The objective of the adaptive control is to provide real-time closed loop feed rate control through the use of Digital Twin feedback. The machining Digital Twin is able to predict both cutting force and spindle power in real time; and these signals are used as virtual inputs to the controller. The Digital Twin can predict the changing cutting forces at the tooltip throughout the machining operation and responds in such a way to maintain a reference force or power level.
The CWEs are calculated prior to machining. The CWE map of a roughing toolpath is shown in Fig. 14. The figure shows high CWE values during the initial full slot (yellow) and zero CWE during the air cuts (blue). The cutting forces are, however, calculated online by using the lookahead and lookup method. This allows real-time calculation of simulated cutting force for use in the adaptive control function.
A machining trial based on simulated cutting force was conducted on the machining centre described in Section 4.1. The machining parameters were as follows: nominal feed rate 1000 mm/min, spindle speed 18760 rpm, axial depth of cut 10 mm and radial depth of cut varying from full (16mm) to half (8mm) immersion.
The pre-calculated CWEs for the machining operations are shown in Fig. 14a. The values represent the CWE gain as a function of feed rate. The navy blue represents low CWE gain values, for example during tool entry and exits and during air cuts. The yellow represents higher CWE gains, for example around the square internal features. The adaptive feed rate for this machining operation is shown in Fig. 14b. The commanded feed rate, calculated using Eq. 7, is a function of the real-time simulated cutting force and a reference force. The yellow represents high feed rates, and the blue feed rate signal shows low feed rates as can be seen around the low CWE gain area of the internal square feature.
To show the difference in simulated cutting forces, the average resultant simulated cutting force using a constant feed rate is shown in Fig. 15a. The large spikes in cutting force can be seen for the sharp changes in CWEs. Figure 15b shows the simulated cutting force when using adaptive feed rate control. The force spikes have been eliminated, and the average cutting force has been commanded to a pre-defined reference of 120 N.
The limitation of the adaptive feed rate is that the simulated cutting force is only as accurate as the engagement model, feed rate signal and the cutting force coefficients. This case study validated the engagement model for complex toolpaths with the feed rate signal; but as can be seen in the measured and simulated cutting force in Fig. 16a, for the toolpath section highlighted in Fig. 16b, there is an offset between the average resultant cutting forces. This is due to inaccurate CFCs used within the trial. Automatic CFC update overcomes this issue; however, it was not used in the case study.

Integrated machining Digital Twin
The previous section described the case studies for the 3 digital machining applications. However, the benefit of the machining Digital Twin is the flexible integration of the applications. The core of the Digital Twin is the real-time cutting force prediction model supported by the lookahead and lookup function; however, by integrating closed loop control based on the multiple machining Digital Twin applications (included in the novel MIRS control), this research distinguishes itself from previously published works as presented in the introduction section.

Conclusions and future work
This paper has taken a step closer to the future machine tool by proposing a novel machining Digital Twin capable of autonomous control of machining operations. Based on the research and results presented in this paper, the following conclusions can be drawn.
A model-based Digital Twin was successfully integrated with live NC data from a CNC machining centre to generate real-time Digital Twin simulations of machining operations. Integrating with Digital Twin, adaptive closed loop control was achieved by providing feedback through the use of newly   The proposed Digital Twin system predicts real-time simulated cutting forces, power and process stability for complex toolpaths, workpieces and CWEs. A method of overcoming computational bottlenecks for calculating highly discretised and complex CWEs was demonstrated, which used a priori computations combined with real-time TCP position data and a lookup method. Through this method, the overall stability of the computational model was vastly improved which laid the foundations for using closed loop control.
For the first time, a Digital Twin which predicts and controls machine-induced residual stress was implemented. The method utilised the real-time machining Digital Twin to compute cutting forces and MIRS online during a roughing toolpath. Online machining parameter optimisation automatically calculated the required machining conditions which satisfied the MIRS control objective. The machining Digital Twin updated the machining parameters via the closed loop feedback to modify the cutting conditions. This was an important first step towards automatically controlling part distortion which will be a component for future research objectives.
A Digital Twin-based chatter prediction and control method was demonstrated. The method used real-time modelbased simulations to predict stability conditions and calculate stable cutting conditions. The closed loop feedback updated the spindle speed and feed rate in real time to adapt and prevent chatter before it occurred. This method showed that without the use of additional sensors, chatter could be predicted and prevented, thereby protecting the tool, workpiece and machine whilst preventing unnecessary downtime during production.
An adaptive feed rate method was proposed which uses CWEs to vary the control system gain and ultimately the system response to feedback. The method was demonstrated for low feed rates, and future work will require greater bandwidth in the system response.
The proposed Digital Twin control applications are key components in the roadmap to achieve unattended operation of the intelligent future machine tool. Further work must address the computational demands of Digital Twins during complex high-speed machining operations and in particular 5-axis machining. A priori computations of CWEs will continue to play a significant part in future research alongside windowing and parallel processing.
Availability of data and materials Data is available with the permission of University of Sheffield AMRC. The data that support the findings of this study are available from the corresponding author upon reasonable request.
Funding The research was funded by the High Value Manufacturing Catapult.

Declarations
Ethics approval Not applicable Consent to participate Not applicable Consent for publication The authors declare that they all consent to publication.

Competing interests The authors declare no competing interests.
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.