In the simulation test, the working condition adopted is the double-shift working condition, and the road adhesion coefficient is 0.8. The double shift reference track is automatically generated by the driving scene designer in MATLAB according to the double shift standard test road.
4.1. Simulation Analysis of the Influence of Different Constant Vehicle Speeds on the Controller’s Tracking Control Effect
Firstly, the tracking effect of the improved controller is simulated, and four sets of simulation tests are carried out at different constant speeds, which are 30 km/h, 60 km/h, 80 km/h, and 100 km/h, respectively, and the comparison with the ordinary MPC is carried out.
The simulation results of 30 km/h and 60 km/h trajectory tracking are shown in (a) and (b) in
Figure 3. Due to the low speed, the tracking process is relatively stable, the overshoot is small, and the trajectory tracking deviation is small. It can be seen from (a) and (b) in
Figure 4 that the fluctuation of the yaw Angle is also within a reasonable range. Compared with the ordinary MPC, the improved vehicle has better stability. It can be seen from (c) and (d) in
Figure 3 that with the increase in vehicle speed, when the vehicle speed is 80 and 100 km/h, the ordinary MPC fails to track at the longitudinal displacement of about 90 m. However, although the tracking error of the improved MPC at 40–90 m is slightly larger than that at low speed, it can still track the desired trajectory after 90 m. It can be seen from (c) and (d) in
Figure 4 that the yaw Angle of the ordinary MPC fluctuates greatly after the longitudinal displacement of 80 m, putting the vehicle in a dangerous state. In the process of the change of the yaw Angle of the improved MPC, the oscillation amplitude is weakened, and the MPC is more stable, with better tracking accuracy and stability. Through the analysis of the above simulation results, the effectiveness of the improved MPC controller is verified.
The calculation time is also an important index to evaluate the performance of the controller. The calculation time of the controller is solved and analyzed by a simulation test. The calculation time of the controller is compared with that of ordinary MPC at low speed (30 km/h) and high speed (100 km/h), respectively, and the performance of the controller is further evaluated.
Through simulation tests, the calculation time of the controller and the percentage reduction of calculation time are shown in
Figure 5. It can be seen from (b) and (d) that the calculation efficiency of the controller is higher when the vehicle is at low speed than at high speed, and the calculation time of the improved controller is shorter, and the calculation performance is significantly improved. However, there are still some time points in the simulation process that take longer to calculate than the ordinary model prediction controller. The reason is that the change of step length in the horizon leads to the influence of the rolling optimization results at the previous time on the rolling optimization results at the next time and thus affects the calculation and solution time. It can be seen from
Table 2 and
Table 3 that the average calculation time of the improved MPC controller at low speed and high speed is 2.15 ms and 4.08 ms, respectively, and the maximum single calculation time is 4.29 ms and 7.10 ms, respectively. The average calculation time of an ordinary MPC controller is 3.94 ms and 4.76 ms, respectively, and the maximum single calculation time is 6.96 ms and 7.27 ms, respectively. Compared with the conventional MPC controller, the average calculation time of the improved MPC controller is reduced by 45.43% and 14.29% at low speed and high speed, respectively, and the maximum single calculation time is reduced by 38.36% and 2.34%.
4.2. Simulation Analysis of the Influence of Vehicle Speed and Prediction Horizon on Tracking Effect
The prediction horizon has a great influence on the performance of the model prediction controller. The prediction horizon is similar to the distance of pre-viewing a future time in the driver model. Under the working conditions of different speeds, different pre-viewing distances will produce different control effects. According to previous research experience, when the vehicle is at low speed, reducing the pre-sight distance will produce a relatively good control effect, and increasing the pre-sight distance will reduce the tracking accuracy and vehicle stability. On the contrary, when the vehicle is at high speed, increasing the pre-sight distance can improve the control effect and will not cause problems such as reduced tracking accuracy and steering jitter due to too small a pre-sight distance, so as to improve the stability of the vehicle. Therefore, the joint simulation platform of CarSim and MATLAB/Simulink was built on the basis of the improved MPC, and the road adhesion coefficient was set to 0.8 under the condition of tracking double shift, and the tracking effect of different speeds and prediction horizons was analyzed. The speed was selected as 30 km/h and 100 km/h, and the prediction horizon Np was selected as 8, 15, 20, 26, and 32, respectively.
When the vehicle speed is 30 km/h, the simulation results of different prediction horizons are compared as shown in
Figure 6. Because of the low speed, it is reasonable to select the first 4 groups of prediction horizon values for comparison. Through the analysis of (a) and (b), it can be seen that the whole tracking process is relatively stable, the tracking deviation of the trajectory is small, and the variation of the yaw Angle is also within a reasonable range. When the prediction horizon
Np is equal to 8, the lateral tracking deviation and yaw Angle of the trajectory are the best. When the prediction horizon
Np is equal to 26, the lateral tracking deviation is the largest. From the analysis of the above simulation results, it can be seen that with the increase in the prediction horizon
Np, both lateral error and heading error become larger, resulting in a decrease in vehicle tracking accuracy.
When the vehicle speed is 100 km/h, the simulation results of different prediction horizons are compared as shown in
Figure 7. Because the vehicle is in high-speed working condition, the stability of the vehicle will be greatly reduced if the prediction horizon is smaller, so it is reasonable to select the last four groups of prediction horizon values for analysis. Through the analysis of (a) and (b), it can be seen that when the vehicle runs at a higher speed, the smaller prediction horizon can no longer meet the requirements of path tracking accuracy and driving stability. This is because the dynamic characteristics of the vehicle change greatly at high speed, resulting in a sharp decline in the stability of the vehicle’s running, making the vehicle unable to quickly reach the desired corner. When the prediction horizon
Np is equal to 15, the vehicle path tracking fails and completely deviates from the expected trajectory. The fluctuation of the yaw Angle of the vehicle is large, which has exceeded the limit of the stability requirements, and the vehicle is seriously unstable. When the prediction horizon
Np is equal to 26 or 32, the deviation of trajectory tracking is moderate, and the yaw velocity changes relatively smoothly.
4.3. Design and Simulation Analysis of Adaptive MPC Controller Based on Variable Prediction Horizon
Through the analysis of the above simulation results, it can be seen that under the condition of low speed (constant speed), the tracking process of the vehicle in the forecasting horizon is relatively stable and the tracking accuracy of the vehicle trajectory is relatively high, while the tracking process in the forecasting horizon will increase the pre-sight distance and slow down the expected response trajectory. Although the tracking process is stable, the deviation is relatively large. Under high-speed (constant speed) conditions, the larger prediction horizon can stably track the expected path, but due to the increase in the pre-sight distance, there is a certain tracking bias, while the smaller prediction horizon will sacrifice the stability of the vehicle, and it is very dangerous at high-speed operation and should be avoided as far as possible. If a constant prediction horizon value is used, it cannot meet the requirements of trajectory tracking at low speed and high speed. Therefore, it is necessary to study the prediction horizon Np and update the prediction horizon value in real time according to the current vehicle speed.
Firstly, we determine the design goal of the adaptive trajectory tracking controller, which is to achieve high-precision trajectory tracking under the condition of vehicle dynamics parameter uncertainty and external interference. The core task of the controller is to adjust the control parameters online, adapt to the dynamic changes of the system, and ensure the tracking performance. A parameter adaptive module (variable prediction horizon controller) is added to the model prediction controller, and a parameter adaptive mechanism based on the recursive least squares method (RLS) is adopted to estimate vehicle dynamics parameters online. The vehicle status information is collected in real time, and the vehicle dynamics parameters are updated by the RLS algorithm and fed back to the MPC optimization problem. Based on the updated parameters, re-solve the MPC optimization problem and generate optimal control inputs.
According to the stability theory of MPC, the selection of the prediction horizon needs to meet certain conditions to ensure the stability of the closed-loop system. Based on Lyapunov stability theory and robust control theory, we derive the lower and upper bounds of the prediction horizon to ensure the stability of the system under uncertainty and external interference. In the process of dynamically updating the prediction horizon, we ensure that the prediction horizon still meets the constraints of the system after each update. Through the introduction of feasibility analysis, the solution of the optimization problem still exists in each update, and the stable operation of the system can be guaranteed.
Based on the above stability analysis, the control strategy for real-time optimization of prediction horizon parameters is given, as shown in
Figure 8. According to the changes of the initial state of the vehicle and the future reference trajectory information, it is input into the model prediction controller; the controller generates the control quantity and inputs it into the CarSim vehicle model to control the trajectory tracking of the vehicle, and the CarSim vehicle model feeds back the state quantity to the prediction horizon controller. The predictive horizon controller estimates the vehicle dynamics parameters online, adjusts the controller parameters in real time, updates the prediction horizon online, determines the corresponding prediction horizon values, and generates the optimal control input to the MPC model predictive controller, thus forming an adaptive trajectory tracking controller based on the variable prediction horizon.
Through the above simulation analysis of low-speed and high-speed conditions, the value of the forecast horizon has a certain reference basis. In order to more accurately analyze the influence of the prediction horizon on the controller tracking effect under different vehicle speeds, CarSim and MATLAB/Simulink were used for joint simulation, the vehicle speed was set at 24~108 km/h, the prediction horizon
Np was set at 6~35, and multiple sets of simulation tests were conducted based on the above selected prediction horizon values. At the same time, in order to ensure the effectiveness of the controller parameters and prevent the occurrence of vehicle control failure, the prediction horizon parameters are selected according to the following requirements: (1) The controller has no over-harmonic oscillation and can successfully track the trajectory path effectively. (2) The solution time of the controller is less than the sampling time [
22].
Finally, valid simulation results were obtained. In the trajectory tracking research of autonomous vehicles, lateral error and heading error serve as important metrics for evaluating the controller’s performance. Therefore, we used smaller lateral error and heading error as evaluation criteria and employed the entropy weight method to determine their weights as 0.5623 and 0.4377, respectively. This ensures that the weights are determined based on the objective variability of the data rather than subjective judgment. Additionally, the method of the approximation of the ideal solution ordering (TOPSIS) was applied to obtain the optimal values of the prediction horizon
Np under different vehicle speeds, as shown in
Table 4. This approach facilitates the achievement of optimal path-tracking performance at different speeds.
According to the above simulation analysis and the results in
Table 4, considering the accuracy and stability of trajectory tracking and the real-time requirements of the controller under high-speed working conditions, the minimum prediction horizon is 8, and the maximum prediction horizon is 26. The relationship between the prediction horizon and the longitudinal velocity change is obtained through the selection of 4 groups of parameters and the rounding of the third-degree polynomial fitting in MATLAB. As shown in Equation (22), its fitting curve is shown in
Figure 9a. Among them, 4 points are the 4 groups of parameters in
Table 4, so it can be seen that the curve after fitting and rounding can well represent the 4 groups of parameters.
In order to better test the performance of the improved trajectory tracking controller (the following simulation results are called adaptive), the road adhesion coefficient is set at 0.8, and the vehicle is simulated for trajectory tracking under variable speed conditions, as shown in
Figure 9b. Vehicle parameters and controller parameters are consistent with the above simulation. Finally, the simulation results are compared and analyzed, and the validity of the variable prediction horizon adaptive trajectory tracking controller is verified.
The simulation results under variable speed conditions are shown in
Figure 10. It can be seen from (a) and (b) that when the prediction horizon
Np is equal to 8, the vehicle speed continues to increase, and the longitudinal displacement is about 80 m. At this time, the vehicle dynamic characteristics change greatly, which can no longer meet the constraint requirements, resulting in the failure of tracking the expected trajectory and expected yaw Angle at the exit under the double-shift condition. When the prediction horizon is large, the tracking accuracy is poor, and the adaptive vehicle can accurately track the reference track. Although the yaw Angle deflects with the increase in speed, it can quickly adjust and converge to the expected value. Through the analysis of (c) and (d), it can be seen that when the prediction horizon
Np is equal to 8, the vehicle tracking failure leads to large lateral error and heading error, and the adaptive vehicle tracking lateral error is the smallest, and the corresponding heading error is small. The heading error in the prediction horizon of 32 is the smallest at medium and high speeds, but the tracking lateral error is larger. This also indicates that the vehicle stability is better when the prediction horizon value is large at high speed, but the tracking lateral error will be larger. According to (e) and (f), it can be seen that when the prediction horizon
Np is small, the yaw velocity will fluctuate greatly; when the prediction horizon
Np is equal to 8, the vehicle will become seriously unstable; when the prediction horizon
Np is large, the vehicle will have good stability; and the changes of the lateral declination Angle and yaw velocity of the vehicle’s center of mass are smooth and natural using adaptive methods, indicating that the vehicle trajectory tracking process is stable.
To further evaluate the goodness of fit of the model, we calculated the SSE (Sum of Squared Errors) for both the fixed and adaptive prediction horizons in (a) and (b) of
Figure 10. In
Figure 10a, under different prediction horizons
Np, the SSE values are as follows: SSE = 473.55 (
Np = 8), SSE = 2.26 (
Np = 15), SSE = 2.27 (
Np = 20), SSE = 4.11 (
Np = 26), and SSE = 6.89 (
Np = 32), while the adaptive prediction horizon yields SSE = 1.39. When
Np = 8, the system exhibited significant fluctuations during the tracking of the desired trajectory and even deviated from it, leading to a very large SSE value. These results indicate that the adaptive prediction horizon offers superior goodness of fit, smaller prediction errors, and the ability to more effectively track the desired trajectory. In
Figure 10b, under different prediction horizons
Np, the SSE values are as follows: SSE = 14.82 (
Np = 8), SSE = 0.0096 (
Np = 15), SSE = 0.034 (
Np = 20), SSE = 0.081 (
Np = 26), and SSE = 0.17 (
Np = 32), while the adaptive prediction horizon yields SSE = 0.0074. When
Np = 8, the SSE value was the largest, accompanied by substantial yaw angle fluctuations and a significant deterioration in vehicle stability. These findings demonstrate that the adaptive prediction horizon achieves higher goodness of fit, smaller prediction errors, smoother yaw angle variations, and stable vehicle tracking performance.
Figure 11 shows the change of adaptive prediction horizon under variable speed. It can be seen that with the constant change of vehicle speed, the controller can update the prediction horizon in real time so as to predict the output at the next moment, ensuring that the variable horizon tracking controller has good adaptive performance under different vehicle speeds.