## 3 Adaptive Cruise Controller Design
### MPC Controller Design
#### 3.1.1 State Space Equation  
In this study, the acceleration of the vehicle was used as the control quantity, and the state variables between vehicles in the following state were established. The relative distance and relative velocity were expressed as Formula (11):  
\[\left\{ \begin{array}{l}x_{rel}=x_{l}-x_{f}\\ v_{rel}=v_{l}-v_{f}\end{array} \right. \tag{11}\]  
where \(x_{rel}\) is the relative distance between the two vehicles; \(x_{l}\) is the displacement of the leading vehicle; \(x_{f}\) is the displacement of the following vehicle; \(v_{rel}\) is the relative speed; \(v_{l}\) is the speed of the leading vehicle; and \(v_{f}\) is the speed of the following vehicle. Considering the distance between the two vehicles and the relative speed, we defined the state variables \(X(k)\) and output \(Y(k)\) for the subsequent calculation of MPC:  
\[\left\{ \begin{array}{l}X(k)=\left[x_{rel}(k),v_{rel}(k),v_{f}(k),a(k),j(k) \right]^{T}\\ Y(k)=\left[x_{rel}(k),v_{rel}(k),a(k),j(k)\right]^{T}\\ Y(k)=DX(k)\end{array} \right. \tag{12}\]  
where, \(a(k)\) is the acceleration of the host vehicle at time \(k\); \(j(k)\) is the jerk of the host vehicle at time \(k\); \(and\)\(D= \begin{bmatrix}1&0&0&0&0\\ 0&1&0&0&0\\ 0&0&0&1&0\\ 0&0&0&0&1\end{bmatrix} .\)  
Figure 5: Battery capacity decay curve. Figure 6: Vehicle-following scenario. We set up a constant headway strategy to arrive at the desired distance:  
\[x_{des}=v_{f}\cdot\tau_{t}+d_{0} \tag{13}\]  
where \(x_{des}\) is the desired distance between vehicles; \(\tau_{t}\) is the constant time interval; and \(d_{0}\) is the minimum safe distance. Due to the inertial and nonlinear nature of the vehicle's drivetrain, there is a certain delay in the actual acceleration of the vehicle when following the desired acceleration. Therefore, a first-order inertial linkage was used in the design to represent the actual transmission characteristics [15], as shown in Formula (14):  
\[a=\frac{1}{\tau s+1}a_{des} \tag{14}\]  
where \(a_{des}\) is the desired acceleration and \(\tau\) is the inertial link time constant. Establishing a state space model between two vehicles and discretizing it, we arrived at:  
\[\left\{ \begin{array}{l}x_{rel}(k+1)=x_{rel}(k)+v_{rel}(k)\cdot ts\\ v_{rel}(k+1)=[a_{l}(k)-a_{f}(k)]\cdot ts+v_{rel}(k)\\ v(k+1)=v(k)+a(k)\cdot ts\\ a(k+1)=(1-\frac{ts}{\tau})a(k)+\frac{ts}{\tau}a_{des}(k)\\ j(k+1)=-\frac{1}{\tau}a(k)+\frac{1}{\tau}a_{des}(k)\end{array} \right. \tag{15}\]  
Converting Formula (15) into matrix form, we arrived at: \(X(k+1)=AX(k)+Bu(k)+\textit{Cal(}k)\), which is expressed as Formula (16):  
\[\left( \begin{array}{c}x_{rel}(k+1)\\ v_{rel}(k+1)\\ v(k+1)\\ a(k+1)\\ j(k+1)\end{array} \right)=\left( \begin{array}{cccc}1&ts&0&0&0\\ 0&1&0&-ts&0\\ 0&0&1&ts&0\\ 0&0&0&-\frac{ts}{\tau}&0\end{array} \right)\left( \begin{array}{c}x_{rel}(k) \\ v_{rel}(k)\\ v(k)\\ a(k)\\ j(k)\end{array} \right)+\left( \begin{array}{c}0\\ 0\\ 0\\ \frac{ts}{\tau}\end{array} \right)u(k)+\left( \begin{array}{c}0\\ ts\\ 0\\ 0\\ 0\end{array} \right)a_{l}(k) \tag{16}\]  
where \(ts\) is the sampling time; \(u(k)\) is the control variable at time \(k\); and \(a_{l}(k)\) is the disturbance at time \(k\). This is the acceleration of the preceding vehicle. Therefore, \(X_{k}\) under the prediction step N can be expressed as Formula (17):  
\[X_{k}=M_{1}x(k)+M_{2}U_{k}+M_{3}a_{lk} \tag{17}\]  
\[M_{1}=\left( \begin{array}{c}I\\ A\\ \vdots\\ A^{N-1}\\ A^{N}\end{array} \right);M_{2}=\left( \begin{array}{cccc}0&0&\cdots&0\\ B&0&\cdots&0\\ AB&B&\cdots&0\\ \vdots&\vdots&\ldots&\vdots\\ A^{N-1}B&A^{N-2}B&\cdots&B\end{array} \right);M_{3}=\left( \begin{array}{cccc}0&0& \cdots&0\\ C&0&\cdots&0\\ AC&C&\cdots&0\\ \vdots&\vdots&\ldots&\vdots\\ A^{N-1}C&A^{N-2}C&\cdots&C\end{array} \right)\]According to \(Y(k)=DX(k)\), it can be concluded that \(Y_{k}\) under the prediction step N can be expressed as Formula (18):  
\[Y_{k}=\left( \begin{array}{c}Y(k)\\ Y(k+1)\\ \vdots\\ Y(k+N-1)\\ Y(k+N)\end{array} \right)=L_{1}X_{k}+L_{2}U_{k}+L_{3}a_{lk} \tag{18}\]  
\[\text{where}\quad L_{1}\quad=\quad\left(