现代控制理论
状态方程的获取
二阶系统
开环系统
G
(
s
)
=
ω
n
2
s
2
+
2
ξ
ω
n
s
G(s) = {\omega_n^2\over s^2+2\xi\omega_ns}
G(s)=s2+2ξωnsωn2
Φ
(
s
)
=
ω
n
2
s
2
+
2
ξ
ω
n
s
+
ω
n
2
=
1
(
s
ω
n
)
2
+
2
ξ
ω
n
s
+
1
\Phi(s) = {\omega_n^2\over s^2 + 2\xi\omega_n s+\omega_n^2} = {{1\over ({s\over \omega_n} )^2+2{\xi\over\omega_n}s+1 }}
Φ(s)=s2+2ξωns+ωn2ωn2=(ωns)2+2ωnξs+11
其中,
ξ
\xi
ξ是阻尼比,
ω
n
\omega_n
ωn是阻尼系数。
特征方程为
s
2
+
2
ξ
ω
n
s
+
ω
n
2
=
0
s^2+2\xi\omega_ns+\omega_n^2=0
s2+2ξωns+ωn2=0
特征方程的根为
s
1
,
2
=
−
ξ
ω
n
±
ω
n
ξ
2
−
1
s_{1,2} = -\xi\omega_n \pm \omega_n\sqrt{\xi^2-1}
s1,2=−ξωn±ωnξ2−1
无阻尼:
ω
n
=
0
\omega_n=0
ωn=0
欠阻尼状态:
0
<
ξ
<
1
0<\xi<1
0<ξ<1
example:
G
(
s
)
=
1
s
2
+
s
+
1
G(s) = {1\over s^2+s+1}
G(s)=s2+s+11
状态方程:
{
x
1
˙
=
x
2
x
2
˙
=
−
6
x
1
−
x
2
+
u
y
=
6
x
1
\begin{cases}\dot{x_1} = x_2\\ \dot{x_2} =-6x_1 -x_2 +u\end{cases} \\ y=6x_1
{x1˙=x2x2˙=−6x1−x2+uy=6x1
A
=
[
0
1
−
6
−
1
]
,
B
=
[
0
1
]
,
C
=
[
6
0
]
,
D
=
[
0
]
A = \left[\begin{matrix}0&1\\-6&-1\end{matrix}\right], B = \left[\begin{matrix}0\\1\end{matrix}\right],C=\left[\begin{matrix}6 & 0 \end{matrix}\right] ,D=[0]
A=[0−61−1],B=[01],C=[60],D=[0]
MATLAB验证
close all;clear;clc
A = [0 1; -6 -1];
B = [0;1];
C = [6 0];
D = [0];
sys = ss(A,B,C,D);
sys_tran = tf(sys);
sys_tran
sys_tran =
6
-----------
s^2 + s + 6
Continuous-time transfer function.
说明构建的状态方程是正确的。
系统能控性
Q
v
=
[
B
A
B
A
B
2
⋯
A
B
n
−
1
]
Q_v = \left[\begin{matrix}B&AB&AB^2&\cdots&AB^{n-1}\end{matrix}\right]
Qv=[BABAB2⋯ABn−1]
对于上述二阶系统
Q
v
=
[
0
1
1
−
1
]
Q_v = \left[\begin{matrix}0&1\\1&-1\end{matrix}\right]
Qv=[011−1]
r
a
n
k
Q
v
=
2
rank{Q_v}=2
rankQv=2 所以,原系统是完全能控的。
系统能观型
Q
o
=
[
C
C
A
C
2
A
⋮
C
n
−
1
A
]
Q_o = \left[\begin{matrix}C\\CA\\C^2A\\\vdots \\C^{n-1}A\end{matrix}\right]
Qo=⎣⎢⎢⎢⎢⎢⎡CCAC2A⋮Cn−1A⎦⎥⎥⎥⎥⎥⎤
上述二阶系统的能观测矩阵
Q
o
=
[
6
0
0
6
]
Q_o = \left[\begin{matrix}6&0\\0&6\end{matrix}\right]
Qo=[6006]
r
a
n
k
Q
o
=
2
rank{Q_o} = 2
rankQo=2,所以原系统时完全能观测的。
李雅普诺夫稳定性
显然,原点为系统的平衡状态,选二次型标量函数为可能的李氏函数,即
{
x
1
˙
=
x
2
x
2
˙
=
−
6
x
1
−
x
2
+
u
\begin{cases}\dot{x_1} = x_2\\ \dot{x_2} =-6x_1 -x_2 +u\end{cases}
{x1˙=x2x2˙=−6x1−x2+u
v
(
x
)
=
x
1
2
+
x
2
2
v(x) = x_1^2+x_2^2
v(x)=x12+x22
v
˙
(
x
)
=
2
x
1
x
2
˙
+
2
x
1
˙
x
2
=
2
x
1
(
−
6
x
1
−
x
2
+
u
)
+
2
x
2
x
2
=
−
12
x
1
2
−
2
x
1
x
2
+
2
x
2
2
+
2
x
1
u
\dot{v}(x) = 2x_1\dot{x_2}+2\dot{x_1}x_2=2x_1(-6x_1 -x_2 +u)+2x_2x_2=-12x_1^2-2x_1x_2+2x_2^2+2x_1u
v˙(x)=2x1x2˙+2x1˙x2=2x1(−6x1−x2+u)+2x2x2=−12x12−2x1x2+2x22+2x1u
出现的这个
u
u
u,怎么处理?
应该是对状态变量
x
x
x求偏导,所以就不会有u出现
[
0
1
−
6
−
1
]
\left[\begin{matrix}0&1\\-6&-1 \end{matrix}\right]
[0−61−1]
[
x
1
x
2
]
[
0
1
−
6
−
1
]
[
x
1
x
2
]
=
x
2
∗
(
x
1
−
x
2
)
−
6
∗
x
1
∗
x
2
=
−
5
x
1
x
2
−
2
x
2
2
=
\left[\begin{matrix}x_1&x_2 \end{matrix}\right] \left[\begin{matrix}0&1\\-6&-1 \end{matrix}\right] \left[\begin{matrix}x_1\\x_2\end{matrix}\right] =x2*(x1 - x2) - 6*x1*x2=-5x_1x_2-2x_2^2 =
[x1x2][0−61−1][x1x2]=x2∗(x1−x2)−6∗x1∗x2=−5x1x2−2x22=
[
0
5
/
2
5
/
2
−
2
]
\left[\begin{matrix}0&5/2\\5/2&-2\end{matrix}\right]
[05/25/2−2]
李雅普诺夫第二法
A
T
P
+
P
A
=
−
Q
A^TP+PA=-Q
ATP+PA=−Q
选取
Q
=
−
I
Q= -I
Q=−I
P
=
[
p
11
p
12
p
21
p
22
]
P = \left[\begin{matrix}p_{11}&p_{12}\\p_{21}&p_{22}\end{matrix}\right]
P=[p11p21p12p22]
A
=
[
0
1
−
6
−
1
]
A = \left[\begin{matrix}0&1\\-6&-1\end{matrix}\right]
A=[0−61−1]
A = [0 1; -6 -1];
syms p11 p12 p21 p22
P = [p11, p12; p21, p22];
eqn = A'*P + P*A == -eye(2,2)
solve(eqn)
p11: 43/12
p12: 1/12
p21: 1/12
p22: 7/12
P = [ 43 12 1 12 1 12 7 12 ] P = \left[\begin{matrix}{43\over12}&{1\over12}\\{1\over12}&{7\over12}\end{matrix}\right] P=[1243121121127]
利用塞尔维特判据检验 P P P的正定性
P = [43/12 1/12;1/12 7/12];
det(P)
ans =
2.0833
Δ
1
=
p
11
=
43
12
>
0
Δ
2
=
∣
43
12
1
12
1
12
7
12
∣
=
2.0833
>
0
\Delta_1=p_{11}={43\over 12}>0\\ \Delta_2 = \left|\begin{matrix}{43\over12}&{1\over12}\\{1\over12}&{7\over12}\end{matrix}\right|=2.0833>0
Δ1=p11=1243>0Δ2=∣∣∣∣1243121121127∣∣∣∣=2.0833>0
可见
P
>
0
P>0
P>0,正定的,系统在原点的平状态是渐进稳定的。
系统的李氏函数及其导函数分贝为
v
(
x
)
=
x
T
P
x
=
1
12
(
43
x
1
2
+
2
x
1
x
2
+
7
x
2
2
)
>
0
v
˙
(
x
)
=
x
T
(
−
I
)
x
=
−
(
x
1
2
+
x
2
2
)
<
0
v(x) = x^TPx = {1\over 12}(43x_1^2+2x_1x_2+7x_2^2)>0\\ \dot{v}(x) = x^T(-I)x=-(x_1^2+x_2^2)<0
v(x)=xTPx=121(43x12+2x1x2+7x22)>0v˙(x)=xT(−I)x=−(x12+x22)<0
ξ
=
0.707
,
ω
n
=
11.313
\xi = 0.707 , \omega_n = 11.313
ξ=0.707,ωn=11.313
设计一个观测器使得极点为
s
1
,
2
=
−
8
±
8
j
s_{1,2}=-8\pm8j
s1,2=−8±8j.
修改封装好的模块参数,得到如下图的曲线。
是不是配置之后也是这个样子的曲线那?
- 系统是完全能观测的,所以可以构造任意极点配置的全维观测器。
- 观测器的期望的特征多项式为
f o ∗ ( s ) = ∏ i = 1 n s − s i = ( s + 8 + 8 j ) ( s + 8 − 8 j ) = s 2 + 16 s + 128 f_o^*(s) = \prod\limits_{i=1}^n{s-s_i} = (s+8+8j)(s+8-8j)=s^2 + 16s+128 fo∗(s)=i=1∏ns−si=(s+8+8j)(s+8−8j)=s2+16s+128 - 计算
f
o
∗
(
A
)
f_o^*(A)
fo∗(A)
f o ∗ ( A ) = A 2 + 16 A + 128 I = [ 122 19 − 114 103 ] f_o^*(A)=A^2 + 16A+128I=\left[\begin{matrix}122&19\\-114&103\end{matrix}\right] fo∗(A)=A2+16A+128I=[122−11419103] - 求观测器的反馈阵,
L
=
[
l
1
l
2
]
L=\left[\begin{matrix}l_1\\l_2\end{matrix}\right]
L=[l1l2]
L = f o ∗ ( A ) Q o − 1 [ 0 1 ] = [ 114 618 ] L=f_o^*(A)Q_o^{-1}\left[\begin{matrix}0\\1\end{matrix}\right] = \left[\begin{matrix}114\\ 618\end{matrix}\right] L=fo∗(A)Qo−1[01]=[114618]
全维观测器的表达式为
x ^ = ( A − L C ) x ^ + B u + L y \hat{x}=(A-LC)\hat{x}+Bu+Ly x^=(A−LC)x^+Bu+Ly
A − L C = [ − 684 1 − 3714 − 1 ] A-LC = \left[\begin{matrix}-684&1\\ -3714&-1\end{matrix}\right] A−LC=[−684−37141−1] - 状态反馈矩阵K
系统是完全能控的
K = [ k 1 k 2 ] K = \left[\begin{matrix}k_1&k_2\end{matrix}\right] K=[k1k2]
带观测期的闭环控制系统
x ^ = A x − B K x ^ + B r x ˙ ^ = L C x + ( A − L C − B K ) x ^ + B r y = C x \begin{matrix} \hat{x} =& Ax-BK\hat{x}+Br\\ \hat{\dot{x}} =& LCx+(A-LC-BK)\hat{x}+Br\\ y=&Cx \end{matrix} x^=x˙^=y=Ax−BKx^+BrLCx+(A−LC−BK)x^+BrCx
闭环特征多项式
f ( s ) = ∣ s I − ( A − B K ) ∣ = ∣ ∣ = s 2 + ( 1 + k 2 ) s + 6 + k 1 f(s) = \left|\begin{matrix}sI-(A-BK)\end{matrix}\right| = \left|\begin{matrix}\end{matrix}\right|= s^2 + (1 + k_2)s+ 6+k_1 f(s)=∣∣sI−(A−BK)∣∣=∣∣=s2+(1+k2)s+6+k1
f o ∗ ( s ) = ∏ i = 1 n s − s i = ( s + 8 + 8 j ) ( s + 8 − 8 j ) = s 2 + 16 s + 128 f_o^*(s) = \prod\limits_{i=1}^n{s-s_i} = (s+8+8j)(s+8-8j)=s^2 + 16s+128 fo∗(s)=i=1∏ns−si=(s+8+8j)(s+8−8j)=s2+16s+128
k 1 = 122 , k 2 = 15 k_1=122,k_2=15 k1=122,k2=15
K = [ 122 15 ] K=\left[\begin{matrix}122 & 15\end{matrix}\right] K=[12215]
零极点配置
G
(
s
)
=
1
s
(
s
−
2
)
=
1
s
2
−
2
s
G(s) = {1\over s(s-2)}={1\over s^2-2s}
G(s)=s(s−2)1=s2−2s1
设计状态反馈增益向量
K
K
K,使得闭环极点为
{
s
1
=
−
1
,
s
2
=
1
}
\{s_1 = -1,s_2=1\}
{s1=−1,s2=1}
传递函数的系数可以标记为
b
1
=
0
,
b
2
=
1
;
a
1
=
−
2
,
a
2
=
0
b_1 = 0,b_2 = 1; a_1 = -2,a_2 = 0
b1=0,b2=1;a1=−2,a2=0
系统的状态方程可以描述为能控规范型
[
x
1
˙
x
2
˙
]
=
[
0
1
−
a
2
−
a
1
]
[
x
1
x
2
]
+
[
0
1
]
u
\left[\begin{matrix}\dot{x_1} \\ \dot{x_2} \end{matrix}\right]= \left[\begin{matrix}0&1 \\ -a_2&-a_1\end{matrix}\right] \left[\begin{matrix}x_1 \\ x_2\end{matrix}\right]+ \left[\begin{matrix}0 \\ 1\end{matrix}\right] u
[x1˙x2˙]=[0−a21−a1][x1x2]+[01]u
y
=
[
b
2
b
1
]
[
x
2
x
1
]
=
[
1
0
]
[
x
2
x
1
]
y =\left[\begin{matrix}b_2&b_1\end{matrix}\right]\left[\begin{matrix}x_2\\x_1\end{matrix}\right] = \left[\begin{matrix}1&0\end{matrix}\right] \left[\begin{matrix}x_2 \\ x_1\end{matrix}\right]
y=[b2b1][x2x1]=[10][x2x1]
原系统的特征多项式可以描述为
α
(
s
)
=
∣
s
I
−
A
∣
=
∣
s
−
1
0
s
−
2
∣
=
s
2
−
2
s
=
s
2
+
a
1
s
+
a
2
\alpha(s) =\left|\begin{matrix}sI-A\end{matrix}\right|=\left|\begin{matrix}s&-1\\0&s-2\end{matrix}\right|=s^2-2s =s^2+a_1s+a_2
α(s)=∣∣sI−A∣∣=∣∣∣∣s0−1s−2∣∣∣∣=s2−2s=s2+a1s+a2
期望的系统的特征多项式
α
∗
=
(
s
−
s
1
)
(
s
−
s
2
)
=
s
2
+
2
s
+
1
=
s
2
+
a
1
∗
s
+
a
2
∗
\alpha^* = (s-s_1)(s-s_2) = s^2+2s+1 = s^2+a_1^*s+a_2^*
α∗=(s−s1)(s−s2)=s2+2s+1=s2+a1∗s+a2∗
a
1
∗
=
2
,
a
2
∗
=
1
a_1^*= 2,a_2^*=1
a1∗=2,a2∗=1
对于用完全能控型描述的系统,其系统的反馈向量可以直接描述为
K
=
[
k
1
k
2
]
=
[
a
2
∗
−
a
2
a
1
∗
−
a
1
]
=
[
1
4
]
K= \left[\begin{matrix}k_1 & k_2\end{matrix}\right] = \left[\begin{matrix}a^*_2-a_2 & a^*_1-a_1\end{matrix}\right]=\left[\begin{matrix}1 & 4\end{matrix}\right]
K=[k1k2]=[a2∗−a2a1∗−a1]=[14]
利用simulink仿真
原系统的方框图
增加反馈增益后的方框图
x
˙
=
A
x
+
B
u
\dot{x} = Ax+Bu
x˙=Ax+Bu
u
(
t
)
=
−
K
x
(
t
)
+
r
(
t
)
u(t) = -Kx(t)+r(t)
u(t)=−Kx(t)+r(t)
x
˙
=
(
A
−
B
K
)
x
+
B
r
\dot{x} = (A-BK)x+Br
x˙=(A−BK)x+Br
事实上,上面的这个方框图可以简化为下图
输出为
极点在{-1,-1}处的系统的传递函数可以直接表示为
G
(
s
)
=
1
s
2
+
2
s
+
1
G(s) = {1\over s^2 + 2s+1}
G(s)=s2+2s+11
其输出为
构造观测器
设
L
=
[
l
1
l
2
]
L =\left[\begin{matrix}l_1\\l_2\end{matrix}\right]
L=[l1l2]
A
−
L
C
=
[
0
1
0
2
]
−
[
l
1
l
2
]
[
1
0
]
=
[
−
l
1
1
−
l
2
2
]
A-LC=\left[\begin{matrix}0&1\\0&2\end{matrix}\right]-\left[\begin{matrix}l_1\\l_2\end{matrix}\right] \left[\begin{matrix}1&0\end{matrix}\right] =\left[\begin{matrix}-l_1&1\\-l_2&2\end{matrix}\right]
A−LC=[0012]−[l1l2][10]=[−l1−l212]
det
[
s
I
−
(
A
−
L
C
)
]
=
[
s
+
l
1
−
1
−
l
2
s
−
2
]
=
s
2
+
(
l
1
−
2
)
s
+
l
2
−
2
l
1
\det[sI-(A-LC)] = \left[\begin{matrix}s+l_1&-1\\-l_2&s-2\end{matrix}\right] = s^2+(l_1-2)s+l_2-2l_1
det[sI−(A−LC)]=[s+l1−l2−1s−2]=s2+(l1−2)s+l2−2l1
{
l
1
−
2
=
2
l
2
−
2
l
1
=
1
→
{
l
1
=
4
l
2
=
5
\begin{cases}l_1-2=2\\ l_2-2l_1 = 1\end{cases} \rightarrow \begin{cases}l_1 = 4\\l_2 = 5\end{cases}
{l1−2=2l2−2l1=1→{l1=4l2=5
带有观测器的闭环控制系统
输出如下图
下图是
y
^
−
y
\hat{y}-y
y^−y的曲线
原系统是一个完全可观测的系统,这点需要在构建全维观测器前说明。
绘制这个图的目的是看一下真是的输出值,与估计值之间的差别。
L阵将这个差值引入到观测器中,在这个例子当中,差值一直为零,相当于不起作用,反馈增益相当于直接加在了原系统上。