倒立摆建模
前言
系统由一辆具有动力的小车和安装在小车上的倒立摆组成,系统是不稳定,我们需要通过控制移动小车使得倒立摆保持平衡。
具体地,考虑二维情形如下图,控制力为水平力FFF,输出为角度θ\thetaθ以及小车的位置xxx。
力分析和系统方程
设两个物体在水平和竖直方向上的相互作用力分别为NNN和PPP。
将小车水平方向上的力相加,得到牛顿力学方程:
Mx¨+bx˙+N=FM\ddot{x}+b\dot{x}+N=FMx¨+bx˙+N=F
将倒立摆水平方向上的力相加,得到:
N=mx¨+mlθ¨cosθ−mlθ˙2sinθN=m\ddot{x}+ml\ddot{\theta}cos\theta-ml\dot{\theta}^2sin\thetaN=mx¨+mlθ¨cosθ−mlθ˙2sinθ
将NNN消去,得
Mx¨+bx˙+mx¨+mlθ¨cosθ−mlθ˙2sinθ=FM\ddot{x}+b\dot{x}+m\ddot{x}+ml\ddot{\theta}cos\theta-ml\dot{\theta}^2sin\theta=FMx¨+bx˙+mx¨+mlθ¨cosθ−mlθ˙2sinθ=F
将垂直于摆的力相加,得
Psinθ+Ncosθ−mgsinθ=mlθ¨+mx¨cosθ(a)Psin\theta+Ncos\theta-mgsin\theta=ml\ddot{\theta}+m\ddot{x}cos\theta(a)Psinθ+Ncosθ−mgsinθ=mlθ¨+mx¨cosθ(a)
为了消去P,NP,NP,N两项,将两个物体质心的力矩相加,得
Plsinθ−Nlcosθ=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+ml2)θ¨+mglsinθ=−mlx¨cosθ(I+ml^2)\ddot{\theta}+mglsin\theta=-ml\ddot{x}cos\theta(I+ml2)θ¨+mglsinθ=−mlx¨cosθ
线性化
将上述方程线性化,θ=π\theta=\piθ=π,并假设系统保持在这个平衡的小邻域内。设ϕ\phiϕ为摆对平衡位置的偏差,满足θ=π+ϕ\theta=\pi+\phiθ=π+ϕ,若偏差十分小,使用以下近似:
cosθ=cos(π+ϕ)≈−1sinθ=sin(π+ϕ)≈−ϕθ¨2=ϕ˙2≈0cos\theta=cos(\pi+\phi)\approx-1 \\ sin\theta=sin(\pi+\phi)\approx-\phi \\ \ddot{\theta}^2=\dot{\phi}^2\approx0cosθ=cos(π+ϕ)≈−1sinθ=sin(π+ϕ)≈−ϕθ¨2=ϕ˙2≈0
将上述近似公式应用至前面的非线性控制方程,得到两个线性化的方程,并使用uuu替代FFF得
(I+ml2)ϕ¨−mglϕ=mlx¨(M+m)x¨+bx˙−mlϕ¨=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