## 4 Delay Compensation Controller Based on Model Prediction
### Test System Delay Compensator Design  
Considering the overall real-time problem of the system, the model of vehicle dynamics should not be too complex. Therefore, a simplified tractor monorail dynamics model was selected to be the dynamics model of the delay compensation controller. During the test, side deflection and understeer were not considered. The dynamic equation in Equation (1) is used in the test process.  
\[\begin{cases}x_{1}=v_{x1}\cos\varphi_{1}\\ y_{1}=v_{x1}\sin\varphi_{1}\\ \varphi_{1}=\frac{v_{x1}}{L_{1}}\tan\delta\end{cases} \tag{1}\]  
Equation (1) defines the position of the tractor's center of mass in geodetic coordinates. It includes variables \(x_{1}\) and \(y_{1}\) for the position in the \(x\) and \(y\) directions, respectively. \(\delta\) is the tractor front wheel angle of rotation; \(v_{x1}\) is the driving speed of the vehicle in the X direction. \(\varphi_{1}\) is the tractor traverse angle; \(L_{1}\) is the distance between the center of the front and rear axles.  
Figure 6 shows the modeling of tractor monorail dynamics. Assumptions for applying this dynamical model to the delay compensator are as follows:  
1. The vertical motion of the vehicle is not considered.
2. The motions of the left- and right-side wheels are combined and described as a wheel.
3. The transfer of the front- and rear-axle loads is ignored.  
Equations (2) and (3) can be used to determine the state quantity \(Z\) and control quantity \(u\) for the twin test vehicle, where \(\phi\) is the yaw angle of the tractor, and \(a\) is the vehicle acceleration.  
\[Z=[x,y,v,\phi], \tag{2}\]  
\[u=[a,\delta] \tag{3}\]  
Considering the delay, the objective function \(J(t)\) is designed to minimize the difference between the current and reference position, velocity and acceleration of the vehicle, where  
Figure 5: Test cycle timeline.  
Figure 6: Modeling of tractor monorail dynamics.  
\(Z_{t}\) is the current state quantity. Additionally, the control volume output is minimized to ensure vehicle stability, as shown in Equation (4).  
\[J(t)=\sum\lVert Z(t+\Delta)-Z_{t}\rVert^{2}Q+\sum\lVert\Delta u\rVert^{2}R+\rho \epsilon^{2}, \tag{4}\]  
where \(Q\) and \(R\) are the weights of the state and control quantities, respectively. The parameter \(\rho\epsilon^{2}\) is the relaxation factor.  
Since the hub motor current of the twin test vehicle has an operating range limit with Ackermann steering, it is necessary to constrain the amount of control, as shown in Equation (5).  
\[u_{\text{min}}\leq u_{t}\leq u_{\text{max}}, \tag{5}\]  
Combining the objective function with constraints, control quantities are solved for each control cycle and time domain. The first control quantity is then used as the output to the system. Continuous control of the twin test vehicle is achieved by iterating through the above steps in a cyclic manner using rolling optimization. If the data from the ECPB hardware test bench is not transmitted to the controller of the twin test vehicle in time for each test cycle, the current control quantity is solved as the driving brake signal by the model predictive control method to guarantee the continuous movement of the twin test vehicle. Figure 7 shows the delay compensation for the twin test vehicle.