Thermal Error Modeling of the CNC Machine Tool Based on Data Fusion Method of Kalman Filter

This paper presents a modeling methodology for the thermal error of machine tool. The temperatures predicted by modified lumped-mass method and the temperatures measured by sensors are fused by the data fusion method of Kalman filter. The fused temperatures, instead of the measured temperatures used in traditional methods, are applied to predict the thermal error. The genetic algorithm is implemented to optimize the parameters in modified lumped-mass method and the covariances in Kalman filter. The simulations indicate that the proposed method performs much better compared with the traditional method of MRA, in terms of prediction accuracy and robustness under a variety of operating conditions. A compensation system is developed based on the controlling system of Siemens 840D. Validated by the compensation experiment, the thermal error after compensation has been reduced dramatically.


Introduction
With the increasing demand of high precision machining, thermal error accounts for an increasingly important part among all error sources of machine tools.The manufacturing industry is going through great challenges in thermal error management.More requirements, such as environment temperature controlling and compulsive warm-up stage before processing, have been proposed by the machine tool builders to avoid the influence of thermal error.Though the thermal error could be reduced to some extent, these methods have the disadvantages of high cost and low efficiency [1].As a result, more thermal error management techniques, such as identification and modeling, have been developed to decrease the thermal errors more economically and efficiently.
Nowadays, thermal error compensation and structure optimization are two main approaches for the thermal error management.The different approaches apply different modeling techniques: empirical-based modeling method and principle-based modeling method [2].The empirical-based modeling method aims at thermal error compensation.The prediction models are established by statistical methods, such as regression [3,4] and neural network [5,6].The dependent variables of the models are the thermal-induced displacements.The independent variables are the discrete temperatures and operating parameters related to temperatures.The measurement experiment is essential before modeling.As a result, the measurement accuracy and reliability of the temperatures and thermal-induced displacements are of great importance to the prediction accuracy and stability of the model.If the temperature sensors break down, the compensation system with empirical-based models will be out of order, which may cause potential safety problems.In addition, as the statistical model could not reflect the mechanisms in thermal error generation, the prediction accuracy and robustness of the empirical-based models are limited.
The principle-based modeling method is mainly used to optimize the structure of the machine tool.Utilizing the basic laws of heat transfer and stress-strain, the temperature field and thermal deformation are calculated.The principlebased modeling method could be further classified into two categories, the finite element method (FEM) [7] and lumpedmass method [8].At present, the FEM is mostly conducted on the reliable commercial software, such as ANSYS and PATRAN.The nodes and elements in FEM are refined but large in quantity.As the calculation amount depends on the number of nodes and elements, the FEM is time consuming and requires the hardware with high performance.This disadvantage constrains the application of FEM in the real-time error compensation.The lumped-masses in the lumped-mass method could be considered as the alternation of the nodes and elements in FEM.However, the number of lumpedmasses is much smaller.The decrease in the calculation amount makes it available to develop a principle-based model to compensate the thermal error.
The difficulty in the lumped-mass method is how to evaluate the parameters, such as the convection coefficient and lumped-mass.Several researchers [9,10] used the modified lumped-mass method to forecast the real-time temperatures of a ball screw system.Influence coefficients are used to compensate the deviations in parameter evaluation.Validated by experiments, the modified lumped-mass method achieved comparable prediction accuracy with the FEM.
In this paper, a novel modeling method is developed based on the data fusion method of Kalman filter.The fused variables are the temperatures from the modified lumpedmass method and measurement.In order to achieve the optimal fitting accuracy, the parameters in modified lumpedmass method and covariances in Kalman filter are optimized by the genetic algorithm.The fused temperatures are further used to forecast the thermal error based on regression analysis.The proposed model in this paper could be considered as an integrated model of empirical-based model and principlebased model.The application of data fusion is aimed at taking the advantages of these two models.Considering the low prediction accuracy and weak robustness of the empiricalbased models, the application of principle-based models into the thermal error compensation is a difficult, but meaningful work.In addition, the proposed method provides a more effective way for the compensation system to operate properly, even when the temperature sensors do not work.
In order to validate the performance of the proposed model, several measurement experiments are conducted on a heavy-duty floor-type milling and boring machine tool.Compared with traditional method without data fusion, the proposed model achieves much better prediction accuracy and robustness.Finally, a compensation system based on the controlling system of Siemens 840D has been developed to compensate the thermal errors in real-time.

Measurement Experiment
The measurement experiment is the preliminary work of thermal error modeling.The experiments under a variety of operating conditions are conducted on a heavy-duty floortype milling and boring machine tool.The enclosed design of the ram in this machine tool results in high temperature inside the ram.The amount of thermal expansion is related to dimensions of the component.The ram of the heavy-duty machine tool is usually in large scale, which raises the thermal error to submillimeter range.This paper aims to predict the thermal errors of the ram.
There are two heat sources inside the ram, spindle motor and hydraulic bearing.Two PT100 temperature sensors are used to detect the temperatures around the heat sources as shown in Figure 1.The temperature measuring point of spindle motor is located in front of the spindle motor, next to the coolant outlet.The measuring point of hydrostatic bearing is located inside the oil-returning slot of the bearing.In order to ensure the measurement accuracy and installation stability, both sensors are imbedded into the ram during the assembling stage of the machine tool.Another temperature sensor is used to detect the environment temperature.But in fact, the variation of environment temperature is quite small, and the variation range is within 0.2 ∘ C as shown in Figure 2. The thermal error of the ram is mainly affected by the two heat sources.
The thermal errors are measured by laser CCD of KEYENCE LK-H02 and MIIYI ILD1700.The measurement uncertainty of the displacement is 0.5 m.As thermal errors are usually related to the relative displacement between the workpiece and the tool, the displacement sensors are fixed on the working table of the machine tools to measure the relative distance changes between the sensors and the spindle of the machine tool.The measuring point (see Figure 3(a)) of thermal error in -axis is located at the spindle nose.The measuring points (see Figures 3(a spindle close to the spindle nose.The thermal errors of an experiment under variable rotating speed are shown in Figure 3(d).It could be easily found that the thermal error in -axis is much larger than those in -axis and -axis.As a result, the proposed model in this paper is focused on the thermal error in -axis.The thermal errors in the other two axes could be predicted as the similar way.
There is a second-level decelerator inside the ram.The reduction ratio for the rotating speed over 750 RPM is 464/ 3796.And the reduction ratio for the rotating speed below 750 RPM is 1102/2263.The different reduction ratios lead to the different correlations between the heat powers of spindle motor and hydraulic bearing.

Modified Lumped-Mass Method.
For the modified lumped-mass model, the temperature of a typical lumpedmass is calculated as where  conv is the convection heat. cond is the conduction heat. gene is the generation heat. is the influence coefficient to compensate the evaluation deviation of each term. and  are the mass and heat capacity of the lumped-mass.The temperatures of two measuring points inside the tested machine tool could be predicted as where    and    are the temperatures of the measured point and environment at th time.ℎ is the convection coefficient. is the convection area.  and   are the generation heats of spindle motor and hydrostatic bearing, and both of them are proportional to the rotating speed: where  is the heat generation coefficient and  is the reduction ratio.Equation ( 2) could be represented as where As long as the rotating speed and the environment temperature are provided in real-time, the temperatures of two inner measuring points could be predicted as (4).

Data Fusion of Kalman Filter.
Besides the predicted temperatures, the sensors are used to measure the temperatures in real-time.Data fusion is conducted to calculate fused values of the predicted and measured temperatures.Due to the requirement of low computation complexity for the compensation model, Kalman filter is implemented for data fusion [11,12].
The Kalman filter algorithm involves two stages: prediction and updating.Based on (4), the equations for the prediction stage are presented as where  =   /Δ/(  /Δ + V 1 ),  = V 1 /(  /Δ + V 1 ), and  = (V 2 + V 3 )//(  /Δ + V 1 ). is the covariance of the process noise.The variables with the subscripts , , and  represent the predicted value, fused value, and measured value, respectively.The equations for the updating stage are presented as where    is the Kalman gain. is the covariance of the measurement noise.The covariances  and , which greatly affect the performance of data fusion, will be optimized by the genetic algorithm.

Regression Analysis of the Thermal Error.
The thermal error is calculated by regression analysis.The independent variables are the temperatures after data fusion.The basic prediction model of the thermal error is CCD in z-axis CCD in y-axis  In order to minimize the prediction deviation, the leastsquares method is conducted to estimate the regression coefficients: in which Δ = [

Optimization of Genetic Algorithm.
The genetic algorithm is one of the intelligent optimization algorithms.Based on the simulation of Darwin's evolution theory, the best individual is survived after iterations.Due to the excellent capability of global search, the genetic algorithm has been widely used in the researches of parameter optimization and identification.
The optimization is conducted in two steps: the optimization of parameters in modified lumped-mass method ] and the optimization of the covariances in Kalman filter  = [ ].These parameters are encoded as floating-point form [13]; namely, a real number of floatingpoint vector is applied to define an individual.Compared with the traditional binary encoding, the floating-point encoding is more appropriate for the individual with several parameters.
The objective function is used to evaluate the fitness of each individual.It is defined as the root mean square value (RMSV) of the prediction deviations.The objective functions for   = [V 1 V 2 V 3 ] and  = [ ] are presented as (12) and ( 13), respectively: The iteration of the genetic algorithm is conducted by the operators of selection, crossover, and mutation.The selection

Environment temperatures
Temperatures prediction based on modified lumped-mass method Eq. ( 5) Data fusion based on Kalman filter Eq. ( 6)-Eq.( 9) Temperatures of the heat sources

Parameters
Selection operator

Floating-point encoding
Crossover operator

Optimization Measurement Modeling
Yes No End of iteration?
For the mutation operator, a variation subject to Gaussian distribution is added to the original variable: where   ∼ (0, 1) and  is a scaling parameter.If the parameters after mutation exceed the upper or lower boundary of the parameter, the mutation process will be repeated again.
The flowchart of the proposed model is presented as Figure 4.The real-time data of temperatures and rotating speed are the inputs of the model.After the optimization of genetic algorithm, the data fusion method of Kalman filter is used to calculate the fused value of predicted temperature and measured temperature.The thermal errors are calculated by the fused temperatures.

Comparisons
In general, the thermal error models could achieve excellent fitting accuracy.However, the prediction deviations will enlarge obviously under different operating conditions.As a result, the prediction accuracy is an important evaluation indicator for the performance of thermal error model.The measured results under variable rotating speed as shown in Figures 2 and 3 are used to optimize the parameters in modified lumped-mass method and the covariances in Kalman filter.The crossing probability and variation probability in genetic algorithm are set as 0.7 and 0.02, respectively.The fitting results of the proposed model are presented as Figure 5.The most common model of multivariate regression analysis (MRA) is used for comparison.In the model of MRA, the measured temperatures are used to calculate the thermal error directly: The maximum residuals (MR) (17) of the proposed model and MRA in Figure 5 are 0.0143 mm and 0.0137 mm, respectively.And the root mean square values (RMSV) (13) of the residuals are 0.0050 mm and 0.0056 mm.Two models achieve comparable accuracies.The fitting performance of them is quite good.In order to evaluate the prediction accuracies under different operating conditions, the results from another two measurement experiments are used for comparisons.One experiment (Case 1) is conducted under the rotating speed of 1300 RPM.And the other one (Case 2) is conducted under variable rotating speed.The prediction accuracies under different operating conditions presented in Figures 6 and  7. Compared with the fitting accuracies (see Figure 5), the prediction accuracies (see Figure 6) of the proposed model and MRA are worse.This reduction in prediction accuracy is quite common in research of thermal error modeling.However, the prediction accuracy of the proposed model has been much improved compared with that of MRA.The increase in MR or RMSV for the proposed model is much smaller than the increase for MRA.Taking Case 1 as an example, the RMSV of the proposed model increase by 0.0032 mm, but the RMSV of MRA increase by 0.0106 mm.As the temperature from the modified lumped-mass method is calculated by the basic laws of heat transfer, the fused temperature could reflect the essences of temperature variation, which results in the improvement in prediction accuracy.
During the measurement, the temperature sensors must be attached onto the surface of the component or be dipped into the oil tank.The measurement results can be affected by the mounting stability.The traditional thermal error models are vulnerable to the measurement errors.Therefore, besides the prediction accuracy, the robustness of the model is considered as another evaluation indicator.In order to evaluate the robustness of the proposed model, the values calculated from sinusoidal function (18) and constant values (19) are added to the measured temperatures of spindle motor.The added values could be regarded as the measurement errors of temperatures.The prediction results of the simulation with measurement errors are shown in Figures 8 and 9.The maximum residuals and root mean square values of the residuals are given in Figure 7. Compared with the results of simulation without measurement errors, the residuals are much larger.Taking Case 2 with sinusoidal errors as an example (Figure 8(b)), the measurement errors induce an increase of RMSV from 0.0100 mm to 0.0156 mm for the proposed model.But the same measurement errors drive the RMSV up to 0.0221 mm for MRA.The residuals of both models present sinusoidal wave forms.The amplitude of the sinusoidal wave in the proposed model is much smaller than that in MRA.Similar results could be achieved in the other three simulations.Therefore, the proposed model could reduce the fluctuation and deviation induced by the measurement errors.
Besides high prediction accuracy and strong robustness, the proposed model could operate even when the temperature sensors cannot work, which is impossible for the traditional thermal error models.After setting the Kalman gain    in (7) as zero, the fused temperatures are all from the modified lumped-mass model.The performance of the simulations without measurement results is presented in Figures 7 and 10.Though the prediction accuracy for Case 2 is not as good as the prediction accuracy after data fusion, a significant proportion of the thermal error could be predicted.If we make   full use of this advantage, it is unnecessary to worry about the sensor faults during the machining process.

Compensation
The aim of modeling is to compensate the thermal error in real-time.In order to meet the real-time performance, the computational complexity of the established model must match the computational capacity of the compensation system.
The computational complexity includes space complexity and time complexity.The space complexity represents the storage space required in the compensation system.The number of variables in ( 5)-( 10) is proportional to the number of   the measured temperatures.As a result, the proposed model has the linear space complexity:  = ().
The time complexity is used to evaluate the time spent in the calculation.The time complexity is calculated based on the amount of calculations.For the proposed model, there is no array operation.The calculations include the basic operations of addition, subtraction, multiplication, and division.As with the space complexity, the time complexity of the proposed method is linear:  = ().
The iteration method of Newton-Raphson method is widely used in FEM.The inverse operation of Hessian matrix, which has a space complexity of  = ( 2 ) and a time complexity of  = ( 3 ), is required in Newton-Raphson method.As a result, the FEM is time consuming and space consuming.Compared with the FEM, the proposed method has much smaller computational complexity.
In this paper, a compensation system is developed on the controlling system of Siemens 840D.temperatures at a previous time, respectively.Utilizing the rotating speed read from NC and the environment temperature measured by PT100 sensors, the temperatures of spindle motor and hydrostatic bearing are predicted by the modified lumped-mass method.In addition, the sensors measure these two temperatures in real-time.A criterion is added in the compensation system to decide whether the sensors have broken down.If there is a sudden change of the measurement value, the Kalman gain will be set as zero.The fused temperatures  The reading of rotating speed and measured temperatures will be triggered by a timer.The timer is set to control the compensation frequency.An experiment with the compensation system is conducted to test the compensation system.The PLC in the experiment will execute the programs every 10 s.The thermal errors before and after compensation are shown in Figure 12(b).The thermal error after compensation has been reduced dramatically.

Conclusions
In this paper, a thermal error modeling method is proposed based on the method of data fusion.The temperature predicted by the modified lumped-mass method and the temperature measured from the PT100 sensors are fused by Kalman filter.With the help of regression analysis, the thermal errors are predicted by the fused temperatures.In order to achieve the optimal prediction accuracy, the parameters of the modified lumped-mass method and the covariances of the Kalman filter are optimized by genetic algorithm.
Validated by the experiments and simulations, the proposed method could achieve better prediction accuracy and robustness compared with the traditional method of MRA.The proposed model could dramatically reduce the fluctuation and deviation induced by the measurement errors.

Figure 1 :
Figure 1: Measuring points of PT100 inside the ram.

Figure 2 :
Figure 2: Variation of the temperatures.
(a) Measurement in -axis and -axis CCD in x-axis (b) Measurement in -axis (c) Data acquisition (d) Thermal error under variable rotating speed

Figure 4 :
Figure 4: Flowchart of the proposed model.
Simulations based on Case 2

Figure 7 :
Figure 7: Performance of the models.

Figure 8 :
Figure 8: Prediction accuracies of the simulation with sinusoidal errors.

Figure 9 :
Figure 9: Prediction accuracies of the simulation with constant errors.

Figure 10 :
Figure 10: Prediction accuracies of the simulation without measurement results.
The signals of PT100 sensors are read by the Siemens module of SM331.The analog signals of sensors are converted to the digital values, and then the digital values are input into the PLC.The compensation programs are executed in the PLC.As the Siemens PLC supports the floating-point arithmetic, the calculation results could attain high precision.The computational procedures in PLC are presented in Figure 11.The temperatures of  −1 − and  −1 − are the fused and measured
− are used to calculate the thermal error.The CNC controller reads the compensation values and shifts the origins of CNC coordinate to implement the compensation.At last,   − and   − will be saved as the corresponding temperatures at the previous time.