# Hierarchical Model Predictive Control for Hydraulic Hybrid Powertrain of a Construction Vehicle
## 3 MPC-Based Hierarchical Control Scheme
### SMPC-Based Upper-Layer Energy Management Strategy Design
The method is derived from the multistage stochastic optimization idea and uses stochastic models (such as Markov models) to describe the external random disturbances, and therefore improves the effect of model predictive control as much as possible. According to this feature, the Markov model proposed above can be conveniently applied to the method, and therefore the scenario based on the SMPC method is built using the updated information on the Markov chain (9) and (10), and system state. * For predictive control based on a scenario stochastic model in the application process, it is necessary to predict the system state and disturbance in a future period (predicted time domain) from the current random disturbance and the measured value of the system state at each sampling moment. The predicted transient state of the system state and the disturbance interaction are also the so-called scenario. This scenario is used to predict the probability of reaching a node. Each node of the scenario represents a predicted state which is the weight factor in the optimization problem (14). This scenario is generally described in terms of trees, as shown in Figure 6, and this description method requires the introduction of the following variables and terms:
* \(\Gamma=\{T_{1},T_{2},\cdots,T_{n}\}\), the set of the tree nodes. Nodes are indexed progressively as they are added to the tree (i.e., \(T_{1}\) is the root node and \(T_{n}\) is the last node added);
* \(pre(T)\in\Gamma\), the predecessor of the node \(T\);
* \(succ(T,j)\in\Gamma\), the successor of node \(T\) with value \(a_{inte,j}\);
* \(x_{T},u_{T},v_{T}\), the state, the output and the disturbance, respectively, associated with node \(T\), where \(x_{T_{1}}=x(k)\) and \(w_{T_{1}}=w(k)\);  
Figure 5: Transition probabilities of torque demand at different velocities. \(\pi_{T}\in[0,1]\), the probability of reaching node \(T\) (from \(T_{1}\));  
\(C=\{C_{1},C_{2},\cdots,C_{c}\}\), the set of candidate nodes, defined as \(C=\{T\
ot\in I\big{|}\exists(i,j):T=succ(T_{i},j)\}\);  
\(S\subset\Gamma\), the set of leaf nodes, \(S=\{T\in I\big{|}succ(T,j)\
ot\in I,\ \forall j\in\{1,2,\ \cdots,\ M\}\}\). Every route from root node to leaf node presents a disturbance scenario that is considered in the optimization problem, a list of possible candidates is evaluated, and the node with largest realization probability is added to the tree until a desired number of nodes, \(n_{max}\), is reached. The procedure to construct scenario tree is listed in the following Algorithm 1:  
```
At any step \(k\): set \(\Gamma=\{T_{1}\}\), \(\pi_{T_{1}}=1\), \(n=1\), \(c=\{succ(T_{1},j),\ j=1,2,\cdots,M\}\). (\(k=1,\ldots,N\)-1) while \(n<n_{max}\) do For \(i=1\) To \(c\) Do Calculate \(\pi_{T_{i}}\) according to (10) and (11) End for Set \(\hat{t^{{}^{\prime}}}=\arg\max\limits_{i\in[1,\cdots,d]}\pi_{C_{i}}\), \(T_{n+1}=C_{i^{{}^{\prime}}}\), \(T=T\cup(T_{n+1})\), \(C=C\backslash T_{n+1}\cup\{succ(T_{n+1},j)\}\), \(j=1,\ 2,\ \cdots,\ M\), \(n=n+1\), \(c=c+M-1\). End while
```  
**Algorithm 1** SMPC Scenario Tree Generation Procedure  
In addition, in order to prevent large changes in the SOC of the accumulator at the beginning and the end of the cycle, energy constraint for the accumulator at the initial and final values is added into the cost function of the optimization. According to (12) to (14), the SMPC problem at time \(k\) is formulated as:  
\[ \begin{array}{c}\min\limits_{u}\sum\limits_{i\in\Gamma\{T_{1}\}}\pi_{T_{i}}Q \Big{(}SOC_{T_{i}}-SOC_{ref}\Big{)}^{2}+\sum\limits_{i\in\Gamma\backslash S }\pi_{T_{i}}R\hat{m}_{f}^{2}\Big{(}u_{T_{i}}\Big{)}\\ x_{T_{1}}=x(k)\\ x_{T_{i}}=f\Big{(}x_{pre(T_{i})},\ u_{pre(T_{i})},w_{T_{i}}\Big{)},T_{i}\in \Gamma\backslash\{T_{1}\}\\ SOC^{\min}\leq SOC_{T_{i}}\leq SOC^{\max},\ T_{i}\in\Gamma\backslash\{T_{1}\} \\ u^{\min}\leq u_{T_{i}}\leq u^{\max},\ T_{i}\in\Gamma\backslash S\end{array}  \tag{15}\]  
where \(Q\) and \(R\) are nonnegative scalar weights, problem (15) can be cast as a standard quadratic programming problem (QP).