资源描述
牛头刨床导杆机构运动分析一、 设计任务及要求:(1)已知:牛头刨床的导杆机构的曲柄每分钟转速n2,各构件尺寸及重心位置,且报头导路x-x位于导杆端点B所作圆弧的平分线上。数据如下表所示:设计内容导杆机构运动分析单位r/min mm符号N2lo2o4lo2Alo4BlBClo4s4数据7040095800要求:1、用c语言编写计算程序,对机构进行动态分析和动态显示。2、上机调试程序并打印结果。3、画出导杆4的角位移,角速度,角加速度的曲线。4、编写设计计算说明书。二、数学模型的建立 如图三个向量组成封闭图形,于是有按复数式可以写成a(cos+isin)-b(cos+isin)+d(cos3+isin3)=0 (1)由于3=90,上式可化简为a(cos+isin)-b(cos+isin)+id=0 (2)根据(2)式中实部、虚部分别相等得acos-bcos=0 (3)asin-bsin+d=0 (4)(3)(4)联立解得=arctan (5)b= (6)将(2)对时间求一阶导数得2=1cos(-) (7)c=b=-a1sin(-) (8)将(2)对时间求二阶导数得3=a1cos(-)- asin(-)-2c2 (9)ac=b”=-a1sin(-)-acos(-)+b (10)ac即滑块沿杆方向的加速度,通常曲柄可近似看作均角速转动,则1=0。三、程序框图输入a,d, 1,输入N作循环,For(i=0;iN;i+)依次计算,b, 2, c, 2, ac将计算的,b, 2, c, 2, ac结果分别存入数组或文件中按格式输出所有计算结果初始化图形系统绘制直角坐标系直角坐标系下分别绘出角位移、角速度、角加速度图象四、程序清单及运行结果:#include #include #include #include #define PI 3.1415926 #define M PI/180 #define C 2*PI*70/60 #define l1 95 #define l2 400 #define l4 800 #define l5 (0.32*l4) #define Ys6 22.88996918 #define l7 l4-Ys6 void dtmn(); void pist(float x0,float y0,float l,float h, float theta); void slide(float x0,float y0,float x1,float h); void pirot(float x0,float y0,float l); void sgd(); void cur();/*主函数*/ main() int Q2,i=0,j=0,Q_272; float Q4,Q41,Q411,w3,a3,Q5,Q51; float Q511,sA,sA1,sA11,Se,w4,Ve,Se1,a4,Se11; float S_e72,S_e172,S_e1172,Q_51172; FILE *fl; if(fl=fopen(mydata.txt,w)=NULL) printf(mydata.txt cannot open!n); exit(0); /*int gd=DETECT,gm; initgraph(&gd,&gm,c:turboc2); cleardevice();*/ clrscr(); printf( zhuanjiao weiyi sudu jiaojiasudu jiasudu n); for(Q2=0;Q2=0&Q2270&Q290&Q2=180&Q2=0&(l7-l4*sin(Q4*M)/l5)=-1&(l7-l4*sin(Q4*M)/l5)=0) Q5=180+asin(l7-l4*sin(Q4*M)/l5)/M; Se=l4*cos(Q4*M)+l5*cos(Q5*M); Q51=-w3*l4*cos(Q4*M)/(l5*cos(Q5*M); w4=Q51; Se1=-w3*l4*sin(Q4-Q5)*M)/cos(Q5*M); Q511=(Q41*Q41*l4*sin(Q4*M)+Q51*Q51*l5*sin(Q5*M)-Q411*l4*cos(Q4*M)/(l5*cos(Q5*M); Se11=-(a3*l4*sin(Q4-Q5)*M)+w3*w3*l4*cos(Q4-Q5)*M)-w4*w4*l5)/cos(Q5*M); S_ej=Se; S_e1j=Se1; Q_511j=Q511; S_e11j=Se11; Q_2j=Q2; printf(%7d %-7.3f %-7.3f %-7.3f %-7.3fn,Q_2j,S_ej, S_e1j,Q_511j,S_e11j); fprintf(fl,%7d %-7.3f %-7.3f %-7.3f %-7.3fn,Q_2j,S_ej, S_e1j,Q_511j,S_e11j); j+; fclose(fl); cur(); dtmn(); sgd(); /*sudu,jiasudu,weiyi,quxiantu hanshu*/ void cur() /*float w1=2*PI,L1=110,L4=135,L61=490,L3=540,L6=380; */ float Q4,Q2,sA,w3,sA1,sA11,Se,Se1,Se11,a3,a4,Q411,Q5,Q51,w4; int gd=DETECT, gmode,i; initgraph(&gd,&gmode,c:turboc2); clrscr(); for(Q2=0;Q2=0&Q2PI*1.5&Q2PI/2&Q2=0&(l7-l4*sin(Q4)/l5)=-1&(l7-l4*sin(Q4)/l5)0) Q5=PI+asin(l7-l4*sin(Q4)/l5); Se=l4*cos(Q4)+l5*cos(Q5); Q51=-w3*l4*cos(Q4)/(l5*cos(Q5); w4=Q51; Se1=-w3*l4*sin(Q4-Q5)/cos(Q5); /*Q511=(Q41*Q41*l4*sin(Q4)+Q51*Q51*l5*sin(Q5)-Q411*Q411*l4*cos(Q4)/(l5*cos(Q5);*/ Se11=-(a3*l4*sin(Q4-Q5)+w3*w3*l4*cos(Q4-Q5)-w4*w4*l5)/cos(Q5); line(100,200,500,200); setcolor(5); line(492,201,500,200); line(492,199,500,200); line(100,10,100,350); setcolor(5); line(99,18,100,10); line(101,18,100,10); putpixel(100+Q2*180/PI,200-Se/5,1); /*绘制位移曲线*/ putpixel(100+Q2*180/PI,200-Se1/100,2); /*绘制速度曲线*/ putpixel(100+Q2*180/PI,200-Se11/100,4); /*绘制加速度曲线*/ setcolor(10); settextjustify(CENTER_TEXT,0); outtextxy(300,300,RED_JIASUDU); outtextxy(300,330,GREEN_SUDU); outtextxy(300,360,BLUE_WEIYI); /* outtextxy(300,50,SUDU JIASUDU WEIYI GUAN XI QU XIAN TU);*/ outtextxy(300,50,SUDU JIASUDU WEIYI GUAN XI QU XIAN TU); getch(); closegraph();/*运动模拟图函数*/ void dtmn() int gd=DETECT,gmode,n; initgraph(&gd,&gmode,c:turboc2); cleardevice(); do setbkcolor(0); sgd(); while(!kbhit(); getch(); /*导轨函数 */ void slide(float x0,float y0,float x1,float h) float xr; int i,n; xr=x0+x1; line(x0,y0,xr,y0); n=x1/h; for(i=0;i=n;i+) moveto(x0+i*h,y0+h); lineto(x0+(i+1)*h,y0); /*摇块函数*/ void pist(float x0,float y0,float l,float h,float theta) float x,y; x=x0-cos(theta)*l/2+h/2*sin(theta); y=y0+l/2*sin(theta)+h/2*cos(theta); moveto(x,y); linerel(l*cos(theta),-l*sin(theta); /*绘制轮廓线*/ linerel(-h*sin(theta),-h*cos(theta); linerel(-l*cos(theta),l*sin(theta); lineto(x,y); /*支点函数*/ void pirot(float x0,float y0,float l) /*float PI=3.1415926;*/ float x,y; int i,n; int h=4; setcolor(4); circle(x0,y0,3); setcolor(9); x=x0-l/2; y=y0+sin(PI/3)*l; moveto(x0,y0); lineto(x,y); linerel(18,0); lineto(x0,y0); n=l/4; for(i=0;i=n;i+) moveto(x+i*h,y+h); lineto(x+(i+1)*h,y); /*连杆,摇块,导轨函数 */ void sgd()int i; int x04,y04,x02,y02; int l02a=l1/2;int l04b=l4/2;float xa,ya,xb,yb,xc,yc,l; float lbc=l5/2; float ss,theta; for(i=0;i64;i+) /*动态模拟*/ ss=i*0.1; /*坐标计算*/ x04=400; x02=400; y04=400; y02=225; xa=x02+l02a*cos(ss); ya=y02+l02a*sin(ss); l=sqrt(xa-x04)*(xa-x04)+(ya-y04)*(ya-y04); xb=x04+(xa-x04)*l04b/l; yb=y04+(ya-y04)*l04b/l; yc=135; xc=xb-sqrt(lbc*lbc-(yb-yc)*(yb-yc); theta=-atan(ya-y04)/(xa-x04); setcolor(4); cleardevice(); circle(xb,yb,3); circle(xa,ya,3); circle(xc,yc,3); setcolor(8); line(50,135,500,135); rectangle(xc+7,yc+6,xc-7,yc-6); /*绘制滑块C*/ line(x02,y02,xa,ya); line(xc,yc,xb,yb); line(xb,yb,x04,y04); setcolor(7); pirot(x02,y02,16); /*绘制支点X04,X02*/ pirot(x04,y04,16); pist(xa,ya,20,10,theta); /*绘制滑块A*/ slide(60,135,100,10); slide(500,135,570,10); setcolor(8); settextstyle(3,0,2); outtextxy(200,30,DAOGAN YUNDONG MONI); outtextxy(200,440,PRESS ANY KEY TO RETURN); outtextxy(200,420,PRESS BREAK TO STOP); delay(2000);运行结果:zhuanjiao weiyi sudu jiaojiasudu jiasudu 0 -71.142 304.647 8.723 -9953.699 5 -75.351 401.248 7.939 -9740.870 10 -80.667 490.578 7.002 -9468.886 15 -87.004 572.911 5.950 -9140.816 20 -94.281 648.534 4.820 -8759.899 25 -102.420 717.730 3.645 -8329.566 30 -111.345 780.766 2.453 -7853.440 35 -120.986 837.896 1.272 -7335.324 40 -131.273 889.345 0.125 -6779.141 45 -142.139 935.321 -0.968 -6188.921 50 -153.521 976.003 -1.990 -5568.732 55 -165.357 1011.550 -2.924 -4922.648 60 -177.586 1042.098 -3.759 -4254.695 65 -190.149 1067.764 -4.482 -3568.840 70 -202.990 1088.634 -5.086 -2868.893 75 -216.050 1104.795 -5.563 -2158.586 80 -229.276 1116.298 -5.907 -1441.448 85 -242.611 1123.185 -6.115 -720.852 90 -256.000 1125.473 -6.185 0.004 95 -269.389 1123.182 -6.115 718.097 100 -282.724 1116.297 -5.907 1430.578 105 -295.950 1104.794 -5.563 2134.752 110 -309.010 1088.633 -5.086 2828.065 115 -321.851 1067.761 -4.482 3508.075 120 -334.414 1042.097 -3.759 4172.396 125 -346.643 1011.550 -2.924 4818.689 130 -358.479 976.002 -1.990 5444.576 135 -369.861 935.319 -0.968 6047.605 140 -380.727 889.344 0.125 6625.189 145 -391.014 837.894 1.272 7174.511 150 -400.655 780.766 2.453 7692.463 155 -409.580 717.729 3.645 8175.566 160 -417.719 648.534 4.820 8619.898 165 -424.996 572.911 5.950 9021.038 170 -431.333 490.578 7.002 9374.011 175 -436.649 401.248 7.939 9673.283 180 -440.858 304.647 8.723 9912.797 185 -443.872 200.530 9.313 10086.062 190 -445.602 88.711 9.667 10186.335 195 -445.954 -30.899 9.741 10206.849 200 -444.835 -158.241 9.495 10141.209 205 -442.156 -293.048 8.893 9983.816 210 -437.831 -434.768 7.909 9730.355 215 -431.781 -582.479 6.526 9378.272 220 -423.944 -734.799 4.748 8927.134 225 -414.275 -889.798 2.601 8378.840 230 -402.757 -1044.928 0.136 7737.403 235 -389.408 -1196.994 -2.562 7008.511 240 -374.285 -1342.188 -5.381 6198.696 245 -357.495 -1476.201 -8.178 5314.545 250 -339.200 -1594.439 -10.791 4362.119 255 -319.613 -1692.325 -13.053 3347.051 260 -299.004 -1765.690 -14.803 2275.500 265 -277.684 -1811.176 -15.912 1155.762 270 -256.000 -1125.473 -6.185 0.005 275 -234.316 -1811.174 -15.912 -1174.578 280 -212.996 -1765.694 -14.803 -2346.066 285 -192.387 -1692.326 -13.053 -3489.404 290 -172.800 -1594.441 -10.791 -4579.275 295 -154.505 -1476.203 -8.178 -5593.049 300 -137.715 -1342.190 -5.381 -6513.247 305 -122.592 -1196.996 -2.562 -7328.699 310 -109.243 -1044.929 0.136 -8034.470 315 -97.725 -889.799 2.601 -8630.820 320 -88.056 -734.800 4.748 -9121.607 325 -80.219 -582.480 6.526 -9512.740 330 -74.169 -434.768 7.909 -9810.804 335 -69.844 -293.048 8.893 -10022.228 340 -67.165 -158.241 9.495 -10152.754 345 -66.046 -30.899 9.741 -10207.297 350 -66.398 88.710 9.667 -10189.990 355 -68.127 200.530 9.313 -10104.407 360 -71.142 304.647 8.723 -9953.700曲线图象及导杆图形五、课程设计总结:通过一周的课程设计,我更加了解了机械原理课程设计的各方面内容;进一步掌握了机构分析的基本知识,熟悉了机械设计的一般方法。通过对解析法的练习,培养了一定的数学建模能力,以及利用计算机C语言程序解决实际问题的能力。就我个人而言,通过这次课程设计对我所学知识进行了检验,同时为将来工作进行一次适应性训练,从中锻炼自己分析问题以及解决问题的能力,由于自身专业知识的缺乏,造成在课程设计过程中遇到不少的困难,还好通过老师的精心指导,以及与同学间的细心交流后,最后还是顺利完成了.这次课程设计使我对导杆机构的设计、制造和加工有了一个初步的了解。在老师的细心辅导和同学的热心帮助下,我的第一次课程设计完成了。在这次设计中,我学到了很多东西,了解了C语言的运用,知道了机械设计制造专业的的任务,以及将来的发展方向。在设计过程中也发现了自己的许多不足之处,在今后我一定会努力学习各方面的知识,认真对待生产实践机械工程问题,为能更好的解决机械设计问题而不断奋斗!六、参考文献1、机械原理孙桓、陈作模,高等教育出版社,1995.82、机械原理课程设计指导书 徐萃萍 冷兴聚3、机械原理电算课程设计指导书 冷兴聚4、C语言设计 谭浩强 清华大学出版社 1995.3 5、C语言典型零件CAD 王占勇 东北大学出版社 2000.96、计算机图形学 罗笑南 王若梅 中山大学出版社 1996.10- 15 -
展开阅读全文