Temperature Sensing and Two-stage Integrated Modeling of the Thermal Error for a Computer-numerical Control Swiss-type Turning Center

For tool machinery, the most crucial factor affecting the machining precision is thermal deformation. Thus far, the most popular method of reducing thermal deformation has been considered as the compensation method, and many mathematical compensation methods have been proposed. However, attempts to develop a more comprehensive model are continuing. To improve the prediction accuracy, in this study, we propose a two-stage integrated data-mining scheme. The first stage, using rough set theory, focuses on how to manipulate the measured problem-dependent temperature and deformation data. The second stage, using a deep-learning neural network scheme, models the relationship between the temperature increase and the thermal error. Comparisons of the proposed method with other methods are also made. Results show that marked improvements are obtained using our proposed integrated data mining scheme.


Introduction
The machining precision directly affects the dimensional accuracy of workpieces.The issue of how to eliminate the machining error has continuously drawn much attention from scholars and engineers attempting to develop precision machine tools.The machining error mainly originates from the mechanism kinematics, thermal deformation, machining, structure dynamics, controller inaccuracy, and deviation from the control rules.Among these factors, thermal deformation has the largest contribution and may reach a value as high as 75% of the total error. (1)here are two sources of thermal deformation in a machine tool, internal and external, which may induce a temperature rise and thermal deformation.The internal heat sources include heat generation from the cutting process, heat generation from friction during motion, and heat generation from electronic systems and motors.The external heat sources include environmental temperature changes and human body radiation.Through the propagation of conduction, convection, and radiation, the generated heat affects all the components of the structure and causes an undesired thermal error.The thermal error of a Swiss-type turning center (see Fig. 1) may be considered as the position error of the tip of the tool clamped in the turret relative to the center of the workpiece clamped in the first (major) or second spindle system.Table 1 shows the details of the thermal sources and errors for a computer-numerical control (CNC) turning center.
In general, there are three ways of reducing the thermal error of a machine tool: designing a thermally stable structure, reducing heat sources, and compensating the thermal error.Reducing the heat sources has become a mature method and this concept has been widely used in manufacturing machine tools.In the design of thermally robust structures, there is a limit to the accuracy that can be achieved.Thus far, thermal error compensation has been successful because it is easy to implement and cost-effective.The procedure used to perform thermal error compensation is as follows: (1) selection of the target machine, (2) determination of the test and verification conditions, (3) determination of the key thermal points for temperature measurement, (4) setting up of temperature-and displacement-sensing systems, (5) data reduction, (6) thermal error modeling, and (7) model verification.
In the above procedure, the main difficulty lies in the data reduction and thereafter the thermal error modeling.Many papers have used different mathematical relationships to build thermal error models of machine tools or their key modules.For example, Du et al. (2) used a modified regression method to build a thermal error model of a machining center.Kim and Park (3) proposed a difference-equation-based state space model for the two axes of a CNC lathe.Moreover, methods based on an artificial neural network (ANN) (4) and PSO combined with an ANN (5) have been reported as means of dealing with the problem of thermal error modeling.Recently, to enhance model accuracy, the concept of data preprocessing has been added.Liu et al. (6) used a linear regression model, incorporating fuzzy clustering and grey relation, which was used for data preprocessing.Wang and Tseng (7) built a linear regression model that employed the rough set theory (RST) for data preprocessing for a vertical machining center.Wang (8) used an ANN auxiliary with grey system theory for data preprocessing for a doublecolumn machining center.It was found that the two-stage thermal error modeling methods (one scheme for data preprocessing and one scheme for building a mathematical relationship) can be comprehensively used.Moreover, past literature surveys (1)(2)(3)(7)(8)(9) showed that different machine structures lead to different thermal behaviors, in which they required more appropriate and accurate thermal error modeling schemes. Thusfar, there have been no publications about the studies of thermal error compensation for a CNC Swiss-type machining center, which has a main spindle system structure considerably different from that of a traditional CNC lathe.In the main spindle system, bar-type workpieces are fed from its left-hand side and come out from the right spindle hole.This complicated system generates heat in usual ways and thus its thermal behavior needs an appropriate thermal error modelling scheme.
Regarding the above discussions, the aim of this study is to build a thermal error model for a Swiss-type machining center.We intend first to carefully study this machine's thermal behavior.Then, we develop a proper measuring method and a measurement system.A suitable integrated two-stage thermal modeling scheme, including the RST and deep-learning neural network methods, is used to establish a comprehensive mathematical relationship.The modeling results are thereafter verified by specifically designed experiments.

Methodology
The methodology used for thermal error modeling is shown in Fig. 2. The key thermal points on the machine were chosen by considering the heat sources in the machine under operation.The measured temperature at the key thermal points and the displacement of the two spindle noses were accumulated and grouped using RST. (10)The grouping results provide the relatively important temperature variables for the main and second spindle systems.Then, we used a deep-learning neural network scheme (11) to establish a thermal error model based on the grouping results, which includes a reduced number of temperature variables and the corresponding thermal deformation for each spindle system.

Measurement system and test conditions
The sensing units were composed of thermal and displacement sensors.Resistance thermometers (PT100) were employed as temperature sensors to detect the temperature variation of the key thermal points on the machine, and eddy current displacement sensors were used to detect the thermal errors of the first and second spindles.The key thermal points for the temperature measurements should be carefully chosen since the number of temperature sensors and their location strongly affect the accuracy of the thermal error modeling and compensation results.In general, the selected key thermal points should be (1) close to the main heat sources, (2) capable of reflecting the temperature field of the system, and (3) strongly related to the thermal error. (12)On the basis of these suggestions, 12 thermal sensors were stamped at the selected key points, as listed in Table 2 and shown in Fig. 3.In addition, an invar rod was mounted on the first and second spindles.Also, to detect the deformation of the first spindle, an eddy current displacement sensor was mounted on a fixture connected to the upper turret.Similarly, another eddy current displacement sensor was mounted on another fixture connected to the lower turret to detect the deformation of the second spindle.

Test conditions
To investigate the thermal behavior of our target two-spindle, two-turret CNC turn-mill machining center, the test conditions used for modeling and verification were designed to simulate real cutting cases and are given in Tables 3 and 4, respectively.

Measurement of temperature and thermal deformation
The temperature and capacitance sensors were integrated into one system so as to retrieve the temperature and deformation readings synchronically.The variation of the measured temperature with time at different sensors on the target machine is shown in Figs.4(a) and 4(b).It was found that the temperature of the machine ranges from 26 (room temperature) to 62 ℃.The temperature variation with time changes among the key thermal points.Moreover, the variation of the thermal drift of the spindles in the axial direction is shown in Fig. 5.The MX1 curve represents the measured thermal drift with time for the first spindle system, which reaches a maximum of 46 μm after 15 min of operation.Similarly, the MX2 curve represents the measured thermal drift with time for the second spindle system, which reaches a maximum of −48 μm after 15 min (slightly larger than that of MX1).

Stage 1: Data trimming
The measured temperature and deformation data are trimmed by RST, which is an effective scheme developed in the field of data mining.Since Pawlak proposed the RST in 1982, (10) this theory has been well studied by many researchers, resulting in major advances. (13,14)The following is a brief introduction of RST used in this study.

Information systems
In RST, information systems are used to represent knowledge.An information system ( ) , S U A = consists of the following: U-a nonempty, finite set called the universe; A-a nonempty, finite set of attributes; A C D = ∪ , in which C is a finite set of condition attributes and D is a finite set of decision attributes (see Table 5).
The universe includes many objects.Objects can be interpreted as cases, states, processes, patients, and observations.Attributes can be interpreted as features, variables, and characteristic conditions.A simple information system is shown in Table 5, in which Ni = N1 -N5 represent the objects of the universe (U = {Ni}),

Reducts and core
An important process in RST is attribute reduction.Attribute reduction should be carried out in such a way that the reduced set of attributes provides the same quality of approximation as the original set.Reducts and the core are two fundamental concepts related to attribute reduction.The minimal subsets of attributes that discern all equivalence classes of the relation D discernable by the entire set of attributes are called reducts.The core is the common part of all reducts.To find the core of an information system, the discernibility matrix and discernibility function should be constructed.
First, the discernibility matrix where i, j = 1, 2, …, n, and n denotes the number of objects in U. To calculate the elements m ij , one must find the set of attributes that discern the objects Ni and Nj and those that do not belong to the same equivalence class of D.
The overall rule can be written as 2 3 , X X Y ∧ → which implies that the decision attribute (Y) only depends on the two core attributes of X 2 and X 3 .
Using Eq. ( 1), the discernibility matrix corresponding to the sample database shown in Table 5 with U = {N1, N2, N3, N4, N5}, C = { 1 2 3 , , X X X }, D = {Y} is obtained and shown in Table 6.For instance, when discerning the sets between the sets N1 and N3, the result , m X X = is obtained.This means that with regard to decision Y, object N1 (Y = 1) differs from object N3 (Y = 0) in attributes X 1 and X 2 .When discerning the sets between N3 and N5, the result is obtained.This is because the attribute X 2 alone is sufficient for distinguishing between N3 (Y = 0) and N5 (Y = 1).
Secondly, the discernibility function can be constructed via the discernibility matrix.

The discernibility function ( )
f A is a Boolean function constructed as follows.
(1) To each element, a Boolean variable 'X' is assigned (e.g., (2) for each element m ij , the Boolean form of the union operation is assigned [(e.g., 1 2 X X ∨ (the union of X 1 and X 2 )]; (3) for different elements, the Boolean form of the intersection operation is assigned [(e.g., 1 2 X X ∧ (the intersection of X 1 and X 2 )].Accordingly, the discernibility function of all the data in Table 6 can be constructed as Finally, to calculate the final form of f(A), the absorption law is applied.The absorption law can be defined as the minimal absorbent construction for a given tolerance information system, which can be easily transformed to the problem of finding the minimal prime implicant for the Boolean function corresponding to this system.According to the absorption law, for instance, to discern the sets among N1, N3, and N5, when are obtained, the discernibility function f(A) can be further expressed and reduced to the form , and one final reduct X 2 of the considered set of attributes is found.Moreover, by applying the absorption law to Eq. ( 2) for all the data in Table 6, the final two cores are obtained as (see Table 6).We can represent our system and rules as in Table 7.
The data analysis through the decision rule of the RST can display the knowledge rule of the thermal error of a machine tool.In addition, the core factors can be found.

Cores:
The two cores of this database are The overall rule can be written as 2 3 X X Y ∧ → , which means that the decision attribute (Y) only depends on two core attributes of X 2 and X 3 .
In this study, X i denotes the temperature at different key points, X i = Ti, i = 1 -12; Y denotes MX1 or MX2.Following the procedures of the above-mentioned discernibility matrix method, we obtain the two overall rules Table 6 Discernibility matrix M corresponding to the sample database shown in Table 1.
Findings of core and decision rules.
It is found that the obtained influence rules are the same for both MX1 and MX2.Using these high-weighting temperature parameters, a mathematical relationship may be derived between the temperature at key points and axial deformation in a simple manner since the number of condition parameters (Ti) is reduced.

Stage 2: Mathematical relationship
Using the resultant rules obtained from RST, we can neglect the effects of T7, T10, T11, and T12 on both MX1 and MX2.Then, a mathematical relationship between temperatures and thermal drifts is established via a deep-learning neural network, described as follows.
A convolutional neural network (CNN) is a state-of-the-art comprehensive network of DNNs, capable of mapping multiple outputs with multiple inputs in modeling problems.This technique was developed in the 1980s and 1990s. (15)Since 2012, when it was dramatically revived, this technique has conquered most computer vision fields and is growing rapidly.A CNN consists of a neural network that extracts features of the input image and another neural network that classifies the feature image.The fundamentals of a CNN are as follows.
The simplest neural network is called a multilayer perception (MLP).The nth layer of an MLP can be expressed as .
Many different functions such as step functions, the sigmoid function, and the hyperbolic tangent, can be chosen.Here, we adopt a rectified linear unit (ReLU).The ReLU function is defined as the positive component of its input as follows: Re 0 : 0 ( ) 0 : It was discovered that even a single hidden layer is sufficient for an MLP to express any continuous function with arbitrary precision (universal approximation theorem).However, the construction of such a neural network is still based on trial and error.Expressing complicated functions is rather expensive for a two-layer MLP since a hidden layer requires a very large number of neurons.Instead, DNN researchers have used networks with multiple narrow layers.The trade-off and challenge in DNNs lie in how to tune them to solve a given problem.A CNN adopts a machine learning algorithm that consists of a set of rules for using and updating a set of parameters (i.e., tuning weights) in accordance with the labeled data provided to it.Moreover, the learning type of the CNN in this study is chosen as reinforcement learning, which is related to supervised learning but decouples the form of the training outputs from that of the inference output.The output of reinforcement learning is called an action, and the label for each training input is called a reward.
Training phase , x r M → Inference phase ( ) A model infers some output action from its input, the action produces some reward from an external system, and then the initial input and subsequent reward are used to update the model.Furthermore, it is difficult to decide the initial distribution of random values of model parameters.It is suggested that these values should be small and random.Here, we chose the cross-entropy loss function to evaluate the difference between the true and estimated outputs.
This loss function is chosen for its capability of dealing with the relationship between multiple inputs and multiple outputs.Finally, to adjust the model weights to minimize the loss function, we use the stochastic gradient descent (SGD) method in conjunction with the backpropagation technique to complete the training of the model.A CNN is similar to a large MLP in which many of the weights in a layer are tied together in a specific pattern.In the training, when a gradient update is applied to one of these weights, it is applied to all of them.Second, using the above nine relatively important temperature rises as the input and the three grinding head deformations as the output, we construct a CNN.This CNN has five layers: one input layer, one convolution layer (twelve neurons), one pooling layer, one hidden layer (eight neurons), and one output layer (two neurons).Only three layers, the convolution, hidden, and output layers, contain weight matrices that require training.Through the training, the weights of the neurons in each layer are determined.We trained our model using the SGD with a batch size of 100 examples, a momentum of 0.79, and a weight decay of 0.0007.We initialized the weights in each required layer using a Gaussian distribution with zero mean and a standard deviation of 0.01.We used an equal learning rate (initialized at 0.01) for all required layers.The typical architecture of the CNN is shown in Fig. 6.
The results obtained after training are expressed in the form of a prediction curve of the thermal error.Figure 5 shows a comparison between the measured (MX1, MX2) and predicted (EX1, EX2) results.It can be seen that the maximum original measured thermal errors are 46 and −48 μm.Moreover, after compensation with our CNN prediction model, the maximum thermal errors are reduced to 0.3 and −0.5 μm, corresponding to reductions of 99.3% and 98.9%, respectively.

Verification
To verify our proposed new thermal error modelling methodology, we now perform another experiment.The new test condition is arranged according to some actual cutting conditions, as shown in Table 8.We measure the temperature variations only at the reduced number of key points, i.e., T1, T2, T3, T4, T5, T6, and T8, and neglect the other five temperatures (T7, T9, T10, T11, and T12).The temperature measurement results are shown in Fig. 7.The thermal errors at the first and second spindle noses are also measured, and the results are shown in Fig. 8. Figure 8 also shows a comparison between the measured and predicted thermal errors for the first and second spindle systems with the new test conditions.It is seen that the maximum measured thermal errors are 49.1 and 51.3 μm at the first and second spindle noses, respectively.Moreover, after compensation with our prediction model, the maximum thermal errors can be reduced to 0.35 and -0.52 μm, corresponding to reductions of 99.28% and 98.98%, respectively.The comparison thus shows satisfying results.

Conclusion
The two-stage thermal error modeling of a CNC Swiss-type turning center has been performed in this study.The new proposed modeling technique includes a data mining scheme based on a rough set theory to reduce the number of key points where the temperature must be monitored and a deep-learning neural network to accurately establish the mathematical relationship between variations in the temperature and deformation.The results for the predicted thermal errors are accurate.The thermal errors after compensation are 0.45 and −0.5 μm for the first and second spindle noses, respectively, in the verification experiment.In this study, we explored the thermal behavior of a specific target, a CNC Swiss-type turning center, and established an accurate and efficient two-stage modeling scheme that may be extensively applied to the thermal error modeling problems for a wide range of CNC machine tools.

Fig. 7 .
Fig. 7. Temperature variation at reduced numbers of key points in the new experiment.

Fig. 8 .
Fig. 8. (Color online) Measured (MX1, MX2) and predicted (EX1, EX2) thermal deformations with time for the first and second spindle systems with the new test conditions.

Table 1
Thermal error and heat sources of a CNC turning center.

Table 2
Locations of key temperature sensors.

Table 3
Test conditions for modelling.

Table 4
Test conditions for verification.

Table 5
Information table of a sample database.

Table 8
New test conditions.