Keywords

1 Introduction

Customers of the machine tool industry demand increasingly precise machines to manufacture their products with tight tolerances in the micrometer range. To enable production of such demanding specifications, continual advances in precision of machine tools are required. Machine tools are susceptible to a range of error sources, of which up to 70% can be attributed to thermal influences, as reported by Mayr et al. [1]. Internal and external thermal influences act on machine tools, cause an offset of the tool center point (TCP) and degrade workpiece accuracy. Most common internal influences are due to heat generated in electrical components such as motors, due to mechanical friction in bearings, ballscrews and gearboxes, and due to the cutting process. External influences are typically the environment and personal radiations. These are summarized in the thermal chain of causes from Wegener et al. [2]. To reduce the undesirable impact of thermal effects, options are to thermally stabilize machine tools via cooling and/or to compensate the machine tool via correcting the NC-axes or tool position. Due to the rising necessity to reduce energy consumption, thermal compensation is an increasingly sought-after solution, as reported by Wegener et al. [3]. As opposed to a resource-based approach, it is a knowledge-based approach, and a crucial step in the direction of increasing energy efficiency.

Two approaches to thermal compensation are generally distinguished: physics-based and data-based. The physics-based approach describes the deformation of the machine tool by differential equations. Physics-based models compute temperature dependent displacements at discrete points of the machine tool, typically via finite elements. To reduce the computational time, these models are coupled with model-order reduction techniques, such as in the work of Hernández Becerro [4]. Physical models can further be improved by parameter tuning based on on-machine measurements. Ihlenfeldt et al. [5] performed a parameter analysis to determine the parameters with the highest impact on the overall machine tool accuracy. The data-based approach is an alternative grey/black box methodology that correlates relevant input and output variables. A wide range of data-based models, from simple regression models to more advanced models such as long short-term memory neural networks, have been applied in the literature. Blaser et al. [6] used ARX (AutoRegressive with eXogenous inputs) to develop a thermal adaptive learning control approach for the compensation of rotary axes of a 5-axis machine tool. This methodology was further improved by Zimmermann et al. [7] who addressed the issue of adaptive input selection. The ARX model was also used by Horejš et al. [8] in their investigation of the effects of fluid cooling systems, underlining the model’s suitability for thermal compensation. Mareš et al. [9] proposed an approach to modelling the thermal errors of a turning-milling centre based on ARX, tested three typical experimental setups (drilling, milling, and turning) under load free conditions and applied compensation offline. Fujishima et al. [10] proposed a deep learning approach to predict thermal errors of a turning center under severe situations such as unexpected temperature change or sensor failure. Ngoc et al. [11] applied LSTM to predict 10 geometric errors of a 5-axis machine tool using the rotational B- and C- axes power information as inputs to the model.

This work focuses on the thermal compensation of a Swiss-type lathe. A number of features distinguish it from a 5-axis machine tool: it incorporates multiple TCPs on tool holders and turrets, its headstock is moveable and facilitates workpiece movement in the z-axis direction, it contains a bar-feeder, a guide bush, and in general a higher number of axes. The lathe has a complex non-symmetric structure and is therefore especially susceptible to thermal influences. Works on thermal compensation of Swiss-type lathes are rare in literature. Ouerhani et al. [12] modelled the warm-up behavior of a Tornos SwissNano4 with four different machine-learning models. A reduction of 90% was reported, however, the thermal loads in the training and validation cases were very similar. Wang et al. [13] used rough-set theory in combination with a CNN to measure the spindle axial deformation but only on a very short time sample of one-hundred minutes. A further investigation is thus clearly mandated.

This publication is structured as follows: Sect. 2 explains the methodology applied for thermal compensation, Sect. 3 introduces the experimental setup on the Swiss-type lathe, Sect. 4 presents the results and Sect. 5 summarizes the work.

2 Methodology of Thermal Error Compensation

This work proposes the application of a novel stacked model for thermal error compensation based on ARX and RFR (Random Forest Regression). Input data (temperatures) are preprocessed via empirical mode decomposition to achieve a more stable model performance.

2.1 Empirical Model Decomposition

Empirical Mode Decomposition (EMD) was proposed by Huang et al. [14] for the analysis of non-stationary time series. The purpose of EMD is to find an intuitive representation of the frequency content of complex dynamic signals, for which Fourier-transform based methods are not suitable, due to their non-sinusoidal nature. EMD decomposes a signal in the time domain into a number of temporally adaptive basis functions called the Intrinsic Mode Functions (IMF) by using a ‘sift’ algorithm. As opposed to a Fourier decomposition, IMFs usually have a variable amplitude and frequency, and the number of IMF components is determined by a convergence to a stoppage criterion defined by a limit of the standard deviation of two consecutive sifting results. The EMD algorithm is used to remove noisy high-frequency components from data to improve the robustness of the thermal compensation model.

EMD considers an input \(x\left( t \right)\), generates an upper envelope \(U\left( t \right)\) and lower envelope \(L\left( t \right)\) based on the local extrema of \(x\left( t \right),\) and computes the mean value \(m\left( t \right)\) as an average of the upper and lower envelopes. The first iteration for the first IMF component is given by:

$$ x\left( t \right) - m_{10} \left( t \right) = h_{10} \left( t \right) $$
(1)

The next iteration, where \(m_{11} \left( t \right)\) is determined from \(h_{10} \left( t \right)\):

$$ h_{10} \left( t \right) - m_{11} \left( t \right) = h_{11} \left( t \right) $$
(2)

The generalized equation for the IMF component \(h_{ik}\), where i is the \(i^{th}\) IMF component and k is the \(k^{th}\) sifting operation is given by Eq. (3). The number of sifting operations is determined by convergence to a stoppage criterion, also defined by Huang et al. [14].

$$ h_{{i\left( {k - 1} \right)}} - m_{ik} = h_{ik} $$
(3)

2.2 Autoregressive Model with Exogenous Inputs (ARX)

The ARX model originates from the field of linear system identification; it is a linear representation of a dynamic system in discrete time steps. ARX considers past and present system inputs as well as past system outputs to compute the prediction for the current system output. The model structure is expressed by the following linear difference equation, adapted from the work of Ljung [15]:

$$ y\left( t \right) + a_{1} y\left( {t - 1} \right) + \cdots + a_{{n_{a} }} y\left( {t - n_{a} } \right) = b_{1} u\left( {t - 1} \right) + \cdots + b_{{n_{b} }} u\left( {t - n_{b} } \right) $$
(4)

\(y\) represents the model output (thermal error) and u the model input (e.g. temperature). The model coefficients can be collected in the \(\underline {\theta }\) matrix and the time series of past outputs and inputs in the matrix \(\underline {\varphi } \left( t \right)\).

$$ \underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\theta } = \left[ {\begin{array}{*{20}l} {a_{1} } \hfill & {a_{2} } \hfill & \ldots \hfill & {a_{{n_{a} }} } \hfill & {b_{1} } \hfill & {b_{2} } \hfill & \ldots \hfill & {b_{{n_{b} }} } \hfill \\ \end{array} } \right] $$
(5)
$$ \underline {\varphi } \left( t \right) = \left[ { - y\left( {t - 1} \right) \ldots - y\left( {t - n_{a} } \right) u\left( {t - 1} \right) \ldots u\left( {t - n_{b} } \right)} \right] $$
(6)

Model parameters \(n_{a}\) and \(n_{b}\), i.e. orders of the autoregressive and exogenous parts respectively, can be determined e.g. via partial autocorrelation function analysis. The coefficient matrix \(\underline {\theta }\) can be calculated via least squares and the thermal error \(\hat{y}\) predicted:

$$ \underline{{\hat{\theta }}} = \left[ {\sum\nolimits_{{i = 1}}^{N} {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\varphi } } \left( t \right)\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\varphi } ^{T} \left( t \right)} \right]^{{ - 1}} \sum\nolimits_{{i = 1}}^{N} {\underset{\raise0.3em\hbox{$\smash{\scriptscriptstyle-}$}}{\varphi } } \left( t \right)y\left( t \right) $$
(7)
$$ \hat{y} = \underline{{\varphi^{T} }} \left( t \right)\underline{{\hat{\theta }}} $$
(8)

2.3 Random Forest Regression (RFR)

Random Forest Regression (RFR) is a supervised learning algorithm based on decision trees that can be applied for both classification and regression tasks. RFR fits a multitude of decision trees in training time (ensemble learning) on variously subsampled data (bootstrapping) and returns the average prediction of individual trees. The original RFR algorithm was first proposed by Tin Kam Ho in 1995 [16]. RFR is a versatile regression algorithm with successful applications across various fields from medical diagnostics to financial fraud detection.

Fig. 1.
figure 1

Random Forest Regression model schematic.

The schematic of the RFR model is shown in Fig. 1. In the training process, each regression tree is assigned a bootstrapped subset of the training data, thus generating N new sets of training data, where N is the total number of trees in the model. N = 100 is applied in this work. Feature sampling is also commonly performed, although here only one feature, the smoothed door status signal, is used and therefore this feature is used at every internal node. In this sense, the RFR model is similar to a bag of trees model. The squared error is taken as the split criterion at every internal node. The output of the model is the average of the values predicted by the N trees.

2.4 Stacked ARX-RFR Model for Thermal Compensation

The ARX-RFR model consists of a calibration phase in which model parameters are calculated and a prediction phase in which the model is applied to compensate errors without in-process error measurement. The model structure is shown in Fig. 2.

Fig. 2.
figure 2

ARX-RFR model schematic for thermal error compensation.

The ARX model is trained with sifted temperature and thermal error data with a time frequency of approximately five minutes. The list of all possible inputs of the ARX model is specified in Table 1 in the next section. Specific inputs are chosen based on knowledge of the machine tool behaviour. The output of the model is the thermal error, for each thermal error a differently parametrized ARX model is constructed.

The inputs of the RFR model are the thermal error residual of the ARX prediction and the smoothed machine door status signal with a time frequency of approximately one minute. The smoothing is performed with a smoothing function shown in Eq. (9).

$$ y_{t,smoothed} = \frac{1}{{1 + e^{{ - k\left( {t_{0} - t} \right)}} }}y_{t} $$
(9)

The machine door status signal \(y_{t}\) is a binary signal, 0 when the door is closed and 1 when the door is open. \(t_{0}\) corresponds to the time at which a status change occurs, \(k = 1\) when the door status changes from 0 to 1 and \(k = - 1\) when the door status changes from 1 to 0. In the prediction phase the models are applied in a stacked manner, i.e. the model predictions are added together.

3 Experimental Setup

3.1 Machine Tool and Measurement Equipment

The experimental machine tool is a Swiss-type lathe, whose kinematic chain can be described as H[w-[S1’-Z1’ S2’-Y2’-Z2’-X2’]-b-[t X1-Y1-[t (S11)-t]]] according to the notation outlined in ISO 10791-1:2015 [17]. Displacement probes are mounted on the tool holder to measure errors in the X - and Y - axes directions, as shown in Fig. 3. Thermal errors are measured between the main spindle S1 and the tool holder. Twelve temperature measurements are monitored, of which seven are from externally mounted temperature sensors and five are from internal NC data, as summarized in Table 1. Temperature sensors are also mounted directly on the tool holder, as shown in Fig. 3.

Fig. 3.
figure 3

Working space of the Swiss-type lathe. The tool holder can be equipped with turning, drilling, and boring tools. Displacement probes and temperature sensors mounted on the tool holder are shown.

Table 1. Temperature Sensors.

For the X-axis compensation, sensors 1, 2, 6, 8, 11, 12 are chosen; for the Y-axis compensation, sensors 1, 2, 6, 10, 11, 12 are chosen.

3.2 Model Calibration Phase

The ARX-RFR model is calibrated with a thermal load cycle of varying spindle and driven tools motor speeds, rapid axes motions, and machine door openings. In this manner, different thermal states of the machine are excited while thermal errors are measured intermittently at a constant frequency of approximately five minutes. The training cycle is shown in Fig. 4.

Fig. 4.
figure 4

Spindle and driven tool speed profiles for the calibration of the ARX-RFR model. The total duration of the data used for training is 80 h. The door of the machine tool is also opened several times during the model calibration phase.

3.3 Thermal Test Piece

The ARX-RFR model is validated on a thermal test-piece shown in Fig. 5. The test-piece has a varying diameter from 7 to 16 mm and a length of 28 mm. The cycle to produce this part runs on the machine tool virtually, i.e. without any material cutting. The influence of heat that would be released during the production of the real part, i.e. with material cutting, is not considered in this work. The cycle per part lasts approximately 60 s: this corresponds to a typical industrial production on a Swiss-type lathe, in which a manufacturing cycle for a single part can last around a minute. The production is interrupted a number of times when the machine door is opened.

Fig. 5.
figure 5

Thermal test-piece. A cycle corresponding to the thermal test-piece runs on the machine but without any machining because tools are replaced by pneumatic probes.

4 Results

EMD is applied to relevant temperature measurements with high frequency content to improve the robustness of the ARX-RFR model. As an example, EMD analysis is applied to the ambient temperature measurement. The machine tool is located in an air-conditioned hall with a set target temperature. However, the hall also has some non-negligible heat losses resulting in an on/off behavior of the air-conditioning and therefore a noisy ambient temperature measurement. This can be seen in the top graph in Fig. 6. The noisy part corresponds to daytime and the decrease in temperature to nighttime when the air-conditioning is turned off.

Fig. 6.
figure 6

Empirical mode decomposition of the ambient temperature into the first five intrinsic mode functions. The units of the y-axis are ºC with the IMF components centered around zero.

The first IMF component has low magnitude and high frequency and can therefore be removed. The ambient temperature measurement with the IMF-1 component removed is shown in Fig. 7. Similar analysis is performed for other data where relevant.

Fig. 7.
figure 7

Plot of raw ambient temperature measurement and with IMF-1 component removed.

Figures 8 and 9 show results of the ARX-RFR compensation model compared to only an ARX model, Fig. 8 the X-axis direction error and Fig. 9 the Y-axis direction. The cycles correspond to the production of the thermal test piece. The yellow stripes indicate the time during which the machine tool door is open and the black line the residual or remaining thermal error.

Fig. 8.
figure 8

Left: ARX compensation model for the virtual production of the thermal test piece for the X-axis direction. Right: ARX-RFR compensation model on the same data with a lower residual thermal error (black).

The plots visually indicate that the residual thermal error is reduced more during and after the machine tool door opening by the ARX-RFR model. The peak-to-peak residual errors and error reductions of the ARX-RFR and ARX models are summarized in Tables 2 and 3. The peak-to-peak is defined as the absolute difference between the maximum and minimum value of the plot. The root mean square residual errors and error reductions are presented in Tables 4 and 5.

Table 2. Peak-to-peak residual errors of ARX and ARX-RFR models
Table 3. Peak-to-peak error reductions of ARX and ARX-RFR models
Table 4. Root-mean-square residual errors of ARX and ARX-RFR models
Table 5. Root-mean-square error reductions of ARX and ARX-RFR models
Fig. 9.
figure 9

Left: ARX compensation model for the virtual production of the thermal test piece for the Y-axis direction. Right: ARX-RFR compensation model on the same data with a lower residual thermal error (black).

5 Conclusion

This work applies a new ARX-RFR thermal compensation model to the virtual production of a thermal test piece interrupted by a number of door openings. Door openings can occur during a production run for example when the working space needs to be cleaned or when a part needs to be inspected. As a result, the working space conditions change as cooler air enters and the precision of the machine tool degrades due to thermal errors. The ARX-RFR model is compared to the well-known ARX model and it is demonstrated that it performs more favorably for the case of a door opening.