# Parallel Hybrid Electric Vehicle Modelling and Model Predictive Control
## 3 Model Predictive Control for the HEV  
A MPC is an open loop, infinite horizon prediction, and optimization subject to dynamic constraints. The continuous first order linear space state equation in Equation (24) can be discretized into time intervals with a discrete \(k\) and \(k+1=k+\Delta t\) (\(\Delta t\) is the computer scanning speed or the time sampling interval). Now, the continuous time form in Equation (24) can be discretized into:  
\[\left\{ \begin{array}{l}x_{t+1}=Ax_{t}+Bu_{t}\\ y_{t}=Cx_{t}+Du_{t}\end{array} \right. \tag{29}\]  
which is subject to the states, inputs, outputs, and the input increase constraints  
\[u_{t}\in\mathcal{U},\ \Delta u_{t}=u_{t}-u_{t-1}\in\Delta\mathcal{U},\ \text{and}\ y_{t}\in\mathcal{Y} \tag{30}\]  
A MPC calculates the open loop input and output prediction horizon. For the calculation simplicity, we assumed the input prediction length is always equal to the output prediction length, or \(N_{u}=N_{y}\). The objective function of the MPC for the HEV is:  
\[\underset{U^{\Delta}\triangleq\{\Delta u_{1},\ldots,\Delta u_{1+N_{u}-1}\}}{ min}\left\{J(U,x(t))=\sum_{k=0}^{N_{u}-1}\Bigl{[}\bigl{(}y_{t+k|t}-r\bigr{)}^{ \prime}Q\Bigl{(}y_{t+k|t}-r\bigr{)}+\Delta u_{t+k}^{\prime}R\Delta u_{t+k} \Bigr{]}\right\} \tag{31}\]By substituting \(x_{k+j|k}=A^{k}x(k)+\sum\limits_{j=0}^{k-1}A^{j}Bu_{k+j-1-j}\), Equation (31) can be transformed as  
\[V(x(k))=\frac{1}{2}x^{\prime}(k)Yx(k)+\underset{U}{min}\bigg{\{}\frac{1}{2}U^{ \prime}HU+x^{\prime}(k)FU\bigg{\}} \tag{32}\]  
subject to the linear matrices inequality (LMI), \(GU\leq W+Ex(t)\), where the column vector \(U\triangleq\left[u_{k}^{\prime},\ldots,u_{k+N-1}^{\prime}\right]\in\mathbb{R}^ {s}\), \(s\triangleq mN_{u}\) is the optimization vector, \(H=H^{\prime}>0\), and \(H\), \(F\), \(Y\), \(G\), \(W\), \(E\) are obtained from \(Q\), \(R\) and in (9) as only the optimizer vector \(U\) is needed, the term involving \(Y\) is usually removed from (10). The optimization problem (10) is a quadratic program (QP). The MPC optimizer will calculate the optimal input vector \(U\triangleq\left\{\Delta u_{k},\ldots,\Delta u_{k+N_{u-1}}\right\}\) subject to the hard constraints of the inputs, \(u_{k}\in\mathcal{U}\), and \(u_{k+i}\in[umax_{min}]\); of the outputs \(y_{k}\in\mathcal{Y}\), and \(y_{k+i|k}\in[ymax_{min}]\); and of the input increments \(\Delta u_{k+i}\in[\Delta umax_{min}]\). But only the first input increment, \(\Delta u_{k}\), is taken into the implementation. Then, the optimizer will update the outputs and states variables with the new update input and repeat the calculation for the next time interval. Therefore, the MPC is also called as the receding time horizon control. A diagram control system for this NMPC is shown in Figure 3.  
The MPC scheme for the HEV in Figure 3 calculates the real-time optimal control action, \(\Delta u_{k}\), and feeds into the vehicle dynamic equations and updates the current states, inputs, and outputs. The updated states, inputs, and outputs will feedback and compare to the reference desired trajectory data for generating the next optimal control action, \(\Delta u_{k}\), in the next interval. When the system is non-linear and has a general derivative nonlinear form, it is calculated as:  
\[\dot{X}=f(x,u) \tag{33}\]  
where \(x\) is the state variables and \(u\) is the inputs. The non-linear equation in (33) can be approximated in a Taylor series at referenced positions of \((x_{r},u_{r})\) for \(\dot{X}_{r}=f(x_{r},u_{r})\), so that:  
\[\dot{X}\approx f(x_{r},u_{r})+f_{x,r}(x-x_{r})+f_{u,r}(u-u_{r}) \tag{34}\]  
where \(f_{x,r}\) and \(f_{r,x}\) are the Jacobian function calculating approximation of \(x\) and \(u\), respectively, moving around the referenced positions \((x_{r},u_{r})\).