# Novel Real-Time Compensation Method for Machine Tool's Ball Screw Thermal Error
## 3 Screw Thermal Error Due to Feed Movement
### Derivation of Screw Thermal Distribution  
The position of the screw nut varies according to instructions from the controller during operation and thus cannot be solved analytically. Since this affects the temperature field, in this paper, the temperature field is iteratively solved by the finite difference method. First, the screw of total length \(L\) is divided into \(N\) micro-units of length of \(dx\) with uniform internal temperature:  
\[N=\frac{L}{dx}. \tag{4}\]  
To account for the heat conduction between the left face of the micro-unit and the adjacent micro-unit, the fixed-end micro-unit (\(n=1\)) is differentiated from the others. The fixed-end face is regarded as adiabatic; thus, at time \(t\), the heat flowing into the \(n\)-th micro-unit from the left end (\(Q_{left}^{n,t}\)) can be expressed as:  
\[Q_{left}^{n,t}=\left\{\begin{array}{l}0(n=1)\\ -\lambda\frac{T_{n}^{n}-T_{n-1}^{n}}{dx}A_{s}(\text{else})\end{array},\right. \tag{5}\]  
where \(A_{s}=\frac{\pi D^{2}}{4}\) is the approximate cross-sectional area of the screw.  
Similarly, for the micro-unit at the free-end face, the heat flow \(Q_{right}^{n,t}\) out of the \(n\)-th micro-unit from the right end at time \(t\) can be expressed as:  
\[Q_{right}^{n,t}=\left\{\begin{array}{l}h(T_{n}^{t}-T_{a})A_{s}(n=N)\\ -\lambda\frac{T_{n+1}^{n}-T_{n}^{n}}{dx}A_{s}(\text{else})\end{array},\right. \tag{6}\]  
where \(h\) is the heat convection coefficient between the screw and the air, and \(T_{a}\) is the ambient temperature.  
Heat transfer on the cylindrical surface of the micro-unit occurs in three sections: air convection, nut, and fixed-end bearing. The heat flowing into the \(n\)-th micro-unit from the circular face at time \(t\) (\(Q_{circle}^{n,t}\)) can be expressed as:  
\[Q_{circle}^{n,t}=\left\{\begin{array}{l}-h(T_{n}^{t}-T_{a})A_{C}(\text{Air convection part})\\ \frac{Q_{N}^{t}}{L_{N}}.dx(\text{Nut part})\\ \frac{Q_{B}^{t}}{L_{B}}.dx(\text{Fixed end bearing part})\end{array},\right. \tag{7}\]  
where \(Q_{N}^{t}\) is the heat flow into the screw from the screw nut at time \(t\), \(L_{N}\) is the length of the screw nut, \(Q_{B}^{t}\) is the heat flow into the screw from the fixed-end bearing, and \(L_{B}\) is the length of the fixed-end bearing.  
The heat stored in the \(n\)-th micro-unit at time \(t\) can be expressed as:  
\[Q_{in}^{n,t}=\rho cA_{s}dx\frac{T_{n}^{t+dt}-T_{n}^{t}}{dt}, \tag{8}\]  
where \(\rho\) is the density of the screw material, \(c\) is the specific heat capacity of the screw material, and \(dt\) is the iterative calculation cycle time.  
According to the principle of heat conservation:  
\[Q_{left}^{n,t}+Q_{circle}^{n,t}=Q_{right}^{n,t}+Q_{\text{in}}^{n,t}. \tag{9}\]  
Combining the above formulas, the iterative calculation formula for predicting the temperature field of the screw at time \(t\)+\(dt\), based on the temperature at time \(t\), can be expressed as follows:  
\[T_{n}^{t+dt}=\left\{\begin{array}{l}T_{n}^{t}+\frac{\lambda dt}{\rho c(dx)^{2 }}(T_{n+1}^{t}-T_{n}^{t})+\frac{4 dt}{\pi D^{2}\rho c}(\frac{Q_{\text{in}}^{t}}{ L_{\text{B}}})(n=1)\\ T_{n}^{t}+\frac{\lambda dt}{\rho c(dx)^{2}}(T_{n+1}^{t}+T_{n-1}^{t}-2T_{n}^{t}) +\frac{4 dt}{\pi D^{2}\rho c}(\frac{Q_{\text{in}}^{t}}{L_{\text{B}}})(1<n\leq \frac{L_{\text{B}}}{dx})\\ T_{n}^{t}+\frac{\lambda dt}{\rho c(dx)^{2}}(T_{n+1}^{t}+T_{n-1}^{t}-2T_{n}^{t} )+\frac{4 dt}{\pi D^{2}\rho c}(\frac{Q_{\text{in}}^{t}}{L_{\text{B}}})(\frac{X _{N}^{t}-\frac{L_{\text{B}}}{dx}}{dx}<n\leq\frac{X_{N}^{t}+\frac{L_{\text{B}} }{dx}}{dx})\\ T_{n}^{t}+\frac{4 dt}{\rho c(dx)^{2}}(T_{n-1}^{t}-T_{n}^{t})-(\frac{4 dtdt}{\rho cD }(1+\frac{D}{4 dx}))(T_{n}^{t}-T_{a})(n=N)\\ T_{n}^{t}+\frac{\lambda dt}{\rho c(dx)^{2}}(T_{n+1}^{t}+T_{n-1}^{t}-2T_{n}^{t} )-(\frac{4 dtdt}{\rho cD})(T_{n}^{t}-T_{a})(\text{else})\end{array}\right. \tag{10}\]  
Assuming that the temperature of the screw is equal to the ambient temperature when the machine tool starts:  
\[T_{n}^{0}=T_{a}.\]  
Thus, the temperature distribution of the screw at any time can be calculated iteratively through the above formula.