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

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 ? k D?s ?G ?s ? ?

num?denPID? F ?s ? ?denPID??den? ? ?numPID??num?

num den F ?s ? ?numPID??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 ? ml ? 3 ?m ? M ?mgl 2 bmgl 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 ? ?numPID??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 ? ml 2 2 bmgl s ? s X ?s ? q q G2 ?s ? ? ? b I ? ml 2 3 ?m ? M ?mgl 2 bmgl 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的一阶倒立摆系统建模与仿真
基于MATLAB 的一阶倒立摆系统建模与仿真 Modeling and Simulation of Single-Inverted Pendulum System Based on Matlab 韩慧敏(0924102 班,12601413502qq.com,...
基于matlab的倒立摆设计
本设计以倒立摆为控制对象, 设计 PID 控制器, 利用 Matlab 软件对倒立摆模型的...Keywords: First-order inverted pendulum;PID controller ;MATLAB simulation II ...
基于一阶倒立摆的matlab仿真实验
成都理工大学工程技术学院 基于一阶倒立摆的 matlab ...inverted pendulum control problem, and its ...(1)线性理论控制方法 将倒立摆系统的非线性模型进行...
基于matlab的倒立摆仿真设计
关键词:一级倒立摆,PID,MATLAB 仿真一、倒立摆模型的研究意义倒立摆系统的研究能有效的反映控制中的许多典型问题:如非线性问题、鲁棒性 问题、镇定问题、随动问题...
基于Matlab的一级倒立摆模型的仿真
倒立摆数学模型推导部分:首先用牛顿—欧拉方法建立数学模 型,接着用动态系统空间状态方程法导出状态方程系数矩阵,然后用 MATLAB 对数学模型进行从状态空间到传递函数的...
一级直线倒立摆matlab程序
('Pendulum Angle'); figure(3); plot(t,s,'r'); xlabel('time(s)')...基于matlab的一级倒立摆... 43页 7下载券 倒立摆MATLAB建模 13页 1下载券喜欢...
一级倒立摆的Simulink仿真
倒立摆数学模型推导部分:首先用线性化数学模型,接着用动 态系统空间状态方程法导出状态方程系数矩阵,然后用 MATLAB 对系统进行可 控可观判断及进行几点配置,加入配置...
模糊控制在倒立摆中的MATLAB仿真应用
模糊控制在倒立摆的MATLAB仿真应用_电子/电路_工程科技_专业资料。利用MATLAB做...1-1 的 a 和 b 所示的分别是轮轨式一级倒立摆系统和二级倒立摆系统的 模型...
基于ADAMS与MATLAB联合仿真的倒立摆设计毕业论文
本文先分别用 MATLAB 和 ADAMS 两种 软件对倒立摆系统进行建模仿真,然后将两者...control, the control of inverted pendulum system are realized by three ...
单级倒立摆控制系统设计及MATLAB中的仿真
建模, 设计了该模型的模糊控制系统, 并利用 Matlab\simulink软件工具 对倒立摆的...Keywords: Inverted pendulum; Simulation; Fuzzy control; Motion; modeling; ...
更多相关标签:
inverted pendulum | 倒立摆建模 | 二级倒立摆建模 | 旋转倒立摆建模 | 一级倒立摆建模 | 倒立摆matlab仿真 | 一级倒立摆matlab仿真 | 倒立摆matlab仿真程序 |