前言
系统由一辆具有动力的小车和安装在小车上的倒立摆组成,系统是不稳定,我们需要通过控制移动小车使得倒立摆保持平衡。
具体地,考虑二维情形如下图,控制力为水平力 F F F,输出为角度 θ \theta θ以及小车的位置 x x x。
力分析和系统方程
设两个物体在水平和竖直方向上的相互作用力分别为
N
N
N和
P
P
P。
将小车水平方向上的力相加,得到牛顿力学方程:
M
x
¨
+
b
x
˙
+
N
=
F
M\ddot{x}+b\dot{x}+N=F
Mx¨+bx˙+N=F
将倒立摆水平方向上的力相加,得到:
N
=
m
x
¨
+
m
l
θ
¨
c
o
s
θ
−
m
l
θ
˙
2
s
i
n
θ
N=m\ddot{x}+ml\ddot{\theta}cos\theta-ml\dot{\theta}^2sin\theta
N=mx¨+mlθ¨cosθ−mlθ˙2sinθ
将
N
N
N消去,得
M
x
¨
+
b
x
˙
+
m
x
¨
+
m
l
θ
¨
c
o
s
θ
−
m
l
θ
˙
2
s
i
n
θ
=
F
M\ddot{x}+b\dot{x}+m\ddot{x}+ml\ddot{\theta}cos\theta-ml\dot{\theta}^2sin\theta=F
Mx¨+bx˙+mx¨+mlθ¨cosθ−mlθ˙2sinθ=F
将垂直于摆的力相加,得
P
s
i
n
θ
+
N
c
o
s
θ
−
m
g
s
i
n
θ
=
m
l
θ
¨
+
m
x
¨
c
o
s
θ
(
a
)
Psin\theta+Ncos\theta-mgsin\theta=ml\ddot{\theta}+m\ddot{x}cos\theta(a)
Psinθ+Ncosθ−mgsinθ=mlθ¨+mx¨cosθ(a)
为了消去
P
,
N
P,N
P,N两项,将两个物体质心的力矩相加,得
P
l
s
i
n
θ
−
N
l
c
o
s
θ
=
I
θ
¨
(
b
)
Plsin\theta-Nlcos\theta=I\ddot{\theta}(b)
Plsinθ−Nlcosθ=Iθ¨(b)
(
a
)
×
l
+
(
b
)
(a)\times l+(b)
(a)×l+(b)得
(
I
+
m
l
2
)
θ
¨
+
m
g
l
s
i
n
θ
=
−
m
l
x
¨
c
o
s
θ
(I+ml^2)\ddot{\theta}+mglsin\theta=-ml\ddot{x}cos\theta
(I+ml2)θ¨+mglsinθ=−mlx¨cosθ
线性化
将上述方程线性化,
θ
=
π
\theta=\pi
θ=π,并假设系统保持在这个平衡的小邻域内。设
ϕ
\phi
ϕ为摆对平衡位置的偏差,满足
θ
=
π
+
ϕ
\theta=\pi+\phi
θ=π+ϕ,若偏差十分小,使用以下近似:
c
o
s
θ
=
c
o
s
(
π
+
ϕ
)
≈
−
1
s
i
n
θ
=
s
i
n
(
π
+
ϕ
)
≈
−
ϕ
θ
¨
2
=
ϕ
˙
2
≈
0
cos\theta=cos(\pi+\phi)\approx-1 \\ sin\theta=sin(\pi+\phi)\approx-\phi \\ \ddot{\theta}^2=\dot{\phi}^2\approx0
cosθ=cos(π+ϕ)≈−1sinθ=sin(π+ϕ)≈−ϕθ¨2=ϕ˙2≈0
将上述近似公式应用至前面的非线性控制方程,得到两个线性化的方程,并使用
u
u
u替代
F
F
F得
(
I
+
m
l
2
)
ϕ
¨
−
m
g
l
ϕ
=
m
l
x
¨
(
M
+
m
)
x
¨
+
b
x
˙
−
m
l
ϕ
¨
=
u
(I+ml^2)\ddot{\phi}-mgl\phi=ml\ddot{x} \\ (M+m)\ddot{x}+b\dot{x}-ml\ddot{\phi}=u
(I+ml2)ϕ¨−mglϕ=mlx¨(M+m)x¨+bx˙−mlϕ¨=u
传递函数
假设初始条件为0,对系统方程应用拉普拉斯变换:
todo