1 Introduction

Nowadays, as global climate warming is becoming remarkably serious, there has been an increasing interest in carbon emissions reduction and energy saving problems [1, 2]. To a large extent, manufacturing activities have aggravated global warming according to the report of the Intergovernmental Panel on Climate Change (IPCC) [3]. It is estimated that industrial energy consumption is expected to account for nearly 50% of global energy consumption by 2040 [4]. The government has adopted various policies on carbon emissions, for example carbon tax, to deal with environmental problems [5]. Forced by the increasing competition in the market and strict regulations on environment protection, manufacturing industries should pay more attention to environment-related indicators such as carbon emissions and carbon effect, besides traditional issues such as product quality, production efficiency and cost [6].

The CNC machine tool is a significant equipment in manufacturing industry, and its rated power is usually several kilowatts or dozens of kilowatts. Therefore, the CNC machining is an energy-intensive production process. In manufacturing industry, the CNC machining energy consumption accounts for a large proportion of carbon emissions in the environment [7]. Hence, it is extremely essential to reduce carbon emissions during the CNC machining. Carbon emission from the CNC machining is closely related to cutting parameters (such as spindle speed, feedrate and cutting depth) [8]. The related research shows that the carbon emission may be reduced by 6–40% by optimizing cutting parameters in the manufacturing process [9]. Consequently, how to select optimal cutting parameters becomes a crucial problem in the process of machining.

Traditional optimization methods of cutting parameters for CNC machine tool are usually based on mathematical models or mechanical manuals in the conditions of static constraint. These methods are very difficult to obtain the optimal results in the dynamic machining conditions, because of ignoring the influence of changes in machining conditions. Recently, digital twin, as an innovative enabling technology for smart manufacturing, provides a new methodology [10]. Digital twin is an effective way to achieve dynamical optimization of physical objects by real-time interaction between physical objects and their high-fidelity twin models, and supports the continuous evolution to adapt to the change from the physical machining [11]. Therefore, a digital twin-driven cutting parameter optimization method is proposed in this paper, which aims at dynamically optimizing cutting parameters based on actual machining conditions for improving machining efficiency and reducing carbon emissions.

The rest of the paper is organized as follows. The related works to cutting parameter optimization and digital twin technology is expounded in Sect. 2. In Sect. 3, an architecture of cutting parameter optimization with digital twin is presented. Section 4 studies the related enabling technologies of proposed method, mainly including ontology semantic modeling of machining process and dynamic optimization for improving cutting parameters. In Sect. 5, the case study is presented to verify the proposed method. Finally, the conclusions and future work are made in Sect. 6.

2 Literature Review

2.1 Cutting Parameter Optimization Method

Recently, researches on the optimization of cutting parameters for reducing carbon emissions and conserving energy have been taken widespread attention by academia and industry because of global warming issues and vigorous market competitions [12]. Some researchers have established a new production indicator, i.e. carbon emissions, for assessing the machining process. Yi et al. [13] presented the carbon emissions boundary model, including the carbon emissions caused by the cutting process, the production of raw materials and auxiliary equipment. Based on different forms of energy consumption, Jiang et al. [14] developed a novel model composed of consumable and transferable carbon emissions, where the source of consumable carbon emissions is electricity, and the source of transferable carbon emissions is raw materials, cutting fluids, etc. For a given machining process, different cutting parameters have almost no effect on the consumption of raw materials. Liu et al. [15] established a carbon emission model for cutting parameter optimization, which took into account the carbon emission from electricity, cutting fluid and cutting tools, but not raw materials. Other researchers focus on the optimization methods for low carbon and other traditional goals such as working efficiency, quality, etc. Zhang et al. [16] adopted NSGA-II algorithm to obtain the optimal cutting parameters. They conducted tests on a CNC lathe to verify the method, and the results showed that the method can achieve a trade-off between low energy, low cost and noise reduction. Zhou et al. [17] developed NG-NSGA-II algorithm to balance three objectives of carbon footprint, time and cost in the machining, and proved that NG-NSGA-II has better search performance than NSGA-II. Li et al. [18] proposed a multi-objective simulated annealing algorithm to solve the integrated model of process optimization and cutting parameter optimization. The results showed that the algorithm can achieve the dual goals of energy saving and workloads balance. In practice, the machining raw materials often cannot be completely removed in a single pass machining, so it is necessary to use multi-pass machining. In view of the problem of multi-pass machining, Li et al. [19] investigated an adaptive multi-objective particle swarm algorithm to optimize the total number of passes and the cutting parameters of every pass, and to realize a balance between energy consumption and cost. As the above studies show, many models and algorithms have been proposed to solve the problem of cutting parameter optimization for low carbon. However, most of the methods search for the optimal solution based on the certain machining conditions and machine performance, which can be considered as a static optimization method. In fact, the actual machining states generally change dynamically because of the dynamic disturbances (such as tool wear and cutting force fluctuation) from machining conditions, that is, the optimal cutting parameters under the certain machining conditions are not always optimal for the current machining process. Hence these static optimization methods are not enough to obtain the best cutting parameters in practice.

Some studies have focused more on feedrate optimization, which can improve the production efficiency and enhance stabilization of cutting force [20]. Based on mechanism model of cutting force, Park et al. [21] developed an autonomous machining system driven by intelligent algorithm to enhance the quality of products and working efficiency. Ridwan et al. [22] investigated a machine condition monitoring system. It can provide online process optimization with real-time machining knowledge to reduce machining time and improve product quality. Considering the constraints associated with the feed drive system and machining process, Erkorkmaz et al. [23] presented a feedrate optimization strategy for the shortest cycle time tool trajectories and proved the feasibility of the method through the engraving surface machining experiment. Xu et al. [24] adopted hybrid forward-reverse mappings of artificial neural networks to optimize feedrate for five-axis milling. This method can improve the solution accuracy and reduce the calculation time compared with other intelligent algorithms. The methods mentioned above have made some contributions to the dynamic optimization of cutting parameters. However, most of the methods lack the mechanism of real-time interaction and symbiotic evolution with physical machining conditions. These methods still have differences between the optimization results and the actual machining, and they have low solution accuracy. Consequently, the existing methods are inadequate to deal with problems of dynamic cutting parameter optimization during CNC machining.

2.2 Digital Twin Technology

With the progress of Industry 4.0, Industrial Internet of Things [25, 26], artificial intelligence [27], etc., a new methodology, named digital twin is presented [28,29,30,31]. Digital twin is a complex system integrating multi-physical field, multi-dimension and multi-probability simulation of physical objects. It realizes interaction and fusion between physical objects and their high-fidelity virtual twin models by making full use of sensing data and historical data [32]. Currently, digital twin has been applied to different stages of the product life cycle in manufacturing field, such as design, manufacturing, predictive maintenance, etc. Luo et al. [33] studied the multi-domain modeling method for CNC machine tool and this method can effectively improve machines stability and reduce machining faults. Liu et al. [34] proposed a digital twin-driven personalized design method for smart workshop, which is an effectual digital design method for physical production system. Considering the complexity of machining conditions, Liu et al. [35] built a process evaluation framework based on digital twin and illustrated validity of the framework with key components of diesel engines. To ensure the safety and availability of machining equipment, Qiao et al. [36] proposed a machine fault prediction method considering work conditions by using digital twin and deep learning technologies. Cheng et al. [37] proposed a digital twin-driven quality prediction method based on physical-virtual data interaction technology. The method improves the predictability and management of the quality control for marine diesel engines. Wang et al. [38] presented a multi-life-cycle remanufacturing method driven by digital twin, which has the advantages of real-time perception control and optimization analysis.

The related studies show that digital twin is an effective method for intelligently predicting and guiding the operations of physical objects with virtual-physical interaction and symbiotic evolution. On the one hand, digital twin fuses real data and simulation data to provide the complete data source for the behavior analysis and prediction of physical objects. On the other hand, it can continuously analyze the operating state of physical objects and their twin models to find differences, and then adopt strategies for dynamic optimization and adjustment to guide physical objects to work better. And digital twin has a great potential to dynamically optimize the machining process through real-time sensing the machining conditions. However, few researches focus on applying digital twin technology to the optimization of the CNC machining process. Hence digital twin is introduced to realize the optimization of cutting parameters in this paper.

3 The Architecture of Cutting Parameter Optimization with Digital Twin

In the CNC machining process, digital twin will continuously simulate the machining behaviors and optimize the cutting parameters based on the real-time sensing data from the physical machining conditions. The optimization result will be fed back to the physical machine tool to guide the actual production process. Here, an architecture of digital twin of a CNC machine tool for cutting parameter optimization is proposed (see Fig. 1). There are two parts in this architecture, namely the physical space and the virtual space.

Fig. 1
figure 1

The architecture of a digital twin of CNC machine tool for cutting parameter optimization

3.1 The Physical Space

In the physical space, it is mainly composed of the physical device layer (CNC machine tool), the perception layer, and the communication network layer. In the process of machining, the working state of the CNC machine tool is sensed and collected through various sensors in the perception layer. All the collected data, namely sensing data, are transmitted to the virtual space through communication network layer (Ethernet, WiFi, ZigBee, etc.), and are used to drive the twin model for simulation and optimization.

3.2 The Virtual Space

In the virtual space, it can be divided as two main models, i.e. the ontology model and the twin model.

  1. (1)

    The ontology model


    It is a communication bridge for understanding the semantic of the real-time interaction between the physical space and the virtual space. The real-time data of the physical space can be semantically parsed by the ontology and transmitted to the twin model. Meanwhile, the ontology can parse simulation data of the twin model into the machining instruction for guiding the physical machine tool.

  2. (2)

    The twin model


    It consists of the simulation model and optimization model. The simulation model, i.e. virtual machine tool, synchronously simulates the machining behaviors of the physical machine tool, such as the cutting tools movement and the process of removing material. In the optimization model, all kinds of mathematical models and intelligent algorithms driven by sensing data are adopted to dynamically optimize cutting parameters.

4 The Semantic Modeling and Dynamical Optimization

4.1 Ontology-Based Modeling for Virtual-Physical Interaction

During the optimization process of cutting parameters, the information in the virtual and physical space needs to realize real-time interaction and fusion. That's to say, the machining data of the physical space, including cutting parameters and state information of all machining resources, should be transmitted to the virtual space for driving the twin model to simulate and optimize. Meanwhile, the optimization results need to be transmitted back to the physical space to guide the actual machining. However, the related process information is characterized by complexity and variability for the practical machining. Therefore, it is necessary to establish the CNC machining process knowledge ontology.

4.1.1 The Modeling of CNC Machining Process Knowledge Ontology

Considering the actual requirements of cutting parameter optimization, i.e. processing time and carbon emissions, many domain terms are summarized and analyzed. \(CNC\_Machining\_Onto\log y\), an ontology on CNC machining process knowledge, is obtained, which mainly includes basic attribute information \(Basic\_Attr\_info\), dynamic processing information \(Dynamic\_Mfg\_Info\) and simulation information \(SL\_Info\). Its formal description is as follows.

$$CNC\_Machining\_Onto\log y = (Basic\_Attr\_Info, \, Dynamic\_Mfg\_Info,\;SL\_Info)$$
  1. (1)

    Basic attribute information \(Basic\_Attr\_Info\)


    It refers to the information that is almost unchanged in the machining process, such as ID, material and dimensions of machining equipment and workpieces. This kind of information is mainly used to describe the basic parameters and processing performance of manufacturing resources. Its formal description is as follows.

    $$Basic\_Attr\_Info = (MT\_Basic\_Info, \, WP\_Basic\_Info,Tool\_Basic\_Info,Aux\_Eqp\_Info)$$
  2. (2)

    Dynamic processing information \(Dynamic\_Mfg\_Info\)


    It refers to information that changes dynamically with the machining process such as cutting parameters, spindle power and axis positions. It directly reflects the real-time state of machining resources. Its formal description is as follows.

    $$Dynamic\_Mfg\_Info = (MT\_Dyna\_Info, \, WP\_Dyna\_Info,Tool\_Dyna\_Info)$$
  3. (3)

    Simulation information \(SL\_Info\)

    It is obtained by simulating and analyzing the relevant data within \(Basic\_Attr\_Info\) and \(Dynamic\_Mfg\_Info\) in the virtual space. It mainly refers to the optimized machining process, carbon emissions and time information in the whole machining. Its formal description is as follows.

    $$SL\_Info = (Optimized\_\Pr ocess,Mfg\_Time, \, CE\_Info,Aux\_Info)$$

    In addition, the subclasses and properties information of each class are shown in Tables 1, 2, 3. And the CNC machining process knowledge ontology is modeled using the ontology editor Protégé, as shown in Fig. 2.

Table 1 Basic attribute information class
Table 2 Dynamic machining information class
Table 3 Simulation information class
Fig. 2
figure 2

The CNC machining process knowledge ontology

4.1.2 The Construction and Parsing Process for the Ontology

In the physical space, the ontology construction and parsing process based on sensing data is as follows.

Step 1: The machining data collected by all kinds of sensors and other information of machining resources is described in the form of XML.

Step 2: The XML file is mapped to OWL file based on mapping rules [39], and the sub-ontology for the physical space is obtained.

Step 3: The ontology parser Jena is used to parse the ontology file, and the data parsed will be uploaded to the twin model.

Similarly, the simulation data from the virtual space is also mapped to the ontology, and the sub-ontology for the virtual space is obtained. Thus, sensing data of the physical space and simulation data of the virtual space constantly update the ontology, and build a complete process knowledge ontology.

4.2 Dynamic Optimization of Cutting Parameters with Digital Twin

4.2.1 Initial Optimization for Minimizing Carbon Emissions and Processing Time

To find initial optimal cutting parameters, we suppose that machine conditions are determined during the process of machining. A multi-objective optimization model is established for minimizing carbon emissions and processing time, and the model is solved by NSGA-II algorithm.

  • Decision variables


    Spindle speed, feedrate, cutting depth and width are significant cutting parameters for CNC machining. Cutting depth and width are depended on machining allowance and accuracy, and they have little or no influence on carbon emissions. Therefore, the decision variables are set as spindle speed \(n\) (r/min) and feedrate \(V_{f}\)(mm/min).

  • Optimization objectives


    Carbon emissions are important in numerous process planning objectives, but from the perspective of economic benefits, processing time is also indispensable. As a result, two objectives are considered, i.e. carbon emissions \(CE_{P}\)(kgCO2)and processing time \(PT_{P}\)(s), as shown in Eq. (1).

$$F(n,V_{f} ) = \left( {\min CE_{P} ,\min PT_{P} } \right)$$
(1)
  1. (1)

    Processing time modeling


    \(PT_{P}\) refers to the total time from stable operation of each subsystem of the machine tool, such as spindle system and feed system, to the finish of the machining task. It is mainly composed of three parts, i.e. material removal time \(PT_{C}\)(s), tool replacing time \(PT_{CT}\)(s) and auxiliary time \(PT_{A}\)(s), as shown in Eq. (2).

    $$PT_{P} = PT_{C} + PT_{CT} + PT_{A}$$
    (2)

\(PT_{C}\) can be obtained as shown in Eq. (3), where \(L\)(mm) denotes the milling length,\(a_{p}\)(mm) denotes the cutting depth,\(\Delta\)(mm) denotes the thickness of the material to be removed, namely the machining allowance.

$$PT_{C} = \frac{60 \times L \times \Delta }{{V_{f} \times a_{p} }}$$
(3)

In the machining process, the cutting tools usually become not sharp enough and must be replaced. According to Taylor's extended equation, the tool life \(T_{tool}\)(min) can be calculated by Eq. (4) [13].

$$T_{tool} = \left[ {\frac{{C \times D^{{b_{t} }} }}{{V_{C} \times a_{p}^{{e_{t} }} \times a_{f}^{{\mu_{t} }} \times a_{e}^{{r_{t} }} \times z^{{n_{t} }} }}} \right]^{\frac{1}{q}}$$
(4)

where \(C\),\(b_{t}\),\(e_{t}\),\(\mu_{t}\),\(r_{t}\),\(n_{t}\) and \(q\) are tool life coefficients,\(D\)(mm) denotes the tool diameter,\(V_{C}\)(m/min) denotes the tool cutting speed,\(a_{f}\)(mm/z) denotes the feedrate per tooth,\(a_{e}\)(mm) is the milling width and \(z\) is number of tool teeth.\(V_{C}\) and \(a_{f}\) can be expressed as shown in Eqs. (5)-(6).

$$V_{C} = \frac{\pi \times D \times n}{{1000}}$$
(5)
$$a_{f} = \frac{{V_{f} }}{n \times z}$$
(6)

\(PT_{CT}\) can be calculated from Eq. (7), where \(T_{tc}\)(min) is the time for tool replacing once.

$$PT_{CT} = T_{tc} \times \frac{{PT_{C} }}{{T_{tool} }}$$
(7)

\(PT_{A}\) refers to the time used by various auxiliary operations in machining, which mainly includes the tool retracting time in this study, as shown in Eq. (8), where \(T_{ae}\)(min) is the time for retracting once.

$$PT_{A} = \frac{{60 \times T_{ae} \times \Delta }}{{a_{p} }}$$
(8)
  1. (2)

    Carbon emissions modeling


    Carbon emissions for the CNC machining are associated to many factors, such as the electricity consumption \(CE_{E}\)(kgCO2), raw materials consumption \(CE_{M}\)(kgCO2), cutting tools \(CE_{T}\)(kgCO2)and cutting fluid \(CE_{F}\)(kgCO2), as show in Fig. 3.

    In the machining process for a part, the removal amount of material \(CE_{M}\) is almost the same for different cutting parameters, so total carbon emissions \(CE_{{\text{P}}}\)(kgCO2)can be represented by Eq. (9).

$$CE_{P} = CE_{E} + CE_{T} + CE_{F}$$
(9)
Fig. 3
figure 3

Carbon emissions boundary of a CNC machining process

Following Eq. (9), the calculations of \(CE_{T}\),\(CE_{F}\) and \(CE_{E}\) can be described as shown in Eqs. (10)-(12).

$$CE_{T} = \frac{{PT_{C} \times W_{tool} \times CEF_{tool} }}{{60 \times T_{tool} }}$$
(10)
$$CE_{F} = \frac{{PT_{P} }}{{T_{fluid} }} \times V_{fluid} \times CEF_{fluid}$$
(11)
$$CE_{E} = E_{P} \times CEF_{elec}$$
(12)

in which \(CEF_{tool}\)(kgCO2/kg),\(CEF_{fluid}\)(kgCO2/m3) and \(CEF_{elec}\)(kgCO2/J) are emission factors of cutting tool, cutting fluid and electricity, respectively.\(W_{tool}\)(kg) denotes the tool weight,\(T_{fluid}\)(s) denotes the cutting fluid change period,\(V_{fluid}\)(m3) denotes the coolant volume for milling, and \(E_{P}\)(J) denotes the electricity energy for the whole process.

In this study, the electricity energy is mainly consumed for tool replacing \(E_{CT}\)(J), materials removing \(E_{C}\)(J) and tool retracting \(E_{A}\)(J). Therefore, the total electricity energy \(E_{P}\)(J) can be defined as Eq. (13).

$$E_{P} = E_{CT} + E_{A} + E_{C} = P_{basic} \times PT_{CT} + P_{idle} \times PT_{A} + (P_{C} + P_{idle} + P_{a} ) \times PT_{C}$$
(13)

in which \(P_{idle}\)(W) is the idle power,\(P_{basic}\)(W) is the basic power,\(P_{C}\)(W) is the cutting power and \(P_{a}\)(W) is the additional power.

\(P_{idle}\) is composed of the basic power \(P_{basic}\)(W) and the unload power \(P_{unload}\)(W), as shown in Eq. (14).

$$P_{idle} = P_{basic} + P_{unload} = P_{basic} + P_{\min 0} + C_{1} \times n + C_{2} \times n^{2}$$
(14)

\(P_{basic}\) is to assure the normal working of the machining system, such as the cooling system and hydraulic system.\(P_{unload}\) refers to the power consumed when the machine tool is only idling without cutting behaviors, which is closely related to the spindle speed, where \(P_{\min 0}\)(W) denotes the minimum unload power of a machine tool, and \(C_{1}\),\(C_{2}\) are rotation coefficients.

\(P_{C}\) is mainly decided by cutting speed \(V_{C}\) and cutting force \(F_{C}\)(N), as shown in Eq. (15), in which \(F_{C}\) can be expressed in Eq. (16).

$$P_{C} = \frac{{F_{C} \times V_{C} }}{60}$$
(15)
$$F_{C} = C_{F} \times a_{p}^{{x_{F} }} \times a_{f}^{{y_{F} }} \times z^{{z_{F} }} \times a_{e}^{{\mu_{F} }} \times D^{{ - q_{F} }} \times n^{{ - w_{F} }} \times K_{F}$$
(16)

where \(C_{F}\) is cutting force coefficients, which is determined according to the cutting tools and workpiece materials. \(x_{F}\),\(y_{F}\),\(z_{F}\),\(\mu_{F}\),\(q_{F}\),\(w_{F}\) are the influence indexes of cutting depth, feedrate, number of tool teeth, cutting width, cutting tool diameter and spindle speed on cutting force.\(K_{F}\) is modification coefficient of the workpiece material.

In addition, \(P_{a}\)(W) refers to some extra power, e.g. the power generated by mechanical friction, which is challenging to establish an accurate mathematic model. Alternatively, we can use an approximate linear formula to represent, as shown in Eq. (17), where \(b_{m}\) denotes the power coefficient [13].

$$P_{a} = b_{m} \times P_{C}$$
(17)
  • Constraints

    For milling, there are a substantial amount of constraints need to be satisfied, as shown below.

$$n_{Min} \le n \le n_{Max}$$
(18)
$$V_{fMin} \le V_{f} \le V_{fMax}$$
(19)
$$F_{C} \le F_{Max}$$
(20)
$$P_{C} \le \eta \times P_{Max}$$
(21)
$$T_{tool} \ge T_{tool}^{Min}$$
(22)
$$R_{a} = \frac{{a_{f}^{2} }}{{8 \times r_{g} }} \le R_{Max}$$
(23)

Constraints (18)–(19) control the spindle speed and feedrate to be within acceptable ranges, where \(n_{Min}\) and \(n_{Max}\) represent the upper and lower bounds of the spindle speed,\(V_{fMin}\) and \(V_{fMax}\) represent the upper and lower bounds of feedrate. As described in Constraint (20), the cutting force needs to be limit within maximum cutting force \(F_{Max}\) for good product quality and machine life. Similarly, the actual machining power should be less than maximum output power of the machine tool, as shown in Constraint (21), where \(P_{Max}\) denotes the maximum spindle power and \(\eta\) denotes the power effective coefficient. The tool life needs to be greater than minimum tool life \(T_{tool}^{Min}\), as shown in Constraint (22). To ensure the product quality, surface roughness \(R_{a}\) should be less than the maximum surface roughness \(R_{Max}\), as shown in Constraint (23), where \(r_{g}\) denotes the nose radius.

  • NSGA-II algorithm for multi-objective optimization

There are many algorithms for solving complex multi-objective optimization problems, e.g. genetic algorithm (GA) [40], harmony search algorithm (HS) [41] and particle swarm algorithm [42]. In this section, NSGA-II is adopted to solve the proposed problem, which is an multi-objective evolutionary algorithm (MOEA). It is characterized by the followings: the fast non-dominated sorting operator greatly decreases the computation complexity; the crowding distance mechanism maintains the population diversity; and the elitism selection strategy can make the superior individuals not be discarded during evolution, and improve robustness of the algorithm. The procedure of NSGA-II is executed according to Fig. 4 as follows.

Fig. 4
figure 4

The procedure of NSGA-II

  • Step 1: The population of size \(N\) is randomly initialized.

  • Step 2: The first-generation population can be generated by performing the fast non-dominated sorting and three genetic operators, namely selection, crossover and mutation.

  • Step 3: Combining offspring populations with parent populations, then performing the fast non-dominated sorting and calculating the crowding distance.

  • Step 4: Optimal individuals can be found by using elitism selection strategy.

  • Step 5: When the size of new parent population reaches \(N\), the iteration will be stopped, and a new child population can be obtained.

4.2.2 Dynamic Re-optimization Based on Virtual-Physical Interaction

Although NSGA-II effectively optimizes the cutting parameters, the process of optimization is carried out based on certain machining conditions. In fact, the actual machining conditions are dynamically changing, which will lead to the deviation between the actual and expected machining state, such as poor machining quality and tool vibration. Hence the initial cutting parameters may not be applicable or optimal for the current machining. It is essential to re-optimize cutting parameters according to the actual machining data. In view of the above problems, dynamic cutting parameter optimization method based on virtual-physical interaction is proposed, as shown in Fig. 5.

Fig. 5
figure 5

The flow chart of dynamic cutting parameter optimization based on virtual-physical interaction

During the machining, the simulation model of the virtual space synchronously simulates the machining behaviors of the CNC machine tool driven by the sensing data from the physical space. At the same time, the simulation model analyzes whether the simulation results are consistent with the desired. If the current machining state does not meet the expectation, for example, cutting force fluctuation, optimization model should be adjusted according to sensing data, and the intelligent algorithms such as NSGA-II or others can be used to re-optimize cutting parameters. Then the optimization results will be verified in the simulation model to confirm whether the actual machining requirements are met. Hereafter the updated machining plan, i.e. NC program, will be transferred to the physical machine to guide the remaining production. During the machining, the simulation and optimization process will be continuously performed through virtual-physical closed loop until the whole machining task is completed.

In the rough milling, the cutting force usually fluctuates with the change of the difference of cutting depths and materials, which may cause machine tool chatter and cutting tool breakage. It is an effective and efficient method for the issues with the dynamically optimized cutting parameters in light of different cutting conditions. In the rough milling, the feedrate has a greater influence on the cutting force than the spindle speed [21]. In addition, among the main cutting parameter variables, feedrate is the easiest to manage and control, so it is usually selected as the variable to adjust the cutting force [43]. Therefore, an example of re-optimizing the feedrate with the real-time sensing data (spindle power, spindle speed, feedrate, axis positions, etc.) to further illustrate the implementation process of this method. The optimization method is as follows.

  1. (1)

    The cutting force model

Many experiments and empirical models show that cutting force \(F_{C}\)(N) can be modeled using spindle power, as shown in Eqs. (24)-(27) [21].

$$T_{s} = \frac{{60000P_{m} }}{2\pi n}$$
(24)
$$F_{t} = \frac{{2T_{s} }}{D}$$
(25)
$$F_{th} = 0.5 \times F_{t}$$
(26)
$$F_{C} = \sqrt {F_{t}^{2} + F_{th}^{2} }$$
(27)

where \(T_{s}\)(N \(\cdot\) m) is the cutting torque,\(P_{m}\)(W) denotes the spindle power,\(n\)(r/min) denotes the spindle speed,\(F_{t}\)(N) denotes the tangential cutting force,\(D\)(mm) denotes the diameter of cutting tool and \(F_{th}\)(N) denotes the thrust cutting force.

  1. (2)

    The feedrate optimization model

According to Eq. (16), for a specific machining operation, the relationship between cutting force and feedrate is approximately proportional under given other parameters, i.e.\(F_{C} = K \times V_{f}^{{y_{F} }}\), where \(K\) is proportionality coefficient. Hence the optimized feedrate can be determined by Eq. (28).

$$V_{f}^{^{\prime}} = \max \left\{ {V \, \left| { \, v(k) = l(k) \times V_{f} \times \left( {\frac{{F_{C}^{e} }}{{F_{C} }}} \right)^{{ - y_{F} }} \in S,k = 1,2,3,4,...} \right.} \right\}$$
(28)

where \(V_{f}\)(mm/min)and \(V_{f}^{^{\prime}}\)(mm/min)respectively denote feedrates before and after optimization.\(F_{C}\)(N) and \(F_{C}^{e}\)(N) respectively denote the original cutting force and the expected cutting force after optimization.\(y_{F}\) is the cutting force coefficient.\(l \in\)[0.5, 1.5] is the optimization capability factor generated randomly with iteration number \(k\),\(S\) represents the feasible region satisfied to Constraints (18)–(23).

Besides, real-time data is collected by sensors at a certain sampling frequency during the machining process, so different amounts of data can be collected for each row of NC program. We assume that there is a segment of NC program with \(N\) rows. For the i-th row, the original feedrate \(V_{f} (i)\) and cutting force \(F_{C} (i)\) can be calculated as shown in Eqs. (29)-(30).

$$\begin{array}{*{20}c} {V_{f} (i) = \frac{1}{{N_{i} }}\sum\limits_{j = 1}^{{N_{i} }} {V_{f} (i,j)} } & {} \\ \end{array}$$
(29)
$$F_{C} (i) = \frac{1}{{N_{i} }}\sum\limits_{j = 1}^{{N_{i} }} {F_{C} (i,j)}$$
(30)

where \(i \in\)[1, N],\(N_{i}\) denotes the data collecting times for the i-th row,\(V_{f} (i,j)\) and \(F_{C} (i,j)\) represent the j-th values of feedrate and cutting force in the i-th row, respectively.\(F_{C}^{e}\) can be represented by Eq. (31).

$$F_{C}^{e} = \frac{{\sum\limits_{{i = 1}}^{N} {\sum\limits_{{j = 1}}^{{N_{i} }} {f(i,j)} } }}{{\sum\limits_{{i = 1}}^{N} {\sum\limits_{{j = 1}}^{{N_{i} }} {n(i,j)} } }}{\mkern 1mu} \;{{where}}\;_{{{{n}}({{i}},{{j}}){\text{ = }}\left\{ {\begin{array}{*{20}c} {1,}\, {{{if}}{\mkern 1mu} {{F}}_{{{C}}} ({{i}},{{j}}) gt; {{F}}_{{{C}}} ({{i}})} \\ {0,}\, {{{if}}{\mkern 1mu} {{F}}_{{{C}}} ({{i}},{{j}}) \le {{F}}_{{{C}}} ({{i}})} \\ \end{array} } \right.}}^{{{{f}}({{i}},{{j}}){{ = }}\left\{ {\begin{array}{*{20}c} {{{F}}_{{{C}}} ({{i}},{{j}}){\mkern 1mu} ,} {{\mkern 1mu} \,{{if}}\, {\mkern 1mu} {{F}}_{{{C}}} ({{i}},{{j}}) gt; {{F}}_{{{C}}} ({{i}})} \\ {0,}\, {{{if}}\, {\mkern 1mu} {{F}}_{{{C}}} ({t{i}},{{j}}) \le {{F}}_{{{C}}} ({{i}})} \\ \end{array} } \right.}}$$
(31)

5 Case Study

To validate this method, a milling process is tested on a CNC milling machine with cemented carbide cutting tool and S45C carbon steel workblank. The specifications of the machine tool are shown in Table 4. The workpiece consists of nine grooves with varying length and cutting depth, as shown in Table 5. More parameters for process optimization, such as carbon emission factors, cutting force coefficients and tool life coefficients, can be obtained from process manuals and stored in the ontology model. Note that this experiment stipulates that the expected value of the variance of the cutting force data is less than 10^3.

Table 4 Specifications of the milling machine
Table 5 Specifications of the workpiece

The 3D simulation model in the virtual space is shown in Fig. 6. In this model, the optimization and simulation process of the CNC machining can be achieved.

Fig. 6
figure 6

The 3D simulation model in the virtual space

5.1 Validation of Initial Optimization

Firstly, the problem is solved by using NSGA-II to obtain initial optimal solution of cutting parameters. The initial parameters of the algorithm are set as shown in Table 6. After optimization, the optimal cutting parameters (\(n\),\(V_{f}\)) are obtained, which are 919 r/min, 441 mm/min. And the objective values (\(PT_{P}\),\(CE_{P}\)) are 95.235 s and 0.0671 kgCO2. The change processes of processing time and carbon emissions are shown in Fig. 7.

Table 6 The initial parameters of NSGA-II
Fig. 7
figure 7

The change processes of a processing time and b carbon emissions

Then, the milling process is performed with the above process plan, i.e.\(n\) = 919 r/min,\(V_{f}\) = 441 mm/min. During the machining process, real-time sensing data, mainly including time, NC program row number, spindle power, spindle speed, feedrate, cutting depth and axis positions, is collected with a sampling period of 100 ms. The spindle power is collected by the power sensor, other data can be obtained from the CNC system. Then the sensing data is semantically parsed through the ontology model using Jena tools. The process of ontology parsing is shown in Fig. 8. The parsed data will be transmitted to the twin model. Next, the virtual machine tool will simulate the machining behaviors of the physical machine. The waveforms of cutting depth, the spindle power collected by sensor and the cutting force calculated by Eqs. (24)–(27) are shown in Fig. 9. It can be found that the spindle power and cutting force fluctuate significantly during the milling, and their fluctuation is almost the same as the variation of cutting depth. And the variance of cutting force data is 7983.2, which is much larger than the expected value (< 10^3). Therefore, it is essential to re-optimize the feedrate.

Fig. 8
figure 8

The process of ontology parsing

Fig.9
figure 9

The waveforms of a cutting depth, b spindle power and c cutting force

5.2 Validation of Dynamic Re-optimization

The method described in Sect. 4.2.2 is used to re-optimize the feedrate, and the spindle speed is fixed after the initial optimization of NSGA-II. The optimization results are verified in the virtual machine tool. The comparison of feedrate is shown in Fig. 10. It shows that the original feedrate is relatively stable. The optimized feedrate is no longer constant. Instead, it varies with cutting depth to maintain a more constant cutting force. Most of the feedrate values are higher than the original values, which provides the potential of saving machining time. Then the ontology model parses the new process plan, which will be sent back to the physical machine to guide the next milling.

Fig. 10
figure 10

The comparison of feedrate

Next, the same milling process is performed using updated NC program, and real-time data such as spindle power is collected again in the new process. The comparison of before and after optimization for spindle power and cutting force are shown in Fig. 11. It shows that the spindle power is relatively stable, and the fluctuation of the cutting force decreases after optimization, which proves the feasibility of proposed method.

Fig. 11
figure 11

The comparison of a spindle power, and b cutting force

5.3 Results and Discussion

The statistical analysis was conducted on the data before and after optimization, as shown in Table 7, where the original data comes from the initial machining process, and the optimized data can be obtained during the milling process using re-optimized cutting parameters.

Table 7 A comparison of statistical data

Compared with original cutting forces, the ratio of maximum to minimum is smaller, the average is larger, and the variance is much smaller for cutting force after optimization. The result indicates that the optimized cutting force is more smooth, which can avoid excessive deformation and unexpected vibration for machines, and the performances of machining equipment are protected.

In addition, for processing time \(PT_{P}\) and carbon emissions \(CE_{P}\), the values of the optimized two objective functions are reduced by 5.84% and 6.1% respectively, i.e. improving the machining efficiency and reducing carbon emissions, which further proves the feasibility of the method.

In short, the proposed method dynamically optimized the cutting federate according to the machining conditions. Hence the method can obtain more accurate and reasonable cutting parameters by continuous simulation and optimization of the virtual twin driven by the real-time sensing data from physical machine tool.

6 Conclusions

Nowadays, low carbon manufacturing has become a trend in modern manufacturing. Cutting parameter optimization is one of effective ways to reduce carbon emissions for manufacturing industry. Digital twin brings about a novel methodology for dynamically optimizing the cutting parameters according to the real-time sensing data in the process of machining. A dynamic cutting parameter optimization method for low carbon and high efficiency based on digital twin is proposed. Compared with traditional static optimization methods, this method can dynamically find optimal cutting parameters in light of the real-time sensing data of the machining conditions. The case study shows that the method can reduce the processing time by 5.84% and carbon emissions by 6.1%. The main contributions of this work are as follows:

  1. (1)

    The architecture of digital twin of a CNC machine tool for cutting parameter optimization is presented, which describes the operation process of the proposed method.

  2. (2)

    The ontology on CNC machining process is established for realizing real-time semantic understanding between physical machine tool and virtual twin model.

  3. (3)

    A dynamic optimization method of cutting parameters based on dynamic perception of physical machining conditions and synchronous simulation of virtual twin model is proposed.

This research has realized the application of digital twin to the problem of cutting parameter optimization. However, this study still has limitations, mainly including the smart perception of machining conditions and the continuous evolution of optimization model driven by sensing data. In the case study, cutting parameters are dynamically optimized based on real-time sensing data for the smoothness of the cutting force, without considering other machining factors such as surface roughness, accuracy, tool life, etc. In the future, the real-time perception of the whole CNC machining conditions based on multi-sensor fusion technology will be further studied. And more research is needed for dynamic evolution of the twin model driven by data fusion and intelligent algorithm to enhance the accuracy of cutting parameter optimization and to obtain better machining performance.