机械运动系统设计与实践报告.docx

上传人:b****2 文档编号:1251617 上传时间:2022-10-19 格式:DOCX 页数:44 大小:1.41MB
下载 相关 举报
机械运动系统设计与实践报告.docx_第1页
第1页 / 共44页
机械运动系统设计与实践报告.docx_第2页
第2页 / 共44页
机械运动系统设计与实践报告.docx_第3页
第3页 / 共44页
机械运动系统设计与实践报告.docx_第4页
第4页 / 共44页
机械运动系统设计与实践报告.docx_第5页
第5页 / 共44页
点击查看更多>>
下载资源
资源描述

机械运动系统设计与实践报告.docx

《机械运动系统设计与实践报告.docx》由会员分享,可在线阅读,更多相关《机械运动系统设计与实践报告.docx(44页珍藏版)》请在冰豆网上搜索。

机械运动系统设计与实践报告.docx

机械运动系统设计与实践报告

机械运动系统设计与实践报告

 

学院:

工程学院

专业:

机械设计及理论

姓名:

学号:

指导教师:

 

2012年3月

环形倒立摆Adams与Matlab联合仿真分析

一、实践目的

1.熟悉和理解环形倒立摆的组成部件及运动原理。

2.通过ADAMS软件对环形倒立摆进行建模,熟练该款软件。

3.通过运用ADAMS导出模块与matlab进行对接处理,熟悉matlab软件的PID运行控制以及掌握simulink的相关设置。

二、实验原理

环形倒立摆是通过电机驱动,带动连杆,同时连杆来带动摆杆运动。

中间需要测量的物理参数主要有:

连杆的角度、连杆的角速度、摆杆的角度、摆杆的角速度。

通过两个光电编码器进行反馈。

从反馈过程中来调节电机的转速及转向,进而达到摆杆的倒立并保持相对平衡。

下图1即为实验室固高环形倒立摆系统组成框架:

图1环形倒立摆组成框架

机房中matlab6.5中控制倒立摆的原理

图二

老师给的程序

%thisisanewsimulationprogramfornewarm-typeinvertedpendulum

%bylgrinputonthestateof0ofarmandthatof0ofpendulum

%!

CAUTION,changedbaseofdirectionofarm

%Suc.

clearall

closeall

%---------------------------------

Ma=0.21;

Mp=0.062;

la=0.133;

lp=0.068;

La=0.25;

Lp=0.19;

Ja=5E-3;

Jp=5.65E-4;

Ca=5.52E-3;

Cp=1.69E-4;

kt=0.0419;

g=9.8;

%------------------continuousstateequation--------------------

ce=[1000;

0100;

00Mp*La^2+JaMp*La*lp;

00Mp*La*lpJp];

ca=[0010;

0001;

-(Mp*la+Mp*La)*g0-(Ca+Cp)Cp;

0Mp*g*lpCp-Cp];

cb=[0;0;kt;0];

CA=inv(ce)*ca;

CB=inv(ce)*cb;

C=[1000;0100];

%---------------------------------------------------------------

Q=diag([100,10,1,1]);

R=1;

[f,s,e]=lqr(CA,CB,Q,R);

%---------------------------------------------------------------

dt=0.005;%samplingtime

th_a=0.1%accdd('Initialangleofarm',0.1);%!

caution,clockdi

%rection

th_p=pi;%=accdd('Initialangleofpendulum',pi);%!

caution,clockdir

%ection+

d_th_a=0.0;%

d_th_p=0.0;%initialvaluesofstates

dd_th_a=0.0;%

dd_th_p=0.0;%

u=0.0;

z=0.0;

energy=0.0;

i=1;

%--------------------------inputparameter---------------------

alpha=30.0;%alpha=accdd('DesignParameteralpha',30.0);

energy_d=1.5*Mp*g*lp;%accdd('DesiredEnergy',1.5*Mp*g*lp);

zeta=1%accdd('DampingFactor',1.0);

wc=1%accdd('DampingFactor',1.0);

flag=0;

%--------------------------startingloop----------------------

fori=1:

6.0/dt

th_a_0=th_a;%

th_p_0=th_p;%

d_th_a_0=d_th_a;%

d_th_p_0=d_th_p;%

dd_th_a_1=dd_th_a;%

dd_th_p_0=dd_th_p;%

ifcos(th_p)>=cos(0.2);

flag=1;

end

ifflag==0%-----------------------swimpingup------------------

dd_th_a=z-(2*zeta*wc*d_th_a+wc^2*th_a);

ydd_temp=-Mp*La*lp*cos(th_a-th_p)*dd_th_a+Mp*La*lp*d_th_a^2*sin(th_a-th_p);

dd_th_p=(ydd_temp+Mp*g*lp*sin(th_p)+Cp*d_th_a-Cp*d_th_p)/Jp;

d_th_a=d_th_a_0+dd_th_a*dt;

d_th_p=d_th_p_0+dd_th_p*dt;

th_a=th_a_0+d_th_a_0*dt+dd_th_a*dt^2*0.5;

th_p=th_p_0+d_th_p_0*dt+dd_th_p*dt^2*0.5;

else

eq_1_1=-Mp*La*lp*d_th_p^2*sin(th_a-th_p)-(Mp*la+Mp*La)*g*sin(th_a);

eq_1_2=-(Ca+Cp)*d_th_a+Cp*d_th_p+kt*u;

eq_1_left=eq_1_1+eq_1_2;

eq_2_1=Mp*La*lp*d_th_a^2*sin(th_a-th_p)+Mp*lp*g*sin(th_p);

eq_2_2=Cp*d_th_a-Cp*d_th_p;

eq_2_left=eq_2_1+eq_2_2;

%--------------------------calculationofinversematrix-------------

M11=Mp*La^2+Ja;

M12=Mp*La*lp*cos(th_a-th_p);

M21=Mp*La*lp*cos(th_a-th_p);

M22=Jp;

M=[M11M12;M21M22];

MI=inv(M);

%-------------------calculationofparameters------------------

dd_th_a=MI(1,1)*eq_1_left+MI(1,2)*eq_2_left;

dd_th_p=MI(2,1)*eq_1_left+MI(2,2)*eq_2_left;

d_th_a=d_th_a_0+dd_th_a*dt;

d_th_p=d_th_p_0+dd_th_p*dt;

th_a=th_a_0+d_th_a_0*dt+dd_th_a*dt^2*0.5;

th_p=th_p_0+d_th_p_0*dt+dd_th_p*dt^2*0.5;

end

energy=0.5*Jp*d_th_p^2+Mp*g*lp*cos(th_p);%energyofpendulum

potential=Mp*g*lp*cos(th_p);

kinetic=0.5*Jp*d_th_p^2;

%------------------------------------------------------------------------

ifflag==0

error=energy-energy_d;

u1=(Mp*La^2+Ja)*dd_th_a+Mp*La*lp*cos(th_a-th_p)*dd_th_p+(Ca+Cp)*d_th_a;

u2=Mp*La*lp*d_th_p^2*sin(th_a-th_p)+(Ma*la+Mp*La)*g*sin(th_a)-Cp*d_th_p;

u=(u1+u2)/kt;

z=alpha*d_th_p*cos(th_p)*error;

else

u=-f*[th_a;th_p;d_th_a;d_th_p];

end

%-----------------Limitinput--------------

ifu>=4.995

u=4.995;

elseifu<=-4.995

u=-4.995;

end

end

%----------------------------savedata----------------------------

accel_th_a(i)=dd_th_a;a的加速度

accel_th_p(i)=dd_th_p;p的加速度

veloc_th_a(i)=dd_th_a;a的速度

veloc_th_p(i)=dd_th_p;p的速度

angle_th_a(i)=th_a;a的角度

angle_th_p(i)=th_p;p的角度

Energy1(i)=energy;能量方程

Energy2(i)=kinetic;动力方程

Energy3(i)=potential;

input(i)=u;

t(i)=i*dt;

end

%----------------------------endloop-------------------------------

subplot(221);plot(t,angle_th_a);

xlabel('time[sec]');

ylabel('AngleofArm[rad]');

grid

subplot(222);plot(t,angle_th_p);

xlabel('time[sec]');

ylabel('AngleofPendulum[rad]');

grid

subplot(223);

plot(t,input);

xlabel('time[sec]');

ylabel('Input');

grid

subplot(224);

plot(t,Energy1,t,Energy2,':

',t,Energy3,'--');

xlabel('time[sec]');

ylabel('EnergyofPendulum');

程序中的一些句子

%thisisanewsimulationprogramfornewarm-typeinvertedpendulum这是一个新臂型倒立摆的新的仿真程序

%bylgrinputonthestateof0ofarmandthatof0ofpendulum由lgr输入的手臂0和0摆的状态

%!

CAUTION,changedbaseofdirectionofarm注意,改变基

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > IT计算机 > 互联网

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1