机械程序设计 c++.docx

上传人:b****8 文档编号:23542992 上传时间:2023-05-18 格式:DOCX 页数:18 大小:288.74KB
下载 相关 举报
机械程序设计 c++.docx_第1页
第1页 / 共18页
机械程序设计 c++.docx_第2页
第2页 / 共18页
机械程序设计 c++.docx_第3页
第3页 / 共18页
机械程序设计 c++.docx_第4页
第4页 / 共18页
机械程序设计 c++.docx_第5页
第5页 / 共18页
点击查看更多>>
下载资源
资源描述

机械程序设计 c++.docx

《机械程序设计 c++.docx》由会员分享,可在线阅读,更多相关《机械程序设计 c++.docx(18页珍藏版)》请在冰豆网上搜索。

机械程序设计 c++.docx

机械程序设计c++

 

机械设计

姓名:

班级:

学号:

V带设计

功率:

5KW小轮转速:

1460r/min传动比:

3.4中心距系数:

0.8载荷性质:

变动小材料:

帘布每天工作时间:

16小时

程序:

/*V带传动设计程序*/

#include"stdio.h"

#include"math.h"

#definePI3.1415926

main()

{

inti,j,m,x,y,g,e,lh;

floatp,n1,n2,u,a,a0,b,af,a1,amin,amax;

floatki,kl,kaf,kq,p0,p1,z,f0,q,ka,pc,v,d2,c1,c2,lc,lj,l;

floatnn[5];

staticintll[35]={0,400,450,500,560,630,710,800,900,1000,1120,1250,1400,1600,

1800,2000,2240,2500,2800,3150,3550,4000,4500,5000,5600,

6300,7100,8000,9000,10000,11200,12500,14000,16000};

floataa[6][15]={{0,3.9E-4,.06,.246,7.44,4.41E-5,.72,4.3E-4,9.8E-8,435,50,63,71,80,90},

{0,1.03E-3,.1,.449,19.62,7.65E-5,.68,2.25E-4,2.25E-8,100,75,90,100,112,125},

{0,2.65E-3,.17,.794,50.6,1.31E-4,.68,1.74E-4,1.94E-8,27,125,140,150,170,180},

{0,7.5E-3,.3,1.48,143.2,2.43E-4,.70,9.64E-3,4.48E-7,7.2,200,224,236,265,280},

{0,2.66E-2,.62,3.15,507.3,4.77E-4,.78,3.38E-5,0,.92,355,400,425,475,500},

{0,4.98E-2,.9,4.57,951.5,7.06E-4,.706,4.95E-5,1.254E-9,0,500,560,630,800,900}};

staticcharbb[6]={'Z','A','B','C','D','E'};

printf("按顺序输入已知数据:

功率P(kw),小轮转速n1(r/min),传动比i(若已知n2,\n");

printf("则i=0),大轮转速n2(r/min)(若已知i,则n2=0),给定中心距a(mm)(若未给,\n");

printf("则a=0),中心距系数a0(0.7~2,若已知a,则a0=0),载荷性质G(平稳1,\n");

printf("变动小2,变动较大3,变动很大4),材质E(帘布0,化纤1),每天工作小时数LH\n");

printf("P,n1,i,n2,a,a0,G,E,LH=\n");

scanf("%f,%f,%f,%f,%f,%f,%d,%d,%d",&p,&n1,&u,&n2,&a,&a0,&g,&e,&lh);

if(n2!

=0)u=floor(n1/n2*1000+.5)/1000;

printf("已知数据:

\n");

printf("P=%.1f,n1=%.0f,i=%.3f,a=%.0f,a0=%.1f,G=%d,E=%d",p,n1,u,a,a0,g,e);

printf("\n");

printf("输出结果:

\n");

if(lh>16)ka=1.2;

elseif(lh<=16&&lh>=10)ka=1.1;

elseka=1;

if(g==2)ka=ka+0.1;

elseif(g==3)ka=ka+0.2;

elseif(g==4)ka=ka+0.3;

pc=ka*p;

for(i=0;i<=4;i++)

{nn[i]=aa[i][9]*pow(pc,1.2);

if(n1>=nn[i])break;};

if(i==0)

{x=0;y=1;}

elseif(n1<=nn[4])

{x=4;y=5;}

else

{x=i-1;y=i+1;}

for(i=x;i<=y;i++)

for(j=10;j<=14;j++)

{

v=floor(PI*aa[i][j]*n1/600+.5)/100;

if(v>=5&&v<=20)

{

d2=floor(u*aa[i][j]*0.98/5+.5)*5;

u=floor(d2/aa[i][j]*0.98*100+.5)/100;

c1=d2+aa[i][j];

c2=d2-aa[i][j];

if(a==0)a1=a0*c1;

elsea1=a;

lc=2*a1+PI*c1/2+c2*c2/4/a1;

for(m=1;m<=33;m++)

{if(lc<=ll[m])break;}

lj=(ll[m]+ll[m-1])/2;

if(lc

elsel=ll[m];

b=2*l-PI*c1;

a1=floor((b+sqrt(b*b-8*c2*c2))/8*10+.5)/10;

amin=floor(a1-0.015*l+0.5);

amax=floor(a1+0.03*l+0.5);

af=180-c2/a1*57.3;

if(af>=120)

{

kl=aa[i][6]+aa[i][7]*l-aa[i][8]*l*l;

kaf=1.25*(1-1/exp(0.51*af*PI/180));

if(u<=1.04)ki=0;

elseif(u<=1.09)ki=0.03;

elseif(u<=1.19)ki=0.052;

elseif(u<=1.49)ki=0.083;

elseif(u<=2.5)ki=0.113;

elseki=0.122;

if(e==0)kq=.75;

elsekq=1;

p0=(aa[i][3]*pow(v,-0.09)-aa[i][4]/aa[i][j]-aa[i][5]*v*v)*v;

p1=aa[i][1]*n1*ki;

z=floor(pc/((p0+p1)*kl*kaf*kq)+0.95);

if(z<=9)

{

f0=floor((500*pc*(2.5/kaf-1))/v/z+aa[i][2]*v*v+0.5);

q=floor(2*z*f0*sin(af*PI/180/2)+0.5);

printf("型号%c,Ld=%.0f,z=%.0f,d1=%.0f,",bb[i],l,z,aa[i][j]);

printf("d2=%.0f,v=%.2f,i=%.2f\n",d2,v,u);

printf("a=%.2f,amin=%.2f,amax=%.2f,",a1,amin,amax);

printf("F0=%.2f,Q=%.2f\n",f0,q);

printf("\n");

}

}

}

elseif(v>20)break;

}

}

运算结果:

齿轮设计

功率:

9.1kw小齿轮转速:

523r/min传动比:

i=4;螺旋角:

12

程序:

/*齿轮传动设计程序*/

#include"stdio.h"

#include"math.h"

#definePI3.1415926

main()

{

inti,j,ii,s,m,r,w,jd,jdd,bz,gk,gkk,yd,lh;

doublep1,n1,u,pd,bt,ze,ka,t1,uu,v,mn,bmn,aa,bb,btt,c1,c2,d1,d11,d22,gb,kbt,at;

doubleeaf,ebt,er,zep,kv,kv1,kv2,zbt,zz,kaf,kk,x,x1,x2,zh,yx,ybt,yep,ch,xych,yy;

doubleb[3],d[3],da[3],df[3],zn[3],n[3],z[3],zv[3],yf[3],ys[3],yn[3];

doublecf[3],chl[3],cfl[3],xch[3],xcf[3],xycf[3];

doublea[9][8]={{0,0,0,0,0,0,0,0},

{0,354,333,294,253,.998,-0.015,.061},

{0,.93,1.44,.93,1.44,.983,.084,.025},

{0,152,165,133,149,1.014,.070,.060},

{0,.28,.38,.22,.30,1.047,.111,.139},

{0,6E-4,3E-4,-0.140,.6,1.1,8E-4,1.0},

{0,9E-4,5E-4,.037,.567,1.18,2E-2,1.25},

{0,1.3E-3,7E-4,-2E-2,.680,1.36,3E-2,1.75},

{0,1.8E-3,1E-3,.071,.714,1.46,7E-2,0}};

doublemm[21]={0,2,2.25,2.5,2.75,3,3.5,4,4.5,5,5.5,6,7,8,9,10,12,14,16,18,20};

intc[3]={0,2,1};

doublehb[3]={0,260,210};

p1=9.08;n1=523;u=4;pd=1;jd=8;bz=2;gk=1;yd=2;lh=24000;bt=12;//hhhjhjhhh

printf("p1=%.1f,n1=%.0f,u=%.3f,pd=%.2f,jd=%d\n",p1,n1,u,pd,jd);

printf("bz=%d,gk=%d,yd=%d,cl1=%d,cl2=%d,\n",bz,gk,yd,c[1],c[2]);

printf("hb1=%.0f,hb2=%.0f,lh=%d,b0=%.2f\n",hb[1],hb[2],lh,bt);

printf("\n");

if(c[1]<=2&&c[2]<=2)ze=189.8;

elseif(c[1]<=2&&c[2]>2)ze=188.9;

elseze=188;

gkk=gk+4;

ka=a[gkk][7];

t1=9.55E6*p1/n1;

n[1]=60*n1*lh;

n[2]=n[1]/u;

for(i=1;i<=2;i++)

{intlwg=c[i];

chl[i]=a[1][c[i]]+a[2][lwg]*hb[i];

cfl[i]=a[3][c[i]]+a[4][lwg]*hb[i];

if(yd==2)cfl[i]=cfl[i]*0.7;

if(n[i]>5E7)zn[i]=1;

elseif(n[i]<1E5)zn[i]=1.6;

elsezn[i]=pow(5E7/n[i],.0756);

xch[i]=chl[i]*zn[i]/1.2;

if(n[i]>3E6)yn[i]=1;

elseif(n[i]<1E4)yn[i]=2.5;

elseyn[i]=pow(3E6/n[i],0.16);

xcf[i]=cfl[i]*yn[i]*2/1.4;

}

if(xch[1]>xch[2])xych=xch[2];

elsexych=xch[1];

d1=65*pow(t1*(u+1)/xych*xych/pd/u,1/3);

for(s=25;s<=30;s++)

{z[1]=s;

z[2]=floor(z[1]*u+0.5);

uu=z[2]/z[1];

mn=d1*cos(bt*PI/180)/z[1];

if(mn>20)printf("m>20\n");

{for(i=1;i<=20;i++)

{if(mn<=mm[i])

{ii=i;break;}

}

for(w=ii;w<=20;w++)

{bmn=mm[w];

if(bt==0)

{aa=bmn*(z[1]+z[2])*0.5;

zbt=1;}

else

{aa=floor(bmn*(z[1]+z[2])/2/cos(bt*PI/180)+0.5);

x=bmn*(z[1]+z[2])/2/aa;

btt=atan(sqrt(1-x*x)/x);

zbt=sqrt(cos(btt));

}

d11=floor(bmn*z[1]/cos(btt)*100+0.5)/100;

d22=floor(bmn*z[2]/cos(btt)*100+0.5)/100;

gb=floor(pd*d11+0.5);

kbt=a[bz][5]+a[bz][6]*(gb/d11)+a[bz][7]*pow(gb/d11,2);

at=atan(tan(20*PI/180)/cos(btt));

bb=atan(tan(btt)*cos(at));

zh=sqrt(2*cos(bb)/cos(at)/sin(at));

x1=cos(at)/(1+2*cos(btt)/z[1]);

x2=cos(at)/(1+2*cos(btt)/z[2]);

c1=z[1]*(sqrt(1-x1*x1)/x1-tan(at));

c2=z[2]*(sqrt(1-x2*x2)/x2-tan(at));

eaf=(c1+c2)/2/PI;

ebt=gb*sin(btt)/PI/bmn;

er=eaf+ebt;

v=floor(PI*d11*n1/600+0.5)/100;

jdd=jd-1;

if(bt==0)

{zep=sqrt((4-eaf)/3);

kv=1+a[jdd][1]*v*z[1];

}

elseif(ebt>=1)

{zep=sqrt(1/eaf);

kv=1+a[jdd][2]*v*z[1];

}

else{zep=sqrt(((4-eaf)/3)*(1-ebt)+ebt/eaf);

kv1=1+a[jdd][1]*v*z[1];

kv2=1+a[jdd][2]*v*z[1];

kv=kv1-ebt*(kv1-kv2);

}

zz=ze*zh*zep*zbt;

if(er<=2)kaf=a[jdd][3]+a[jdd][4]*er;

elsekaf=a[jdd][5]+a[jdd][6]*er;

if(kaf>er/eaf/zep/zep)kaf=er/eaf/zep/zep;

kk=ka*kv*kbt*kaf;

ch=zz*sqrt(2*kk*t1*(uu+1)/gb/d11/d11/uu);

zv[1]=z[1]/pow(cos(btt),3);

zv[2]=zv[1]*uu;

b[2]=gb;b[1]=gb+5;

if(bmn<=5)yx=1;

elseyx=1.03-6E-3*bmn;

for(i=1;i<=2;i++)

xycf[i]=xcf[i]*yx;

btt=btt*180/PI;

if(btt<30&&ebt<1)ybt=1-ebt*btt/120;

elseif(btt<30&&ebt>=1)ybt=1-btt/120;

elseif(btt>=30&&ebt<1)ybt=1-ebt/4;

elseybt=0.75;

for(r=1;r<=2;r++)

{if(zv[r]>400)

{yf[r]=2.06;ys[r]=1.97;}

elseif(zv[r]<100)

{yf[r]=-0.075*sqrt(zv[r]-20)+2.8;

ys[r]=1.25*pow(zv[r],0.08);

}

else{yf[r]=2.26-5E-4*zv[r];

ys[r]=1.77+5E-4*zv[r];

}

yep=0.25+0.75/eaf;

yy=yf[r]*ys[r]*yep*ybt;

cf[r]=2*kk*t1*yy/d11/b[r]/bmn;

}

d[1]=d11;

d[2]=d22;

for(i=1;i<=2;i++)

{da[i]=floor((d[i]+2*bmn)*100+0.5)/100;

df[i]=floor((d[i]-2.5*bmn)*100+0.5)/100;

}

printf("mn=%.2f,z1=%.0f,z2=%.0f,u=%.3f\n",bmn,z[1],z[2],uu);

printf("bt=%.5f,a=%.3f,d1=%.3f,d2=%.3f\n",btt,aa,d[1],d[2]);

printf("da1=%.3f,da2=%.3f,df1=%.3f\n",da[1],da[2],df[1]);

printf("df2=%.3f,b1=%.2f,b2=%.2f\n",df[2],b[1],b[2]);

printf("ch=%.2f,xych=%.2f,cf1=%.2f,cf2=%.2f\n",ch,xych,cf[1],cf[2]);

printf("xycf1=%.2f,xycf2=%.2f\n",xycf[1],xycf[2]);

if(ch<=xych&&cf[1]<=xycf[1]&&cf[2]<=xycf[2])

{printf("pass!

\n");

break;}

elseprintf("NOpass?

\n");

}

}

}

}

运行结果:

轴承的设计

#include"stdio.h"

#include"math.h"

main()

{

inti,xh,d,dd,b,jd,di;

floatfa[2],fr[2],rf[2],xf[2],be[2],bt[2],y[2],e[2],p[2];

floatpp,lhp,n,lh,ff,c,c0;

FILE*fp;

if((fp=fopen("bearb.txt","r"))==NULL)

{printf("cannotopenfile\n");

exit

(1);}

ff=1.2,n=487;lh=9600;rf[1]=1922;rf[2]=2345;xf[1]=0;xf[2]=1320;

printf("请选择计算方法dj:

\n");

printf("1.校核计算2.选择计算\n");

scanf("%d",&jd);

if(jd==1)

{printf("请输入轴承内径di:

\n");

scanf("%d",&di);}

while(!

feof(fp))

{fscanf(fp,"%d%d%d%d%f%f",&xh,&d,&dd,&b,&c,&c0);

if(jd==1&&di!

=d)continue;

for(i=1;i<=2;i++)

{fa[i]=xf[i];fr[i]=rf[i];be[i]=fa[i]/c0;bt[i]=fa[i]/fr[i];

if(be[i]<=0.028)

{e[i]=0.19+15/7*(be[i]-0.014);y[i]=2.3-155/7*(be[i]-0.014);}

elseif(be[i]<=0.056)

{e[i]=0.22+10/7*(be[i]-0.028);y[i]=1.99-10*(be[i]-0.028);}

elseif(be[i]<=0.084)

{e[i]=0.26+5/7*(be[i]-0.056);y[i]=1.71-40/7*(be[i]-0.056);}

elseif(be[i]<=0.11)

{e[i]=0.28+10/13*(be[i]-0.084);y[i]=1.55-50/13*(be[i]-0.084);}

elseif(be[i]<=0.17)

{e[i]=0.30+2/3*(be[i]-0.11);y[i]=1.45-7/3*(be[i]-0.11);}

elseif(be[i]<=0.28)

{e[i]=0.34+4/11*(be[i]-0.17);y[i]=1.31-16/11*(be[i]-0.17);}

elseif(be[i]<=0.42)

{e[i]=0.38+2/7*(be[i]-0.28);y[i]=1.15-11/14*(be[i]-0.28);}

else{e[i]=0.42+1/7*(be[i]-0.42);y[i]=1.04-2/7*(be[i]-0.42);}

if(bt[i]>e[i])p[i]=ff*(0.56*fr[i]+y[i]*fa[i]);

elsep[i]=ff*fr[i];

}

if(p[1]>p[2])pp=p[1];

elsepp=p[2];

lhp=16667*pow(c/pp,3)/n;

if(jd==1||lhp>=lh)

{printf("计算结果:

\n");

printf("轴承型号:

%d\n",xh);

printf("内径d=%d,外径D=%d,宽度B=%d,\n",d,dd,b);

printf("实际使用寿命:

%8.2f\n",lhp);

fclose(fp);

break;}

}

}

 

运行结果:

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

当前位置:首页 > 外语学习 > 其它语言学习

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

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