当前位置:首页 >> 信息与通信 >>

Inverted pendulum倒立摆的matlab建模


ECE451 Controll Engineering

Inverted pendulum

09/29/2013

Introduction:
Inverted pendulum is a typical fast, multi-varaibles, nonlinear, unstable system, it has significant meaning. We choose the PID controller to fot the inverted pendulum.

Assume the input is a step signal , the gravitational accelerationg=9.8m/s^2 and linearize the nonlinear model around the operating point.

1.Mathematic Modling

M mass of the car 0.5 kg m mass of the pendulum 0.2 kg b coefficient of friction for cart 0.1 N/m/sec l length to pendulum center of mass 0.3 m I mass moment of inertia of the pendulum 0.006 kg.m^2 F force applied to the cart x coordinate of cart position θ pendulum angle from vertical (down) N and F are the force from horizontal and vertical direction. N = m dt 2 (x + l sin θ) Force analysis Consider the horizontal direction cart force, we get the equation: Mx = F ? bx ? N Consider the horizontal direction pendulum force, we get the equation: N = mx + mlθcosθ ? mlθ2 sinθ To get rid of P and N, we get this equation:
d2

?Pl sin θ ? Nl cos θ = Iθ Merge these two equations, about to PAnd N, to obtain a second motion equation: l + ml2 θ + mgl sin θ = ?mlx cos θ u to represent the controlled object with the input force F, linearized two motion equations

Apply Laplace transform to the equation above

The transfer function of angle and position

Let v = x

put the equation above into the second equation

We get the transfer function

State space equation:

Solve the algebraic equation, obtain solution as follows:

Finally we get the system state space equations.

2. PID Controller Design
We now design a PID controller for the inverted pendulum system. KD(s) is the transfer function of the controller.

G(s) is the transfer function of the controlled car. Considering that the input r(s) =0, the block diagram can be transformed as: The output of the system is

G ?s ? y ?s ? ? F ?s ? ? 1 ? kD?s ?G ?s ? ?

? num?denPID F ?s ? ?denPID??den? ? ?num PID ??num?

num den F ?s ? ? ?? num PID num? 1? ?denPID??den?

num—the numerator of the object den —the denominator of the object numPID – the numerator of the PID controller transfer function denPID – the denominator of the PID controller transfer function The object transfer function is

ml 2 s ??s ? num q ? ? 2 U ?s ? den b I ? m l 3 ?m ? M ?m gl 2 bm gl s4 ? s ? s ? s q q q ,

?

?

2 in which q ? ? ?m ? M ? I ? ml ? ?ml?

?

?

2

?.

PID Controller Transfer Function is
2 KI KDs ? K ps ? KI KD?s ? ? K D s ? K P ? ? s s2

Now, we add the car ’s position as another output, we get

in which G1 is the transfer function of the pendulum, G2 is the transfer function of the car. The output of the car ’s position is

num2 G2 ?s ? den2 X ?s ? ? F ?s ? ? F ?s ? ?num PID ??num1 ? 1 ? KD?s ?G1 ?s ? 1? ?denPID??den1 ?
in which, num1,den1,num2,den2 are separately mean the controlled object 1 and object 2 and PID controller‘s numerators and denominators.
? I ? ml 2 g? X ?s ? ? ? ? 2 ? ? ?s ? s ? ? ml From , we could get that I ? m l2 2 bm gl s ? s X ?s ? q q G2 ?s ? ? ? b I ? m l2 3 ?m ? M ?m gl 2 bm gl U ?s ? s4 ? s ? s ? s q q q

?

?

?

?

?

?

2 In which, q ? ? ?m ? M ? I ? ml ? ?ml?

?

?

2

?.

We can easily simplified the equation as

X ?s ? ?

?num2 ??denPID? F ?s ? ?denPID??den ? ? k ?numPID ??num1 ?

3. Matlab Simulation
In design, the cart's position will be ignored. Under these conditions, the design criteria are: 1) settling time is less than 5 seconds 2) pendulum should not move more than 0.05 radians away from the vertical When kd=1,k=1,ki=1: numc1=4.5455 0 0 0, denc1=1 4.7273 -26.6364 0.0909 0 0, num2= -1.8182 0 44.5455 0, denc2=1 4.7273 -26.6364 0.0909 0

Then we tried many times to adjust the parameter to satisfy the requirements: Ts <=5 s and overshoot M<0.05. We find the optimal parameters of kd,k,ki which is the second situation. 2. When kd=20,k=300,ki=1: Numc1= 4.5455 0 0 0, denc1=0.001 0.09111.3325 0.0001 0 0, numc2= -1.8182 0 44.5455 0, denc2=0.001 0.09111.3325 0.0001 0 0

The results:

Matlab codes

M=0.5; m=0.2; b=0.1; I=0.006; g=9.8; l=0.3; q=(M+m)*(I+m*l^2)/q-(m*l)^2; num1=[m*l/q 0 0]; den1=[1 b*(I+m*l^2)/q-(M+m)*m*g*l/q-b*m*g*l/q 0]; num2=[-(I+m*l^2)/q 0 m*g*l/q]; den2=den1; kd=1; k=1; ki=1; numPID=[kd k ki]; denPID=[1 0]; numci=conv (num1 denPID); denc1=polyadd(conv(denPID,den1),conv(numPID,num1)); t=0:0.1:20; figure(1) impulse(numc1,denc1,t) title(‘Angle’) figure(2) impulse(numc2,denc2,t) title(‘Position’)

M=0.5; m=0.2; b=0.1; I=0.006; g=9.8; l=0.3; q=(M+m)*(I+m*l^2)/q-(m*l)^2; num1=[m*l/q 0 0]; den1=[1 b*(I+m*l^2)/q-(M+m)*m*g*l/q-b*m*g*l/q 0]; num2=[-(I+m*l^2)/q 0 m*g*l/q]; den2=den1; kd=20; k=300; ki=1; numPID=[kd k ki]; denPID=[1 0]; numci=conv (num1 denPID);

denc1=polyadd(conv(denPID,den1),conv(numPID,num1)); t=0:0.1:20; figure(1) impulse(numc1,denc1,t) title(‘Angle’) figure(2) impulse(numc2,denc2,t) title(‘Position’)

Simulation:

We will build a closed-loop model with reference input of pendulum position and a disturbance force applied to the cart.

We now begin to simulate the closed-loop system. The physical parameters are set as follows. M=0.5, m=0.2, b=0.1, I=0.006, g=9.8, l=0.3 After 20s simulation, we see the response as follow

The response is very much like what have been done in Matlab codes.



相关文章:
直线二级倒立摆的建模和控制
会利用 matlab 提供的 lqr 函数获得直线二级 倒立摆线性化模型的 lqr 控制器; ...Key words: inverted pendulum, modeling, LQR, balance control 4 一、设计...
一阶倒立摆系统的双闭环模糊控制方案范文,毕业设计
图 8 系统仿真模型 作为受控对象的一阶倒立摆的模型(inverted pendulum) ,这里...可在 MATLAB 中建立一个 m 文件调用此数据文件绘制仿真结果曲线,m 文件程序如...
一级直线倒立摆matlab程序
('Pendulum Angle'); figure(3); plot(t,s,'r'); xlabel('time(s)')...基于matlab的一级倒立摆... 43页 7下载券 倒立摆MATLAB建模 13页 1下载券喜欢...
毕业论文-基于LabVIEW的倒立摆控制系统设计
Keywords: inverted pendulum; LabVIEW; LQR. 1 鲁...根据倒立摆系统的组成对其控制系统建模,计算分析,仿真...基于 LabVIEW 和 Matlab 的自动控制虚拟实验系统[J]...
一级倒立摆的实时控制
Inverted Pendulum Abstract Inverted pendulum system,...运用简单的 matlab 编程得倒立摆是开环不稳定系统,...的建模分析 2.1 直线一级摆系统的控制原理倒立摆...
倒立摆控制系统设计
三种校正方法都利用 MATLAB 通过人机 界面调用,以...Inverted pendulum is a complex, time-varying, ...1.2 倒立摆研究意义倒立摆控制模型和火箭发射垂直系统...
...直线二级倒立摆的控制问题的研究和matlab仿真毕业论...
倒立摆的控制问题的研究和matlab仿真毕业论文设计说明...倒立摆系统的结构并详细推导了二级 倒立摆的数学模型...(论文)说明书 ABSTRACT Inverted pendulum is a ...
倒立摆
本文首先介绍了倒立摆的物理基础并建立仿真模型,应用 Matlab 文本编辑 器对方案的...inverted pendulum4 2.1 Physical modeling of a first order inverted pendulum...
二级倒立摆的建模与仿真
首先需要对被控制系统进行建模 . 二级倒立摆系统数学模型的建立 基于以下假设: 1) 每一级摆杆都是刚体; 2) 在实验过程中同步带长保持不变; 3) 驱动力与放大...
一级倒立摆的PID控制设计
Keywords: PID controller; inverted pendulum; Genetic algorithm; MATLAB ...辽宁科技大学本科生毕业设计 第 22 页 4 一级倒立摆的模型 4.1 一级倒立摆的...
更多相关标签: