A Temperature Sensor Clustering Method for Thermal Error Modeling of Heavy Milling Machine Tools

A clustering method is an effective way to select the proper temperature sensor location for thermal error modeling of machine tools. In this paper, a new temperature sensor clustering method is proposed. By analyzing the characteristics of the temperature of the sensors in a heavy floor-type milling machine tool, an indicator involving both the Euclidean distance and the correlation coefficient was proposed to reflect the differences between temperature sensors, and the indicator was expressed by a distance matrix to be used for hierarchical clustering. Then, the weight coefficient in the distance matrix and the number of the clusters (groups) were optimized by a genetic algorithm (GA), and the fitness function of the GA was also rebuilt by establishing the thermal error model at one rotation speed, then deriving its accuracy at two different rotation speeds with a temperature disturbance. Thus, the parameters for clustering, as well as the final selection of the temperature sensors, were derived. Finally, the method proposed in this paper was verified on a machine tool. According to the selected temperature sensors, a thermal error model of the machine tool was established and used to predict the thermal error. The results indicate that the selected temperature sensors can accurately predict thermal error at different rotation speeds, and the proposed temperature sensor clustering method for sensor selection is expected to be used for the thermal error modeling for other machine tools.


Introduction
Errors of machine tools can be classified into quasi-static errors and dynamic errors [1].Quasi-static errors include geometry errors [2], load-induced errors [3], etc., of which thermal error is also an very important part, greatly influencing the accuracy of the machine tools [4,5], and may account for up to 40%-70% of the total error [6,7].Thermal error compensation is considered as one of the most effective methods to alleviate the influence of the thermal error [8,9], in which the temperature field and the thermal error of the machine tool are firstly measured then, according to the measured data, thermal error model [10][11][12] is established to predict the thermal error of the machine tool and the prediction is transmitted into the numerical control (NC) system to complete the compensation.Among the whole procedure, temperature sensor location selection is considered an important step.Although a large number of temperature sensors are placed in the machine tool to obtain the whole temperature field containing detailed temperature information, not every one of them is required [13][14][15] in thermal error modeling.There are some reasons: firstly, more temperature sensors lead to a more complex thermal error model, greatly increasing the cost of software and hardware in the establishment of a compensation system; secondly, some sensors may contain similar information that would reduce the stability and accuracy of the model, and a bad selection of them would lead to a poor prediction of the thermal error model.Thus, proper temperature sensors are needed to be selected.
A "sensors-near-heat source" method was firstly used for selection in which the selected sensors are near heat sources.It is obvious that the "sensors-near-heat source" method is not a scientific method and it may ignore some key sensors that not close to heat sources.Thus, some mathematical methods were introduced by researchers to guide the selection of proper temperature sensors [16][17][18][19][20]. Lo [21] established an optimization objective function by a modified model adequacy criterion based on the Mallow's C p statistic and used a discrete domain search method for the selection.Li [22] and Yan [23] introduced grey correlation theory to select proper sensors.Lee [24] used the Optimal Brain Surgeon (OBS) method to eliminate sensors with insignificant information.In recent years, clustering methods have also been used to select proper temperature sensors.The core concept of a clustering method is to cluster sensors into clusters (groups).Then, one most representative sensor of each cluster is selected to form the final selection.This kind of method has been the most widely used one since it can reduce redundant temperature information.Many clustering algorithms have been used by researchers, such as K-means clustering [7], fuzzy C-means clustering [25][26][27], etc.Additionally, new measuring instruments have also been used for the selection recently.Abdulshahed [28] used a thermal imaging camera to obtain the thermal images and then key sensors were identified.In summary, all of the above methods can effectively select proper temperature sensors and also guarantee a high-accuracy thermal error model.
It can be concluded from the above references that one common thing in these methods is deriving an indicator that describes the difference between the temperatures of the sensors.The indicator that can more effectively describe the real difference between sensors leads to a better selection.Therefore, in this paper, a new indicator was firstly derived.Considering the Euclidean distance between the value of temperature sensors can describe their physical distance on the machine tool, and the correlation coefficient depicts the similarity of the variation of the value of temperature sensors, they were both included in the new indicator.Then, the indicator was expressed as the form of distance matrix to be used in a hierarchical clustering method [17] to cluster temperature sensors.During the clustering process, there are two parameters, the weight coefficient and the number of the clusters, which remains to be optimized.Due to the high-nonlinearity of the problem, the parameters were optimized by a genetic algorithm (GA) [29][30][31], and the fitness function of the GA was also rebuilt.By establishing the thermal error model at one rotation speed and then deriving its root mean square error (RMSE) at two different rotation speeds with a small temperature disturbance, the value of the fitness function is defined as the average RMSE.Thus, the optimized parameters were derived.Meanwhile, the final selection of the temperature sensors were also derived during the GA process.
The method proposed in this paper was verified on a heavy floor-type milling machine tool.According to the method, three temperature sensors were selected from 23 options.Based on the selected temperature sensors, the thermal error model was established to predict the thermal error at different rotation speeds.Then, the accuracy of the prediction was compared to the prediction derived from different temperature sensor selection methods (clustering only based on Euclidean distance, clustering only based on the correlation coefficient, temperature sensor selection based on the "sensors-near-heat source" method, etc.).The result indicates that the method in this paper can derive better accuracy for different rotation speeds, so the effectiveness of the method is proved.The method in this paper is expected to be applicable to temperature sensor location selection of other machine tools.
In summary, the structure of the paper is illustrated as follows: the structure of the investigated milling machine tool is introduced in Section 2; the temperature sensor clustering method is presented in Section 3; in Section 4, the verification of the method is introduced; and the conclusions are shown in Section 5.

Structure of the Investigated Machine Tool
In this paper, a heavy floor-type milling machine tool (type: BHBM200, Beijing No. 1 Machine Tool Plant, Beijing, China) was chosen as the object to analyze.The configuration of the machine tool is shown in Figure 1, which is a four-axis machine tool, composed of five main parts: (1) guide way; (2) pillar; (3) headstock; (4) ram; and (5) spindle.The four axes are X-axis, Y-axis, Z-axis, and Zs-axis, respectively.The pillar moves horizontally on the guide way along the X-axis; the headstock moves vertically on the pillar along the Y-axis; the ram moves forward and backward in the headstock along the Z-axis; and the spindle moves forward and backward in the ram along the Zs-axis.The Zs-axis and Z-axis are parallel to each other.According to the pre-experiment, heat was mostly generated in the ram and the spindle of the machine tool, and most of the thermal errors lie in the direction of Z-axis of the ram.The pillar and headstock contribute a small amount of the thermal error.
Appl.Sci.2017, 7, 82 3 of 16 presented in Section 3; in Section 4, the verification of the method is introduced; and the conclusions are shown in Section 5.

Structure of the Investigated Machine Tool
In this paper, a heavy floor-type milling machine tool (type: BHBM200, Beijing No. 1 Machine Tool Plant, Beijing, China) was chosen as the object to analyze.The configuration of the machine tool is shown in Figure 1, which is a four-axis machine tool, composed of five main parts: (1) guide way; (2) pillar; (3) headstock; (4) ram; and (5) spindle.The four axes are -axis, -axis, -axis, and axis, respectively.The pillar moves horizontally on the guide way along the -axis; the headstock moves vertically on the pillar along the -axis; the ram moves forward and backward in the headstock along the -axis; and the spindle moves forward and backward in the ram along the axis.The -axis and -axis are parallel to each other.According to the pre-experiment, heat was mostly generated in the ram and the spindle of the machine tool, and most of the thermal errors lie in the direction of -axis of the ram.The pillar and headstock contribute a small amount of the thermal error.In order to derive the detailed temperature field of the machine tool, 23 Pt100 temperature sensors (type: STT-F, Beijing Sailing Technology Corporation, Beijing, China) were placed on the machine tool.The resolution of the sensors is 0.1 °C, which meets the demand of the measurement.These sensors were mainly placed in the ram of the machine tool, which has the most obvious temperature change, and some other sensors were placed on the pillar and the headstock.Some sensors were also placed at the inlet and outlet of the oil, since the temperature of the oil can indicates the temperature where temperature sensors cannot be placed.The list of the locations of the temperature sensors is shown in Table 1.The temperature rise of the sensors were recorded by a computer software.In order to derive the detailed temperature field of the machine tool, 23 Pt100 temperature sensors (type: STT-F, Beijing Sailing Technology Corporation, Beijing, China) were placed on the machine tool.The resolution of the sensors is 0.1 • C, which meets the demand of the measurement.These sensors were mainly placed in the ram of the machine tool, which has the most obvious temperature change, and some other sensors were placed on the pillar and the headstock.Some sensors were also placed at the inlet and outlet of the oil, since the temperature of the oil can indicates the temperature where temperature sensors cannot be placed.The list of the locations of the temperature sensors is shown in Table 1.The temperature rise of the sensors were recorded by a computer software.Thermal error of the machine tool was also measured.A measurement bar was installed on the spindle and then three charge coupled device (CCD) laser displacement sensors (type: ILD1700, Micro-Epsilon Corporation, Ortenburg, Germany, and type: LK-H020, Keyence Corporation, Osaka, Japan) were placed along the axial and radial directions of the bar to measure the thermal error along the Z-axis, X-axis, and Y-axis, respectively, as shown in Figure 2. The resolution of the CCD laser sensors is 0.1 µm, which also satisfies the demand of the measurement.Thermal error of the machine tool was also measured.A measurement bar was installed on the spindle and then three charge coupled device (CCD) laser displacement sensors (type: ILD1700, Micro-Epsilon Corporation, Ortenburg, Germany, and type: LK-H020, Keyence Corporation, Osaka, Japan) were placed along the axial and radial directions of the bar to measure the thermal error along the -axis, -axis, and -axis, respectively, as shown in Figure 2. The resolution of the CCD laser sensors is 0.1 μm, which also satisfies the demand of the measurement.

Temperature Sensor Clustering Method
There are 23 temperature sensors on the machine tool.However, not all of them can be used for the thermal error modeling of the machine tool since too many sensors would lower the stability and increase the cost of the software and hardware when establishing the thermal error compensation system.Thus, the temperature sensors need to be selected for thermal error modeling.In this chapter, a new temperature sensor clustering method is illustrated.The core concept is the construction of an indicator that can better reflect the difference between temperature sensors.Therefore, the first step is constructing a new indicator.

Indicator Construction
In this subsection, factors that result in the differences between the temperature sensors were discussed.Firstly, it is obvious that the gap between the values of the temperature sensors causes the difference.Take temperature 1 and temperature 2 in Figure 3 as an example; the gap between the value of them is large, so the information of these two sensors are different.As for the physical meaning, a large gap between the values of the two temperature sensors usually means that they are placed at very different places on the machine tool.Thus, the gap between the values of the temperature sensors should be considered in the indicator.However, just considering the gap is not enough.Take temperature 2 and temperature 3 in Figure 3, as an example; there is a large gap between them, however, these two sensors have a proportional relationship, indicating that the similarity between them is high.That is, there is little difference between these two temperature

Temperature Sensor Clustering Method
There are 23 temperature sensors on the machine tool.However, not all of them can be used for the thermal error modeling of the machine tool since too many sensors would lower the stability and increase the cost of the software and hardware when establishing the thermal error compensation system.Thus, the temperature sensors need to be selected for thermal error modeling.In this chapter, a new temperature sensor clustering method is illustrated.The core concept is the construction of an indicator that can better reflect the difference between temperature sensors.Therefore, the first step is constructing a new indicator.

Indicator Construction
In this subsection, factors that result in the differences between the temperature sensors were discussed.Firstly, it is obvious that the gap between the values of the temperature sensors causes the difference.Take temperature 1 and temperature 2 in Figure 3 as an example; the gap between the value of them is large, so the information of these two sensors are different.As for the physical meaning, a large gap between the values of the two temperature sensors usually means that they are placed at very different places on the machine tool.Thus, the gap between the values of the temperature sensors should be considered in the indicator.However, just considering the gap is not enough.Take temperature 2 and temperature 3 in Figure 3, as an example; there is a large gap between them, however, these two sensors have a proportional relationship, indicating that the similarity between them is high.That is, there is little difference between these two temperature sensors.Moreover, when establishing a thermal error model with sensors that have high similarity, the model shows weak stability and is very easily influenced by disturbance.Therefore, the similarity between the temperature sensors is also needed to be involved in the indicator.In summary, the indicator should contain both the gap between the value of the temperature sensors and their similarity.
sensors.Moreover, when establishing a thermal error model with sensors that have high similarity, the model shows weak stability and is very easily influenced by disturbance.Therefore, the similarity between the temperature sensors is also needed to be involved in the indicator.In summary, the indicator should contain both the gap between the value of the temperature sensors and their similarity.

Establishment of the Distance Matrix
The indicator proposed above can be expressed in the form of the distance matrix.Firstly, the distance matrix that represents the gap between the values of the temperature sensors is derived.
The temperature value of all temperature sensors can be represent by a matrix : where 1~ is the measured temperature sequence of the th temperature sensor, which has elements: in which each element is a temperature value, representing the temperature at a certain moment.For example, 1~ is the temperature value of the th temperature sensor at the th sampling time.
The distance matrix is expressed in the form of Equation ( 3): is a symmetric matrix and its diagonal elements are all zero.It reflects the distance between every two temperature sensors of the total temperature sensors.For example, is the distance between the th temperature sensor and the th temperature sensor.When considering the gap between the value of the temperature sensors, can be expressed by the Euclidean distance.Euclidean distance is a type of geometrical distance between vectors in dimensional space when considering the measured temperature sequences ( ) of every temperature sensor as dimension vectors.As for the th temperature sensor and the th temperature sensor , it is expressed as:

Establishment of the Distance Matrix
The indicator proposed above can be expressed in the form of the distance matrix.Firstly, the distance matrix that represents the gap between the values of the temperature sensors is derived.
The temperature value of all temperature sensors can be represent by a matrix X m×n : where x i ( i = 1 ∼ n) is the measured temperature sequence of the ith temperature sensor, which has m elements: in which each element is a temperature value, representing the temperature at a certain moment.For example, x ij ( j = 1 ∼ m) is the temperature value of the ith temperature sensor at the jth sampling time.
The distance matrix is expressed in the form of Equation ( 3): D is a n × n symmetric matrix and its diagonal elements are all zero.It reflects the distance between every two temperature sensors of the total n temperature sensors.For example, d pq is the distance between the pth temperature sensor and the qth temperature sensor.When considering the gap between the value of the temperature sensors, d pq can be expressed by the Euclidean distance.Euclidean distance is a type of geometrical distance between vectors in m dimensional space when considering the measured temperature sequences (x i ) of every temperature sensor as m dimension vectors.As for the pth temperature sensor x p and the qth temperature sensor x q , it is expressed as: Thus, each element of the matrix can be derived according to Equation (4).Then, for further calculation, the element of the matrix is normalized to [0, 1] by the following process: in which, d max and d min are the maximum and minimum elements of all d pq ( p = 1 ∼ n, q = 1 ∼ n), respectively.Hence, by assembling the new elements d e pq , the distance matrix representing the gap between the value of the temperature sensors is obtained: Then, the distance matrix that represents the similarity between the temperature sensors is derived.The similarity between the temperature sensors can be represented by the correlation coefficient.The correlation coefficient between the pth temperature sensor x p and the qth temperature sensor x q can be expressed as: in which: and: are the average value of x p and x q , respectively.r pq reflects the similarity between the pth temperature sensor and the qth temperature sensor, which lies in the range of [−1, 1].When r pq is close to 0, the similarity between temperature sensors is low.Conversely, when r pq is close to −1 or 1, the similarity between temperature sensors is high.Thus, the following expression was constructed to express the difference between x p and x q according to their similarity: d r pq lies within the range of [0, 1].The larger d r pq is, the lower the similarity between x p and x q is, so the larger the difference between x p and x q is, and vice versa.
Consequently, the distance matrix representing the similarity can be obtained by assembling the d r pq into a n × n symmetric matrix as follows: Thus, by introducing a weight coefficient, the distance matrix both representing the gap between the temperature sensors and the similarity between the temperature sensors is derived: For each element in D a , Equation ( 12) can be written as Equation ( 13): in which, α is the weight coefficient within the range of [0, 1].The larger α is, the more influence the gap between the value of temperature sensors has on the distance matrix, and vice versa.

Hierarchical Clustering Method
The main concept of clustering is dividing temperature sensors into several clusters according to the distance matrix.Temperatures measured by the sensors that are clustered into the same cluster have smaller differences.Thus, one representative temperature sensor is selected from each cluster to form the final selection of temperature sensors.There are many kinds of clustering methods, but since the number of the temperature sensors is not large, hierarchical clustering method was used.The clustering process is shown as follows: 1.
Find the minimum element of the upper triangular part of the distance matrix D a , named as d a pq (p = 1 ∼ n, q = 1 ∼ n, p < q), which means temperature sensors x p and x q have the smallest distance, and clustering x p and x q into one cluster, named as x (pq) = x p x q ; 2.
Since x p and x q are clusterd, the distance matrix is re-calculated:  4), ( 5), (7), and (10); 2. 4 Derive the new d a pq based on new d e pq and d r pq according to Equation (13); 2.5 There is one new d a pq between x (pq) and every other temperature sensor (cluster).Thus, (n − 1) different d a pq can be obtained.Arrange them into the corresponding place of the pth row and the pth column of the distance matrix to derive a new distance matrix D a with (n − 1) rows and (n − 1) columns;

3.
Loop step 1 and step 2 until n, which is the size of the distance matrix D a , reduced to an ideal number λ(λ < n).λ is the number of the clusters we would like to cluster to.The temperature sensors in each cluster can also be derived according to step 1.
The flow chart of the hierarchical clustering is shown in Figure 4:

Optimization of the Parameters
It can be found that two parameters in this method remain uncertain: the weight coefficient α and the number of the clusters λ.The weight coefficient determines the form of the distance matrix, which influences the result of the clustering.The number of the clusters determines the number of the temperature sensors being selected for the thermal error model, and then influences the accuracy of the model.Thus, it is necessary to derive the optimized value of these two parameters.
However, it is a highly nonlinear optimization problem since a small change of α leads to totally different clustering results, and the number of the clusters only has discrete values.Thus, it is hard for regular optimization methods to be applied to this problem.Therefore, in this paper, a genetic algorithm (GA) was used to optimize the parameters.

Genetic Algorithm (GA)
A genetic algorithm is an intelligent algorithm that simulates Darwinian evolution theory, in which the combination of the parameters to be optimized are considered as "individuals" in nature.Firstly, some random value of the parameters were generated to form a population.Secondly, they were encoded by a binary coding method so the value of the parameters were transformed into a format that is more like gene.Thirdly, these "individuals" were crossed to generate the next generation, and some of them also mutated to derive new "individuals".Fourthly, these "individuals" was selected by a fitness function and "individuals" who derive a smaller value of fitness function survive.The above steps were repeated several times until all "individuals" in the population derive the approximate smallest fitness function.The value of these individuals were considered as the optimized value.
Deriving a fitness function that can better reflect the goodness of the "individual" is the key of the GA.The fitness function can be expressed as: in which: is the value of the fitness function; α , λ is the combination of the weight coefficient and the number of the clusters, which is the "individual".
The fitness function should reflect both the accuracy and the stability of the model derived from the "individuals".Thus, the fitness function was constructed according to the following steps: 1.The machine tool was firstly operated at the rotation speed of 1300 rpm, obtaining the temperature of the sensors , and the thermal error ; 2. According to the clustering method in Sections 3.2 and 3.3 and the two parameters α , λ , all temperature sensors are clustered into λ clusters: , ,…, ;

Optimization of the Parameters
It can be found that two parameters in this method remain uncertain: the weight coefficient α and the number of the clusters λ.The weight coefficient determines the form of the distance matrix, which influences the result of the clustering.The number of the clusters determines the number of the temperature sensors being selected for the thermal error model, and then influences the accuracy of the model.Thus, it is necessary to derive the optimized value of these two parameters.
However, it is a highly nonlinear optimization problem since a small change of α leads to totally different clustering results, and the number of the clusters only has discrete values.Thus, it is hard for regular optimization methods to be applied to this problem.Therefore, in this paper, a genetic algorithm (GA) was used to optimize the parameters.

Genetic Algorithm (GA)
A genetic algorithm is an intelligent algorithm that simulates Darwinian evolution theory, in which the combination of the parameters to be optimized are considered as "individuals" in nature.Firstly, some random value of the parameters were generated to form a population.Secondly, they were encoded by a binary coding method so the value of the parameters were transformed into a format that is more like gene.Thirdly, these "individuals" were crossed to generate the next generation, and some of them also mutated to derive new "individuals".Fourthly, these "individuals" was selected by a fitness function and "individuals" who derive a smaller value of fitness function survive.The above steps were repeated several times until all "individuals" in the population derive the approximate smallest fitness function.The value of these individuals were considered as the optimized value.
Deriving a fitness function that can better reflect the goodness of the "individual" is the key of the GA.The fitness function can be expressed as: in which: f is the value of the fitness function; [α, λ] is the combination of the weight coefficient and the number of the clusters, which is the "individual".
The fitness function should reflect both the accuracy and the stability of the model derived from the "individuals".Thus, the fitness function was constructed according to the following steps: 1.
The machine tool was firstly operated at the rotation speed of 1300 rpm, obtaining the temperature of the sensors X 1 , and the thermal error e 1 ;

2.
According to the clustering method in Sections 3.2 and 3.3 and the two parameters [α, λ], all temperature sensors are clustered into λ clusters: 1 , X 1 , . . .,X Choose one temperature sensor from each cluster to form a combination.Thus, we derive a set of all possible combinations, denoted as Ω 1 .For each combination of temperature sensors, a thermal error model can be derived; 4.
The machine tool was operated at two different rotation speeds, 600 rpm and 2200 rpm, respectively, obtaining X 2 , e 2 and X 3 , e 3 ; 5.
Corresponding to Ω 1 , combinations of the temperature sensors in X 2 and X 3 were obtained.
For each combination of temperature sensors, a 0.5 • C of disturbance was added to simulate the disturbance, then they were used to derive the predicted thermal error e 2 and e 3 according to the corresponding thermal error model obtained in step 3. Thus, a set of average root mean square errors (RMSE) were derived, each of them is expressed as: where l 2 and l 3 are the number of the elements in e 2 and e 3 , respectively; 6.
Among the set of the average RMSEs, find the minimum one, f min , which is considered as the value of the fitness function.Meanwhile, the best combination of temperature sensors corresponding to f min can also be derived.
The flowchart of these steps is shown in Figure 5.The core concept of the fitness function is establishing the thermal error model at one rotation speed, then deriving its accuracy at two different rotation speeds with temperature disturbance.Thus, the optimized parameters [α, λ] can derive a clustering from which the best combination of temperature sensors being selected can derive a thermal error model that has better accuracy for different rotation speeds and also has robustness to resist the disturbance from the environment.
Appl.Sci.2017, 7, 82 9 of 16 3.Choose one temperature sensor from each cluster to form a combination.Thus, we derive a set of all possible combinations, denoted as .For each combination of temperature sensors, a thermal error model can be derived; 4. The machine tool was operated at two different rotation speeds, 600 rpm and 2200 rpm, respectively, obtaining , and , ; 5. Corresponding to , combinations of the temperature sensors in and were obtained.For each combination of temperature sensors, a 0.5 °C of disturbance was added to simulate the disturbance, then they were used to derive the predicted thermal error and according to the corresponding thermal error model obtained in step 3. Thus, a set of average root mean square errors (RMSE) were derived, each of them is expressed as: where and are the number of the elements in and , respectively; 6.Among the set of the average RMSEs, find the minimum one, , which is considered as the value of the fitness function.Meanwhile, the best combination of temperature sensors corresponding to can also be derived.
The flowchart of these steps is shown in Figure 5.The core concept of the fitness function is establishing the thermal error model at one rotation speed, then deriving its accuracy at two different rotation speeds with temperature disturbance.Thus, the optimized parameters α , λ can derive a clustering from which the best combination of temperature sensors being selected can derive a thermal error model that has better accuracy for different rotation speeds and also has robustness to resist the disturbance from the environment.The main parameters of GA include: (1) initial population size; (2) crossover possibility; (3) mutation rate; and (4) maximum number of generations.The value of these parameters are shown in Table 2.After 20 generations, the difference of the fitness function value in the whole population gradually reduced to a stable value, as shown in Figure 6.Thus, the value of [α, λ] after optimization are derived: α = 0.66 and λ = 3, so the clustering is further derived, shown in Figure 7.The clusters of temperature sensors after clustering are shown in Figure 8.According to Figure 8, it can be seen that all temperature sensors are clustered into three very different clusters.Cluster 1 has nine temperature sensors, which are mostly located at the front and the middle of the ram, mainly reflecting the temperature of the structure of the ram, whose temperature rise is within 0-5 .Cluster 2 has 13 temperature sensors, whose temperature rise is much smaller, and curves of these temperature sensors are not as smooth as Cluster 1; Cluster 3 has only one temperature sensor, because it is located near the spindle motor and has a much more swift temperature rise than the other two temperature clusters.It can be observed that some temperature sensors that difficult to be clustered were properly dealt with, such as the three small-amplitude sensors in Cluster 1.They can be clustered into Cluster 2 or just form a new cluster.According to the method, they were clustered into Cluster 1 since this method derives the minimum value of the fitness function.
Meanwhile, the final selected combination of the temperature sensors that have the minimum average RMSE is also derived during the GA process, shown in Table 3 and marked in black in Figure 8 (the temperature sensor in Cluster 3 is not marked because there is only one temperature sensor). in Table 2.After 20 generations, the difference of the fitness function value in the whole population gradually reduced to a stable value, as shown in Figure 6.Thus, the value of α , λ after optimization are derived: α 0.66 and λ 3 , so the clustering is further derived, shown in Figure 7.The clusters of temperature sensors after clustering are shown in Figure 8.According to Figure 8, it can be seen that all temperature sensors are clustered into three very different clusters.
Cluster 1 has nine temperature sensors, which are mostly located at the front and the middle of the ram, mainly reflecting the temperature of the structure of the ram, whose temperature rise is within 0-5 .Cluster 2 has 13 temperature sensors, whose temperature rise is much smaller, and curves of these temperature sensors are not as smooth as Cluster 1; Cluster 3 has only one temperature sensor, because it is located near the spindle motor and has a much more swift temperature rise than the other two temperature clusters.It can be observed that some temperature sensors that are difficult to be clustered were properly dealt with, such as the three small-amplitude sensors in Cluster 1.They can be clustered into Cluster 2 or just form a new cluster.According to the method, they were clustered into Cluster 1 since this method derives the minimum value of the fitness function.
Meanwhile, the final selected combination of the temperature sensors that have the minimum average RMSE is also derived during the GA process, shown in Table 3 and marked in black in Figure 8 (the temperature sensor in Cluster 3 is not marked because there is only one temperature sensor).    in Table 2.After 20 generations, the difference of the fitness function value in the whole population gradually reduced to a stable value, as shown in Figure 6.Thus, the value of α , λ after optimization are derived: α 0.66 and λ 3 , so the clustering is further derived, shown in Figure 7.The clusters of temperature sensors after clustering are shown in Figure 8.According to Figure 8, it can be seen that all temperature sensors are clustered into three very different clusters.Cluster 1 has nine temperature sensors, which are mostly located at the front and the middle of the ram, mainly reflecting the temperature of the structure of the ram, whose temperature rise is within 0-5 .Cluster 2 has 13 temperature sensors, whose temperature rise is much smaller, and curves of these temperature sensors are not as smooth as Cluster 1; Cluster 3 has only one temperature sensor, because it is located near the spindle motor and has a much more swift temperature rise than the other two temperature clusters.It can be observed that some temperature sensors that are difficult to be clustered were properly dealt with, such as the three small-amplitude sensors in Cluster 1.They can be clustered into Cluster 2 or just form a new cluster.According to the method, they were clustered into Cluster 1 since this method derives the minimum value of the fitness function.
Meanwhile, the final selected combination of the temperature sensors that have the minimum average RMSE is also derived during the GA process, shown in Table 3 and marked in black in Figure 8 (the temperature sensor in Cluster 3 is not marked because there is only one temperature sensor).

Verification of the Method
The effectiveness of the above method was verified by an experiment.The selected temperature sensors were used to establish the model to predict the thermal error of the machine tool and compared to other temperature sensor selection methods.In order to verify whether the selected temperature sensors can be used at different spindle rotation speeds, firstly the machine tool was operated at 1200 rpm and 2000 rpm, respectively, to generate the data for establishing the thermal error model, and then verify its prediction accuracy at other rotation speeds.
According to Table 3, temperature sensor No. 10 (oil of the gear box), No. 14 (hydrostatic oil of the spindle), and No. 21 (near the spindle motor) were selected after optimization.Multiple regression analysis (MRA) [32][33][34] was used to establish the model.Since the thermal error along the -axis contributes most of the thermal error, the thermal error along -axis was considered in the model.Through MRA, the thermal error model was derived as follows: 0.0310 0.0152 0.0101 (16) in which, the value of temperature rise was used, so the constant term of the model is zero.Then, four comparison groups with different temperature sensor selection methods were established, in which the models were all established by MRA to make sure the differences between groups are mainly caused by the temperature selection method.
As for the first comparison group, temperature sensors were clustered and selected only considering the Euclidean distance between the temperature sensors.Three temperature sensors (No. 4 (upper surface on the rear of the ram), No. 18 (cooling water of the spindle motor), and No. 21 (near the spindle motor)) were selected.Then the thermal error model was established:

Verification of the Method
The effectiveness of the above method was verified by an experiment.The selected temperature sensors were used to establish the model to predict the thermal error of the machine tool and compared to other temperature sensor selection methods.In order to verify whether the selected temperature sensors can be used at different spindle rotation speeds, firstly the machine tool was operated at 1200 rpm and 2000 rpm, respectively, to generate the data for establishing the thermal error model, and then verify its prediction accuracy at other rotation speeds.
According to Table 3, temperature sensor No. 10 (oil of the gear box), No. 14 (hydrostatic oil of the spindle), and No. 21 (near the spindle motor) were selected after optimization.Multiple regression analysis (MRA) [32][33][34] was used to establish the model.Since the thermal error along the Z-axis contributes most of the thermal error, the thermal error along Z-axis was considered in the model.Through MRA, the thermal error model was derived as follows: e z = 0.0310x 10 + 0.0152x 14 + 0.0101x 21 (16) in which, the value of temperature rise was used, so the constant term of the model is zero.Then, four comparison groups with different temperature sensor selection methods were established, in which the models were all established by MRA to make sure the differences between groups are mainly caused by the temperature selection method.
As for the first comparison group, temperature sensors were clustered and selected only considering the Euclidean distance between the temperature sensors.Three temperature sensors (No. 4 (upper surface on the rear of the ram), No. 18 (cooling water of the spindle motor), and No. 21 (near the spindle motor)) were selected.Then the thermal error model was established: e z = 0.0423x 4 + 0.0069x 18 + 0.0156x 21 (17) As for the second comparison group, temperature sensors were clustered and selected only according to the correlation coefficient between temperature sensors.Three temperature sensors (No. 10 (oil of the gear box), No. 16 (inlet of the cooling box), and No. 21 (near the spindle motor)) were selected to establish the thermal error model: e z = 0.0638x 10 − 0.0033x 16 + 0.0161x 21 (18) In the third comparison group, only one temperature sensor was selected.Considering temperature sensor No. 21 (near the spindle motor) has the minimum model prediction error among all sensors, temperature sensor No. 21 was selected to establish the proportional model of thermal error: e z = 0.0198x 21 (19) In the fourth comparison group, temperature sensors were selected according to the "sensors-near-heat source" method, in which the temperature sensors that were placed near the heat source of the machine tool, as well as the sensors reflecting the temperature of the environment, were selected.Thus, four sensors (No.21 (near the spindle motor), No. 15 (surface of the worktable), No. 22 (near the hydrostatic oil in the ram), and No. 23 (environment temperature near the pillar)) were selected to establish the thermal error model: e z = 0.0196x 21 − 0.1144x 15 − 0.0015x 22 + 0.1360x 23 (20) After the establishment of the models, the machine tool was operated at 1000 rpm to verify the accuracy of the model.Since the rotation speed was not within the range of the rotation speed that was used to build the thermal error model, the universality of the selected temperature sensors be verified.Comparisons of the accuracy of these models are shown in Figure 9, and the RMSEs and maximum deviations are shown in Table 4.As for the second comparison group, temperature sensors were clustered and selected only according to the correlation coefficient between temperature sensors.Three temperature sensors (No. 10 (oil of the gear box), No. 16 (inlet of the cooling box), and No. 21 (near the spindle motor)) were selected to establish the thermal error model: 0.0638 0.0033 0.0161 In the third comparison group, only one temperature sensor was selected.Considering temperature sensor No. 21 (near the spindle motor) has the minimum model prediction error among all sensors, temperature sensor No. 21 was selected to establish the proportional model of thermal error: In the fourth comparison group, temperature sensors were selected according to the "sensorsnear-heat source" method, in which the temperature sensors that were placed near the heat source of the machine tool, as well as the sensors reflecting the temperature of the environment, were selected.
After the establishment of the models, the machine tool was operated at 1000 rpm to verify the accuracy of the model.Since the rotation speed was not within the range of the rotation speed that was used to build the thermal error model, the universality of the selected temperature sensors can be verified.Comparisons of the accuracy of these models are shown in Figure 9, and the RMSEs and maximum deviations are shown in Table 4.According to Figure 9 and Table 4, the conclusions can be drawn that the method in this paper can derive the best model accuracy, and the predicted thermal error can depict the general trend of the thermal error, as well as the small variation of the thermal error caused by the cooling water.For According to Figure 9 and Table 4, the conclusions can be drawn that the method in this paper can derive the best model accuracy, and the predicted thermal error can depict the general trend of the thermal error, as well as the small variation of the thermal error caused by the cooling water.For the maximum deviation between the predicted thermal error and the measured thermal error, the method in this paper still has the lowest value among all the compared methods.
As for the first comparison group, only the Euclidian distance of the temperature sensors were considered, which would cause there to be one dominated temperature sensor among the selected sensors because its variation amplitude is much larger than the others.Thus, some information would be lost and the accuracy of the prediction is poor.The small variation caused by cooling water cannot be predicted either.
As for the second comparison group, only the correlation coefficient of the sensors were considered.Thus, some temperature sensors that only have very small amplitudes would be clustered with temperature sensors that have large amplitudes, and probably be selected.Thus, although they can predict the variation caused by the cooling water, they failed to derive an accurate amplitude of the thermal error.
As for the third comparison group, only one temperature sensor was included.This is similar to the first comparison group.Thus, the accuracy of the prediction would be lower, and the variation caused by cooling water cannot be predicted either.
As for the fourth comparison group, temperature sensors near the heat sources and temperature sensors of the environment were selected.It seems that this method contains the main information of the heat sources.However, most of the heat sources have very similar temperature variation when the machine tool is working, so there is very high collinearity when establishing the thermal error model, resulting in instability.The model might have high accuracy for the same rotation speed as the measurement.However, when predicting the thermal error at another rotation speed, the accuracy is much lower.
In order to further verify the effectiveness of the temperature selection method in a more real working condition, the machine tool operated according to a schedule that simulated the working process of the machine tool, as shown in Table 5, in which the spindle of the machine tool rotated at different rotation speeds and also paused for a period of time during working.Then the thermal error prediction accuracy of the method in this paper was also compared to other comparison groups.The results are shown in Figure 10 and the RMSEs and maximum deviations are shown in Table 6.
According to the result, although the rotation speed in the verification is far less than the speed when establishing the model (1200 rpm and 2000 rpm), the method in this paper can still derive a predicted thermal error that has better accuracy.The results show that both the RMSE and the maximum deviation of the method are smaller than the other considered temperature sensor selection methods.As for Comparison Group 1, it has one dominated temperature sensor that was placed near the heat source and has a larger amplitude.Since the model is established at high rotation speed (1200 rpm and 2000 rpm), the dominated temperature sensor usually overestimates the thermal error when the rotation speed is low (300 rpm or 500 rpm).This is because, at lower speed, the heat generated by the heat source reduces, but the temperature near the heat source may not reduce significantly, while the other selected temperature sensors cannot remedy this problem since they are similar to the dominated sensor.As for comparison groups 3 and 4, they would have the same problem since the sensors are all placed near the heat source.
As for Comparison Group 2, the accuracy is better since the clustering is based on the correlation coefficient.The selected sensors are not similar, reducing the collinearity of the model and improving its stability for different rotation speeds.However, its accuracy is still not better than the method considering both the Euclidean distance and correlation coefficient.
Thus, according to the results, the effectiveness of the temperature clustering method in this paper is confirmed, and this method is expected to have a wide applicability for different working conditions.

Conclusions
In this paper, a new temperature sensor clustering method is derived for the selection of sensor locations.An indicator comprehensively considering both the Euclidean distance and the correlation coefficient was proposed to reflect the difference between them.Then, the indicator was expressed as the form of distance matrix, which was used in hierarchical clustering.A genetic algorithm (GA) was used to optimize the parameters in clustering, and the fitness function of the algorithm was also rebuilt.After the optimization by GA, the proper parameters for clustering were derived, as well as the final selection of the temperature sensors.Finally, the effectiveness of the method was verified and compared to some other temperature sensor selection method through an experiment on a heavy floor-type milling machine tool.Conclusions can be drawn according to the experiment results: The RMSE of the method is 0.0118 mm at 1000 rpm and 0.0200 mm at near-real working conditions.The maximum deviation of the method is 0.0227 mm at 1000 rpm and 0.0434 mm at the near-real conditions.The accuracy is better than all other comparison groups and also meets the demand of manufacturing.It can also be found that all the groups appeared overestimating at a much lower rotation speed, while the method in this paper can better control this phenomenon.These above conclusions proved the effectiveness of the method to be used in the thermal error modeling of the machine tools.
Additionally, it can be found that, on the basis of a proper temperature sensor selection, a simple model can also guarantee an accurate and stable prediction of thermal errors.Actually, a much more complex error model would lead to more instability, influencing its application in engineering.This conclusion emphasizes the importance of temperature sensor selection for thermal error modeling.
Future work will increase the initial number of temperature sensors for the method, adjusting the structure of the combination of the Euclidian distance and correlation coefficient (not just linear superposition), and applying the method to another machine tool.

Figure 1 .
Figure 1.Configuration of the machine tool.

Figure 1 .
Figure 1.Configuration of the machine tool.

Figure 2 .
Figure 2. Measurement of the thermal error.

Figure 2 .
Figure 2. Measurement of the thermal error.

Figure 3 .
Figure 3. Temperature sensors with different characteristics.

Figure 3 .
Figure 3. Temperature sensors with different characteristics.

Derive the distance matrix D a Figure 4 .
Figure 4. Flowchart of the hierarchical clustering method.

Figure 4 .
Figure 4. Flowchart of the hierarchical clustering method.

Figure 5 .
Figure 5. Flowchart of the establishment of the fitness function.The main parameters of GA include: (1) initial population size; (2) crossover possibility; (3) mutation rate; and (4) maximum number of generations.The value of these parameters are shown

Figure 5 .
Figure 5. Flowchart of the establishment of the fitness function.

Figure 9 .
Figure 9. Comparisons of the accuracy of the models.

Figure 9 .
Figure 9. Comparisons of the accuracy of the models.

Figure 10 .
Figure 10.Comparison of the accuracy.

Table 1 .
Location of temperature sensors.

Table 1 .
Location of temperature sensors.
2.1Delete the qth row and the qth column of the original distance matrix D a ; 2.2 Calculate the average temperature of x (pq) by rows, named as x (pq) ;

Table 2 .
Parameters of the genetic algorithm (GA).

Table 2 .
Parameters of the genetic algorithm (GA).

Table 2 .
Parameters of the genetic algorithm (GA).

Table 4 .
Comparisons of the root mean square errors (RMSEs) and the maximum deviations.
Thus, four sensors (No.21 (near the spindle motor), No. 15 (surface of the worktable), No. 22 (near the hydrostatic oil in the ram), and No. 23 (environment temperature near the pillar)) were selected to establish the thermal error model:

Table 4 .
Comparisons of the root mean square errors (RMSEs) and the maximum deviations.

Table 5 .
Working schedule of the machine tool.

Table 6 .
Comparisons of the RMSEs and the maximum deviations.

Table 5 .
Working schedule of the machine tool.Figure 10.Comparison of the accuracy.