## 2 Mathematical Modeling and Methods
### The Composition of the Control System
#### 2.4.2 Pump-Motor Hydraulic System Control System
\tag{15}\]  
\[\mathbf{A}=\left[ \begin{array}{cccc}-\frac{1}{T_{p}}&0&0&\frac{k_{p}}{T_{p}}&0 \\ \frac{\delta_{p}}{V_{0}}&-\frac{\delta_{p}}{V_{0}}(c_{im}+c_{em})&-\frac{ \delta_{p}}{V_{0}}D_{m}&0\\ 0&\frac{D_{m}}{J_{t}}&-\frac{B_{m}}{J_{t}}&0&\frac{T_{L}}{J_{t}}\\ 0&0&0&0&0\\ 0&0&0&0&0\end{array} \right], \tag{16}\]  
\[\mathbf{B}=\left[ \begin{array}{cccc}0&0\\ 0&0\\ 0&0\\ 1&0\\ 0&1\end{array} \right],\ \ \mathbf{H}=[0&0&1&0&0]\]  
The transmission model is discretized:  
\[\left\{ \begin{array}{l}x(k+1)=A_{d}x(k)+B_{d}u(k)\\ y(k)=C_{d}x(k)\end{array} \right. \tag{17}\]  
Assuming that the prediction time domain of the system is \(N_{P}\) and the control time domain is \(N_{m}\), the predicted value at time \(k\) is:  
\[\left\{ \begin{array}{l}x(k+1|k)=A_{d}x(k)+B_{d}u(k)\\ x(k+2|k)=A_{d}x(k+1)+B_{d}u(k+1)\\ =A_{d}^{2}x(k)+A_{d}B_{d}u(k)+B_{d}u(k+1)\\ \ldots\\ x(k+N_{p}\Big{|}k)=A_{d}^{N_{p}}x(k)+A_{d}^{N_{p}-1}B_{d}u(k)\\ +A_{d}^{N_{p}-2}B_{d}u(k+1)+\ldots+A_{d}^{N_{p}-N_{m}}B_{d}u(k+N_{m}-1)\end{array} \right. \tag{18}\]The predicted output values of the controlled system are shown:  
\[\left\{ \begin{array}{l}y(k+1|k)=C_{d}A_{d}x(k)+C_{d}B_{d}u(k)\\ y(k+2|k)=C_{d}A_{d}x(k+1)+C_{d}B_{d}u(k+1)\\ =C_{d}A_{d}^{2}x(k)+C_{d}A_{d}B_{d}u(k)+C_{d}B_{d}u(k+1)\\ \ldots\\ y(k+N_{p}\big{|}k)=C_{d}A_{d}^{N_{p}}x(k)+C_{d}A_{d}^{N_{p}-1}B_{d}u(k)\\ +C_{d}A_{d}^{N_{p}-2}B_{d}u(k+1)+\ldots+C_{d}A_{d}^{N_{p}-N_{m}}B_{d}u(k+N_{m}- 1)\end{array} \right. \tag{19}\]  
The general formula for the output prediction value of the controlled system in the prediction time domain is:  
\[\left\{ \begin{array}{l}\mathbf{Y}(k)=\mathbf{F}\mathbf{x}(k)+\mathbf{GU}\\ \mathbf{Y}(k)=\left[\begin{array}{cccc}y(k+1|k)&y(k+2)|k&\ldots&y(k+N_{P})|k \end{array}\right]^{T}\\ \mathbf{F}=\left[\begin{array}{cccc}C_{d}A_{d}&C_{d}A_{d}^{2}&\ldots&C_{d}A_{ d}^{N_{p}}\end{array}\right]^{T}\\ \mathbf{U}=\left[\begin{array}{cccc}u(k)&u(k+1)&\ldots&u(k+N_{m}-1)\end{array} \right]\end{array} \right. \tag{20}\]  
\[\mathbf{G}=\left[ \begin{array}{cccc}C_{d}B_{d}&0&\ldots&0\\ C_{d}B_{d}A_{d}&C_{d}B_{d}&\ldots&0\\ \ldots&\ldots&\ldots&\ldots\\ C_{d}B_{d}A_{d}^{N_{p}-1}&C_{d}B_{d}A_{d}^{N_{p}-2}&\ldots&C_{d}B_{d}A_{d}^{N_{ p}-N_{m}}\end{array} \right] \tag{21}\]  
The difference between the state variable and the output value at time \(k+1\) and time \(k\) can be obtained. \[\left\{\begin{array}{l}x(k+1)-x(k)=A_{d}(x(k+1)-x(k))\\ +B_{d}(u(k+1)-u(k))\\ y(k+1)-y(k)=C_{d}(x(k+1)-x(k))\\ \Downarrow\\ \Delta x(k+1)=A_{d}\Delta x(k)+B_{d}\Delta u(k)\\ \Delta y(k+1)=C_{d}A_{d}\Delta x(k)+C_{d}B_{d}\Delta u(k)\\ \Downarrow\\ \left\{ \begin{array}{l}x_{u}(k+1)=A_{u}x_{u}(k)+B_{u}\Delta u(k)\\ y(k)=C_{u}x_{u}(k)\\ \end{array} \right. \tag{22}\]  
\[\mathbf{x}_{u}(k)=\left[ \begin{array}{l}\Delta x(k)\\ y(k)\end{array} \right]\! ;\,\mathbf{A_{u}}=\left[ \begin{array}{ll}A_{d}&0_{d}^ {T}\\ C_{d}A_{d}&1\end{array} \right]\! ;\,\mathbf{B_{u}}=\left[ \begin{array}{ll}B_{d }\\ C_{d}B_{d}\end{array} \right]\! ; \tag{23}\]  
The performance optimization index function of MPC is:  
\[\mathbf{J}=(\mathbf{Y_{r}}-\mathbf{Y})^{\mathrm{T}}\mathbf{R_{s}}(\mathbf{Y}- \mathbf{Y_{r}})+\Delta\mathbf{U}^{\mathrm{T}}\mathbf{R}\Delta\mathbf{U} \tag{24}\]  
where \(\mathbf{Y_{r}}\) represents the expected value matrix; \(\mathbf{R}\) represents the control weight matrix. The error weight matrix is:  
\[\mathbf{R}_{S}^{T}=\underbrace{[1\quad 1\quad\ldots\quad 1]}_{N_{p}}^{ \mathrm{T}}y_{r}(k)=\overline{\mathbf{R}}_{S}^{T}y_{r}(k) \tag{25}\]  
\[