Thermal Error Model of Linear Motor Feed System Based on Bayesian Neural Network

The linear motor feed system has been in service in complex working conditions for a long time, thus causing the nonuniform distribution of the temperature field distribution. Thus, the thermal error has become a key factor affecting system motion accuracy. In order to maximize the accuracy and efficiency of thermal error compensation for linear motor feed systems, an improved modeling method for the thermal error of the linear motor feed system based on Bayesian neural networks is proposed in combination with the strong generalization performance and avoidance of overfitting of Bayesian neural networks. And the specific modeling ideas are as follows: Firstly, the X-Y cross-type two-axis linear motor feed system is taken as the test object. Due to the traditional neural network’s slow convergence, overfitting, and underfitting problems, the Bayesian neural network is used to model the thermal error of the linear motor feed system. Secondly, to avoid the influence of multicollinearity data on the final results, the grey relation analysis method is used to screen the temperature measuring points. The data with a large relation degree is selected for modeling to ensure the prediction accuracy of the neural network. Thirdly, the temperature variables of sensitive points and thermal positioning errors are taken as data input samples. Fourthly, a Bayesian neural network model is established. Fifthly, the hyperparameters of the Bayesian neural network are determined by a calculating method of Hessian matrix by Gauss-Newton approximation. And finally, a thermal error prediction model is established. The comparison and analysis with the neural network constructed by the ordinary Levenberg-Marquardt algorithm after a series of experimental demonstrations see that the prediction accuracy of the proposed method can be enhanced by up to 10%. It also shows that the prediction model has the advantages of high precision, strong generalization ability, anti-disturbance solid ability, and strong robustness, etc. Therefore, the prediction model is expected to be widely used in predicting and compensating thermal error of the feed system of high-speed CNC machine tools in practical machining occasions.


I. INTRODUCTION
As a typical complex electromechanical coupling system, the thermal performance of the linear motor feed system directly affects the feed motion accuracy and control accuracy. Especially at high speed, high acceleration, variable speed, variable acceleration, variable load, start/stop, and The associate editor coordinating the review of this manuscript and approving it for publication was Paolo Giangrande . other complex working conditions, the friction heat generated by the linear moving guide pair and the heat generated by the primary coil of the linear motor make the temperature rise and thermal expansion. They also lead to the non-uniform distribution of the temperature field of the internal and external heat sources, and then thermal deformation, which affects the system's positioning accuracy and repeated positioning accuracy. Therefore, the study of thermal error modeling and variation law of linear motor feed systems under complex VOLUME 9, 2021 This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ working conditions has important theoretical significance and application value. Research on machine tool thermal error modeling methods at home and abroad is mainly divided into empirical thermal and theoretical thermal error models. For thermal error compensation, the statistical model of thermal error is made based on experiments. Theoretical thermal error modeling often avoids thermal errors, and thermal error prediction is realized based on the relationship between heat transfer and the constraint relationship between displacement and force.
Empirical thermal error modeling methods are mainly classified into static modeling and dynamic modeling. In static modeling, the generation process of thermal error is regarded as a stationary process, and the variables, such as temperature, show the thermal error. Static modeling is divided into artificial neural network thermal error modeling and multiple linear regression analysis thermal error modeling. Reference [1] showed the thermal error model based on the ART-MAP neural network. Using different network forms and the ASCII data calculation method to train the network, the model's accuracy is controlled within ±7.4µm. Reference [2] showed the thermal prediction model based on a self-organizing deep neural network (DNN), which was used for accurate training of thermal error modeling of heavy-duty machine tool foundation system. The model has been improved in two aspects. First, a lost self-organization mechanism for unsupervised training was therefore proposed to prevent feature detectors' self-adaptation. In addition, a regularization enhanced transfer function was proposed further to reduce the less important weight in the process and improve the capability of feature extraction and generalization. The accuracy of the thermal error prediction model was verified by the thermal error experiment, which laid the foundation for subsequent research on thermal error compensation. Due to the different environment and configuration of the machine, if we want to transfer the trained model to other machines (or a new test environment), we must collect new training data, and the model must be retrained or slightly tuned. Therefore, the training model is not universal because it is trained only for a specific experiment. Fu et al. [3] applied Radial Basis Function Neural Network Based on Chicken Colony Optimization Algorithm to integrated thermal error modeling and proposed a chaotic neural network to deal with the nonlinear relationship between temperature variables and thermal error. A fitness function based on the radial basis function model was suggested to solve the optimal initial structural parameters of the radial basis function. The radial basis function was trained by using the optimal initial structural parameters and measured data, and the optimal thermal error model was established. However, the proposed thermal error model should be considered for further study under diverse experimental conditions. In addition, the thermal error model also needs to be considered for the same type of machine tools further to verify the robustness and practicability of the model. Ye et al. [4] proposed a new regression analysis modeling method to determine the thermal deformation coefficient of the machine tool moving shaft. The parameters of the thermal prediction model were obtained by the measurement of the thermal error, current boundary, and machining conditions with sensors. The dynamic characteristics of the positioning and straightness thermal error of the machine tool's moving shaft under different feed speeds, different moving shaft, and bearing mounting modes were analyzed. Finally, the theoretical model was derived based on the experimental data, and the axial and radial thermal deformation coefficients of different times and positions were obtained. However, the study used 12 temperature measuring points, which may influence the regression results. Because the regression results might be affected by some temperature which had little relationship with thermal deformation. Zhu et al. [5] proposed a thermal error modeling and compensation method for a precision feed system based on collaborative training support vector machine regression algorithm (COSVR). The thermal error model was established by integrating labeled data (temperature and thermal error) and unlabeled temperature data. The compensation method based on the Siemens 840D, numerical control system, was used to compensate for the thermal error. The X-axis of the precision boring machine's double drive ball screw feed system was taken as the research object to carry out the thermal characteristics experiment. The thermal error model was established using COSVR to integrate all the data. The results showed that the COSVR model has better prediction performance and could more effectively reduce the thermal error. However, in the machine tool thermal characteristics experiment, it was difficult to measure the thermal error online under many working conditions. That part of the thermal error cannot be tested but can only be used for prediction calculation. The dynamic model needs to consider the elastic effect of thermal deformation. Yang et al. [6] used an improved Elman network (EN) and compared the results with RBF neural network, and improved the prediction accuracy of the machine tool compensation model. Xia et al. [7] used the grouping explicit algorithm to solve the thermal problem of a finite length one-dimensional bar numerically and proposed predicting the thermal error of a certain lead screw feed system by combining the NARMAX time series with the neural network model.
Theoretical thermal error modeling needs to consider three heat transfer forms: heat conduction, convective heat dissipation, and heat radiation. Based on the law of heat conservation, the temperature field is solved, and then the deformation is calculated. It mainly divides into concentrating mass method and finite element method. During the modeling process of the lumped mass method, it is necessary to simplify the model according to the geometric shape and size of the parts. The simplified model comprises multiple lumped mass points connected by thermal resistance, and an energy conservation equation is established for each node. Xu et al. [8], [9] found the thermal behavior model of the lead screw system by using the improved concentrated mass method, revised the influence coefficient of the model according to the experimental results, and estimated the thermal error of the lead screw system and the effectiveness of the air cooling system and the coolant system. The experimental results verified the correctness of the thermal model. Still, the preconditions of the thermal model involve some assumptions, which had some gaps compared with the natural working environment of the motor. The finite element method uses finite element software for thermal error modeling. Based on the study of thermal-structure coupled finite element data flow and its critical conditions, Zhang et al. [10] calculated the heat source power, forced convection heat transfer coefficient between rotating surface and air at different speeds, combined heat transfer coefficient between stationary surface and external environment and thermal resistance of key contact surfaces. Based on the finite element simulation analysis of the thermal model, the temperature characteristics, thermal deformation mechanism, and state of the whole machine were obtained. But only the boundary conditions of the spindle system were considered, and the other system was ignored. Using the finite element method, Uhlmann and Hu [11] proposed a thermal model to simulate the thermal behavior of a high-speed machining center equipped with a linear motor. The complex boundary conditions such as heat source, contact, and convective heat transfer were considered in this model. Instantaneous temperature changes and deformation were allowed in this solution. The experimental comparison showed that the model could predict the temperature distribution and positioning error under specific working conditions. However, the deformation in this paper is the deformation of the whole system. For error compensation, the thermal error of the main shaft should be taken into account. The thermal error studied is too broad and not accurate enough. As a mature numerical calculation method, the finite element method is widely used in the thermal error modeling of machine tools. The simulation accuracy is very high when the boundary conditions are not complicated. However, in most cases, the boundary conditions have to be optimized through experiments. This method can only be used for modeling and simulation and cannot be directly used for error compensation.
The heating process of the linear motor is very complex. Zhao et al. [12] and Pei et al. [13] studied the heat dissipation effect of the linear motor with overload operation by using water cooling. When the heating model was established, the heat source calculation results were not rigorous enough and lacked calculation steps; The results of the finite element model were lack of boundary condition setting process, and the results were not convincing. Zaouia et al. [14] carried out multi-physical modeling and numerical analysis for the tubular linear switched reluctance motor. Firstly, the electromagnetic mechanical model of the motor was established. Then the nonlinear magnetic problem was studied, involving Maxwell's equation, Galactonian finite element method, and the Newton-Raphson method, etc. Finally, the heating model was obtained. Tan et al. [15] established the thermal model of bistable permanent magnet actuator and calculated the armature iron loss and coil copper loss, respectively. However, the calculation process of iron loss is complicated. It is not applicable to calculate the heat source of a linear motor, and its application scope is small. Iron loss is not the primary heat source for linear motors, so a simplified method should be adopted to calculate the iron loss. Luo et al. [16] studied the slotless tubular permanent magnet linear motor that used mechanical and electromagnetic coupling differential equations. And the relationship between motor mass and motor performance in the punching system was obtained. However, in the process of motor operation, the thermal performance of the motor was not considered, and the thermal effect of the linear motor is an essential factor that should not be ignored. Liu et al. [17] studied the current density of permanent magnet synchronous linear motor (PMLSM). They designed a PMLSM with high current density using electromagnetic-thermal coupling field analysis and fitting method. Li et al. [18] studied the thermal characteristics of T-type linear ultrasonic motor with longitudinal vibration transducer under no-load by measuring the surface temperature of the driving pin, piezoelectric ceramics, and end cover with a thermal imager. Jiao et al. [19] proposed a nodal thermal modeling method based on a piecewise equivalent thermal loop, which was used to analyze the steady and transient thermal states of tubular linear oscillation motors. However, the nodal thermal modeling method of the segmented equivalent thermal loop is much more complex than the finite element modeling method.
Based on one-dimensional heat conduction and onedimensional thermal expansion theory, Lin et al. [20] deduced the temperature distribution model and thermal deformation error dynamic model of linear motor-driven feed shaft thermal dynamic process. Combining the finite element analysis method and experiment, they constructed the dynamic identification model of thermal pseudo lag deformation of direct feed shaft based on key temperature points. The results showed that the dynamic identification model could effectively predict the dynamic thermal behavior, and the feed accuracy of the direct feed shaft could be improved by constructing the thermal deformation compensation system. However, the proposed compensation scheme is missing in the article.
The errors of linear motor feed systems in operation can be divided into two kinds. One is the thermal error, and the other is the system error. The system error is caused by the inaccuracy of the motor servo system. Aiming at the problem that the control precision of the servo drive system is easily affected, adaptive control [21], robust control [22], and sliding mode control have been proposed. Wang et al. [23] proposed an improved prescribed performance control method, which avoids the singularity problem and relaxes the requirements for initial conditions. And an adaptive law was presented to estimate the unknown upper boundary parameters of the system uncertainties, including the unknown nonlinearities, model uncertainties, and external disturbances. In reference [24], a specified performance function was introduced into the control design to improve VOLUME 9, 2021 the transient behavior and steady-state convergence performance. A new asymptotic tracking controller is designed, which is combined with the robust integral of the sign of the error (rise) to compensate the neural network approximation error and external interference to achieve the approaching tracking performance. It should be noted that the positioning error data obtained by the experimental measurement is the sum of thermal error and system error. In order to improve the modeling accuracy, the system error should be subtracted from each positioning error data in the modeling process.
There is a lack of uncertainty measurement in prediction in the current neural network architecture. So, we need Bayesian neural networks. Bayesian neural networks are more significant for overfitting and can be learned quickly from small data sets. The Bayesian method further provides uncertainty estimation by its parameters in the form of the probability distribution. Meanwhile, by integrating the parameters with a prior probability distribution, the average value is calculated during the training period, which provides a regularization effect to the neural network. The Bayesian optimization algorithm has the potential to select the hyperparameters of general machine learning algorithms [25]. Liang et al. [26] proposed an effective model based on a Bayesian neural network to predict the ground vibration caused by trains. Maier et al. [27] used the Bayesian method to optimize the process parameters of turning and reduce the number of experiments. The Bayesian neural network can obtain a relatively stable model based on less data, and the distribution of parameters in each layer is obtained (generally, it is assumed that the parameters in each layer obey Gaussian distribution, and the mean and variance are calculated according to the training set data). It can effectively solve the problem of overfitting, not only predict the result but also effectively predict the error of the result, reducing the possibility of the local minimum solution. Therefore, this method also has good performance in thermal error data processing and modeling. The LM(Levenberg-Marquardt) algorithm is traditionally used to train neural networks because it is not difficult to fall into local optima. When the LM algorithm is training the neural network, the error is generally allowed to develop in the direction of increasing. At the same time, the weight of the network is optimized by combining the Gauss-Newton approximation method and the gradient descent method to obtain a neural network structure with fast convergence and an excellent fitting effect. The calculation is simple but requires a lot of memory. Bayesian regularization is the optimization of the LM algorithm, so this paper uses the Bayesian neural network for training.
In this paper, the empirical thermal error modeling method is used to model the thermal error of the linear motor feed system. In view of the lack of random factors in thermal error modeling of the linear motor feed system, and the problem that BP neural network using traditional LM algorithm is easy to produce overfitting, a thermal error modeling of linear motor feed system based on Bayesian neural network is proposed. Since it is challenging to measure the thermal error in machining directly, it is necessary to reflect the thermal error with easily observed variables. By analyzing the thermal deformation mechanism of the machine tool, it is known that temperature is selected as an independent variable and thermal positioning error as the dependent variable. An infrared thermal imager measures the temperature field at different feeding speeds and different times. Then the laser interferometer is used to measure the thermal positioning error. The spindle thermal drift of the rotary motor is easy to measure, which is the manifestation of the thermal error of the rotary motor. The thermal error of the linear motor is mainly reflected in the thermal positioning error, so the thermal positioning error is selected to represent the thermal error of the linear motor feed system. According to the temperature and thermal positioning error of the measuring point at different times, the gray relation analysis is carried out, and the thermal sensitive points with the relation degree of thermal positioning error are selected. The temperature data of sensitive points and thermal positioning error data are used to train the Bayesian neural network. The final modeling results show that this method can effectively predict the thermal positioning error of the linear motor feed system. The rest of this paper is arranged as follows: the basic theory of the Bayesian neural network is deduced, the thermal positioning error measurement experiment is carried out, the thermal sensitive points are selected, the Bayesian neural network thermal error model is constructed, and its effect is verified.
The contributions of this article are listed as follows: 1) To solve the problem of slow convergence, over-fitting, and under-fitting of the traditional neural network, a Bayesian neural network is used to model the thermal error of the linear motor feed system. 2) The basic principle of the Bayesian neural network has been deduced. 3) Grey relation analysis is used to screen the temperature data to avoid the influence of multicollinearity data on the final results. Moreover, data with a large relation degree are screened for modeling to ensure the prediction accuracy of the neural network. 4) The neural network has good generalization and prediction accuracy and can estimate the thermal positioning error data according to the temperature data of thermal sensitive points.

II. HEAT GENERATION AND HEAT TRANSFER PRINCIPLE
Since the main heating component of the linear motor feed system is the coil assembly, we focus on this component rather than friction. The heat generated by the coil assembly results from coil resistance (which varies with temperature), electromagnetic eddy currents, and hysteresis. Heat generation is a complex phenomenon. In linear motor designs for industrial applications, electrical current is the primary source of heat generation. In the steady-moving feed-driven stage, the continuous electrical current generates power to move the stage. The heat in the coil assembly is generated by continuous electrical current and fixed electrical resistance. Then the heat is transferred from the interior to the surface of the linear motor through convection, conduction, and radiation and then to the surrounding environment through the medium. In the motor temperature field analysis, only heat conduction and convection are considered in the model because the radiation factor is too complicated and has little influence. In the process of heating generation and heat transfer, the temperature therefore changes. The metal parts of a linear motor constantly absorb and release heat in heat transfer, resulting in deformation and eventually leading to thermal errors.

III. BASIC PRINCIPLES AND ALGORITHM STEPS OF BAYESIAN NEURAL NETWORK
The traditional neural network has some problems, such as not being fast enough to converge and usually generating local minimum phenomenon. In this paper, the thermal error model of the linear motor feed system is established by using a Bayesian neural network combined with the temperature data and thermal position error data of the linear motor feed system. The Bayesian neural network model describes the uncertainty of parameter estimation and thermal error using the posterior distribution and prediction distribution, which enriches the calculation of thermal error, and avoids the over-fitting problem when modeling small data sets by introducing zero-mean normal prior distribution. The construction of a Bayesian neural network is mainly divided into several steps: network structure determination, Bayesian regularization calculation, weight threshold updating iteration, and data set training.

A. BASIC PRICINPLES
In a Bayesian neural network, the first step is to regularize the parameters. The input data obtained by the experiment consist of system input value and noise data. Error function (MSE) is usually used to explain the accuracy of neural networks.
where n is the number of sample sets, a i is neural network calculation result, t i is the expected output. Then, Bayesian regularization correction is carried out, so that the performance function is added to the mean sum of the squares of the weights, which is the regularization term E w , Then the regularization term is used for the error function to solve the overfitting problem. The performance function becomes F, where m is the number of weights, w i is the connection weight of the network. The results of accuracy of the neural network will be influenced by α and β. If α β, the training process gives priority to reduce the error, which increases the risk of overfitting. If α β, the training process gives priority to the complexity of the model, which can make the generalization of the network better, but it usually leads to underfitting. Therefore, in the training process, it is critical to choose the most suitable parameter combination (α and β) so that we could avoid overfitting and underfitting. The main idea of Bayesian methods is to maximize the posterior probability by using heuristic knowledge and data sets. The traditional algorithm is difficult to solve the α and β parameters, while the Bayesian regularization algorithm can automatically change the combination of parameters to obtain a better training effect. Every parameter is seen as a random numerical value. The posterior probability density function of weights will be calculated based on the learning set. The training process of the Bayesian neural network consists of two steps. At first, choose the optimal parameters, and then optimize α and β.
In the Bayesian neural network, the weights of the network are random. The density function of the weight will be obtained on the basis of Bayes' rule: where D refers to the data set, M is the neural network model used, w is the network weight vector, P (D | w, β, M ) is a likelihood function, which determines the w, P (w | M , α) is the prior density, and P (D | M , α, β) is the normalization factor, which makes the probability sum be 1. If the noise data and the prior distribution of weights are both seen to obey normal distribution, then Z D (β) = (π/β) n/2 (7) Substitute it into eq.(4), From Eq. (7) and Eq. (8), we know the Z D (β) and Z W (α), which are both constants, and unknown is Z F (α, β). But we can calculate its estimated value. The objective function has a quadratic shape around the minimum point, So F (w) can be expanded, where the gradient is zero and w MP is the posterior density, then the normalized constant is solved where, H = β∇ 2 E D + α∇ 2 E w is the Hessian matrix of the objective function. When using Bayesian optimization to regularize the parameters of the function, it is necessary to VOLUME 9, 2021  calculate the Hessian matrix of the objective function F (w) at the minimum value w * , Wang [28] proposed to calculate Hessian matrix. The algorithm flow is shown in figure 1.

B. BAYESIAN NEURAL NETWORK ALGORITHM STEPS
The specific steps of Bayesian neural network construction are as follows: Step 1: determine the structure of the neural network, find the appropriate number of hidden layer neurons and other parameters, and determine the weight of the network.
Step 2: Input the training data, train the network, and calculate the error.
Step 3: Correct the error according to the Bayesian regularization algorithm, feedback back, and update the weight.
Step 4: Repeat Steps 2 and 3 until conditions are met.

IV. SELECTION OF THERMAL SENSITIVE POINTS
In the process of thermal error modeling, the input is temperature data. Therefore, the selection of thermal sensitive points is critical to the prediction accuracy of the thermal error model and the generalization ability of the neural network. If the number of temperature variables is too large, the model's prediction accuracy will be reduced due to the multicollinearity relationship between the temperature variables. Suppose the number of temperature variables is too small. In that case, some essential information about thermal error will be lost, leading to insufficient learning, reducing the accuracy of the prediction. Therefore, the key variables in the temperature field should be screened as accurately as possible before thermal error modeling. In this study, temperature data are collected from 8 temperature measuring points, and the heat-sensitive points are selected by the grey relation analysis method. Grey Relation Analysis (GRA) determines the relation level by calculating the similarity between each variable and the dynamic development trend of the same reference sequence. Grey relation analysis is used to identify the closeness of the relationship between thermal errors and different temperature measuring points. The analysis steps are as follows.
Step 2: Normalized data. The purpose of normalization is to dimensionalize the reference sequence and the comparison sequence and assign the same weight to the reference sequence and each comparison sequence.
where x i (j) is the data after normalization; x (0) i (j) is the original data; m is the number of data sets. The dimensionless data sequence is formed into the following matrix: (1) . . . . . . . . .
x 0 (m) · · · x n (m) Step 3: Calculate the relation coefficient. The grey comprehensive relation coefficient of thermal error sequence X 0 and temperature rise sequence X i is (13) where, i (k) = |x 0 (k) − x i (k)| and min i min k i (k) are two minimum values and two maximum values, respectively. ρ is the resolution coefficient, and the value range is in [0, 1]. The smaller the value is, the more significant the difference between the relation coefficients is. When ρ 0.5463, the resolution is the best, so generally, take ρ = 0.5.
Step 4: Calculate the relation degree. The mean value of the relation coefficient at each moment is taken as the relation degree between the reference sequence and the comparison sequence of group I, and its calculation formula is

V. TEMPERATURE FIELD MEASUREMENT AND THERMAL POSITIONING ERROR MEASUREMENT OF LINEAR MOTOR FEED SYSTEM A. TEMPERATURE MEASUREMENT
The thermal error of the linear motor feed system is one of the most critical factors affecting the accuracy of a linear motor. During the linear motor feed system operation, the winding box produces a lot of heat, leading to the guide rail's deformation and distortion. In addition, the presence of a temperature gradient causes the column to deform and tilt. Therefore, it is necessary to measure the thermal characteristics of the feed drive system. The work mainly includes two aspects: the temperature field and thermal positioning error.
The measurement of the temperature field primarily relies on the NS9500PRO infrared thermal imager, and measuring points are in addition to the thermal imager to observe the surface temperature of the feed system. We need to preliminarily determine the approximate position of the temperature measuring point according to the temperature field image of the thermal imager. Generally speaking, with the increase of operation time, the position with significant temperature change is preferred. As shown in Figure 7, in the thermal imager interface, it can be clearly seen that the position with higher temperature is red, and the position with lower temperature is green. The thermal positioning error of the feed system is measured by a laser interferometer. This experiment measures both the thermal error of the feed system and the temperature of the selected measuring point. The feed system is not equipped with a cooling system, which can accurately measure the temperature of the measuring point. Taking DZY500TA505020 as the research object, the relationship between the temperature field of the linear motor feed system and the positioning error is studied. The movement of the X and Y axes is driven synchronously by the linear motor feed system. The travel range of the X and Y axes is 800mm. Several reference points are added to the NS9500PRO infrared thermal imager, as showed in the figure. These measuring points are derived from different positions of the linear motor and are in contact with the winding box of the linear motor. The thermal deformation of these positions will lead to abnormal movement, resulting in thermal positioning errors. The coordinate system is established with the geometric center of the lowest side plate of the linear motor feed system as the origin of coordinates. The coordinates of each point are set out in the table. In the experiment, the ambient temperature is kept at about 22 • C. The linear motor is preheated in the first 500s and reciprocates linearly at a feed speed of 50mm/s, and the feed speed is switched to 100mm/s in the 3000s and 200mm/s in the 6000s. This process needs to connect the computer to the linear motor feed system's controller and then through programming. Temperature data are measured at every 100s, and the system ran continuously for 12000s. Switching the feed rate aims to prevent the system from reaching thermal equilibrium, where temperature data and positioning errors do not change. And the temperature field and location error under different constant speed conditions can be obtained so that the generalization ability of the neural network is improved.

B. THERMAL POSITIONING ERROR MEASUREMENT
In this paper, the linear motor feed system needs to be measured under reciprocating movement in the range of 500mm. The specific operation is as follows: the leftmost point of the track is 0, and the middle position is 250 mm. And then make it go back and forth in a straight line. After each temperature measurement, the positioning error is measured once. The positioning error of the feed system consists of geometric error and thermal error. Firstly, the geometric error of the VOLUME 9, 2021  linear motor under complete cooling conditions is measured. The measurement results of the positioning error include geometric error and thermal error. The measurement value minus the geometric error is recorded as the thermal positioning error of the measurement. The measuring time of the laser interferometer is 5s, and when measuring temperature, the machine stops for 10s.

C. ARRANGEMENT OF MEASUREMENT EXPERIMENTAL SYSTEM
The arrangement of the testbed is illustrated in the figure.
The laser interferometer is set on the tripod, and the thermal imager is set on the tripod to take the temperature of the measuring point. The laser is released from the laser kit, passes through the 4 and 5 mirror sets in turn, and then reflects the light to the reflected light-receiving holes in the laser kit. The linear motor is controlled by a computer processing center and linear motor controller. The laser interferometer is attached to the computer processing center through a data line to record the measurement results of positioning errors. The room temperature sensor receives the ambient temperature, and the compensator compensates for the measurement results of the laser interferometer according to the room temperature. The following temperature measuring points are added to the thermal imager. The photos taken by the infrared camera are saved in the SD card and finally imported into the computer processing center. Then complete the measurement tasks.

VI. CONSTRUCTION AND VERIFICATION OF NEURAL NETWORK A. DETERMINATION OF INPUT AND OUTPUT DATA AND SELECTION OF THERMAL SENSITIVE POINTS
According to the experimental process, the temperature change curve of each measuring point with time is illustrated  in the figure. In the actual measurement process, the temperature trends of b, c and e, h are almost the same, because b, c and e, h are geometrically symmetric, and the heat conduction and convection between them are almost the same. In order to avoid collinearity, point b and point e are eliminated.
According to the data processing in Part 4, the temperature data are imported into Excel and the formula calculation process is realized by using the table to obtain the gray relation degree as follows.
Points a, c, d, f, g, and h are selected as thermosensitive points for the next step of modeling.

B. DETERMINE THE NUMBER OF NEURONS IN THE HIDDEN LAYER
The neural network is composed of input, hidden, and output layers, which can simplify the complex problem and quickly    get the calculation result. But to determine a suitable network, it is essential to determine the hierarchy and the number of neurons in each. In this paper, a neural network with only one hidden layer is suggested to solve the problem. So the key is neuron identification. The input layer is generally related to the problem. In this paper, the neural network is primarily used to quantify the thermal positioning error of the linear motor feed system. Therefore, the number of neurons in the input layer is equal to thermally sensitive points. According to the calculation process in this paper, the number of neurons in the input layer can be obtained as 6, which are the temperature of a point T1, c point T2, d point T3, f point T4, g point T5, and h point T6. The output layer represents the final result. In this paper, the target is thermal positioning error. That is, the number of neurons in the output layer is 1.
The number of neurons in the hidden layer is the key to the neural network model and is very important to the training of neural networks. A Bayesian neural network can contain multiple hidden layers. Still, when the number of hidden layers is too much, the training network time will become longer, and the phenomenon of overfitting is easy to appear [29]. Using a hidden layer and selecting the correct number of hidden layer nodes can achieve high enough accuracy. In this paper, the structure of a single hidden layer is adopted. After the number of hidden layers is selected, the best number of the hidden layer nodes should be determined. The calculation formula of the optimal hidden layer node is shown in the formula: where z represents hidden layer nodes, u represents input layer nodes, v represents the number of output nodes, and p is a constant between 1 and 10. It is known that u = 6, v = 1. The number of hidden layer neurons is calculated between [4], [13]. In order to find the most points of the hidden layer, a Bayesian neural network is used to train the different numbers of neurons. In the case of the same parameters, the error between the network output value and the predicted value is obtained, and the degree of data fitting R is taken as the standard to obtain the optimal node of the hidden layer. When the fitting degree is the highest, the corresponding hidden node value is the best choice. Finally, the number of nodes in the optimal hidden layer is 10 to build a Bayesian neural network model with the best performance. The overall schematic diagram is illustrated in the figure.

C. TEXT OF THERMAL ERROR MODEL
The mean square error of the trained neural network is 2.36 * 10^−6. The R-value of neural network training is illustrated in the figure. The figure below shows the degree of deviation between the expected output and the network output. When the data falls on the dashed line of the diagonal, the expected output value is equal to the network output value, indicating that the better the fitting effect is, the closer the R-value is to 1. Firstly, the accuracy of the neural network should be checked according to the temperature data and thermal positioning error data during the measurement experiment.
When the feed speed is 300mm/s, the positioning error of some moments during the reciprocating linear motion is obtained by using the neural network so as to test the generalization of the Bayesian neural network. Firstly, temperature data and thermal positioning error data of 11300s are collected according to the experimental method. Then input the thermal sensitive points data at different times into the neural network and output the thermal positioning errors at different times. Then the LM algorithm is used to train the neural network to perform the same operation.

D. ANALYSIS OF THE RESULTS OF THE EXPERIMENT
According to the experiment results, it can be observed that the thermal positioning error of the linear motor feed system increases gradually with the increase of the running time and reaches the balance of around 9500s. The changing trend of positioning error calculated by the two neural networks is consistent with the experimental data. The error of the two methods is significant before the 4700s. The reason is that the temperature field distribution of the feed system is not uniform at the beginning of the operation, and the amount of data before the 4700s is less than that after the 4700s, which eventually leads to the lack of learning of this part of data. The generalization performance of the neural network of the LM algorithm is limited, and it is not easy to process the data outside the learning data set. The Bayesian neural network can effectively prevent over-fitting and under-fitting, so the error is minor. The maximum error of the Bayesian neural network is 10% lower than that of the LM algorithm, which shows that the Bayesian neural network has good generalization.

VII. CONCLUSION AND PROSPECTS
In this paper, a thermal error modeling method of the linear motor based on a Bayesian neural network is proposed and used to predict the thermal error of the linear motor feed system. The following conclusions can be drawn: (1) GRA can be used to screen temperature-sensitive points, avoid the interference of irrelevant temperature data on neural network training, and determine the number of input variables for subsequent thermal error modeling of the neural network.
(2) The temperature data of temperature-sensitive points are passed by the Bayesian neural network and taken as the model's input data. The positioning error is considered as the output of the model. After modeling, accurate positioning errors can be obtained according to the temperature data of sensitive points. It lays a foundation for the subsequent compensation of the linear motor.
(3) The experiment is carried out at different feed speeds. At the beginning of the 3000s, the feed speed is 50mm/s. At 3000s, the feed speed is changed to 100mm/s and 200mm/s at 6000s. The generalization ability of the neural network is improved.
The results show that the performance of the Bayesian neural network model is obviously better than that of the LM-algorithm-trained neural network. However, the linear motor feed system has the toothed effect, end effect, and thrust fluctuation, etc. The speed variation in the actual feed process is more complex, so the thermal error model may not be applicable to more complex conditions. The research object of this paper is only limited to the linear motor feed system, not equipped with tools and loads. More complex working conditions can be considered in future work, such as variable load, variable speed, increasing heat dissipation conditions, or cutting heat. On this basis, the influence of heat conduction and convection on the temperature field of the feed system should be considered to reduce the model error further. ZEQING YANG received the Ph.D. degree from Hebei University of Technology, China. She is currently an Associate Professor with the Department of Instrumentation Engineering, Hebei University of Technology. She presided over and completed the general projects of the National Natural Science Youth Fund, Hebei Youth Science Fund, Tianjin Natural Science Fund, Hebei Natural Science Fund, and key basic research projects, Tianjin Science and Technology Commissioner Project, and Sinoma Equipment Commission Project. As the main researcher, she participated in one major national science and technology project, one major scientific instrument and equipment development project of the 13th five-year plan, two general projects of the National Natural Science Foundation of China, eight provincial and ministerial projects, and four enterprise entrusted projects. She has over 40 scientific articles and holds over 30 patents. Her current research interests include online detection and error compensation of CNC equipment, digital integrated measurement and control, and digital twin operation and maintenance monitoring of complex equipment, visual inspection, and pattern recognition. She is a Senior