机械原理课程设计编程说明书设计题目:牛头刨床凸轮机构指导教师:王琦王春华设计者:雷选龙学号:0807100309班级:机械08-32010年7月15日辽宁工程技术大学机械原理课程设计任务书(二)姓名雷选龙专业机械工程及自动化班级机械08-3班学号五、要求:1)计算从动件位移、速度、加速度并绘制线图。
2)确定凸轮机构的基本尺寸,选取滚子半径,画出凸轮实际廓线,并按比例绘出机构运动简图。
以上内容作在A2或A3图纸上。
3)编写出计算说明书。
指导教师:开始日期:2010年07月10日完成日期:2010年07月16日目录一设计任务及要求-----------------------------------------------2二数学模型的建立-----------------------------------------------2三程序框图--------------------------------------------------------5四程序清单及运行结果-----------------------------------------6五设计总结-------------------------------------------------------14六参考文献-----------------------------------------------------15一 设计任务与要求已知摆杆9为等加速等减速运动规律,其推程运动角φ=70,远休止角φs =10,回程运动角φ΄=70,摆杆长度l 09D =125,最大摆角φmax =15,许用压力角[α]=40,凸轮与曲线共轴。
(1) 要求:计算从动件位移、速度、加速度并绘制线图(用方格纸绘制),也可做动态显示。
(2) 确定凸轮的基本尺寸,选取滚子半径,画出凸轮的实际廓线,并按比例绘出机构运动简图。
(3) 编写计算说明书。
二 机构的数学模型1 推程等加速区 当2/0ϕδ≤≤时角位移 22max /21ϕδϕ=m角速度 2max /4ϕδϕω= 角加速度 2max /4ϕϕε= 2 推程等减速区 当ϕδϕ≤<2/时角位移 22max max /)(21ϕδϕϕϕ--=m角速度 2max /)(4ϕδϕϕω-= 角加速度 2max /4ϕϕε-= 3 远休止区 当s ϕϕδϕ+≤<时角位移 max 1ϕ=m 角速度 0=ω 角加速度 0=ε 4 回程等加速区当2/ϕϕϕδϕϕ'++≤<+s s 时角位移 22max max /)(21ϕϕϕδϕϕ'---=s m角速度 2max /)(4ϕϕϕδϕω'---=s 角加速度 2max /4ϕϕε'-= 5 回程等减速区当ϕϕϕδϕϕϕ'++≤<'++s s 2/时 角位移 22max /)(21ϕδϕϕϕϕ'-'++=s m 角速度 2max /)(4ϕδϕϕϕϕω'-'++-=s 角加速度 2max /4ϕϕε'= 6 近休止区角位移 01=m 角速度 0=ω 角加速度 0=ε如图选取xOy 坐标系,B1点为凸轮轮廓线起始点。
开始时推杆轮子中心处于B1点处,当凸轮转过角度时,摆动推杆角位移为,由反转法作图可看出,此时滚子中心应处于B 点,其直角坐标为:()()00cos cos sin sin ϕϕδδϕϕδδ++-=++-=l a y l a x因为实际轮廓线与理论轮廓线为等距离,即法向距离处处相等,都为滚半径rT.故将理论廓线上的点沿其法向向内测移动距离r r 即得实际廓线上的点B(x1,y1).由高等数学知,理论廓线B 点处法线nn 的斜率应为 ()()θθδδθcos /sin ////=-==d dy d dx dy dx tg 根据上式有:()()()()δϕϕϕδδδδϕϕϕδδδd d l a d dy d d l a d dx /1sin sin //1cos cos /00++++-=+++-=可得()()()()()()2222////cos ////sin δδδθδδδθd dy d dx d dy d dy d dx d dx +-=+=实际轮廓线上对应的点B(x,y)的坐标为⎩⎨⎧==θθsin 1cos 1r r r y y r x x 此即为凸轮工作的实际廓线方程,式中“-”用于内等距线,“+”用于外等距线。
三四程序清单及运行结果#include<math.h>#include<dos.h>#include<graphics.h>#include<conio.h>#include<stdio.h>#define l 125.0#define Aa 40#define r_b 50#define rr 7.5#define K (3.1415926/180)#define dt 0.25float Q_max,Q_t,Q_s,Q_h;float Q_a;double L,pr;float e[1500],f[1500],g[1500];void Cal(float Q,double Q_Q[3]){Q_max=15,Q_t=70,Q_s=10,Q_h=70;if(Q>=0&&Q<=Q_t/2){Q_Q[0]=K*(2*Q_max*Q*Q/(Q_t*Q_t));Q_Q[1]=4*Q_max*Q/(Q_t*Q_t);Q_Q[2]=4*Q_max/(Q_t*Q_t);}if(Q>Q_t/2&&Q<=Q_t){Q_Q[0]=K*(Q_max-2*Q_max*(Q-Q_t)*(Q-Q_t)/(Q_t*Q_t));Q_Q[1]=4*Q_max*(Q_t-Q)/(Q_t*Q_t);Q_Q[2]=-4*Q_max/(Q_t*Q_t);}if(Q>Q_t&&Q<=Q_t+Q_s){Q_Q[0]=K*Q_max;Q_Q[1]=0;Q_Q[2]=0;}if(Q>Q_t+Q_s&&Q<=Q_t+Q_s+Q_h/2){Q_Q[0]=K*(Q_max-2*Q_max*(Q-Q_t-Q_s)*(Q-Q_t-Q_s)/(Q_h*Q_h));Q_Q[1]=-4*Q_max*(Q-Q_t-Q_s)/(Q_h*Q_h);Q_Q[2]=-4*Q_max/(Q_h*Q_h);}if(Q>Q_t+Q_s+Q_h/2&&Q<=Q_t+Q_s+Q_h){Q_Q[0]=K*(2*Q_max*(Q_h-Q+Q_t+Q_s)*(Q_h-Q+Q_t+Q_s)/(Q_h*Q_h)); Q_Q[1]=-4*Q_max*(Q_h-Q+Q_t+Q_s)/(Q_h*Q_h);Q_Q[2]=4*Q_max/(Q_h*Q_h);}if(Q>Q_t+Q_s+Q_h&&Q<=360){Q_Q[0]=K*0;Q_Q[1]=0;Q_Q[2]=0;}}void Draw(float Q_m){float tt,x,y,x1,y1,x2,y2,x3,y3,x4,y4,dx,dy;double QQ[3];circle(240,240,3);circle(240+L*sin(50*K)+4*cos(240*K),240+L*cos(50*K)-4*sin(240*K),3); moveto(240,240);lineto(240+20*cos(240*K),240-20*sin(240*K));lineto(260+20*cos(240*K),240-20*sin(240*K));lineto(240,240);moveto(240+L*sin(50*K)+4*cos(240*K),240+L*cos(50*K)-4*sin(240*K)); lineto(240+L*sin(50*K)+20*cos(240*K),240+L*cos(50*K)-20*sin(240*K)); lineto(255+L*sin(50*K)+20*cos(240*K),240+L*cos(50*K)-20*sin(240*K)); lineto(240+L*sin(50*K)+4*cos(240*K),240+L*cos(50*K)-4*sin(240*K));for(tt=0;tt<=720;tt=tt+2){Cal(tt,QQ);x1=L*cos(tt*K)-l*cos(Q_a+QQ[0]-tt*K);y1=l*sin(Q_a+QQ[0]-tt*K)+L*sin(tt*K);x2=x1*cos(Q_m*K+40*K)+y1*sin(Q_m*K+40*K);y2=-x1*sin(Q_m*K+40*K)+y1*cos(Q_m*K+40*K);putpixel(x2+240,240-y2,2);dx=(QQ[1]-1)*l*sin(Q_a+QQ[0]-tt*K)-L*sin(tt*K);dy=(QQ[1]-1)*l*cos(Q_a+QQ[0]-tt*K)+L*cos(tt*K);x3=x1-rr*dy/sqrt(dx*dx+dy*dy);y3=y1+rr*dx/sqrt(dx*dx+dy*dy);x4=x3*cos(Q_m*K+40*K)+y3*sin(Q_m*K+40*K);y4=-x3*sin(Q_m*K+40*K)+y3*cos(Q_m*K+40*K); putpixel(x4+240,240-y4,YELLOW);}}void Curvel(){int t;float y1,y2,y3,a=0;for(t=0;t<=360/dt;t++){delay(300);a=t*dt;if((a>=0)&&(a<=Q_t/2)){y1=(2*Q_max*pow(a,2)/pow(Q_t,2))*10;y2=(4*Q_max*(dt*K)*a/pow(Q_t,2))*pow(10,4.8);y3=(4*Q_max*pow((dt*K),2)/pow(Q_t,2))*pow(10,8.5);putpixel(100+a,300-y1,1);putpixel(100+a,300-y2,2);putpixel(100+a,300-y3,4);line(100+Q_t/2,300-y3,100+Q_t/2,300);}if((a>Q_t/2)&&(a<=Q_t)){y1=(Q_max-2*Q_max*pow((Q_t-a),2)/pow(Q_t,2))*10;y2=(4*Q_max*(dt*K)*(Q_t-a)/pow(Q_t,2))*pow(10,4.8);y3=((-4)*Q_max*pow((dt*K),2)/pow(Q_t,2))*pow(10,8.5); putpixel(100+a,300-y1,1);putpixel(100+a,300-y2,2);putpixel(100+a,300-y3,4);line(100+Q_t,300-y3,100+Q_t,300);line(100+Q_t/2,300,100+Q_t/2,300-y3);}if((a>Q_t)&&(a<=Q_t+Q_s)){y1=Q_max*10;y2=0;y3=0;putpixel(100+a,300-y1,1);putpixel(100+a,300-y2,2);putpixel(100+a,300-y3,4);line((100+Q_t+Q_s),300,(100+Q_t+Q_s),300-y3);}if((a>Q_t+Q_s)&&(a<=Q_t+Q_s+Q_h/2)){y1=(Q_max-2*Q_max*pow((a-Q_t-Q_s),2)/pow(Q_h,2))*10;y2=((-4)*Q_max*(dt*K)*(a-Q_t-Q_s)/pow(Q_h,2))*pow(10,4.8);y3=((-4)*Q_max*pow((dt*K),2)/pow(Q_h,2))*pow(10,8.5);putpixel(100+a,300-y1,1);putpixel(100+a,300-y2,2);putpixel(100+a,300-y3,4);line((100+Q_t+Q_s+Q_h/2),300,(100+Q_t+Q_s+Q_h/2),300-y3);line((100+Q_t+Q_s),300,(100+Q_t+Q_s),300-y3);}if((a>Q_t+Q_s+Q_h/2)&&(a<=Q_t+Q_s+Q_h)){y1=(2*Q_max*pow((Q_h-a+Q_t+Q_s),2)/pow(Q_h,2))*10;y2=((-4)*Q_max*(dt*K)*(Q_h-a+Q_t+Q_s)/pow(Q_h,2))*pow(10,4.8); y3=(4*Q_max*pow((dt*K),2)/pow(Q_h,2))*pow(10,8.5);putpixel(100+a,300-y1,1);putpixel(100+a,300-y2,2);putpixel(100+a,300-y3,4);line((100+Q_t+Q_s+Q_h),300-y3,(100+Q_t+Q_s+Q_h),300);line((100+Q_t+Q_s+Q_h/2),300,(100+Q_t+Q_s+Q_h/2),300-y3);}if((a>Q_t+Q_s+Q_h)&&(a<=360)){y1=0;y2=0;y3=0;putpixel(100+a,300,1);putpixel(100+a,300,2);putpixel(100+a,300,4);}e[t]=y1;f[t]=y2;g[t]=y3;}}main(){int gd=DETECT,gm;int i,t,choice,x_1,y_1,flag=1;double QQ1[3],aa;FILE *f1;if((f1=fopen("liminghao.txt","w"))==NULL){printf("liminghao.txt cannot open!\n");exit(0);}initgraph(&gd,&gm," ");cleardevice();for(t=0;!kbhit();t++){for(;t>360;)t-=360;if(flag==1)for(L=l-r_b+70;L<l+r_b;L+=2){Q_a=acos((L*L+l*l-r_b*r_b)/(2.0*L*l));Cal(t,QQ1);aa=atan(l*(1-QQ1[1]-L*cos(Q_a-QQ1[0]))/(L*sin(Q_a+QQ1[0])));/*压力角*/pr=(pow((L*L+l*l*(1+QQ1[1])*(1+QQ1[1])-2.0*L*l*(1+QQ1[1]*cos(Q_a+QQ1[0])) ),3.0/2))/*曲率半径*//((1+QQ1[1])*(2+QQ1[1])*L*l*cos(Q_a+QQ1[0])+QQ1[2]*L*l*sin(Q_a+QQ1[0]) -L*L-l*l*pow((1+QQ1[1]),3));if(aa<=Aa&&pr>rr)flag=0;break;}if(flag==0)Cal(t,QQ1);Draw(t);cleardevice();x_1=240+L*sin(50*K)-l*cos(Q_a+QQ1[0]+40*K);y_1=240+L*cos(50*K)-l*sin(Q_a+QQ1[0]+40*K);circle(x_1,y_1,rr);line(240+L*sin(50*K),240+L*cos(50*K),x_1,y_1);moveto(240+L*sin(50*K),240+L*cos(50*K));lineto(240+L*sin(50*K)+l*cos(Q_a+QQ1[0]+40*K),480+2*L*cos(50*K)-y_1); lineto(140+L+l*cos(Q_a+QQ1[0])*2,480+2*L*cos(50*K)-y_1);delay(1);}getch();cleardevice();line(100,80,100,445);line(70,300,530,300);line(100,80,98,90);line(100,80,102,90);line(520,298,530,300);line(520,302,530,300);setcolor(2);outtextxy(300,150,"The analysis of the worm gear's movement"); printf("\n\n\n\n\n Q(w,a)");printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\t\t\t\t\t\t\t\tt");Curvel();getch();printf("\n\n\n\n\n\n\n\n\n\n");for(i=0;i<=1440;i=i+20){delay(1000);printf("%d %f %f %f\n",i/4,e[i],f[i],g[i]); fprintf(f1,"%d %f %f %f\n",i/4,e[i],f[i],g[i]); }getch();fclose(f1);closegraph();}角度10倍角位移104.8倍角速度108.5倍角加速度235-360 0.000000 0.000000 0.000000五总结机械原理课程设计是工科院校学生在大学期间利用已学过的知识和计算机工具第一次比较全面的,具有实际意义的课程设计,也是机械原理课程的一个重要的实践环节。