1、状态空间模型
线性离散时间系统的状态空间模型如下:
x ( k + 1 ) = A x ( k ) + B u u ( k ) + B d d ( k ) y c ( k ) = C c x ( k ) (1) \begin{aligned} &x(k+1)=Ax(k)+B_uu(k)+B_dd(k)\\[1ex] &y_c(k)=C_cx(k)\tag{1} \end{aligned} x(k+1)=Ax(k)+Buu(k)+Bdd(k)yc(k)=Ccx(k)(1)
其中 x ( k ) ∈ R n x x(k)\in\cal{R}^{n_x} x(k)∈Rnx 是状态变量; u ( k ) ∈ R n u u(k)\in\cal{R}^{n_u} u(k)∈Rnu 是控制输入变量; y c ( k ) ∈ R n c y_c(k)\in\cal{R}^{n_c} yc(k)∈Rnc 是被控输出变量; d ( k ) ∈ R n d d(k)\in\cal{R}^{n_d} d(k)∈Rnd 是可以测量的外部干扰变量。
上面的离散时间模型与连续时间模型
x ˙ = A c x ( t ) + B c u u ( t ) + B c d d ( t ) y c ( t ) = C c x ( t ) (2) \begin{aligned} &\dot{x}=A_cx(t)+B_{cu}u(t)+B_{cd}d(t)\\[1ex] &y_c(t)=C_cx(t)\tag{2} \end{aligned} x˙=Acx(t)+Bcuu(t)+Bcdd(t)yc(t)=Ccx(t)(2)
之间有如下的转化关系:
A = e A c T s B u = ∫ 0 T s e A c τ d τ ⋅ B c u B d = ∫ 0 T s e A c τ d τ ⋅ B c d (3) \begin{aligned} A&=e^{A_cT_s}\\[1ex] B_u&=\int_0^{T_s}e^{A_c\tau}\mathrm{d}\tau\cdot B_{cu}\\[1ex] B_d&=\int_0^{T_s}e^{A_c\tau}\mathrm{d}\tau\cdot B_{cd} \end{aligned}\tag{3} ABuBd=eAcTs=∫0TseAcτdτ⋅Bcu=∫0TseAcτdτ⋅Bcd(3)
其中 T s T_s Ts 是系统的采样时间。
2、预测方程
将模型(1)改写成增量模型
Δ x ( k + 1 ) = A Δ x ( k ) + B u Δ u ( k ) + B d Δ d ( k ) y c ( k ) = C c Δ x ( k ) + y c ( k − 1 ) (4) \begin{aligned} \Delta x(k+1)&=A\Delta x(k) + B_u\Delta u(k) + B_d\Delta d(k)\\[1ex] y_c(k)&=C_c\Delta x(k)+y_c(k-1)\tag{4} \end{aligned} Δx(k+1)yc(k)=AΔx(k)+BuΔu(k)+BdΔd(k)=CcΔx(k)+yc(k−1)(4)
其中
Δ x ( k ) = x ( k ) − x ( k − 1 ) Δ u ( k ) = u ( k ) − u ( k − 1 ) Δ d ( k ) = d ( k ) − d ( k − 1 ) \begin{aligned} \Delta x(k)=x(k)-x(k-1)\\[1ex] \Delta u(k)=u(k)-u(k-1)\\[1ex] \Delta d(k)=d(k)-d(k-1)\\[1ex] \end{aligned} Δx(k)=x(k)−x(k−1)Δu(k)=u(k)−u(k−1)Δd(k)=d(k)−d(k−1)
首先以最新测量值为初始条件,基于模型(4)预测系统未来的动态。为此,设定预测时域为 p p p,控制时域为 m m m 且 m ≤ p m\leq p m≤p。为了推导系统的预测方程,我们假设:
- 控制时域之外,控制量不变,即 Δ u ( k + i ) = 0 , i = m , m + 1 , ⋯ , p − 1 \Delta u(k+i)=0,\quad i=m,m+1,\cdots,p-1 Δu(k+i)=0,i=m,m+1,⋯,p−1;
该假设是因为控制时域有可能小于预测时域,而预测系统未来动态需要在整个预测时域的控制输入。 - 可测干扰在 k k k 时刻之后不变,即 Δ d ( k + i ) = 0 , i = 1 , 2 , ⋯ , p − 1 \Delta d(k+i)=0,\quad i=1,2,\cdots,p-1 Δd(k+i)=0,i=1,2,⋯,p−1;
该假设是因为在当前时刻( k k k 时刻),我们还不知道干扰的未来取值。
在当前时刻 k k k,测量值为 x ( k ) x(k) x(k),可以计算 Δ x ( k ) = x ( k ) − x ( k − 1 ) \Delta x(k)=x(k)-x(k-1) Δx(k)=x(k)−x(k−1),这个将作为预测系统未来动态的起点。由(4)可以预测 k + 1 k+1 k+1 到 k + 3 k+3 k+3 时刻的状态(实际上是状态增量,简单起见称为状态)如下:
Δ x ( k + 1 ∣ k ) = A Δ x ( k ) + B u Δ u ( k ) + B d Δ d ( k ) Δ x ( k + 2 ∣ k ) = A Δ x ( k + 1 ∣ k ) + B u Δ u ( k + 1 ) + B d Δ d ( k + 1 ) = A 2 Δ x ( k ) + A B u Δ u ( k ) + B u Δ u ( k + 1 ) + A B d Δ d ( k ) Δ x ( k + 3 ∣ k ) = A Δ x ( k + 2 ∣ k ) + B u Δ u ( k + 2 ) + B d Δ d ( k + 2 ) = A 3 Δ x ( k ) + A 2 B u Δ u ( k ) + A B u Δ u ( k + 1 ) + B u Δ u ( k + 2 ) + A 2 B d Δ d ( k ) (5) \begin{aligned} \Delta x(k+1|k)&=A\Delta x(k) + B_u\Delta u(k) + B_d\Delta d(k)\\[1ex] \Delta x(k+2|k)&=A\Delta x(k+1|k) + B_u\Delta u(k+1) + B_d\Delta d(k+1)\\[1ex] &=A^2\Delta x(k) + AB_u\Delta u(k) + B_u\Delta u(k+1) + AB_d\Delta d(k)\\[1ex] \Delta x(k+3|k)&=A\Delta x(k+2|k) + B_u\Delta u(k+2) + B_d\Delta d(k+2)\\[1ex] &=A^3\Delta x(k) + A^2B_u\Delta u(k) + AB_u\Delta u(k+1) + B_u\Delta u(k+2) + A^2B_d\Delta d(k)\tag{5} \end{aligned} Δx(k+1∣k)Δx(k+2∣k)Δx(k+3∣k)=AΔx(k)+BuΔu(k)+BdΔd(k)=AΔx(k+1∣k)+BuΔu(k+1)+BdΔd(k+1)=A2Δx(k)+ABuΔu(k)+BuΔu(k+1)+ABdΔd(k)=AΔx(k+2∣k)+BuΔu(k+2)+BdΔd(k+2)=A3Δx(k)+A2BuΔu(k)+ABuΔu(k+1)+BuΔu(k+2)+A2BdΔd(k)(5)
式中, k + 1 ∣ k k+1|k k+1∣k 表示 k k k 时刻对 k + 1 k+1 k+1 时刻的预测;符号 ∣ | ∣ 后面的 k k k 表示当前时刻为 k k k。进而,可以预测 k + m k+m k+m 至 k + p k+p k+p 时刻的状态
Δ x ( k + m ∣ k ) = A Δ x ( k + m − 1 ∣ k ) + B u Δ u ( k + m − 1 ) + B d Δ d ( k + m − 1 ) = A m Δ x ( k ) + A m − 1 B u Δ u ( k ) + A m − 2 B u Δ u ( k + 1 ) + ⋯ + B u Δ u ( k + m − 1 ) + A m − 1 B d Δ d ( k ) ⋮ Δ x ( k + p ∣ k ) = A Δ x ( k + p − 1 ∣ k ) + B u Δ u ( k + p − 1 ) + B d Δ d ( k + p − 1 ) = A p Δ x ( k ) + A p − 1 B u Δ u ( k ) + A p − 2 B u Δ u ( k + 1 ) + ⋯ + A p − m B u Δ u ( k + m − 1 ) + A p − 1 B d Δ d ( k ) (6) \begin{aligned} \Delta x(k+m|k)&=A\Delta x(k+m-1|k) + B_u\Delta u(k+m-1) + B_d\Delta d(k+m-1)\\[1ex] &=A^m\Delta x(k) + A^{m-1}B_u\Delta u(k) + A^{m-2}B_u\Delta u(k+1) +\cdots + B_u\Delta u(k+m-1) + A^{m-1}B_d\Delta d(k)\\[1ex] &\vdots\\[1ex] \Delta x(k+p|k)&=A\Delta x(k+p-1|k) + B_u\Delta u(k+p-1) + B_d\Delta d(k+p-1)\\[1ex] &=A^p\Delta x(k) + A^{p-1}B_u\Delta u(k) + A^{p-2}B_u\Delta u(k+1) +\cdots + A^{p-m}B_u\Delta u(k+m-1) + A^{p-1}B_d\Delta d(k)\\[1ex] \end{aligned}\tag{6} Δx(k+m∣k)Δx(k+p∣k)=AΔx(k+m−1∣k)+BuΔu(k+m−1)+BdΔd(k+m−1)=AmΔx(k)+Am−1BuΔu(k)+Am−2BuΔu(k+1)+⋯+BuΔu(k+m−1)+Am−1BdΔd(k)⋮=AΔx(k+p−1∣k)+BuΔu(k+p−1)+BdΔd(k+p−1)=ApΔx(k)+Ap−1BuΔu(k)+Ap−2BuΔu(k+1)+⋯+Ap−mBuΔu(k+m−1)+Ap−1BdΔd(k)(6)
进一步,由增量方程(4)可以预测 k + 1 k+1 k+1 至 k + p k+p k+p 的被控输出
y c ( k + 1 ∣ k ) = C c Δ x ( k + 1 ∣ k ) + y c ( k ) = C c A Δ x ( k ) + C c B u Δ u ( k ) + C c B d Δ d ( k ) + y c ( k ) , y c ( k + 2 ∣ k ) = C c Δ x ( k + 2 ∣ k ) + y c ( k + 1 ∣ k ) = ( C c A 2 + C c A ) Δ x ( k ) + ( C c A B u + C c B u ) Δ u ( k ) + C c B u Δ u ( k + 1 ) + ( C c A B d + C c B d ) Δ d ( k ) + y c ( k ) , ⋮ y c ( k + m ∣ k ) = C c Δ x ( k + m ∣ k ) + y c ( k + m − 1 ∣ k ) = ∑ i = 1 m C c A i Δ x ( k ) + ∑ i = 1 m C c A i − 1 B u Δ u ( k ) + ∑ i = 1 m − 1 C c A i − 1 B u Δ u ( k + 1 ) + ⋯ + C c B u Δ u ( k + m − 1 ) + ∑ i = 1 m C c A i − 1 B d Δ d ( k ) + y c ( k ) , ⋮ y c ( k + p ∣ k ) = C c Δ x ( k + p ∣ k ) + y c ( k + p − 1 ∣ k ) = ∑ i = 1 p C c A i Δ x ( k ) + ∑ i = 1 p C c A i − 1 B u Δ u ( k ) + ∑ i = 1 p − 1 C c A i − 1 B u Δ u ( k + 1 ) + ⋯ + ∑ i = 1 p − m + 1 C c A i − 1 B u Δ u ( k + m − 1 ) + ∑ i = 1 p C c A i − 1 B d Δ d ( k ) + y c ( k ) , (7) \begin{aligned} y_c(k+1|k)&=C_c\Delta x(k+1|k)+y_c(k)\\[1ex] &=C_cA\Delta x(k)+C_cB_u\Delta u(k)+C_cB_d\Delta d(k)+y_c(k),\\[1ex] y_c(k+2|k)&=C_c\Delta x(k+2|k)+y_c(k+1|k)\\[1ex] &=(C_cA^2+C_cA)\Delta x(k)+(C_cAB_u+C_cB_u)\Delta u(k)\\[1ex]&\quad+C_cB_u\Delta u(k+1)+(C_cAB_d+C_cB_d)\Delta d(k)+y_c(k),\\[1ex] &\vdots\\[1ex] y_c(k+m|k)&=C_c\Delta x(k+m|k)+y_c(k+m-1|k)\\[1ex] &=\sum_{i=1}^mC_cA^i\Delta x(k)+\sum_{i=1}^mC_cA^{i-1}B_u\Delta u(k)+\sum_{i=1}^{m-1}C_cA^{i-1}B_u\Delta u(k+1)+\cdots\\[1ex]&\quad+C_cB_u\Delta u(k+m-1)+\sum_{i=1}^mC_cA^{i-1}B_d\Delta d(k)+y_c(k),\\[1ex] &\vdots\\[1ex] y_c(k+p|k)&=C_c\Delta x(k+p|k)+y_c(k+p-1|k)\\[1ex] &=\sum_{i=1}^pC_cA^i\Delta x(k)+\sum_{i=1}^pC_cA^{i-1}B_u\Delta u(k)+\sum_{i=1}^{p-1}C_cA^{i-1}B_u\Delta u(k+1)+\cdots\\[1ex]&\quad+\sum_{i=1}^{p-m+1}C_cA^{i-1}B_u\Delta u(k+m-1)+\sum_{i=1}^pC_cA^{i-1}B_d\Delta d(k)+y_c(k),\\[1ex] \end{aligned}\tag{7} yc(k+1∣k)yc(k+2∣k)yc(k+m∣k)yc(k+p∣k)=CcΔx(k+1∣k)+yc(k)=CcAΔx(k)+CcBuΔu(k)+CcBdΔd(k)+yc(k),=CcΔx(k+2∣k)+yc(k+1∣k)=(CcA2+CcA)Δx(k)+(CcABu+CcBu)Δu(k)+CcBuΔu(k+1)+(CcABd+CcBd)Δd(k)+yc(k),⋮=CcΔx(k+m∣k)+yc(k+m−1∣k)=i=1∑mCcAiΔx(k)+i=1∑mCcAi−1BuΔu(k)+i=1∑m−1CcAi−1BuΔu(k+1)+⋯+CcBuΔu(k+m−1)+i=1∑mCcAi−1BdΔd(k)+yc(k),⋮=CcΔx(k+p∣k)+yc(k+p−1∣k)=i=1∑pCcAiΔx(k)+i=1∑pCcAi−1BuΔu(k)+i=1∑p−1CcAi−1BuΔu(k+1)+⋯+i=1∑p−m+1CcAi−1BuΔu(k+m−1)+i=1∑pCcAi−1BdΔd(k)+yc(k),(7)
定义 p p p 步预测输出向量和 m m m 步输入向量如下:
Y p ( k + 1 ∣ k ) = = d e f [ y c ( k + 1 ∣ k ) y c ( k + 2 ∣ k ) ⋮ y c ( k + p ∣ k ) ] p × 1 , Δ U ( k ) = = d e f [ Δ u ( k ) Δ u ( k + 1 ) ⋮ Δ u ( k + m − 1 ) ] m × 1 (8) \begin{aligned} Y_p(k+1|k)&\overset{\mathrm{def}}{=\!=}\left[ \begin{matrix} y_c(k+1|k) \\[2ex] y_c(k+2|k) \\[2ex] \vdots\\[2ex] y_c(k+p|k) \end{matrix} \right]_{p\times 1},\\[1ex] \Delta U(k)&\overset{\mathrm{def}}{=\!=}\left[ \begin{matrix} \Delta u(k) \\[2ex] \Delta u(k+1) \\[2ex] \vdots\\[2ex] \Delta u(k+m-1) \end{matrix} \right]_{m\times 1} \end{aligned}\tag{8} Yp(k+1∣k)ΔU(k)==def yc(k+1∣k)yc(k+2∣k)⋮yc(k+p∣k) p×1,==def Δu(k)Δu(k+1)⋮Δu(k+m−1) m×1(8)
那么,对系统未来 p p p 步预测的输出可以由下面的预测方程计算:
Y p ( k + 1 ∣ k ) = S x Δ x ( k ) + I y c ( k ) + S d Δ d ( k ) + S u Δ U ( k ) (9) Y_p(k+1|k)=S_x\Delta x(k)+{\cal{I}}y_c(k)+{\cal{S}_d}\Delta d(k)+{\cal{S}_u}\Delta U(k)\tag{9} Yp(k+1∣k)=SxΔx(k)+Iyc(k)+SdΔd(k)+SuΔU(k)(9)
其中
S x = [ C c A ∑ i = 1 2 C c A i ⋮ ∑ i = 1 p C c A i ] p × 1 , I = [ I n c × n c I n c × n c ⋮ I n c × n c ] p × 1 , S d = [ C c B d ∑ i = 1 2 C c A i − 1 B d ⋮ ∑ i = 1 p C c A i − 1 B d ] p × 1 , S u = [ C c B u 0 0 ⋯ 0 ∑ i = 1 2 C c A i B u C c B u 0 ⋯ 0 ⋮ ⋮ ⋮ ⋮ ∑ i = 1 m C c A i − 1 B u ∑ i = 1 m − 1 C c A i − 1 B u ⋯ ⋯ C c B u ⋮ ⋮ ⋮ ⋮ ∑ i = 1 p C c A i − 1 B u ∑ i = 1 p − 1 C c A i − 1 B u ⋯ ⋯ ∑ i = 1 p − m + 1 C c A i − 1 B u ] p × m (10) \begin{aligned} S_x&=\left[ \begin{matrix} C_cA \\[2ex] \sum_{i=1}^2C_cA^i \\[2ex] \vdots\\[2ex] \sum_{i=1}^pC_cA^i \end{matrix} \right]_{p\times 1} ,\quad{\cal{I}}=\left[ \begin{matrix} I_{n_c\times n_c} \\[1ex] I_{n_c\times n_c} \\[1ex] \vdots\\[1ex] I_{n_c\times n_c} \end{matrix} \right]_{p\times 1},\quad{\cal{S}_d}=\left[ \begin{matrix} C_cB_d \\[2ex] \sum_{i=1}^2C_cA^{i-1}B_d \\[2ex] \vdots\\[2ex] \sum_{i=1}^pC_cA^{i-1}B_d \end{matrix} \right]_{p\times 1},\\[4ex] {\cal{S}_u}&=\left[ \begin{matrix} C_cB_u & 0 & 0 & \cdots & 0\\[2ex] \sum_{i=1}^2C_cA^iB_u & C_cB_u & 0 & \cdots & 0 \\[2ex] \vdots & \vdots & \vdots & &\vdots \\[2ex] \sum_{i=1}^mC_cA^{i-1}B_u & \sum_{i=1}^{m-1}C_cA^{i-1}B_u & \cdots & \cdots & C_cB_u \\[2ex] \vdots & \vdots & \vdots & &\vdots \\[2ex] \sum_{i=1}^pC_cA^{i-1}B_u & \sum_{i=1}^{p-1}C_cA^{i-1}B_u & \cdots & \cdots & \sum_{i=1}^{p-m+1}C_cA^{i-1}B_u \end{matrix} \right]_{p\times m} \end{aligned}\tag{10} SxSu= CcA∑i=12CcAi⋮∑i=1pCcAi p×1,I= Inc×ncInc×nc⋮Inc×nc p×1,Sd= CcBd∑i=12CcAi−1Bd⋮∑i=1pCcAi−1Bd p×1,= CcBu∑i=12CcAiBu⋮∑i=1mCcAi−1Bu⋮∑i=1pCcAi−1Bu0CcBu⋮∑i=1m−1CcAi−1Bu⋮∑i=1p−1CcAi−1Bu00⋮⋯⋮⋯⋯⋯⋯⋯00⋮CcBu⋮∑i=1p−m+1CcAi−1Bu p×m(10)