最小方差自校正调节器设计
1、前言
自校正控制适用于结构已知但参数未知而恒定的随机系统,也适用于结构已知但参数缓慢变化的随机系统。其能完成调节任务,也能完成伺服跟踪任务。
自校正控制涉及到以下几个方面:
(1)被控对象参数估计:由于系统参数未知或者缓慢变化,无法直接进行控制,因此需要根据系统的输入输出,估计系统的参数;
(2)自校正控制系统性能指标:根据控制系统的性质和对控制系统的要求,有不同的性能指标形式,最普遍的是最小方差控制和极点配置控制。对于最小方差控制的目标函数为误差的二次型;极点配置控制的性能指标不是用目标函数的形式表示的,而是把预期的闭环系统的行为用一组期望传递函数的零极点的位置加以规定的,其目标就是想要实际的闭环系统的零极点收敛于这一组期望的零极点。
最小方差控制包含最小方差自校正调节器和最小方差自校正控制器,本文先从最小方差自校正调节器进行介绍。
2、系统介绍
最小方差自校正调节器结构框图如下:
其包含3个模块:控制对象、参数估计器和调节器。参数估计器根据控制对象的输出 y y y和输入 u u u的观测序列来估计被控对象的参数 θ \theta θ,将得到的参数估计值 θ ^ \hat \theta θ^送到调节器,调节器按照设计好的性能指标以及参数估计值 θ ^ \hat \theta θ^对控制器的参数进行调整,实现系统运行的性能指标达到最优或者接近最优状态。
在最小方差自校正调节器中,用在线辨识方法估计系统的参数,以输出 y ( t ) y(t) y(t)的方差最小作为调节指标,在自校正调节过程中,使系统的输出方差达到最小。
3、调节器设计
3.1 最优控制
被控对象的差分方程为
A ( q − 1 ) y ( t ) = q − d B ( q − 1 ) u ( t ) + C ( q − 1 ) w ( t ) (1) \begin{array}{c} A(q^{-1})y(t)=q^{-d}B(q^{-1})u(t)+C(q^{-1})w(t) \tag{1} \end{array} A(q−1)y(t)=q−dB(q−1)u(t)+C(q−1)w(t)(1)
其中,
A ( q − 1 ) = 1 + a 1 q − 1 + a 2 q − 2 + ⋯ + a n a q − n a B ( q − 1 ) = b 0 + b 1 q − 1 + ⋯ + b n b q − n b C ( q − 1 ) = c 0 + c 1 q − 1 + ⋯ + c n c q − n c (2) \begin{array}{c} \begin{align*} A(q^{-1}) &= 1 + a_1 q^{-1} + a_2 q^{-2} + \cdots + a_{n_a} q^{-n_a} \\ B(q^{-1}) &= b_0 + b_1 q^{-1} + \cdots + b_{n_b} q^{-n_b} \\ C(q^{-1}) &= c_0 + c_1 q^{-1} + \cdots + c_{n_c} q^{-n_c} \end{align*} \tag{2} \end{array} A(q−1)B(q−1)C(q−1)=1+a1q−1+a2q−2+⋯+anaq−na=b0+b1q−1+⋯+bnbq−nb=c0+c1q−1+⋯+cncq−nc(2)
y ( t ) y(t) y(t)为控制对象的输出; u ( t ) u(t) u(t)为其输入; w ( t ) w(t) w(t)为均值为0,方差为 σ 2 \sigma^2 σ2的白噪声序列; d d d为系统的时延。
由于系统存在 d d d个周期的时延,即当前的控制作用 u ( t ) u(t) u(t)要滞后 d d d的采样周期才能对系统的输出产生影响,因此要使系统输出方差最小,需要对输出量提前 d d d步进行预测,根据预测值来调整控制作用 u ( t ) u(t) u(t),以补偿随机扰动在 ( t + d ) (t+d) (t+d)时刻对输出的影响。
最小方差自校正调节器二次型指标函数为
J = E [ y 2 ( t + d ) ] = J m i n (3) \begin{array}{c} J=E[y^2(t+d)]=J_{min} \tag{3} \end{array} J=E[y2(t+d)]=Jmin(3)
根据 e q ( 1 ) eq(1) eq(1)可得
A ( q − 1 ) y ( t ) = q − d B ( q − 1 ) u ( t ) + C ( q − 1 ) w ( t ) ⇒ A ( q − 1 ) y ( t + d ) = B ( q − 1 ) u ( t ) + C ( q − 1 ) w ( t + d ) ⇒ y ( t + d ) = B ( q − 1 ) A ( q − 1 ) u ( t ) + C ( q − 1 ) A ( q − 1 ) w ( t + d ) (4) \begin{array}{c} A(q^{-1})y(t)=q^{-d}B(q^{-1})u(t)+C(q^{-1})w(t) \\ \Rightarrow A(q^{-1})y(t+d)=B(q^{-1})u(t)+C(q^{-1})w(t+d) \\ \Rightarrow y(t+d) = \frac{B(q^{-1})}{A(q^{-1})}u(t)+\frac{C(q^{-1})}{A(q^{-1})}w(t+d) \tag{4} \end{array} A(q−1)y(t)=q−dB(q−1)u(t)+C(q−1)w(t)⇒A(q−1)y(t+d)=B(q−1)u(t)+C(q−1)w(t+d)⇒y(t+d)=A(q−1)B(q−1)u(t)+A(q−1)C(q−1)w(t+d)(4)
要使最小方差自校正调节器的解存在,需要满足下列假设:
如果 B ( q − 1 ) ) B(q^{-1}) ) B(q−1))的零点全在 q − 1 q^{-1} q−1复平面单位圆外,则称该系统为最小相位系统,否则为非最小相位系统,有时称 B ( q − 1 ) ) B(q^{-1}) ) B(q−1))的零点全在 q − 1 q^{-1} q−1复平面单位圆外的系统为逆稳定系统,否则为逆不稳定系统。之所以要求 B ( q − 1 ) ) B(q^{-1}) ) B(q−1))和 C ( q − 1 ) ) C(q^{-1}) ) C(q−1))的零点全在单位圆外, 与闭环系统的稳定性有关,后面在稳定性这一节进行分析。
由 e q ( 4 ) eq(4) eq(4)可得
y ( t + d ) = B ( q − 1 ) A ( q − 1 ) u ( t ) + C ( q − 1 ) A ( q − 1 ) w ( t + d ) \begin{array}{c} y(t+d) = \frac{B(q^{-1})}{A(q^{-1})}u(t)+\frac{C(q^{-1})}{A(q^{-1})}w(t+d) \end{array} y(t+d)=A(q−1)B(q−1)u(t)+A(q−1)C(q−1)w(t+d)
将 C ( q − 1 ) A ( q − 1 ) \frac{C(q^{-1})}{A(q^{-1})} A(q−1)C(q−1)分解为
C ( q − 1 ) A ( q − 1 ) = F ( q − 1 ) + q − d G ( q − 1 ) A ( q − 1 ) (5) \begin{array}{c} \frac{C(q^{-1})}{A(q^{-1})}=F(q^{-1})+\frac{q^{-d}G(q^{-1})}{A(q^{-1})} \tag{5} \end{array} A(q−1)C(q−1)=F(q−1)+A(q−1)q−dG(q−1)(5)
其中,
F ( q − 1 ) = 1 + f 1 q − 1 + ⋯ + f d − 1 q − d + 1 G ( q − 1 ) = g 0 + g 1 q − 1 + ⋯ + g n a − 1 q − n a + 1 (6) \begin{array}{c} \begin{align*} F(q^{-1}) &= 1 + f_1 q^{-1} + \cdots + f_{d-1} q^{-d+1} \\ G(q^{-1}) &= g_0 + g_1 q^{-1} + \cdots + g_{n_a-1} q^{-n_a+1} \end{align*} \tag{6} \end{array} F(q−1)G(q−1)=1+f1q−1+⋯+fd−1q−d+1=g0+g1q−1+⋯+gna−1q−na+1(6)
将 e q ( 6 ) eq(6) eq(6)代入 e q ( 4 ) eq(4) eq(4)可得
y ( t + d ) = B ( q − 1 ) A ( q − 1 ) u ( t ) + F ( q − 1 ) w ( t + d ) + G ( q − 1 ) A ( − 1 ) w ( t ) (7) \begin{array}{c} y(t+d) = \frac{B(q^{-1})}{A(q^{-1})}u(t)+F(q^{-1})w(t+d)+\frac{G(q^{-1})}{A(^{-1})}w(t) \tag{7} \end{array} y(t+d)=A(q−1)B(q−1)u(t)+F(q−1)w(t+d)+A(−1)G(q−1)w(t)(7)
由 e q ( 1 ) eq(1) eq(1)可得
w ( t ) = A ( q − 1 ) C ( q − 1 ) y ( t ) − B ( q − 1 ) C ( q − 1 ) q − d u ( t ) (8) \begin{array}{c} w(t)=\frac{A(q^{-1})}{C(q^{-1})}y(t)-\frac{B(q^{-1})}{C(q^{-1})}q^{-d}u(t) \tag{8} \end{array} w(t)=C(q−1)A(q−1)y(t)−C(q−1)B(q−1)q−du(t)(8)
将 e q ( 8 ) eq(8) eq(8)代入 e q ( 7 ) eq(7) eq(7)可得
y ( t + d ) = B ( q − 1 ) A ( q − 1 ) u ( t ) + F ( q − 1 ) w ( t + d ) + G ( q − 1 ) A ( − 1 ) [ A ( q − 1 ) C ( q − 1 ) y ( t ) − B ( q − 1 ) C ( q − 1 ) q − d u ( t ) ] = B ( q − 1 ) A ( q − 1 ) u ( t ) + F ( q − 1 ) w ( t + d ) + G ( q − 1 ) C ( − 1 ) y ( t ) − B ( q − 1 ) G ( q − 1 ) A ( − 1 ) C ( q − 1 ) q − d u ( t ) = F ( q − 1 ) w ( t + d ) + [ B ( q − 1 ) A ( q − 1 ) − q − d B ( q − 1 ) G ( q − 1 ) A ( − 1 ) C ( q − 1 ) ] u ( t ) + G ( q − 1 ) C ( − 1 ) y ( t ) = F ( q − 1 ) w ( t + d ) + B ( q − 1 ) C ( q − 1 ) − q − d B ( q − 1 ) G ( q − 1 ) A ( − 1 ) C ( q − 1 ) u ( t ) + G ( q − 1 ) C ( − 1 ) y ( t ) (9) \begin{array}{c} y(t+d) = \frac{B(q^{-1})}{A(q^{-1})}u(t)+F(q^{-1})w(t+d)+\frac{G(q^{-1})}{A(^{-1})}[\frac{A(q^{-1})}{C(q^{-1})}y(t)-\frac{B(q^{-1})}{C(q^{-1})}q^{-d}u(t)] \\\\ = \frac{B(q^{-1})}{A(q^{-1})}u(t)+F(q^{-1})w(t+d)+\frac{G(q^{-1})}{C(^{-1})}y(t)-\frac{B(q^{-1})G(q^{-1})}{A(^{-1})C(q^{-1})}q^{-d}u(t) \\\\ =F(q^{-1})w(t+d)+\left [ \frac{B(q^{-1})}{A(q^{-1})} - \frac{q^{-d}B(q^{-1})G(q^{-1})}{A(^{-1})C(q^{-1})} \right ] u(t) + \frac{G(q^{-1})}{C(^{-1})}y(t)\\\\ =F(q^{-1})w(t+d)+\frac{B(q^{-1})C(q^{-1}) - q^{-d}B(q^{-1})G(q^{-1})}{A(^{-1})C(q^{-1})} u(t) + \frac{G(q^{-1})}{C(^{-1})}y(t) \tag{9} \end{array} y(t+d)=A(q−1)B(q−1)u(t)+F(q−1)w(t+d)+A(−1)G(q−1)[C(q−1)A(q−1)y(t)−C(q−1)B(q−1)q−du(t)]=A(q−1)B(q−1)u(t)+F(q−1)w(t+d)+C(−1)G(q−1)y(t)−A(−1)C(q−1)B(q−1)G(q−1)q−du(t)=F(q−1)w(t+d)+[A(q−1)B(q−1)−A(−1)C(q−1)q−dB(q−1)G(q−1)]u(t)+C(−1)G(q−1)y(t)=F(q−1)w(t+d)+A(−1)C(q−1)B(q−1)C(q−1)−q−dB(q−1)G(q−1)u(t)+C(−1)G(q−1)y(t)(9)
由 e q ( 5 ) eq(5) eq(5)可得
C ( q − 1 ) = A ( q − 1 ) F ( q − 1 ) + q − d G ( q − 1 ) ⇒ B ( q − 1 ) C ( q − 1 ) = A ( q − 1 ) B ( q − 1 ) F ( q − 1 ) + q − d B ( q − 1 ) G ( q − 1 ) \begin{array}{c} C(q^{-1}) = A(q^{-1})F(q^{-1})+q^{-d}G(q^{-1})\\\\ \Rightarrow B(q^{-1})C(q^{-1}) = A(q^{-1})B(q^{-1})F(q^{-1})+q^{-d}B(q^{-1})G(q^{-1}) \end{array} C(q−1)=A(q−1)F(q−1)+q−dG(q−1)⇒B(q−1)C(q−1)=A(q−1)B(q−1)F(q−1)+q−dB(q−1)G(q−1)
代入 e q ( 9 ) eq(9) eq(9)可得
y ( t + d ) = F ( q − 1 ) w ( t + d ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) + G ( q − 1 ) C ( − 1 ) y ( t ) (10) \begin{array}{c} y(t+d) =F(q^{-1})w(t+d)+\frac{B(q^{-1})F(q^{-1})}{C(q^{-1})} u(t) + \frac{G(q^{-1})}{C(^{-1})}y(t) \tag{10} \end{array} y(t+d)=F(q−1)w(t+d)+C(q−1)B(q−1)F(q−1)u(t)+C(−1)G(q−1)y(t)(10)
e q ( 10 ) eq(10) eq(10)也称为控制对象的预测模型。
代入 e q ( 3 ) eq(3) eq(3)可得,方差为
J = E [ y 2 ( t + d ) ] = = E { [ F ( q − 1 ) w ( t + d ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) + G ( q − 1 ) C ( q − 1 ) y ( t ) ] 2 } = = E { [ F ( q − 1 ) w ( t + d ) ] 2 } + E { [ G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) ] 2 } + + 2 E { F ( q − 1 ) w ( t + d ) [ G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) ] } (11) \begin{array}{c} \begin{align*} J &= E[y^2(t+d)] = \\ &= E \left\{ \left[ F(q^{-1})w(t+d) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) + \frac{G(q^{-1})}{C(q^{-1})}y(t) \right]^2 \right\} = \\ &= E \left\{ [F(q^{-1})w(t+d)]^2 \right\} + E \left\{ \left[ \frac{G(q^{-1})}{C(q^{-1})}y(t) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) \right]^2 \right\} + \\ &+ 2E \left\{ F(q^{-1})w(t+d) \left[ \frac{G(q^{-1})}{C(q^{-1})}y(t) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) \right] \right\} \end{align*} \tag{11} \end{array} J=E[y2(t+d)]==E{[F(q−1)w(t+d)+C(q−1)B(q−1)F(q−1)u(t)+C(q−1)G(q−1)y(t)]2}==E{[F(q−1)w(t+d)]2}+E{[C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)]2}++2E{F(q−1)w(t+d)[C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)]}(11)
由于 w ( t + d ) w(t+d) w(t+d)与 y ( t ) , u ( t ) y(t),u(t) y(t),u(t)互不相关,所以 e q ( 11 ) eq(11) eq(11)最后一项为0,即
E { F ( q − 1 ) w ( t + d ) [ G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) ] } = 0 \begin{array}{c} \begin{align*} E \left\{ F(q^{-1})w(t+d) \left[ \frac{G(q^{-1})}{C(q^{-1})}y(t) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) \right] \right\}=0 \end{align*} \end{array} E{F(q−1)w(t+d)[C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)]}=0
此时,
E [ y 2 ( t + d ) ] = E { [ F ( q − 1 ) w ( t + d ) ] 2 } + E { [ G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) ] 2 } \begin{array}{c} \begin{align*} E[y^2(t+d)] = E \left\{ [F(q^{-1})w(t+d)]^2 \right\} + E \left\{ \left[ \frac{G(q^{-1})}{C(q^{-1})}y(t) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) \right]^2 \right\} \end{align*} \end{array} E[y2(t+d)]=E{[F(q−1)w(t+d)]2}+E{[C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)]2}
又 E { [ G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) ] 2 } ≥ 0 E \left\{ \left[ \frac{G(q^{-1})}{C(q^{-1})}y(t) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) \right]^2 \right\}\ge 0 E{[C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)]2}≥0,所以
E [ y 2 ( t + d ) ] ≥ E { [ F ( q − 1 ) w ( t + d ) ] 2 } (12) \begin{array}{c} \begin{align*} E[y^2(t+d)] \ge E \left\{ [F(q^{-1})w(t+d)]^2 \right\} \end{align*} \tag{12} \end{array} E[y2(t+d)]≥E{[F(q−1)w(t+d)]2}(12)
如果在任意时刻,有
G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) = 0 \begin{array}{c} \begin{align*} \frac{G(q^{-1})}{C(q^{-1})}y(t) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) = 0 \end{align*} \end{array} C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)=0
那么
E [ y 2 ( t + d ) ] = E { [ F ( q − 1 ) w ( t + d ) ] 2 } = J m i n (13) \begin{array}{c} \begin{align*} E[y^2(t+d)] = E \left\{ [F(q^{-1})w(t+d)]^2 \right\} = J_{min} \end{align*} \tag{13} \end{array} E[y2(t+d)]=E{[F(q−1)w(t+d)]2}=Jmin(13)
可得,最优控制为
u ( t ) = − G ( q − 1 ) B ( q − 1 ) F ( q − 1 ) y ( t ) (14) \begin{array}{c} \begin{align*} u(t) =- \frac{G(q^{-1})}{B(q^{-1})F(q^{-1})}y(t) \end{align*} \tag{14} \end{array} u(t)=−B(q−1)F(q−1)G(q−1)y(t)(14)
对应的最小方差为
J min = E { ( F ( q − 1 ) w ( t + d ) ) 2 } = ( 1 + f 1 2 + ⋯ + f d − 1 2 ) σ 2 (15) \begin{array}{c} \begin{align*} J_{\min} = E \left\{ (F(q^{-1}) w(t+d))^2 \right\} = (1 + f_1^2 + \cdots + f_{d-1}^2) \sigma^2 \end{align*} \tag{15} \end{array} Jmin=E{(F(q−1)w(t+d))2}=(1+f12+⋯+fd−12)σ2(15)
对应的自校正框图为
3.2 最优预测估值
最优预测估值 y ^ ( t + d ∣ t ) \hat y(t+d \mid t) y^(t+d∣t)为 y ( t ) , y ( t − 1 ) , ⋯ , u ( t ) , u ( t − 1 ) , ⋯ y(t),y(t-1),\cdots, u(t),u(t-1),\cdots y(t),y(t−1),⋯,u(t),u(t−1),⋯的线性组合,其估计误差为
y ~ ( t + d ∣ t ) = y ( t + d ) − y ^ ( t + d ∣ t ) (16) \begin{array}{c} \begin{align*} \tilde{y}(t+d \mid t) = y(t+d) - \hat{y}(t+d \mid t) \end{align*} \tag{16} \end{array} y~(t+d∣t)=y(t+d)−y^(t+d∣t)(16)
要求估计误差的方差最小,即
J ′ = E [ y ~ 2 ( t + d ∣ t ) ] = E { [ y ( t + d ) − y ^ ( t + d ∣ t ) ] 2 } = J min ′ (17) \begin{array}{c} J' = E[\tilde{y}^2(t+d \mid t)] = E\left\{ [y(t+d) - \hat{y}(t+d \mid t)]^2 \right \}= J_{\min}^\prime \tag{17} \end{array} J′=E[y~2(t+d∣t)]=E{[y(t+d)−y^(t+d∣t)]2}=Jmin′(17)
将 e q ( 4 ) eq(4) eq(4)代入可得
J ′ = E { [ G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) + F ( q − 1 ) w ( t + d ) − y ^ ( t + d ∣ t ) ] 2 } = E { [ G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) − y ^ ( t + d ∣ t ) ] 2 + E [ F ( q − 1 ) w ( t + d ) ] 2 } \begin{aligned} J' & =E\Big\{\Big[\frac{G(q^{-1})}{C(q^{-1})}y(t)+\frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t)+F(q^{-1})w(t+d)-\hat{y}(t+d\mid t)\Big]^{2}\Big\}= \\ & E\Big\{\Big[\frac{G(q^{-1})}{C(q^{-1})}y(t)+\frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t)-\hat{y}(t+d\mid t)\Big]^{2}+ \\ & E[F(q^{-1})w(t+d)]^{2}\Big\} \end{aligned} J′=E{[C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)+F(q−1)w(t+d)−y^(t+d∣t)]2}=E{[C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)−y^(t+d∣t)]2+E[F(q−1)w(t+d)]2}
其中,第一项为非负项,如果有
G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) − y ^ ( t + d ∣ t ) = 0 \begin{array}{c} \begin{align*} \frac{G(q^{-1})}{C(q^{-1})}y(t)+\frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t)-\hat{y}(t+d\mid t)=0 \end{align*} \end{array} C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)−y^(t+d∣t)=0
则,
J ′ = E { [ F ( q − 1 ) w ( t + d ) ] 2 } = J m i n ′ \begin{aligned} J' & = E \Big \{[F(q^{-1})w(t+d)]^{2}\Big\}=J_{min}' \end{aligned} J′=E{[F(q−1)w(t+d)]2}=Jmin′
可得,最优预测估值为
y ^ ( t + d ∣ t ) = G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) = 0 \begin{array}{c} \begin{align*} \hat{y}(t+d\mid t) = \frac{G(q^{-1})}{C(q^{-1})}y(t)+\frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) = 0 \end{align*} \end{array} y^(t+d∣t)=C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)=0
输出误差为
y ~ ( t + d ∣ t ) = y ( t + d ) − y ^ ( t + d ∣ t ) = y ( t + d ) = F ( q − 1 ) w ( t + d ) \begin{array}{c} \begin{align*} \tilde{y}(t+d \mid t) &= y(t+d) - \hat{y}(t+d \mid t)= y(t+d) \\&=F(q^{-1})w(t+d) \end{align*} \end{array} y~(t+d∣t)=y(t+d)−y^(t+d∣t)=y(t+d)=F(q−1)w(t+d)
根据前面最优控制推导,由 e q ( 14 ) eq(14) eq(14)可得,在最优控制 u ( t ) u(t) u(t)下,最优预测估值 y ^ ( t + d ∣ t ) = 0 \hat{y}(t+d\mid t)=0 y^(t+d∣t)=0。
4、算法步骤
4.1 显式最小方差调节器
(1)采样读取新的观测值 y ( t ) y(t) y(t)和 u ( t ) u(t) u(t);
(2)按照递推最小二乘法估计控制对象的参数 a 1 , a 2 , ⋯ , a n a , b 0 , b 1 , ⋯ , b n b , c 1 , c 2 , ⋯ , c n c a_1,a_2,\cdots,a_{n_a},b_0,b_1,\cdots,b_{n_b},c_1,c_2,\cdots,c_{n_c} a1,a2,⋯,ana,b0,b1,⋯,bnb,c1,c2,⋯,cnc。这里假定 c 0 = 1 c_0=1 c0=1。由最小二乘递推公式得:
θ T = [ a 1 a 2 ⋯ a n a b 0 b 1 ⋯ b n b c 1 c 2 ⋯ c n c ] φ T ( t − 1 ) = [ − y ( t − 1 ) ⋯ − y ( t − n a ) u ( t − d ) ⋯ u ( t − n b ) w ^ ( t − 1 ) ⋯ w ^ ( t − n c ) ] \theta^{\mathrm{T}}= \begin{bmatrix} a_{1} &a_{2} & \cdots &a_{n_{a}} & b_{0} & b_{1} & \cdots & b_{n_{b}} & c_1 & c_2 & \cdots &c_{n_c} \end{bmatrix} \\ \boldsymbol{\varphi}^{\mathrm{T}}(t-1)= \begin{bmatrix} -y(t-1) & \cdots & -y(t-n_{a}) & u(t-d) & \cdots & u(t-n_{b}) & \hat w(t-1) & \cdots & \hat w(t-n_c) \end{bmatrix} θT=[a1a2⋯anab0b1⋯bnbc1c2⋯cnc]φT(t−1)=[−y(t−1)⋯−y(t−na)u(t−d)⋯u(t−nb)w^(t−1)⋯w^(t−nc)]
ε ^ ( t ) = y ( t ) − φ T ( t − 1 ) θ ^ ( t − 1 ) θ ^ ( t ) = θ ^ ( t − 1 ) + K ( t ) [ y ( t ) − φ T ( t − 1 ) θ ^ ( t − 1 ) ] K ( t ) = P ( t − 1 ) φ ( t − 1 ) [ 1 + φ T ( t − 1 ) P ( t − 1 ) φ ( t − 1 ) ] − 1 P ( t ) = P ( t − 1 ) − P ( t − 1 ) φ ( t − 1 ) [ 1 + φ T ( t − 1 ) P ( t − 1 ) φ ( t − 1 ) ] − 1 φ T ( t − 1 ) P ( t − 1 ) \begin{array}{c} \begin{aligned} & \hat{\varepsilon}(t)=y(t)-\boldsymbol{\varphi}^{\mathrm{T}}(t-1)\boldsymbol{\hat{\theta}}(t-1) \\ & \hat{\boldsymbol{\theta}}(t)=\hat{\boldsymbol{\theta}}(t-1)+\mathbf{K}(t)[y(t)-\boldsymbol{\varphi}^{\mathrm{T}}(t-1)\hat{\boldsymbol{\theta}}(t-1)] \\ & K(t)=P(t-1)\boldsymbol{\varphi}(t-1)[1+\boldsymbol{\varphi}^{\mathrm{T}}(t-1)\boldsymbol{P}(t-1)\boldsymbol{\varphi}(t-1)]^{-1} \\ & P(t)=P(t-1)-P(t-1)\boldsymbol{\varphi}(t-1)\left[1+\boldsymbol{\varphi}^{\mathrm{T}}(t-1)\boldsymbol{P}(t-1)\boldsymbol{\varphi}(t-1)\right]^{-1}\boldsymbol{\varphi}^{\mathrm{T}}(t-1)\boldsymbol{P}(t-1) \end{aligned} \end{array} ε^(t)=y(t)−φT(t−1)θ^(t−1)θ^(t)=θ^(t−1)+K(t)[y(t)−φT(t−1)θ^(t−1)]K(t)=P(t−1)φ(t−1)[1+φT(t−1)P(t−1)φ(t−1)]−1P(t)=P(t−1)−P(t−1)φ(t−1)[1+φT(t−1)P(t−1)φ(t−1)]−1φT(t−1)P(t−1)
(3)按 e q ( 5 ) eq(5) eq(5)计算 F ( q − 1 ) F(q^{-1}) F(q−1)和 G ( q − 1 ) G(q^{-1}) G(q−1)的系数;
(4)按 e q ( 14 ) eq(14) eq(14)计算最优控制 u ( t ) u(t) u(t);
(5)采样时间由 t t t变为 t + 1 t+1 t+1,重复上述步骤。
显式自校正调节器直接对控制对象的参数进行辨识,其计算比较复杂;其次,由于自校正调节器是闭环控制,还需要检验反馈通道的阶数是否符合闭环辨识的要求。
4.2 隐式最小方差调节器
隐式最小方差调节器不对控制对象的参数进行辨识,而是直接辨识调节器的参数。
根据等式
G ( q − 1 ) C ( q − 1 ) y ( t ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) = 0 (18) \begin{array}{c} \begin{align*} \frac{G(q^{-1})}{C(q^{-1})}y(t) + \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}u(t) = 0 \end{align*} \tag{18} \end{array} C(q−1)G(q−1)y(t)+C(q−1)B(q−1)F(q−1)u(t)=0(18)
设
G ( q − 1 ) C ( q − 1 ) = α 0 + α 1 q − 1 + ⋯ + α n a − 1 q − n a + 1 = A α ( q − 1 ) B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) = β 0 + β 1 q − 1 + ⋯ + β n b + d − 1 q − n b − d + 1 = B β ( q − 1 ) (19) \begin{array}{c} \begin{aligned} & \frac{G(q^{-1})}{C(q^{-1})}=\alpha_{0}+\alpha_{1}q^{-1}+\cdots+\alpha_{n_{a}-1}q^{-n_{a}+1}=A_{\alpha}(q^{-1}) \\ & \frac{B(q^{-1})F(q^{-1})}{C(q^{-1})}=\beta_{0}+\beta_{1}q^{-1}+\cdots+\beta_{n_{b}+d-1}q^{-n_{b}-d+1}=B_{\beta}(q^{-1}) \end{aligned} \tag{19} \end{array} C(q−1)G(q−1)=α0+α1q−1+⋯+αna−1q−na+1=Aα(q−1)C(q−1)B(q−1)F(q−1)=β0+β1q−1+⋯+βnb+d−1q−nb−d+1=Bβ(q−1)(19)
代入 e q ( 18 ) eq(18) eq(18),可得
α 0 y ( t ) + α 1 y ( t − 1 ) + ⋯ + α n a − 1 y ( t − n a + 1 ) + β 0 u ( t ) + β 1 u ( t − 1 ) + ⋯ + β n b + d − 1 u ( t − n b − d + 1 ) = 0 (20) \begin{array}{c} \begin{align*} \alpha_{0}y(t)+\alpha_{1}y(t-1)+\cdots+\alpha_{n_{a}-1}y(t-n_{a}+1)+\\ \beta_{0}u(t)+\beta_{1}u(t-1)+\cdots+\beta_{n_{b}+d-1}u(t-n_{b}-d+1)=0 \end{align*} \tag{20} \end{array} α0y(t)+α1y(t−1)+⋯+αna−1y(t−na+1)+β0u(t)+β1u(t−1)+⋯+βnb+d−1u(t−nb−d+1)=0(20)
其中,待估参数为 α 0 , α 1 , ⋯ , α n a − 1 , β 0 , β 1 , ⋯ , β n b + d − 1 \alpha_0,\alpha_1,\cdots,\alpha_{n_a-1},\beta_0,\beta_1,\cdots,\beta_{n_b+d-1} α0,α1,⋯,αna−1,β0,β1,⋯,βnb+d−1。按照 e q ( 20 ) eq(20) eq(20)不能进行辨识,利用 e q ( 10 ) eq(10) eq(10)进行参数辨识。将 e q ( 19 ) eq(19) eq(19)代入 e q ( 10 ) eq(10) eq(10)得,
y ( t + d ) = F ( q − 1 ) w ( t + d ) + B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) u ( t ) + G ( q − 1 ) C ( − 1 ) y ( t ) = α 0 y ( t ) + α 1 y ( t − 1 ) + ⋯ + α n a − 1 y ( t − n a + 1 ) + β 0 u ( t ) + β 1 u ( t − 1 ) + ⋯ + β n b + d − 1 u ( t − n b − d + 1 ) + e ( t + d ) (21) \begin{array}{c} \begin{align*} y(t+d) =F(q^{-1})w(t+d)+\frac{B(q^{-1})F(q^{-1})}{C(q^{-1})} u(t) + \frac{G(q^{-1})}{C(^{-1})}y(t) \\=\alpha_{0}y(t)+\alpha_{1}y(t-1)+\cdots+\alpha_{n_{a}-1}y(t-n_{a}+1)+\\\beta_{0}u(t)+\beta_{1}u(t-1)+\cdots+\beta_{n_{b}+d-1}u(t-n_{b}-d+1)+e(t+d) \end{align*} \tag{21} \end{array} y(t+d)=F(q−1)w(t+d)+C(q−1)B(q−1)F(q−1)u(t)+C(−1)G(q−1)y(t)=α0y(t)+α1y(t−1)+⋯+αna−1y(t−na+1)+β0u(t)+β1u(t−1)+⋯+βnb+d−1u(t−nb−d+1)+e(t+d)(21)
其中, e ( t + d ) = F ( q − 1 ) w ( t + d ) e(t+d)=F(q^{-1})w(t+d) e(t+d)=F(q−1)w(t+d)。为了使调节器参数便于辨识,应尽量减少被估参数数目,可凭经验给出 β ^ 0 \hat \beta_0 β^0,则
θ T = [ α 0 α 1 ⋯ α n a − 1 β 1 β 2 ⋯ β n b + d − 1 ] φ T ( t ) = [ y ( t ) y ( t − 1 ) ⋯ y ( t − n a + 1 ) u ( t − 1 ) ⋯ u ( t − n b − d + 1 ) ] \theta^{\mathrm{T}}= \begin{bmatrix} \alpha_{0} & \alpha_{1} & \cdots & \alpha_{n_{a}-1} & \beta_{1} & \beta_{2} & \cdots & \beta_{n_{b}+d-1} \end{bmatrix} \\ \boldsymbol{\varphi}^{\mathrm{T}}(t)= \begin{bmatrix} y(t) & y(t-1) & \cdots & y(t-n_{a}+1) & u(t-1) & \cdots & u(t-n_{b}-d+1) \end{bmatrix} θT=[α0α1⋯αna−1β1β2⋯βnb+d−1]φT(t)=[y(t)y(t−1)⋯y(t−na+1)u(t−1)⋯u(t−nb−d+1)]
e q ( 21 ) eq(21) eq(21)可写成
y ( t + d ) − β ^ 0 u ( t ) = φ ⊺ ( t ) θ ^ ( t ) + e ( t + d ) (22) \begin{array}{c} \begin{align*} y(t+d)-\hat{\beta}_{0}u(t)=\boldsymbol{\varphi}^{\intercal}(t)\hat{\boldsymbol{\theta}}(t)+e(t+d) \end{align*} \tag{22} \end{array} y(t+d)−β^0u(t)=φ⊺(t)θ^(t)+e(t+d)(22)
递推最小二乘参数估计公式如下:
θ ^ ( t + 1 ) = θ ^ ( t ) + K ( t ) [ y ( t + d ) − β ^ 0 u ( t ) − φ T ( t ) θ ^ ( t ) ] K ( t ) = P ( t − 1 ) φ ( t − 1 ) [ 1 + φ T ( t − 1 ) P ( t − 1 ) φ ( t − 1 ) ] − 1 P ( t ) = P ( t − 1 ) − P ( t − 1 ) φ ( t − 1 ) [ 1 + φ T ( t − 1 ) P ( t − 1 ) φ ( t − 1 ) ] − 1 φ T ( t − 1 ) P ( t − 1 ) (23) \begin{array}{c} \begin{aligned} & \mathbf{\hat{\theta}}(t+1)=\mathbf{\hat{\theta}}(t)+\mathbf{K}(t)[y(t+d)-\mathbf{\hat{\beta}}_{0}u(t)-\mathbf{\varphi}^{\mathrm{T}}(t)\mathbf{\hat{\theta}}(t)] \\ & \mathbf{K}(t)=\mathbf{P}(t-1)\mathbf{\varphi}(t-1)[1+\mathbf{\varphi}^{\mathrm{T}}(t-1)\mathbf{P}(t-1)\mathbf{\varphi}(t-1)]^{-1} \\ & \mathbf{P}(t)=\mathbf{P}(t-1)-\mathbf{P}(t-1)\mathbf{\varphi}(t-1)[1+\mathbf{\varphi}^{\mathrm{T}}(t-1)\mathbf{P}(t-1)\mathbf{\varphi}(t-1)]^{-1}\mathbf{\varphi}^{\mathrm{T}}(t-1)\mathbf{P}(t-1) \end{aligned} \tag{23} \end{array} θ^(t+1)=θ^(t)+K(t)[y(t+d)−β^0u(t)−φT(t)θ^(t)]K(t)=P(t−1)φ(t−1)[1+φT(t−1)P(t−1)φ(t−1)]−1P(t)=P(t−1)−P(t−1)φ(t−1)[1+φT(t−1)P(t−1)φ(t−1)]−1φT(t−1)P(t−1)(23)
最优控制为
u ( t ) = − 1 β ^ 0 [ α ^ 0 y ( t ) + α ^ 1 y ( t − 1 ) + ⋯ + α ^ n a − 1 y ( t − n a + 1 ) + β ^ 1 u ( t − 1 ) + ⋯ + β ^ n b + d − 1 u ( t − n b − d + 1 ) ] (24) \begin{array}{c} \begin{aligned} u(t)=-\frac{1}{\hat{\beta}_{0}}[\hat{\alpha}_{0}y(t)+\hat{\alpha}_{1}y(t-1)+\cdots+\hat{\alpha}_{n_{a}-1}y(t-n_{a}+1)\\+\hat{\beta}_{1}u(t-1)+\cdots+\hat{\beta}_{n_{b}+d-1}u(t-n_{b}-d+1)] \end{aligned} \tag{24} \end{array} u(t)=−β^01[α^0y(t)+α^1y(t−1)+⋯+α^na−1y(t−na+1)+β^1u(t−1)+⋯+β^nb+d−1u(t−nb−d+1)](24)
隐式最小方差自校正调节器计算步骤如下:
(1)采样读取新的观测值 y ( t + d ) y(t+d) y(t+d);
(2)按 e q ( 23 ) eq(23) eq(23)估计 θ ^ ( t ) \hat \theta(t) θ^(t);
(3)按 e q ( 24 ) eq(24) eq(24)计算最佳控制 u ^ ( t ) \hat u(t) u^(t);
(4)采样时间 t + d t+d t+d变为 t + d + 1 t+d+1 t+d+1,重复上述步骤。
5、稳定性分析
前面在进行最优控制推到时,需要假设 B ( q − 1 ) , C ( q − 1 ) B(q^{-1}),C(q^{-1}) B(q−1),C(q−1)的所有零点都位于 q − 1 q^{-1} q−1复平面单位圆外。这一节将对其进行解释:
由 e q ( 14 ) eq(14) eq(14)可得最优控制,将其代入被控对象的微分方程 e q ( 1 ) eq(1) eq(1),可得
A ( q − 1 ) y ( t ) = q − d B ( q − 1 ) [ − G ( q − 1 ) B ( q − 1 ) F ( q − 1 ) y ( t ) ] + C ( q − 1 ) w ( t ) B ( q − 1 ) [ A ( q − 1 ) F ( q − 1 ) + q − d G ( q − 1 ) ] y ( t ) = B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) w ( t ) (25) \begin{array}{c} \begin{aligned} A(q^{-1})y(t)=q^{-d}B(q^{-1})\Big [- \frac{G(q^{-1})}{B(q^{-1})F(q^{-1})}y(t) \Big]+C(q^{-1})w(t) \\ B(q^{-1})\left[A(q^{-1})F(q^{-1})+q^{-d}G(q^{-1})\right]y(t)=B(q^{-1})F(q^{-1})C(q^{-1})w(t) \end{aligned} \tag{25} \end{array} A(q−1)y(t)=q−dB(q−1)[−B(q−1)F(q−1)G(q−1)y(t)]+C(q−1)w(t)B(q−1)[A(q−1)F(q−1)+q−dG(q−1)]y(t)=B(q−1)F(q−1)C(q−1)w(t)(25)
由 e q ( 5 ) eq(5) eq(5)得
C ( q − 1 ) = A ( q − 1 ) F ( q − 1 ) + q − d G ( q − 1 ) \begin{array}{c} \begin{aligned} C(q^{-1}) = A(q^{-1})F(q^{-1})+q^{-d}G(q^{-1}) \end{aligned} \end{array} C(q−1)=A(q−1)F(q−1)+q−dG(q−1)
将其代入 e q ( 25 ) eq(25) eq(25)可得,
B ( q − 1 ) C ( q − 1 ) y ( t ) = B ( q − 1 ) F ( q − 1 ) C ( q − 1 ) w ( t ) \begin{array}{c} \begin{aligned} B(q^{-1})C(q^{-1})y(t)=B(q^{-1})F(q^{-1})C(q^{-1})w(t) \end{aligned} \end{array} B(q−1)C(q−1)y(t)=B(q−1)F(q−1)C(q−1)w(t)
可得闭环系统的特征方程为
B ( q − 1 ) C ( q − 1 ) = 0 \begin{array}{c} \begin{aligned} B(q^{-1})C(q^{-1})=0 \end{aligned} \end{array} B(q−1)C(q−1)=0
为了使闭环系统稳定, B ( q − 1 ) B(q^{-1}) B(q−1)和 C ( q − 1 ) C(q^{-1}) C(q−1)的零点必须在单位圆外。如果 B ( q − 1 ) B(q^{-1}) B(q−1)的零点在单位圆外,则由
A ( q − 1 ) y ( t + d ) = B ( q − 1 ) u ( t ) + C ( q − 1 ) w ( t + d ) \begin{array}{c} \begin{aligned} A(q^{-1})y(t+d)=B(q^{-1})u(t)+C(q^{-1})w(t+d) \end{aligned} \end{array} A(q−1)y(t+d)=B(q−1)u(t)+C(q−1)w(t+d)
可得,在 y ( t + d ) y(t+d) y(t+d)有界时,能保证序列 u ( t ) {u(t)} u(t)有界。如果 B ( q − 1 ) B(q^{-1}) B(q−1)的零点不在单位圆外,则 y ( t + d ) y(t+d) y(t+d)有界时,不能保证序列 u ( t ) {u(t)} u(t)有界。因此最小方差自校正调节器只适用于 B ( q − 1 ) B(q^{-1}) B(q−1)的零点在单位圆外的系统。
6、例题
(1)当 d = 1 d=1 d=1时,由 e q ( 5 ) eq(5) eq(5)可得,
C ( q − 1 ) A ( q − 1 ) = F ( q − 1 ) + q − d G ( q − 1 ) A ( q − 1 ) \begin{array}{c} \frac{C(q^{-1})}{A(q^{-1})}=F(q^{-1})+\frac{q^{-d}G(q^{-1})}{A(q^{-1})} \end{array} A(q−1)C(q−1)=F(q−1)+A(q−1)q−dG(q−1)
求得
F ( q − 1 ) = 1 G ( q − 1 ) = 3.2 + 0.2 q − 1 \begin{array}{c} F(q^{-1})=1\\ G(q^{-1})=3.2+0.2q^{-1} \end{array} F(q−1)=1G(q−1)=3.2+0.2q−1
代入 e q ( 14 ) eq(14) eq(14)可得,
u ( t ) = − G ( q − 1 ) B ( q − 1 ) F ( q − 1 ) y ( t ) = − 3.2 + 0.2 q − 1 1 + 0.5 q − 1 y ( t ) ⇒ u ( t ) = − 0.5 u ( t − 1 ) − 3.2 y ( t ) − 0.2 y ( t − 1 ) \begin{array}{c} \begin{align*} u(t) &=- \frac{G(q^{-1})}{B(q^{-1})F(q^{-1})}y(t)\\\ &= -\frac{3.2+0.2q^{-1}}{1+0.5q^{-1}}y(t) \\\ \Rightarrow u(t) &=-0.5u(t-1)-3.2y(t)-0.2y(t-1) \end{align*} \end{array} u(t) ⇒u(t)=−B(q−1)F(q−1)G(q−1)y(t)=−1+0.5q−13.2+0.2q−1y(t)=−0.5u(t−1)−3.2y(t)−0.2y(t−1)
输出误差为
y ~ ( t ) = F ( q − 1 ) w ( t ) = w ( t ) \tilde{y}(t) = F(q^{-1})w(t)=w(t) y~(t)=F(q−1)w(t)=w(t)
输出误差方差为
E ( y ~ 2 ( t ) ) = σ 2 E(\tilde {y}^2(t)) = \sigma^2 E(y~2(t))=σ2
(2)当 d = 2 d=2 d=2时,表明系统延迟增大,性能变差。由 e q ( 5 ) eq(5) eq(5)可得,
C ( q − 1 ) A ( q − 1 ) = F ( q − 1 ) + q − d G ( q − 1 ) A ( q − 1 ) \begin{array}{c} \frac{C(q^{-1})}{A(q^{-1})}=F(q^{-1})+\frac{q^{-d}G(q^{-1})}{A(q^{-1})} \end{array} A(q−1)C(q−1)=F(q−1)+A(q−1)q−dG(q−1)
求得
F ( q − 1 ) = 1 + 3.2 q − 1 G ( q − 1 ) = 5.64 − 2.24 q − 1 \begin{array}{c} F(q^{-1})=1+3.2q^{-1}\\ G(q^{-1})=5.64-2.24q^{-1} \end{array} F(q−1)=1+3.2q−1G(q−1)=5.64−2.24q−1
代入 e q ( 14 ) eq(14) eq(14)可得,
u ( t ) = − G ( q − 1 ) B ( q − 1 ) F ( q − 1 ) y ( t ) = − 5.64 − 2.24 q − 1 ( 1 + 0.5 q − 1 ) ( 1 + 3.2 q − 1 ) y ( t ) = − 5.64 − 2.24 q − 1 1 + 3.7 q − 1 + 1.6 q − 2 y ( t ) ⇒ u ( t ) = − 3.7 u ( t − 1 ) − 1.6 u ( t − 2 ) − 5.64 y ( t ) + 2.24 y ( t − 1 ) \begin{array}{c} \begin{align*} u(t) &=- \frac{G(q^{-1})}{B(q^{-1})F(q^{-1})}y(t)\\\ &= -\frac{5.64-2.24q^{-1}}{(1+0.5q^{-1})(1+3.2q^{-1})}y(t) \\\ &= -\frac{5.64-2.24q^{-1}}{1+3.7q^{-1}+1.6q^{-2}}y(t) \\\ \Rightarrow u(t) &=-3.7u(t-1)-1.6u(t-2)-5.64y(t)+2.24y(t-1) \end{align*} \end{array} u(t) ⇒u(t)=−B(q−1)F(q−1)G(q−1)y(t)=−(1+0.5q−1)(1+3.2q−1)5.64−2.24q−1y(t)=−1+3.7q−1+1.6q−25.64−2.24q−1y(t)=−3.7u(t−1)−1.6u(t−2)−5.64y(t)+2.24y(t−1)
输出误差为
y ~ ( t ) = F ( q − 1 ) w ( t ) = w ( t ) + 3.2 w ( t − 1 ) \tilde{y}(t) = F(q^{-1})w(t)=w(t)+3.2w(t-1) y~(t)=F(q−1)w(t)=w(t)+3.2w(t−1)
输出误差方差为
E ( y ~ 2 ( t ) ) = ( 1 + 3. 2 2 ) σ 2 = 11.24 σ 2 E(\tilde {y}^2(t)) = (1+3.2^2)\sigma^2=11.24\sigma^2 E(y~2(t))=(1+3.22)σ2=11.24σ2
对应的matlab代码如下:
% 隐式最小方差调节器% y_hat : 观测数据
% na : A(q^{-1}) = 1 + a_1*q^{-1} + a_2*q^{-2} + ... + a_{na}*q_{-na}
% nb : B(q^{-1}) = b_0 + b_1*q^{-1} + ... + b_{nb}q_{-nb}
% nc : C(q^{-1}) = c_0 + c_1*q^{-1} + ... + c_{nc}q_{-nc}
% d : 延时步数clc
clearA = [1, -1.7, -0.7];
B = [1, 0.5];
C = [1, 1.5, 0.9];
d = 2;na = length(A) - 1;
nb = length(B) - 1;
nc = length(C) - 1;% 初始化
beta0 = 1; % 经验值
theta = zeros(na + nb + d, 1); % 参数向量
P = eye(na + nb + d); % 协方差矩阵
N = 1000;% 产生初始观测
y_hat = zeros(na + nb + d, 1);
u = zeros(na + nb + d, 1);for t=1:N% 构造数据矩阵phi = [y_hat(end-na+1:end); u(end-nb-d+1:end)];% 计算PP = P - P*phi* inv((1 + phi' * P * phi)) * phi' * P;% 计算KK = P * phi * inv((1 + phi' * P * phi));% 计算thetatheta = theta + K * (y_hat(end) - beta0 * u(end) - phi' * theta);% 计算uu_hat = -1/beta0 * phi' * theta;%u_hat = 0;u = [u; u_hat] ;y = phi' * theta + beta0 * u(end) + 0.1*sin(0.01*t);%+ (2*rand - 1); % 根据u产生观测数据y_hat = [y_hat; y]; % 将新观测到的数据放入数组
end% 绘图
plot(y_hat)
hold on
plot(u)
legend("y_{hat}","u")disp("y_hat 方差为:")
disp(var(y_hat))
在计算 u u u时,当输入最优控制时,结果如下:
方差为: 0.0044
当注释掉最优控制,令其为0时,
%u_hat = -1/beta0 * phi' * theta;
u_hat = 0;
方差为:37.5501
可以看到在没有控制时,输出的方差很大。
7、总结
从以上推导可以看出最小方差调节器在得到最优控制 u ( t ) u(t) u(t)时,对应的最优预测 y ~ ( t + d ∣ t ) \tilde{y}(t+d \mid t) y~(t+d∣t)为0。在运用该算法时,使用隐式最小方差调节器实现起来较为容易。
下一篇将介绍最小方差自校正控制器,用于跟踪参考信号。