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

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\simulink软件工具 对倒立摆的...Keywords: Inverted pendulum; Simulation; Fuzzy control; Motion; modeling; ...
倒立摆系统的建模(拉格朗日方程)
inverted pendulum system 2 系统主要组成部分简介直线一级倒立摆装置如图 2.2 ...而 Simulink 是 MATLAB 最重要的组件之一,它提供一个动态系统建模、仿 真和...
基于ADAMS与MATLAB联合仿真的倒立摆设计毕业论文
本文先分别用 MATLAB 和 ADAMS 两种 软件对倒立摆系统进行建模仿真,然后将两者...Control methods of inverted pendulum are widely used in military, aerospace,...
基于adams和matlab的一级倒立摆联合仿真
倒立摆三维建模 四、基于 ADAMS 的一级倒立摆模型设计 五、ADAMS 和 MATLAB/...plant export New controls plant 一栏中填入 inverted_pendulum,file prefix 同...
毕业设计 二级倒立摆建模
关键词:倒立摆;PID;状态反馈; MATLAB I 何安林: 二级倒立摆系统建模与仿真 ABSTRACT Double Inverted Pendulum System Modeling and Simulation Conventional PID ...
单级移动倒立摆建模及串联PID校正-课程设计
Keywords: inverted pendulum PID control parameters tuning MATLAB 1 武汉理工大学《自动控制原理》课程设计说明书 单级移动倒立摆建模及串联 PID 校正 1 单级移动...
单级倒立摆的智能控制及其GUI动画演示
关键词:倒立摆, PID 控制器, MATLAB,GUI I Abstract Inverted Pendulum System ...2 单级倒立摆的智能控制及 GUI 动画演示 2 单级倒立摆的数学模型 2.1 模型...
一级倒立摆的模糊控制
( Inverted Pendulum)是处于倒置不稳定状态、通过人为...图 2-2 单机倒立摆模型图 小车由电机通过同步带...根据实际系 统参数及状态方程,在 matlab 环境下编写...
倒立摆毕业论文
关键词:倒立摆 数学建模 PID 原理 Matlab 仿真 1 ABSTRACT The inverted pendulum is in the inverted unstable state, by the artificial control of the dynamic...
直线二级倒立摆的建模和控制
会利用 matlab 提供的 lqr 函数获得直线二级 倒立摆线性化模型的 lqr 控制器; ...Key words: inverted pendulum, modeling, LQR, balance control 4 一、设计...
更多相关标签: