资源描述:
《斜齿轮变位系数分配-C程序.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、#include"stdio.h"#include"math.h"voidmain(){intz1,z2,Zh,A;floatM,a,Zh2,u;floatXn,x1;doublea1,a2;/*a1=端面啮合角(实数)a2=端面啮合角(角度)*/doublexishuhe(float,double);/*函数声明*/floatfenpei(floatu,floatx);/*函数声明*/printf("请输入两齿轮齿数:");scanf("%d%d",&z1,&z2);printf("请输入齿轮模数:");scanf("%f",&M);printf("请输入圆整后中心距:"
2、);scanf("%d",&A);Zh=z1+z2;Zh2=Zh/0.797;/*Zh=齿数和Zh2=当量齿数和*/u=z2/(z1+0.0);/*u=传动比(z1+0.0)是为了得到非整数的u*/a=M*Zh/1.8544;printf("z1=%dz2=%dZh=%dZh2=%fM=%.2fA=%da=%.4f",z1,z2,Zh,Zh2,M,A,a);a1=acos(a/A*0.9308);a2=a1/3.*180;printf("端面啮合角(角度)=%.3f",a2);Xn=xishuhe(Zh2,a2);printf("变位系数和=%.3f",Xn);x1=fen
3、pei(u,Xn);printf("齿轮1变位系数=%.3f",x1);}doublexishuhe(floatz,doublea)/*求变位系数和的函数*/{floatXn;if(a>=20.5&&a<21)Xn=(z/300-0.00163*z)/0.5*(a-20.5)+0.00163*z;if(a>=21&&a<21.5)Xn=(z/200-z/300)/0.5*(a-21)+z/300;if(a>=21.5&&a<22)Xn=(0.007*z-z/200)/0.5*(a-21.5)+z/200;if(a>=22&&a<22.5)Xn=(0.00898*z-0.007*z)
4、/0.5*(a-22)+0.007*z;if(a>=22.5&&a<23)Xn=(z/90-0.00898*z)/0.5*(a-22.5)+0.00898*z;if(a>=23&&a<23.5)Xn=(z/75-z/90)/0.5*(a-23)+z/90;if(a>=23.5&&a<24)Xn=(z/64-z/75)/0.5*(a-23.5)+z/75;if(a>=24&&a<24.5)Xn=(z/55-z/64)/0.5*(a-24)+z/64;if(a>=24.5&&a<25)Xn=(0.0207*z-z/55)/0.5*(a-24.5)+z/55;if(a>=25&&a<25.5
5、)Xn=(0.02325*z-0.0207*z)/0.5*(a-25)+0.0207*z;if(a>=25.5&&a<26)Xn=(0.02641*z-0.02325*z)/0.5*(a-25.5)+0.02325*z;returnXn;}floatfenpei(floati,floatx)/*变位系数分配函数*/{floatx1;if(i>=0.7&&i<1)x1=0.5251*x-0.0339;if(i>=1&&i<1.2)x1=0.4473*x+0.0581;if(i>=1.2&&i<1.6)x1=0.375*x+0.1375;if(i>=1.6&&i<2.2)x1=0.2759
6、*x+0.2552;if(i>=2.2&&i<3.0)x1=0.2105*x+0.3369;if(i>=3.0)x1=0.1361*x+0.4243;returnx1;}