Pre-compensation of Friction for CNC Machine Tools through Constructing a Nonlinear Model Predictive Scheme

Nonlinear friction is a dominant factor affecting the control accuracy of CNC machine tools. This paper proposes a friction pre-compensation method for CNC machine tools through constructing a nonlinear model predictive scheme. The nonlinear friction-induced tracking error is firstly modeled and then utilized to establish the nonlinear model predictive scheme, which is subsequently used to optimize the compensation signal by treating the friction-induced tracking error as the optimization objective. During the optimization procedure, the derivative of compensation signal is constrained to avoid vibration of machine tools. In contrast to other existing approaches, the proposed method only needs the parameters of Stribeck friction model and an additional tuning parameter, while finely identifying the parameters related to the pre-sliding phenomenon is not required. As a result, it greatly facilitates the practical applicability. Both air cutting and real cutting experiments conducted on an in-house developed open-architecture CNC machine tool prove that the proposed method can reduce the tracking errors by more than 56%, and reduce the contour errors by more than 50%.


Introduction
In the feed drive system of CNC machine tools, friction, which is from the ball-screw and the linear motion guide, is one of the most crucial factors that restrict the positioning accuracy of machine tools [1].At the velocity reversal points, the reversals of friction cause large tracking errors.To improve the positioning accuracy of the feed drives, various friction compensation techniques have been proposed.
The friction compensation methods can be classified into two groups, i.e., the model-free and the model-based friction compensation methods [2].The model-free friction compensation method usually treats the friction as a disturbance, and develops various advanced controllers to suppress the adverse effect of friction [3].Papageorgiou et al. [4,5] implemented and experimentally compared several friction-resilient controllers.Ren et al. [6] estimated the friction with a reduced-order extended state observer, and designed a super-twisting sliding mode controller to control the three-wheeled omnidirectional mobile robot.Tian et al. [7] treated the friction as a rapidly changing disturbance during velocity reversal, and proposed an adaptive switching-gain sliding-modeassisted disturbance observer to suppress the frictioninduced tracking error.Su et al. [8] proposed a robust output feedback nonlinear proportional-derivative (PD) controller for the positioning of uncertain motion systems subject to the unknown friction with consideration of the actuator constraint.
The model-based friction compensation, which can be realized in the feedback or feedforward manner [9], cancels the friction torque by applying an additional drive torque according to the friction model.Armstrong-Hélouvry et al. [10] made a survey on the friction modeling and compensation, and proposed the well-known Stribeck curve to describe the friction characteristic of the lubricated metallic surfaces.The friction is divided into four regimes, i.e., the static friction, the boundary lubrication, the partial fluid lubrication and the full fluid lubrication.However, because the friction predicted by the Stribeck friction model is not continuous around zero velocity [11], the Stribeck friction model cannot be directly used in the friction compensation of precision motion control.
To realize the continuous and precise friction compensation, various friction models and compensation methods have been developed.The existing friction compensation methods can be classified into the static friction model-based methods and the dynamic friction model-based methods [12].In terms of the static friction model-based methods, Makkar et al. [13] proposed a continuously differentiable friction model by expressing friction as the sum of three tanh functions and a linear function with respect to velocity.Based on this model, researchers developed various controllers, e.g., adaptive prescribed performance motion controller [14], robust adaptive tracking controller [15] and rise-based controller [16].Xi et al. [17] proposed a two-stage tracking error-based static friction compensation method through expressing the compensation signal as a function of tracking error and velocity.Feng et al. [18] used a trapezoidal compensation pulse to compensate the friction-induced errors, and designed a generalized regression neural network algorithm to generate the optimal pulse amplitude function.Verbert et al. [19] expressed the friction force as a time-varying coefficient multiplied by the sign of velocity, and designed an online updating law to estimate this coefficient based on the position and velocity errors.Yang et al. [20] proposed a method to distinguish the boundary between the pre-sliding and sliding regimes, and proposed a two stage friction model that uniformly expresses the friction corresponding to the presliding and sliding regimes as functions of velocity.Huang et al. [21] deduced an analytical formulation to distinguish the breakaway point between the pre-sliding and sliding stages, and proposed a triple-stage friction compensation method to cancel the effect of static friction.
In terms of the dynamic friction model-based methods, Dahl [22] presented a friction model that describes the presliding friction as an elastic deflection of surface asperities.However, this model did not incorporate the Stribeck effect.Canudas de Wit et al. [23] proposed the well-known LuGre model, which captures most of the friction behaviours including the Stribeck effect, hysteresis, spring-like characteristics of friction, and varying break-away force.Yao et al. [24] proposed a continuously differentiable version of the LuGre model.Based on the LuGre model and its modifications, researchers developed parameter estimation and compensation method [25], neural network-based adaptive funnel sliding mode controller [26], adaptive barrier controller [27], adaptive compensator [28,29], observer-based friction compensator [30], distributed friction compensator [31], and adaptive load friction compensator [32].Dupont et al. [33] proposed the elastoplastic friction model for the control applications involving small displacements and velocities.Based on this model, Keck et al. [34] developed a friction parameter identification and compensation method.Al-Bender et al. [35] proposed the generalized Maxwell-slip (GMS) model.Based on the GMS model, various modifications [36,37] and controllers [38] were developed.Bui et al. [39] proposed a new friction model, which combines the conventional Coulomb-viscous friction model and a nonlinear sinusoidal component, to better describe the friction in case of high speed motion or insufficient lubration.Guo et al. [40] proposed a neural network-based friction model, which takes the position and velocity information as input to predict the friction.
The above methods can realize precise prediction and compensation of friction.However, in order to obtain continuous compensation signal at the velocity reversal points, both the static and dynamic model-based methods usually introduce presliding-related parameters besides the Stribeck model parameters .For example, the boundary between presliding and sliding is required for the static model-based methods [17,20,21].The stiffness and damping coefficients of the bristles [23][24][25][26][27][28][30][31][32] are required for the LuGre model-based methods.The attraction parameters are required for the GMS model-based methods [35][36][37][38].Identifications of these parameters depend on the position measurements by rotary encoders or linear scales [21].If the resolutions of rotary encoders or linear scales are high and the measurement noise is small [11], those presliding-related parameters can be precisely identified.However, if the resolutions of rotary encoders or linear scales are low or the measurement noise is relatively large, those parameters are difficult to be precisely identified whether by offline [20,[41][42][43][44] methods or online methods [19,27,28,[30][31][32].This fact limits the scope of application of the existing methods.
To avoid the identification of the fine parameters related to pre-sliding, this paper proposes a non-linear model predictive scheme for friction pre-compensation of CNC machine tools based on Stribeck friction model.Through taking the friction-induced tracking error as the optimization objective, the optimal compensation signal is computed with the help of non-linear model predictive scheme.The derivative of the compensation signal is constrained to avoid the vibration of the machine tool.The advantages of the proposed method are three-folds.
(1) Besides the parameters of the Stribeck model, the proposed method only introduces one additional parameter, i.e. the bound of the derivative of the compensation signal, which can be experimentally tuned to minimize the tracking errors.Although the parameters of some existing methods can be tuned in the same way, they usually introduce more than one parameter [17, 20, 21, 23-28, 30-32, 35-38].By introducing only one parameter, the proposed method greatly reduces the complexity of experimentally tuning operation.(2) The basic controller of the proposed method is the commonly used Proportional-Proportional Integral (P-PI) controller with velocity feedforward in the commercial CNC machine tools.This allows the proposed method to be easily integrated into the CNC system of machine tools.(3) Since the proposed method directly takes the friction-induced tracking error as the optimization objective to calculate the optimal compensation signal, the proposed method is expected to have good tracking performance.
The contributions of this paper are three-folds.First, a precise prediction model of the nonlinear frictioninduced tracking error of the P-PI controller with velocity feedforward is established, as described in Section 2. Second, the nonlinear model predictive friction pre-compensation method is developed with the constraining of derivative of compensation signal, as described in Section 3. Third, both air cutting and real cutting experiments are conducted to validate the proposed method, as presented in Section 4. Section 5 gives the conclusions.

Modeling of the Friction-Induced Tracking Error
In this section, the prediction model of the frictioninduced tracking error is established, which includes the following three steps.First, the model of the actual feed drive system with non-linear friction and compensation signal is developed.Second, the model of the ideal feed drive system without friction is developed.Third, through calculating the difference between the predicted position of the actual feed drive system and that of the ideal feed drive system, the friction-induced tracking error is obtained.
Since the proposed method is aimed to compensate the friction, the friction-induced tracking error is adopted as the optimization target.If the aim is to directly reduce the tracking error, the tracking error can be directly taken as the optimization target.

Modeling of the Feed Drive System under Friction and Compensation Signal
Figure 1 shows the block diagram of the feed drive system of a concerned axis.The feed drive is controlled by the commonly used Proportional-Proportional Integral (P-PI) controller [45] with velocity feedforward in the commercial CNC machine tools.
The mechanical system can be written as the following continuous state space equation: Figure 1 Block diagram of the feed drive system of a concerned axis (R and P are the reference position and the actual position.K f , K p , K v and T v are the velocity feedforward coefficient, the position loop gain, the velocity loop gain, and the integral time constant.T s is the sampling interval.u c is the compensation signal of friction.ZOH is short for zero-order holder.T f is the friction torque.K a , K t , r g , J and B are the current amplification factor, torque amplification factor, lead screw gain, equivalent inertia and viscous damping) where ω is the angular velocity of the screw.The dot '. ' means the derivative operation.
The continuous state space equation in Eq. ( 1) is transformed into the discrete domain with zero-order holder: Because of the integration in the velocity loop, the closed loop system model is one order higher than the open loop system model in Eq. ( 2).Therefore, an additional state variable q, which is shown in Figure 1, is introduced.According to the block diagram shown in Figure 1, the state variable q can be expressed as follows: (1) (3) where e v is the tracking error of velocity loop, which is expressed as follows: The control signal u is expressed as follows: Substituting Eqs. ( 3), ( 4) and ( 5) into Eq.( 2), the closed loop system model can be obtained as follows: Armstrong et al. [10] made an in-depth survey of the physics behind the friction phenomenon.The typical friction characteristic for the lubricated metallic surfaces in contact is described as the Stribeck curve.Based on this model, the expression for the nonlinear friction d is written as follows [11]: (4) (  7) is shown in Figure 2.
Please note that the viscous friction term is shown in Figure 2 but is omitted in Eq. ( 7), since it has been integrated into the damping coefficient B. The parameters in relation to the Stribeck friction model can be identified by the method reported in Ref. [11].
According to Eqs. ( 4) and ( 5), the total control signal u a (k) can be expressed as a function of the state variable:

Prediction of the Friction-Induced Tracking Error
Through replacing the friction term d(k) and the compensation term u c (k) in Eq. ( 6) by 0, the actual position of the ideal servo system free from friction can be predicted as follows: (8)    where the superscript '*' means the variables for the ideal servo system free from friction.The friction-induced tracking error can thus be obtained through calculating the difference between the actual position P(k) disturbed by friction and the actual position P * (k) free from friction.
where e d is the friction-induced tracking error.where n p ≥ n c is the prediction horizon.The compen- sation signals beyond the control horizon and within the prediction horizon are chosen to be the same as u c (k + n c − 1) , i.e., (10)  The following objective function is chosen to minimize the friction-induced tracking error:

Construction of the Nonlinear Model Predictive Scheme
If this objective function is directly applied without constraints, the optimal solution of U k will be a sharp step signal, as shown in Figure 4.This signal will impact the ball screw and cause the vibration of the machine tool.
Therefore, the derivative of the compensation signal needs to be constrained.However, the derivative of the compensation signal is not convenient to be constrained for the system model given in Eq. ( 6).Therefore, the system model in Eq. ( 6) is updated by the following incremental model.(14) where (16) The optimization problem in Eq. ( 18) can be solved by the interior-point method [46] or trust-region method [47].

Simulation and Experimental Verifications
To evaluate the performance of the proposed method, simulations, air cutting experiments and real-cutting experiments are conducted.The experiments are conducted on an in-house developed open-architecture CNC machine tool, as shown in Figure 5.
The machine tool is controlled by a real-time control board, where various controllers can be implemented.The sampling frequency is set as 1000 Hz.The servo model parameters and friction model parameters of each axis are identified utilizing the method reported in Ref. [11].The results are listed in Table 1.
The P-PI controller with velocity feedforward shown in Figure 1 is implemented on the real-time control board.The parameters of the P-PI controllers of each axis are tuned to minimize the tracking errors without causing vibration, and the parameters are listed in Table 1.
Three common trajectories, i.e., the 3D circular trajectory, the fan-shaped trajectory, and the butterfly trajectory, are adopted to validate the controlling performance in both ideal and complex cases.All the trajectories are planned under a maximum feedrate of 20 mm/s, a maximum acceleration of 200 mm/s 2 and a maximum jerk of 2000 mm/s 3 by using the S-shaped feedrate planning method reported in Ref. [45].

Validation and Comparison with the Existing Methods: 3D Circular Trajectory
First, the developed tracking error prediction model is validated.The 3D circular trajectory is applied, as shown in Figure 6.
The circular trajectory is repeated 3 times to verify the repeating performance of the proposed method.The prediction accuracy of tracking error depends on the identification accuracy of the servo model and friction model.In the experiment, the identification accuracy is improved through carrying out the identification for several times with the method reported in Ref. [11] and taking the average value.The predicted and measured tracking errors of the X, Y and Z axes without friction compensation are shown in Figure 7.It can be seen that the tracking errors can be precisely predicted.
Next, the following four methods are implemented and compared.
• P-PI, which is a P-PI controller with velocity feedforward.The friction is not compensated.• P-PI + TEFC, which is a P-PI controller with velocity feedforward and with the tracking error-based friction compensation (TEFC) method reported in Ref. [17].• P-PI + LFC, which is a P-PI controller with velocity feedforward and with the LuGre model-based friction compensation (LFC) method reported in Ref. [31].• P-PI + NMPFP, which is a P-PI controller with velocity feedforward and with the proposed nonlinear model predictive friction pre-compensation (NMPFP) method.
To ensure a fair comparison, the parameters of the P-PI controllers of the four methods are the same, and are listed in Table 1.The experimental tuning result of the upper bound u c is 0.03.The control horizon n p and the prediction horizon n c are set as 100.For each optimiza- tion, the first 10 control signals in the control horizon are adopted.The virtual CNC system developed in Ref.
[48] is adopted in the simulation.The system considers the second order rigid body dynamic model of feed drive, the saturation of actuation system, the quantization error, the measurement noise, the stribeck friction model and the backlash.The model parameters are identified with the method reported in Ref. [11] and the identification results are shown in Table 1.The simulation and experimental tracking errors of the four methods for circular trajectory are shown in Figure 8.
The compensation signals of the proposed method are shown in Figure 9.It can be seen that the proposed P-PI + NMPFP method obtains the smallest tracking errors in both simulations and experiments.Two performance indexes, i.e., the maximum absolute tracking errors and the root-mean-square value of tracking errors, are calculated for each method.The results are listed in Table 2.
Compared with the P-PI controller without friction compensation, the proposed method reduces the maximum absolute tracking errors by 66.8% for X axis, 70.0% for Y axis and 72.9% for Z axis.The tracking errors are not just due to friction, but also due to the velocity, acceleration and jerk of trajectory, and the vibration, measurement noise, backlash and other factors of the machine tool.However, friction is the main factor causing tracking errors, especially at the velocity reversal points.Therefore, the tracking errors can be greatly reduced by the proposed friction compensation method.
The contour errors of the four methods are calculated and shown in Figure 10.
The maximum absolute contour errors and the rootmean-square value of contour errors are listed in Table 2.It can be seen that the proposed method obtains the smallest contour error.Compared with the P-PI controller without friction compensation, the proposed method reduces the maximum contour error by 69.0%, and reduces the root-mean-square value of contour error by 70.4%.

Analysis of the Robustness: Fan-Shaped Trajectory
The robustness means the maintenance of the controlling performance when the model parameters are not precisely known [49].Good robustness can greatly improve the practicality of the controller.In this section, the robustness of the proposed friction compensation method is investigated.Among all the parameters listed in Table 1, the controller parameters are precisely known Figure 7 The predicted and measured tracking errors of the 3D circular trajectory with P-PI controller without friction compensation by the designers of the control systems of CNC machine tools.The current amplification factor ( K a ), the torque amplification factor ( K t ), the lead screw gain ( r g ) can be obtained by referring to the manuals of the servo motors and the lead screws.Only the equivalent inertia (J), the viscous damping (B) and the friction model parameters are not precisely known, and need to be identified.Therefore, it is necessary to test the robustness of the proposed method in terms of J, B and the friction model parameters.
First, the robustness in terms of the equivalent inertia J and the viscous damping B is investigated.The fanshaped trajectory shown in Figure 11 is adopted.90%, 100% and 110% of the J and B are utilized in the proposed algorithm to simulate the cases where J and B are not precisely identified.The corresponding tracking errors  are shown in Figure 12.It can be seen that for different nominal J and B, the tracking errors are more or less the same.When J and B are inaccurate, the tracking errors only increase by 1 or 2 μm.This proves that the proposed method has good robustness in terms of J and B.
Next, the robustness in terms of the friction parameters is investigated.90%, 100% and 110% of the predicted frictions are utilized in the proposed algorithm to simulate the cases where the friction parameters are not precisely identified.The tracking errors are shown in Figure 13.
Compared with the P-PI controller without friction compensation, the proposed method with 100% of the predicted friction can reduce the maximum tracking error by 66.7% for X axis, 60.0% for Y axis, and 82.5% for Z axis, while the proposed method with 90% of the predicted friction can reduce the maximum tracking error by 60.0% for X axis, 52.2% for Y axis, and 75.4% for Z axis.It can be seen that the proposed method can still achieve good performances when the friction parameters are not accurate.This proves that the proposed method has good robustness in terms of friction parameters.

Real Cutting Experiment: Butterfly Trajectory
To further investigate the performance of the proposed method, real cutting experiments are carried out.The butterfly trajectory shown in Figure 14 is adopted.
The material of the workpieces are Aluminium 7075.The tool is a four-fluted mill with the diameter of 5 mm and helix angle of 45 • .The spindle speed is selected as 3000 r/min.The maximum feedrate is 20 mm/s, as shown in Figure 14.The axial depth of cut is 0.5 mm.An image of a workpiece after cutting is shown in Figure 15.
Both air cutting and real cutting experiments are conducted for the P-PI controllers without friction compensation and with the proposed NMPFP method.The tracking error and contour error results are shown in  It can be seen that in both air cutting and real cutting, the proposed method realizes considerable reduction of tracking errors.Also, it can be seen that the tracking errors for air cutting and real cutting are more or less the same.This is due to the following two reasons.(1) Compared to the drive torque, the cutting torque disturbance caused by the cutting force is much smaller.Therefore, the tracking error caused by the cutting torque disturbance is small.(2) The integral term in the P-PI controller has the disturbance suppression ability.The cutting force disturbance can be well suppressed.

Conclusions
This paper proposes a nonlinear model predictive scheme to pre-compensate the friction for CNC machine tools.The developed method aims at improving the practical applicability through avoiding fine identification of the parameters in relation to pre-sliding, since these parameters are usually difficult to be accurately identified because of the small displacement of pre-sliding, the quantization error and noise of position measurement.Besides the model parameters of the Stribeck friction, the proposed approach only introduces a single parameter, i.e., the boundary of the derivative of compensation signal.This makes the proposed method easy to be parameterized.
The developed method is experimentally validated by evaluating its tracking and contouring performances, the robustness in terms of the uncertainties of model parameters, and the performance in the real cutting processes.Experiments show that compared with the P-PI controller without friction compensation, the proposed method can reduce the maximum tracking error by 56% to 81%, and reduce the maximum contour error by 50% to 69% for different trajectories.It is also validated that the proposed method has good robustness in terms of the uncertainties of servo model parameters and friction model parameters.For fluctuations of ± 10% in the servo model parameters J and B, the tracking errors are only 1-2 µ m larger.For fluctuations of ± 10% in the friction parameters, the tracking errors can still be reduced by more than 52%.Furthermore, experiments demonstrate that the proposed method shows similar tracking and contouring error reductions in real cutting as those in air cutting.
Since the nonlinear model predictive control method takes a relatively long time to calculate and is difficult to calculate online, the friction compensation signals are pre-calculated offline.However, this method lacks adaptivity to model parameter uncertainties and unknown disturbances.In the future research, the calculation speed of the algorithm can be improved to realize online compensation.
is the total control signal.� ω is the threshold of zero angular velocity.d + s and d − s are the static frictions in the positive and negative directions.d + c and d − c are the coulomb frictions in the positive and negative directions.+ 1 , + 2 , − 1 and − 2 are parameters of the Stribeck friction model.The friction model in Eq. (

Figure 3
Figure3shows the block diagram of the proposed nonlinear model predictive friction pre-compensation method.The compensation signals generated by the NMPFP at time step k can be denoted by

Figure 2 Figure 3
Figure 2 Stribeck friction model for the lubricated ball-screw drive the incremental compensation signal of friction.Correspondingly, the compensation signals and the predicted tracking errors are updated by To avoid sharp change of the compensation signal, the incremental compensation signal �u c (k) needs to be constrained: where u c is the upper bound of the incremental com- pensation signal.The nonlinear optimization problem at time step k can be summarized as follows:

Figure 4 Figure 5
Figure 4 An illustrative example of the compensation signal: (a) The velocity of the reference trajectory, (b) The original view and (c) the locally enlarged view of the compensation signals with and without constraining of u c (�u c (k) = u c (k + 1) − u c (k))

Figure 6
Figure 6 (a) The circular trajectory and (b) its axial position and (c) velocity after feedrate planning

Figure 8 Figure 9
Figure 8The simulated and experimentally measured tracking errors of the 3D circular trajectory with different controllers

Figure 10 Figure 11 Figure 12 Figure 13
Figure 10The contour errors of the 3D circular trajectory with different controllers (The maximum contour errors are labeled on the figures)

Figure 14 Figure 15 Figure 16
Figure 14 (a) The butterfly trajectory and (b) its axial position and (c) velocity after feedrate planning Figures16 and 17.It can be seen that in both air cutting and real cutting, the proposed method realizes considerable reduction of tracking errors.Also, it can be seen that the tracking errors for air cutting and real cutting are more or less the same.This is due to the following two reasons.(1) Compared to the drive torque, the cutting torque disturbance caused by the cutting force is much smaller.Therefore, the tracking error caused by the cutting torque disturbance is small.(2) The integral term in the P-PI controller has the disturbance suppression ability.The cutting force disturbance can be well suppressed.

Figure 17
Figure 17The contour errors of the butterfly trajectory with different controllers for air cutting and real cutting (The maximum contour errors are labeled on the figures)

Table 1
Servo model parameters, controller parameters and friction model parameters of each feed drive axis

Table 2
Performance indexes of difference methods for the 3D circular trajectory