Thermal error modelling of machine tools based on ANFIS with fuzzy c-means clustering using a thermal imaging camera

Thermal errors are often quoted as being the largest contributor to CNC machine tool errors, but they can be effectively reduced using error compensation. The performance of a thermal error compensation system depends on the accuracy and robustness of the thermal error model and the quality of the inputs to the model. The location of temperature measurement must provide a representative measurement of the change in temperature that will affect the machine structure. The number of sensors and their locations are not always intuitive and the time required to identify the optimal locations is often prohibitive, resulting in compromise and poor results. In this paper, a new intelligent compensation system for reducing thermal errors of machine tools using data obtained from a thermal imaging camera is introduced. Different groups of key temperature points were identiﬁed from thermal images using a novel schema based on a Grey model GM (0,N) and fuzzy c-means (FCM) clustering method. An Adaptive Neuro-Fuzzy Inference System with fuzzy c-means clustering (FCM-ANFIS) was employed to design the thermal prediction model. In order to optimise the approach, a parametric study was carried out by changing the number of inputs and number of membership functions to the FCM-ANFIS model, and comparing the relative robustness of the designs. According to the results, the FCM-ANFIS model with four inputs and six membership functions achieves the best performance in terms of the accuracy of its predictive ability. The residual value of the model is smaller than ±2 l m, which represents a 95% reduction in the thermally-induced error on the machine. Finally, the proposed method is shown to compare favourably against an Artiﬁcial Neural Network (ANN) model. (cid:2) 2014 The Authors. Published by Elsevier Inc. This is an open access article under the CC BY license (http://creativecommons.org/licenses/by/3.0/).


Introduction
Thermal errors can have significant effects on CNC machine tool accuracy. They arise from thermal deformations of the machine elements created by external heat/cooling sources or those that exist within the structure (i.e. bearings, motors, belt drives, the flow of coolant and the environment temperature). According to various publications [1,2], thermal errors represent approximately 70% of the total positioning error of the CNC machine tool. Spindle drift is often considered to be the major error component among them [1]. Thermal errors can be reduced by amending a machine tool's structure using advanced design and manufacture procedures, such as structural symmetry or cooling jackets. However, an error compensation system is often considered to be a less restrictive and more economical method of decreasing thermal errors. An extensive study has been carried out in the area of thermal error compensation [3]. There are two general schools of thought related to thermal error compensation. The first uses numerical analysis techniques such as the finite-element method [4] and finite-difference method [5]. These methods are limited to qualitative analysis because of the problems of establishing the boundary conditions and accurately obtaining the characteristics of heat transfer. The second approach uses empirical modelling, which is based on correlation between the measured temperature changes and the resultant displacement of the functional point of the machine tool, which is the change in relative location between the tool and workpiece. Although this method can provide reasonable results for some tests, the thermal displacement usually changes with variation in the machining process. An accurate, robust thermal error prediction model is the most significant part of any thermal compensation system. In recent years, it has been shown that thermal errors can be successfully predicted by empirical modelling techniques such as multiple regression analysis [6], types of Artificial Neural Networks [7], fuzzy logic [8], an Adaptive Neuro-Fuzzy Inference System [9,10], Grey system theory [11] and a combination of several different modelling methods [12,13].
Chen et al. [6] used a multiple regression analysis (MRA) model for thermal error compensation of a horizontal machining centre. With their experimental results, the thermal error was reduced from 196 to 8 lm. Yang et al. [14] also used the MRA model to form an error synthesis model which merges both the thermal and geometric errors of a lathe. With their experimental results, the error could be reduced from 60 to 14 lm. However, the thermal displacement usually changes with variation in the machining process and the environment; it is difficult to apply MRA to a multiple output variable model. In order to overcome the drawbacks of MRA models, more attention has subsequently been given to the Artificial Intelligence (AI) techniques such as Artificial Neural Networks (ANNs). Chen et al. [7] proposed an ANN model structured with 15 nodes in the input layer, 15 nodes in the hidden layer, and six nodes in the output layer in order to drive a thermal error compensation of the spindle and lead-screws of a vertical machining centre. The ANN model was trained with 540 training data pairs and tested with a new cutting condition, which was not included within the training pairs. Test results showed that the thermal errors could be reduced from 40 to 5 lm after applying the compensation model, but no justification for the number of nodes or length of training data was provided. Wang [13] used a neural network trained by a hierarchy-genetic-algorithm (HGA) in order to map the temperature variation against the thermal drift of the machine tool. Wang [10] also proposed a thermal model merging Grey system theory GM (1,m) and an Adaptive Neuro-Fuzzy Inference System (ANFIS). A hybrid learning method, which is a combination of both steepest descent and least-squares estimator methods, was used in the learning algorithms. Experimental results indicated that the thermal error compensation model could reduce the thermal error to less than 9.2 lm under real cutting conditions. He used six inputs with three fuzzy sets per input, producing a complete rule set of 729 (3 6 ) rules in order to build an ANFIS model. Clearly, Wang's model is practically limited to low dimensional modelling. Eskandari et al. [15] presented a method to compensate for positional, geometric, and thermally induced errors of three-axis CNC milling machine using an offline technique. Thermal errors were modelled by three empirical methods: MRA, ANN, and ANFIS. To build their models, the experimental data was collected every 10 min while the machine was running for 120 min. The experimental data was divided into training and checking sets. They found that ANFIS was a more accurate modelling method in comparison with ANN and MRA. Their test results on a free form shape show average improvement of 41% of the uncompensated errors. A common omission in the published research is discussion or scientific rigour regarding the selection of the number and location of thermal sensors. Other researchers have shown that a precise selection of thermal sensors and their position is needed to ensure the prediction accuracy and robustness of compensation models. Poor location and a small number of thermal sensors will lead to poor prediction accuracy. However, a large number of thermal sensors may have a negative influence on a model's robustness because each thermal sensor may bring noise to the model as well as bringing useful information. Additionally, issues of sensor reliability are commercially sensitive; the fewer sensors installed the fewer potential failures. Engineering judgment, thermal mode analysis, stepwise regression and correlation coefficient have been used to select the location of temperature sensors for thermal error compensation models [3]. Yan et al. [14] proposed an MRA model combing two methods, namely the direct criterion method and indirect grouping method; both methods are based on the synthetic Grey correlation. Using this method, the number of temperature sensors was reduced from sixteen to four sensors and the best combination of temperature sensors was selected. Jan Han et al. [16] proposed a correlation coefficient analysis and fuzzy c-means clustering for selecting temperature sensors both in their robust regression thermal error model and ANN model [17]; the number of thermal sensors was reduced from thirty-two to five. However, these methods suffer from the following drawbacks: a large amount of data is needed in order to select proper sensors; and the available data must satisfy a typical distribution such as normal (or Gaussian) distribution. Therefore, a systematic approach is still needed to minimise the number of temperature sensors and select their locations so that the downtime and resources can be reduced while robustness is increased. It is notable that most publications deal only with the reduction in sensors, but not the means by which the original set were determined. As a result the system is only shown for situations where the possible solutions are a subset of all potential locations, which requires non-trivial preconditioning of the problem. This is a situation where some aspects of the machine spatial temperature gradients might already have been missed and is typical when a machine model is being adapted, rather than evaluated from a new perspective.
In order to overcome the drawbacks of traditional Artificial Intelligence techniques such as ANNs and fuzzy logic, more attention has been focussed on hybrid models. For instance, in the fuzzy system's applications, the membership functions (MFs) typically have to be manually adjusted by trial and error. The fuzzy model performs like a white box, meaning that the model designers can explicitly understand how the model achieved its goal. However, such models that are based only on expert knowledge may suffer from a loss of accuracy due to engineering assumptions [8]. Conversely, ANNs can learn from the data provided without preconceptions and assumptions. However, they perform as a ''black box,'' which means that there is no information regarding the method by which the goal is achieved and so the achieved optimal solution can exhibit unrealistic physical characteristics that do not extrapolate to other situations. Applying the ANN technique to optimise the parameters of a fuzzy model allows the model to learn from a given set of training samples. At the same time, the solution is mapped out into a Fuzzy Inference System (FIS) that can be evaluated by the model designer as to produce a realistic representation of the physical system. The Adaptive Neuro Fuzzy Inference System (ANFIS) is such a neuro-fuzzy technique. It combines fuzzy logic and neural network techniques in a single system.
Construction of the ANFIS model using a data-driven approach usually requires division of the input/output data into rule patches. This can be achieved by using a number of methods such as grid partitioning or the subtractive clustering method [18]. However, one limitation of standard ANFIS is that the number of rules rises rapidly as the number of inputs increases (number of input sensors). For instance, if the number of input variables is n, and M is the partitioned fuzzy subset for each input variable, then the number of possible fuzzy rules is M n . As the number of variables rises, so the number of fuzzy rules increases exponentially, increasing the load on the computer processor and increasing memory requirements. Thus, a reliable and reproducible procedure to be applied in a practical manner in ordinary workshop conditions was not proposed. It is important to note that an effective partition of the input space can decrease the number of rules and thus increase the speed in both learning and application phases. A fuzzy rule generation technique that integrates ANFIS with FCM clustering is applied in order to minimise the number of fuzzy rules. The FCM is used to systematically create the fuzzy MFs and fuzzy rule base for ANFIS.
In this paper, a thermal imaging camera was used to record temperature distributions across the machine structure during the experiments. The thermal images were saved as a matrix of temperatures with a specific resolution of one pixel, each of which can be considered as a possible temperature measurement point. The size of a temperature sensor means that, in a practical compensation system, sensing could not be physically applied at that spatial resolution. However, the locations can be centred on the optimal position and it is possible to use localised averaging of pixels to reduce any noise across the image. The Grey system theory and fuzzy c-means clustering are applied to minimise the number of temperature points and select the most suitable ones for a given target accuracy. ANFIS using FCM was implemented to derive a thermal prediction model. Temperature measurement points were chosen as inputs and thermal drift data was synchronously measured by non-contact displacement transducers (NCDTs) as the output. The ANFIS with FCM uses these input/output pairs to create a fuzzy inference system whose membership functions (MFs) are tuned using either the back-propagation (BP) or least-squares estimator learning algorithm. Using the rule base of FCM can increase the speed of the learning process and improve results. Finally, the performance of the proposed ANFIS model was compared with a traditional ANN model.

Thermal imaging camera
A thermal imaging camera provides a visible image of otherwise invisible infrared light that is emitted by all bodies due to their thermal state. The thermal imaging camera has become a powerful tool for researchers and has applications in various fields such as medicine, biometrics, computer vision, building maintenance and so on. In this paper, a high-specification thermal imaging camera, namely a FLIR ThermaCAM Ò S65, was used to record a sequence of thermal images of temperature distributions across the spindle carrier structure. This camera provides a sensitivity of 0.08°C, and an absolute accuracy of ± 2%. Full camera specifications are provided in Table 1. The thermal imaging camera offers a continuous picture of the temperature distribution in the image field-of-view. This is important as it provides the distribution of heat during heating and cooling cycles across the whole machine structure. This allows the machine's structural elements to be measured online during the test. As well as the camera providing live continuous thermal images, they can also be recorded for further analysis. The thermal images are saved as a matrix of temperatures with a specific resolution of one pixel (equivalent to 2.25 mm 2 ), which equates to over 76,000 temperature measurement points for this 320 Â 240 resolution camera. These thermal images can be transferred to a personal computer for analysis.
In this work, the data has been analysed using MATLAB. One disadvantage of thermal imaging is it can have low absolute accuracy, usually in the order of ± 2°C. A number of MATLAB functions have been developed to enhance this accuracy, including averaging the images to reduce pixel noise, alignment of images and extraction from the temperature data by averaging groups of pixels at a specific point [19].
The radiation measured by the thermal camera depends on the temperature of the machine tool structure, but is also affected by the emissivity of the machine surfaces. Additionally, radiation reflects from shiny surfaces (ball screw, test mandrel, etc.), and is directly captured by the thermal camera and appearing as very hot areas. In order to measure the temperature of the machine structure precisely it is therefore necessary to know the emissivity accurately, for which the application of masking tape with a known emissivity (0.95) is a common and effective solution. The camera parameters are then set according to the measurement conditions considering the emissivity of the machine tool material, the distance between the machine and the camera, the relative humidity and the ambient temperature, as shown in Table 2.

Adaptive Neuro-Fuzzy Inference System (ANFIS)
The Adaptive Neuro Fuzzy Inference System (ANFIS), was first introduced by Jang, in 1993 [20]. According to Jang, the ANFIS is a neural network that is functionally the same as a Takagi-Sugeno type inference model. The ANFIS is a hybrid intelligent system that takes advantages of both ANN and fuzzy logic theory in a single system. By employing the ANN technique to update the parameters of the Takagi-Sugeno type inference model, the ANFIS is given the ability to learn from training data, the same as ANN. The solutions mapped out onto a Fuzzy Inference System (FIS) can therefore be described in linguistic terms. In order to explain the concept of ANFIS structure, five distinct layers are used to describe the structure of an ANFIS model. The first layer in the ANFIS structure is the fuzzification layer; the second layer performs the rule base layer; the third layer performs the normalisation of membership functions (MFs); the fourth and fifth layers are the defuzzification and summation layers, respectively. More information about the ANFIS network structure is given in [20].
ANFIS model design consists of two sections: constructing and training. In the construction section, the number and type of MFs are defined. Construction of the ANFIS model requires the division of the input/output data into rule patches. This can be achieved by using a number of methods such as grid partitioning, subtractive clustering method and fuzzy c-means (FCM) [18]. In order to obtain a small number of fuzzy rules, a fuzzy rule generation technique that integrates ANFIS with FCM clustering will be applied in this paper, where the FCM is used to systematically create the fuzzy MFs and fuzzy rule base for ANFIS. Fig. 1 shows basic structure of the ANFIS with FCM clustering.
In the training section, training data pairs should first be generated to train an ANFIS model. These data pairs consist of the ANFIS model inputs and the corresponding output. The membership function parameters are able to change through the learning process. The adjustment of these parameters is assisted by a supervised learning of the input/output dataset that are given to the model as training data. Different learning techniques can be used, such as a hybrid-learning algorithm combining the least squares method and the gradient descent method is adopted to solve this training problem.

Fuzzy c-means clustering
Fuzzy c-means (FCM) is a data clustering method in which each data point belongs to a cluster, with a degree specified by a membership grade. Dunn introduced this algorithm in 1973 [21] and it was improved by Bezdek in 1981 [22]. FCM partitions a collection of n vectors x i ; i ¼ 1; 2; . . . ; n into fuzzy groups, and determines a cluster centre for each group such that the objective function of dissimilarity measure is reduced.
i ¼ 1; 2; . . . ; c are arbitrarily selected from the n points. The steps of the FCM method are, explained in brief: Firstly, the centres of each cluster c i ; i ¼ 1; 2; . . . ; c are randomly selected from the n data patterns fx 1 ; x 2 ; x 3 ; . . . ; x n g. Secondly, the membership matrix (l) is computed with the following equation: where, l ij : The degree of membership of object j in cluster i; m: is the degree of fuzziness ðm > 1Þ; and d ij ¼ jjc i À x j jj: The Euclidean distance between c i and x j .
The process is stopped if it falls below a certain threshold. Finally, the new c fuzzy cluster centres c i ; i ¼ 1; 2; . . . ; c are calculated using the following equation: In this paper, the FCM algorithm will be used to separate whole training data pairs into several subsets (membership functions) with different centres. Each subset will be trained by the ANFIS, as proposed by Park et al. [23]. Furthermore, the FCM algorithm will be used to find the optimal temperature data clusters for thermal error compensation models.

Grey model GM (0, N)
The interaction between different temperature sources and sinks creates a complex non-linear thermal behaviour for a machine tool. The model designers often want to know which sources have a dominant effect and which exert less influence on thermal response of the machine tool. The Grey systems theory, introduced by Deng in 1982 [24], is a methodology that focuses on studying the Grey systems by using mathematical methods with a only few data sets and poor information. The technique works on uncertain systems that have partial known and partial unknown information. It is most significant advantage is that it needs a small amount of experimental data for accurate prediction, and the requirement for the data distribution is also low [25]. The Grey model GM (h, N) is based on the Grey system theory, where h is the order of the difference equation and N is the number of variables [26]. The GM (h, N) model is defined as follows: If in sequences x N ðkÞ are the influence factors of the same system, then the GM (h, N) model is described as [26,25]: According to the previous definition of GM (h, N), the GM (0, N) is a zero-order Grey system, which can be described as follows:  From Eq. (4), we can write: The coefficients of the model can then be estimated from the following equation: where, Therefore, the influence ranking of the major sequences (input sensors) on the influencing sequence (thermal drift) can be known by comparing the model values of ðh 2 $ h N Þ.
The whole block diagram of the proposed system is shown in Fig. 2, where spots 1 to N represent the virtual temperature sensor data captured from the thermal imaging camera, and the thermal drift obtained from non-contact displacement transducers (NCDTs).

Experimental setup
In this study, experiments were performed on a small vertical milling centre (VMC). The thermal imaging camera was used to record a sequence of temperature distributions across the spindle-carrier structure of the machine tool. Three NCDTs were used to measure the resultant displacement of a solid test bar, used to represent the tool. Two sensors, vertically displaced by 100 mm, measure both displacement and tilt in the Y-axis direction and a third measures displacement in the Z-axis direction (see Fig. 3). Distortions in the X-axis direction were not measured during this study, since experience has shown that the symmetry of the machine structure renders this effect negligible. A general overview of the experimental setup is shown in Fig. 4.
The use of masking tape on the machine provides areas of known emissivity. In particular, in some locations such as on the rotating test bar, the tape is required to provide a temperature measurement, which would be difficult to achieve by other means.
The VMC was examined by running the spindle at its highest speed of 9000 rpm for 120 min to excite the thermal behaviour. The spindle was then stopped for approximately 50 min for cooling. The thermal imaging camera was positioned approximately 1500 mm from the spindle carrier to ensure that the parts of the machine of interest were within the field of view. Images were captured and stored to the camera's memory card during the experiment at 10 s intervals. The thermal displacement at the spindle was measured simultaneously and is shown in Fig. 5. The maximum displacement for the Y top-axis is 20 lm, the Y bottom-axis is 23 lm, and the Z-axis is 35 lm.
MATLAB functions were developed to enhance and analyse the temperature data [19]. These functions include image averaging (to reduce noise from individual pixels), image alignment and the ability to extract a discrete point precisely by averaging groups of pixels. In addition, efficient methods of creating virtual sensors were created, including the ability to draw ''lines'' of temperature sensor spots representing strips [19]. This is important in order to obtain sufficient temperature data readings across the carrier structure. A Grey model was applied to the measured temperature data to quantify the influence of each spot across the carrier structure. Fig. 6 shows thermal images with 525 discrete spots on the carrier and Fig. 7 shows some extracted readings from these spots taken over the duration of the whole test.

Application of GM (0, N) model
The machine was run through a test-cycle of 120 min heating and approximately 70 min cooling. The temperature change and displacement of the spindle relative to the table in the Z-axis was captured throughout the test. This was used in the GM (0, N) model to determine which parts within the machine structure contribute most significantly to the total thermal displacement. Further analysis then concentrated on the influence coefficient of discrete points using the FCM method. The process is as follows:    First, the GM (0, N) model of Grey system theory is calculated using the temperature changes and displacement of spindle nose in the Z-axis.
Suppose that Spot-1$Spot-525 represents the major variables (inputs) x  8), as jh 2 j $ jh 526 j, indicating the influence weighting of the input data against the output data, respectively. The greater the influence weight, the greater the impact on the thermal error, and the more likely it is that the temperature variable can be regarded as a possible modelling variable. Fig. 8 shows a 3D plot of the influence coefficient matrix.
From Fig. 8, the flow of heat across the carrier can be clearly seen. Different points have different influence on thermal error in the Z direction; the points near the motor are the highest factors. During the cooling cycle, it can be seen (Fig. 5) that the test bar shows some movement occurred immediately after the spindle was stopped. This movement is probably caused by the expansion of the test bar itself; the localised heat from the motor and spindle bearings flow into the bar and there is no cooling effect from air turbulence. This flow of heat into the test bar is a significant contributor to the drift in the Z direction as the tool continues to expand after the spindle has stopped. An investigation of the source of this growth of the test bar was carried out by extracting ten spots during the same heating and cooling test as show in Fig. 9. The GM (0, N) model of the Grey system theory was applied again on a specific period ''snapshot'' of the test as shown in Fig. 10. Fig. 11 shows the GM (0, N) model output for the selected period. It can be observed that the temperature change of different selected spots on the carrier has different influence on the thermal error in the Z-axis direction and the spots 9 and 10 on the test bar are the most important factors, while spot 7 is the most significant location on the machine structure. The GM (0, N) model provides a method to analyse systems where traditional methods such as the correlation coefficient do not seem  appropriate. It is applicable irrespective of the size of data sets and independent of requirement for a specific distribution. The results of this investigation indicate that the GM (0, N) model is a good optimisation tool for finding the proper selection of thermal sensors and their location.    Influence ranking Fig. 11. Influence ranking of ten temperature spots using GM (0, N).

Thermal error modelling and discussion
The temperature sensors were clustered into a different number of groups using FCM as described in Section 5, starting with one cluster for group 1 up to eight clusters for group 8. Then, one sensor from each cluster was selected according to its correlation with the thermal drift to represent the temperature sensor of the same category (see Table 3); eight ANFIS models were constructed from these representative spots for evaluation. An example of the clustering procedure for four clusters is shown in Fig. 12.
It is important to understand any uncertainty that is created by variation of the model design. A parametric study was conducted by testing the accuracy of the models with variation in number of inputs and in number of membership functions. Eight models were developed as follows: representative temperature sensors from Table 3 were selected as input variables and the thermal drift in the Z-direction was considered as a target variable. The same test (120 min heating and 70 min cooling) was used for training and validation the models: experimental data are divided into training and checking datasets. The training dataset is used to train (or tune) a fuzzy model, while the checking dataset was used for over-fitting model validation. The Gaussian functions are used to describe the membership degree of these inputs, due to their advantages of being smooth and non-zero at each point [9]. After setting the initial parameter values in the FCM-ANFIS models, the models were adjusted using a hybrid learning scheme.
Extensive simulations were conducted to select the optimal number of MFs (clusters) and number of iterations (epoch number) for each model. The performance of the model depends on the combination of these different parameters. Too Table 3 The cluster results. few MFs do not allow the FCM-ANFIS models to be mapped well. However, too many MFs increase the difficulty of training and lead to over-fitting or memorising undesirable inputs such as noise. The prediction errors were measured separately for each model using the root mean square error (RMSE) index. By varying the simulations, it was determined that the optimal solution was six MFs in the first five models, and three MFs for the remaining models. Different numbers of epochs were selected for each model because the training process only needs to be carried out until the errors to converge. An example of selecting MFs with four inputs is presented in Table 4. In order to examine the performance of all the FCM-ANFIS models on non-training data, another test was carried out on the same machine in an operational cycle as follows. The machine was programmed to run at spindle speed of 8000 rpm for 60 min and then 40 min with the spindle stopped. It was then run again at spindle speeds of 4000 rpm and 9000 rpm for 30 min and 40 min respectively. Finally, measurement continued for another 40 min with the spindle stopped. During the experiment, the thermal errors were measured by the NCDTs, and the predicted displacements were obtained using FCM-ANFIS models.

No of groups
The performances of the models used in this study were computed using four performance criteria: root mean square error (RMSE), Nash-Sutcliffe efficiency coefficient (NSE), correlation coefficient (R) and also residual value. The equations of first two are defined as: where, Z: Thermal drift; P: The predicted thermal drift; Z: Average of the thermal drift; and n: The number of measured data. In Table 5, the prediction performance of eight FCM-ANFIS models was compared for training and non-training data respectively. Table 5 illustrates the obtained results from all eight developed models. From these results, it can be observed that both NSE and RMSE have promising values during the training stage for all the models. However, during the testing stage the models with one and two input variables gave low efficiency, low correlation coefficient and high residual value due to insufficient data regarding the system behaviour. In addition, the seven and eight inputs models did not give as good results as the other models due to redundancy of input data. The FCM-ANFIS model with four inputs gives the best estimation, taking into account the performance indices (higher efficiency coefficient NSE = 0.97 higher correlation coefficient R = 0.9912, and lower mean square error RMSE = 1.4139) and lowest residual value amongst others as shown in Fig. 13.
The structure of the FCM-ANFIS model with four inputs is shown in Fig. 14. There are four input neurons, corresponding to the four selected representative sensors. In the second layer, six neurons are connected to each input neuron (in total 24 neurons), which correspond to six Gaussian membership functions for each input sensor as shown in Fig. 15. The next layer contains six neurons equivalent to six fuzzy ''if-then'' rules. The result of the prediction process is presented by six neurons in the output layer. A weighted average method is used for the defuzzification stage in order to obtain the final predicted thermal drift. Fig. 16 describes the temperature rise during the testing experiment. It can be seen that the temperature extracted from the representative sensors fluctuated due to change of the spindle speed, which causes sudden change in the resultant displacement in the Z-axis direction. The simulation result shows that the proposed FCM -ANFIS model can predict the error accurately and can also track the rapid changes of thermal error precisely (the maximum residual is approximately ± 2 lm). Thus, a model with four representative temperature sensors is therefore a powerful and precise predictor of the thermal errors of the machine tool (see Fig. 17).
The prediction of the FCM-ANFIS model with four selected key temperature points can significantly reduce the thermal error from an independent test under different conditions of varying rotational spindle speeds and dwells on the machine tool. To emphasise the importance of correctly finding the optimal sensor locations, one of the virtual sensors was arbitrarily moved from the location determined by this method to another location that could have been selected intuitively, i.e. with some engineering justification. It is noticeable that by changing just one temperature point from the key temperature points gives unsatisfactory prediction ability (residual value ± 9 lm), which implies that the proposed methods (GM (0, N) and FCM) are a valid and important combination to build an accurate model.

Comparison with other models
In order to assess the ability of FCM-ANFIS model relative to that of a neural network model, an ANN model was constructed using the same input variables to the ANFIS with four inputs. Usually ANN model have three layers: Input, hidden and output layer. Although, for common engineering problems, one hidden layer is sufficient for model training, two or more   hidden layers may be needed for very complex phenomena [9]. An ANN model with three layers was used in this study: the input layer has four input variables and the output layer has one neuron (the thermal drift in the Z-axis direction).
The same test (120 min heating and 70 min cooling) was used for training the model; the experimental data are divided into training and validation datasets. After a series of experiments to find the best architecture, an ANN model with 10 neurons in the hidden layer was constructed to predict the thermal drift in the Z-axis direction. Prediction results using ANFIS and ANN are shown in Fig. 18, where the two models were trained using the same training dataset and tested by the same testing dataset. The same four performance criteria of root mean square error (RMSE), Nash-Sutcliffe efficiency coefficient (NSE) and correlation coefficient (R) were used to judge the optimal model. According to the results in Fig. 18 and the evaluation criteria in Table 6 it is very clear that the ANFIS model has smaller RMSE and higher NSE compared to the ANN model. Therefore, the ANFIS model is shown to be a good modelling choice to predict the thermal error of machine tools. Moreover, the ANN model is a black box in nature and its relationships between inputs and outputs are difficult to interpret, while ANFIS is transparent and its ''if-then'' rules are easy to understand and interpret.

Conclusion
In this paper, a thermal imaging camera has been used to record temperature distributions across the spindle carrier structure during the experiments. The thermal images are saved as a matrix of temperatures with a specific resolution of one pixel (equivalent to 2.25 mm 2 ). This system equates to over 76,000 possible temperature measurement points. Averaging, which is used to decrease noise, reduces the number of temperature locations to the equivalent of 525 points, depending upon the field of view. This richness of data is exploited to find the optimal location for temperature measurement when designing a thermal error control model.
With the use of GM (0, N) and FCM methods, the influence rankings of recorded temperature data has been found to be applicable to determine which parts within the machine structure contribute most significantly to the total thermal displacement. This eliminates the need for intuitive locating of sensors and significantly reduces implementation time. The principal advantage of this novel technique is to use thermal imaging to assess a machine's thermal behaviour and to build compensation models with different numbers and configurations of sensors. An Adaptive Neuro-Fuzzy Inference System with FCM (FCM-ANFIS) has been employed for the prediction of the thermal error in machine tools. The models are built using data obtained from short heating and cooling test, with a wide variety of models being able to be assessed using multiple simulations.
The results on this machine indicate that FCM-ANFIS model with four inputs and six rules has the optimal capability to map the input-output data pairs; it can predict thermal displacement under different operational conditions depending on  the availability of the empirical data. Perhaps counter-intuitively, the ANFIS model is less well conditioned when additional sensors are included. Minimal effort is then required for practical application of discrete contact sensors that are used for on-line compensation. The method was further tested by observing that the optimally-found model could compensate the thermal errors derived from the heat induced by running the spindle of the machine to better than ± 2 lm for an arbitrary duty cycle. However, by varying the location of one sensor to another ''intuitive'' node, the accuracy of the model fell to ± 9 lm.
In addition to the better absolute accuracy, the FCM-ANFIS has been shown to have the advantage of requiring fewer rules, in this case requiring only six rules as opposed to the standard ANFIS model. This is a significant benefit, since the latter method is significantly more laborious to construct.
Finally, an ANN model was trained using the same sensor locations and same training dataset. The FCM-ANFIS model was shown to give better performance that the ANN model. In summary, the proposed FCM -ANFIS model is a valid and promising alternative for predicting thermal error of machine tools without increasing computation overheads.