基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx

上传人:b****6 文档编号:7754206 上传时间:2023-01-26 格式:DOCX 页数:16 大小:404.91KB
下载 相关 举报
基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx_第1页
第1页 / 共16页
基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx_第2页
第2页 / 共16页
基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx_第3页
第3页 / 共16页
基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx_第4页
第4页 / 共16页
基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx_第5页
第5页 / 共16页
点击查看更多>>
下载资源
资源描述

基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx

《基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx》由会员分享,可在线阅读,更多相关《基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx(16页珍藏版)》请在冰豆网上搜索。

基于AutoCAD VBMathematica和Working model的凸轮设计与仿真.docx

基于AutoCADVBMathematica和Workingmodel的凸轮设计与仿真

 

基于AutoCAD,VB,Mathematica和Workingmodel的凸轮设计与仿真

 

目录

摘要………………………………………………………………1

引言………………………………………………………………1

凸轮设计要求……………………………………………………2

Excel软件辅助设计……………………………………………2

AutoCAD凸轮轮廓线设计………………………………………3

VB编程作凸轮轮廓线并仿真……………………………………4

Mathematica编程作凸轮轮廓线………………………………9

WorkingModel凸轮仿真………………………………………13

各个软件比较……………………………………………………15

课题研究收获……………………………………………………15

参考文献…………………………………………………………16

 

摘要

凸轮是具有曲面轮廓的构件,一般多为原动件。

当凸轮为原动件时,通常做等速的转动或移动,而从动件就按照预期的输出特性要求做连续或间隙的往复运动,移动或平面复杂运动。

本文主要介绍用Excel计算凸轮轮廓线坐标数据,然后导入AutoCAD和Workingmodel中生成凸轮轮廓线。

还介绍了用VB和Mathematica编程来设计凸轮轮廓线并对凸轮进行仿真。

主要技术要求是熟悉凸轮设计基本原理及相关理论计算,能熟练使用Excel,AutoCAD和Workingmodel等软件,熟悉VB和Mathematica编程语言,能将他们相结合起来应用到设计仿真中。

关键词:

凸轮,Excel,AutoCAD,Workingmodel,VB和Mathematica,设计,仿真。

引言

盘形凸轮设计的主要任务是绘制凸轮的轮廓曲线,传统设计方法分为图解法和解析法两种。

其中图解法是根据从动件的位移曲线,按“反转法”原理,做出从动件在反转过程中所占据的一系列位置,从而求得凸轮轮廓曲线。

图解法可用手工法和计算机辅助设计的方法进行。

手工图解法设计凸轮的轮廓曲线误差较大,故对于精度要求高的高速凸轮往往不能满足要求。

计算机辅助作图的方法来作凸轮曲线需要足够多的轨迹上的点的坐标才能达到高的精度要求。

但是求解大量点的坐标计算繁琐,所以我们就利用Excel强大的的表格数据处理功能来准确便捷的计算出足够多的点的坐标数据,然后将这些数据导入AutoCAD中生成凸轮轮廓线,我们还将数据导入WorkingModel中,这就可以对凸轮的运动做直观地观察。

同时,我们还借助编程语言在计算机上编制程序来完成凸轮轮廓曲线的绘制和验证仿真,我们分别用VB和Mathematica进行编程并加以比较。

凸轮设计要求:

凸轮基圆半径r0=40mm,行程h=20mm,偏距e=10mm,推程为简谐运动,推程角为φ0=120°,远休止角φs=30°,回程运动为等加速等减速运动,回程角为φ0′=120°,近休止角φs′=90°。

Excel软件辅助设计

用Excel计算出凸轮轮廓线上点的坐标(部分数据截图)

AutoCAD凸轮轮廓线设计

数据导入AutoCAD中生成凸轮轮廓线:

由该图可直观的看出,AutoCAD是根据导入的点的坐标,用光滑的曲线将其一一连接得到凸轮轮廓曲线的。

VB编程作凸轮轮廓线并仿真:

1.VB程序

‘模块

Publics(200)AsDouble

Publicv(200)AsDouble

Publica(200)AsDouble

Publics1(200),v1(200),a1(200)

PublicConstpi=3.1415926

Publicδ0,δ1,δ2,δ3‘运动角参数

Publich,ω,rb,e,r,e1,r0‘升程、角速度、基圆半径等

PublicSubdraw1()

n=rb/15:

r=rb/n:

e1=e/n

main.Picture1.Circle(35*50,40*50),r*50‘画基圆

main.Picture1.Circle(35*50,40*50),e1*50‘画偏心圆

EndSub

Dimr0AsDouble

PrivateSubCommand1_Click()

δ0=Val(Text3(0).Text)‘初始值

δ1=Val(Text4.Text)

δ2=Val(Text3

(1).Text)

δ3=360-δ0-δ1-δ2

h=Val(Text5.Text)

r0=Val(Text6.Text)‘滚子半径

rb=Val(Text2.Text)‘基圆半径

e=Val(Text1.Text)‘偏心距

DimjAsInteger

j=0

'计算推程的位移

Ifop1dengsu(0).Value=TrueThen‘等速运动

Fori=0Toδ0Step3

s(j)=h*i/δ0

j=j+1

Nexti

ElseIfop1dengjiajian(0).Value=TrueThen‘等加速等减速

Fori=0Toδ0/2Step3

s(j)=2*h*i^2/δ0^2

j=j+1

Nexti

Fori=δ0/2+3Toδ0Step3

s(j)=h-2*h(δ0-i)^2/δ0^2

j=j+1

Nexti

ElseIfop1yuxian(0).Value=TrueThen‘余弦加速度

Fori=0Toδ0Step3

s(j)=h*(1-Cos(pi*i/δ0))/2

j=j+1

Nexti

ElseIfop1zhengxian(0).Value=TrueThen‘正弦加速度

Fori=0Toδ0Step3

s(j)=h*(1-Sin(pi*i/δ0))/2

j=j+1

Nexti

EndIf

‘计算远停程位移

Fori=3To(δ0+δ1)Step3

s(j)=h

j=j+1

Nexti

‘计算回程的位移

Ifop2dengsu

(1).Value=TrueThen‘等速运动

Fori=3To(δ0+δ1+δ2)Step3

s(j)=h*(1-i/δ2)

j=j+1

Nexti

ElseIfop2dengjiajian

(1).Value=TrueThen‘等加速等减速

Fori=3To(δ0+δ1+δ2/2)Step3

s(j)=h-2*h*i^2/δ2^2

j=j+1

Nexti

Fori=(δ0+δ1+δ2/2)+3To(δ0+δ1+δ2)Step3

s(j)=2*h*(δ2-i)^2/δ2^2

j=j+1

Nexti

ElseIfop2yuxian

(1).Value=TrueThen‘余弦加速度

Fori=3To(δ0+δ1+δ2)Step3

s(j)=h*(1+Cos(pi*i/δ2))/2

j=j+1

Nexti

ElseIfop2zhengxian

(1).Value=TrueThen‘正弦加速度

Fori=3To(δ0+δ1+δ2)Step3

s(j)=h*(1+Sin(pi*i/δ2))/2

j=j+1

Nexti

EndIf

‘近停程

Fori=(δ0+δ1+δ2)To(δ0+δ1+δ2+δ3)Step5

s(j)=r0

j=j+1

Nexti

draw1

IfVal(Text6.Text)=0Then

Drawwith=3

Picture1.Line(35*50,(40-r)*50)-(35*50,5*50)

Turnofftimer

Timer1.Interval=250

Timer1.Enabled=True‘选择直动尖顶从动件动画

ElseIfVal(Text6.Text)>0Then

Turnofftimer

x0=35+e1:

y0=40-Sqr(r^2-e1^2)

Forg=2To70‘画理论轮廓线

m=g-1

X2=35-(s(g)+Sqr(r^2-e1^2))*Sin(5*g*pi/180)+e1*Cos(5*g*pi/180)

Y2=40-(s(g)+Sqr(r^2-e1^2))*Cos(5*g*pi/180)+e1*Sin(5*g*pi/180)

X1=35-(s(m)+Sqr(r^2-e1^2))*Sin(5*m*pi/180)+e1*Cos(5*m*pi/180)

Y1=40-(s(m)+Sqr(r^2-e1^2))*Cos(5*m*pi/180)+e1*Sin(5*m*pi/180)

Picture1.Line(x0*50,y0*50)-(X1*50,Y1*50)

Picture1.Line(X1*50,Y1*50)-(X2*50,Y2*50)

x0=X2:

y0=Y2

Nextg

Timer2.Interval=250

Timer2.Enabled=True‘选择直动滚子从动件动画

Else

Picture1.CurrentX=20*50

Picture1.CurrentY=62*50

Picture1.Print"重新选择"

EndIf

EndSub

PrivateSubTimer1_Timer()‘直动滚子从动件动画

x0=35+e1:

y0=40-Sqr(r^2-e1^2)

Forg=2To70

m=g-1

X3=e1*Cos(5*g*pi/180)

Y3=-e1*Sin(5*g*pi/180)

X2=35-(s(g)+Sqr(r^2-e1^2))*Sin(5*g*pi/180)+e1*Cos(5*g*pi/180)

Y2=40-(s(g)+Sqr(r^2-e1^2))*Cos(5*g*pi/180)+e1*Sin(5*g*pi/180)

X1=35-(s(m)+Sqr(r^2-e1^2))*Sin(5*m*pi/180)+e1*Cos(5*m*pi/180)

Y1=40-(s(m)+Sqr(r^2-e1^2))*Cos(5*m*pi/180)+e1*Sin(5*m*pi/180)

Picture1.Line((62+g*0.6)*50,15*50)-((62+g*0.6)*50,(15-s(g))*50)

Picture1.Line((X3+35)*50,(Y3+40)*50)-(X2*50,Y2*50)

Picture1.Line(x0*50,y0*50)-(X1*50,Y1*50)

Picture1.Line(X1*50,Y1*50)-(X2*50,Y2*50)

x0=X2:

y0=Y2

Nextg

Ifg>70Then

Turnofftimer

EndIf

EndSub

PrivateSubTimer2_Timer()‘直动滚子从动件动画

X2=35-(s(g)+Sqr(r^2-e1^2))*Sin(5*g*pi/180)+e1*Cos(5*g*pi/180)

Y2=40-(s(g)+Sqr(r^2-e1^2))*Cos(5*g*pi/180)+e1*Sin(5*g*pi/180)

Picture1.Circle(X2*50,Y2*50),(r0/rb*15)*50

g=g+1

Ifg>71Then

Turnofftimer

EndIf

EndSub

PrivateSubturnofftimer()

Timer1.Enabled=False

Timer2.Enabled=False

EndSub

 

参数输入:

 

形成轮廓线,验证仿真:

 

用Mathematica编程作凸轮轮廓线

locuspoint1={s,Sin[s2]};

ParametricPlot[Evaluate[locuspoint1],{s,-2,2}]

locuspoint2={If[N[]/2

ParametricPlot[Evaluate[locuspoint2],{s,0,2}]

Needs["MechanicalSystems`Modeler2D`"]

CamPlot[Point[2,locuspoint2],{s,0,2},FrameTrue,AspectRatioAutomatic]

Show[%/.{X21,Y2-2,20.5}]

Off[General:

:

"spell1"]

alpha;beta;

On[General:

:

"spell1"]

camprof={3Cos[alpha],3Sin[alpha]+Sin[2alpha]};

ParametricPlot[Evaluate[camprof],{alpha,0,2},AspectRatioAutomatic]

ground=1;

cam=2;

follower=3;

SetBodies[Body[follower,InitialGuess{{-3.5,4.0},0.0}]]

SetConstraints[Revolute2[1,Point[cam,0],Point[ground,0]],Revolute2[2,Point[follower,0],Point[ground,{-3.5,4}]],RotationLock1[3,cam,2N[π]T],CamToLine1[4,Point[cam,camprof],{alpha,1.5},Line[follower,{0.5,-1},{6.5,-1}]]]

SolveMech[.15]

SolveMech[.30]

locuspoint={If[N[π]/2

ParametricPlot3D[Evaluate[locuspoint],{s,0,2},{t,0,2},PlotPoints{35,2}]

Needs["MechanicalSystems`Modeler3D`"]

True]

Show[%/.{X21,Y2-2,Z20.5,Eo2.7,Ei2.7,Ej20,Ek20}]

camsurf={If[N[π]/2

ground=1;

cam=2;

follower=3;

SetBodies[Body[follower,InitialGuess{{-2,0,2},{1,0,0,0}}]]

SetConstraints[Revolute5[1,Line[cam,0,{0,2,0}],Line[ground,0,{0,2,0}]],Revolute5[2,Line[follower,0,{0,2,0}],Line[ground,{-2,0,2},{-2,2,2}]],ProjectedAngle1[3,Vector[cam,{0,0,1}],Vector[ground,{0,0,1}],Vector[ground,{0,-1,0}],2N[π]T],CamToSphere1[4,Point[cam,camsurf],{alpha,1.5},{beta,1},Point[follower,{2,1,0}],0.5]]

SolveMech[0.1]

SolveMech[.20]

Needs["MechanicalSystems`Modeler2D`"]

knotpoints={{0,1.5},{.75,.75},{1,0},{.707,-.707},{0,-1},{-.707,-.707},{-1,0},{-.75,.75},{0,1.5}};

splinelocus=SplineFit[knotpoints,EndConditionsClosed]

ParametricPlot[splinelocus[s],{s,0,8},AspectRatioAutomatic]

CamToCircle1[4,Point[2,splinelocus[s]],{s,2.0},Point[3,{0,0}],.2]

data=PolarToXY/@Table[{4-i,iN[π]},{i,1,3,.2}];

splinelocus=SplineFit[data,EndConditions{{.106,-.994},{.152,-.476}}]

ParametricPlot[splinelocus[s],{s,0,10},AspectRatioAutomatic]

splinearc=ArcLength[splinelocus]

ground=1;

cam=2;

SetConstraints[CamToLine1[1,Point[cam,splinelocus[s]],{s,2},Line[ground,{0,0},{1,0}]],RotationLock1[2,cam,2N[]T],Constraint[3,splinearc[s]==Location[cam,splinelocus[s]]1\[RightDoubleBracket]]]

SetGuess[{X24,Y22.5}];

SolveMech[{0,-0.2,-0.4}]

ansplinelocus=PolarToXY[{4-s,sN[]}]

ansplinearc=\[Integral]

s

Plot[Evaluate[{ansplinearc-(ansplinear/.s1),splinearc[5(s-1)]}],{s,1,3}]

data=Join[{{3.08599,0.61384},{3.23358,1.33939},{3.20411,2.14091},{2.82843,2.82843},{2.14092,3.20411},{1.33939,3.23358},{0.61384,3.08599}},Table[3{Cos[i],Sin[i]},{i,N[]/2,2N[],3N[]/(224)}]];

len=Length[data];

fourierdata=[Fourier/@Transpose[data]2]/[N[

]];

fourierdata1,1\[RightDoubleBracket]/=2;

fourierdata2,1\[RightDoubleBracket]/=2;

terms=10;

fourierlocus=(Take[Re[#1],terms].Table[Cos[is],{i,0,terms-1}]+Take[Im[#1],terms].Table[Sin[is],{i,0,terms-1}]&)/@fourierdata;

Show[Graphics[{PointSize[.018],Point/@data}],ParametricPlot[Evaluate[fourierlocus],{s,0,2},DisplayFunctionIdentity],AspectRatioAutomatic]

locuspoint1=Involute[g1,{0,0},4.0,5.0,0];

locuspoint2=Involute[g2,{0,0},5.6,7.0,N[]]

ground=1;

gear1=2;

gear2=3;

SetConstraints[Revolute2[1,Point[ground,{0,0}],Point[gear1,{0,0}]],RotationLock1[2,gear1,2N[]T],Revolute2[3,Point[ground,{12,0}],Point[gear2,{0,0}]],CamToCam1[4,Point[gear1,locuspoint1],{g1,1},Point[gear2,locuspoint2],{g2,1}]]

SolveMech[0.01,SolutionVelocity]

{-((2d)/(3d))/.%,5.6/4.0}

{-(2/3)/.Out[0],1.4}

 

WorkingModel生成轮廓线并仿真:

导入数据:

生成凸轮轮廓线:

速度图像:

由上述速度图像很容易发现,图像基本满足题设要求,但并不是十分光滑的曲线,说明用WorkingModel设计凸轮精度有限,考虑到WorkingModel简单便捷,可以做大致的建模和观察。

通过增加导入坐标数据的组数,可以使曲线更加光滑。

 

各个软件比较:

AutoCAD具有完善的二维图形绘制功能和强大的图形编辑功能,通过导入Excel中得出的数据,生成凸轮轮廓线显然比WorkingModel要便捷,精确。

而WorkingModel也因其易于操作的特点,用于我们简单地仿真中也很适合。

Ma

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

当前位置:首页 > 小学教育 > 语文

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

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