单水源管网平差c程序

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#includemath.h#includestdio.h#defineA100main(){intB[A],E[A],IO[A],JO[A],ok=0,i,k,p,LOOP;floatL[A],D[A],q[A],h[A],s1[A],s[A],w[A],v[A];floatxs,c,Dq[A]={0},sq[A],Dh[A];FILE*fp;charF[10];printf(pleaseinputdatafilename......);scanf(%s,F);fp=fopen(F,r);fscanf(fp,%d%d%f,&p,&LOOP,&xs);for(k=1;k=p;k++)fscanf(fp,%d%d%f%f%f%d%d,&B[k],&E[k],&L[k],&D[k],&q[k],&IO[k],&JO[k]);fclose(fp);for(k=1;k=p;k++){q[k]*=(IO[k]0)?-1:1;q[k]*=xs;if(D[k]=290)D[k]-=1;D[k]/=1000;w[k]=3.14/4*D[k]*D[k];s1[k]=1.736e-9/pow(D[k],5.33)*L[k];}a1:ok++;printf(ok=%d\n,ok);if(ok5000)gotoa2;for(k=1;k=p;k++){q[k]=q[k]+Dq[int(fabs(IO[k]))]-Dq[JO[k]];v[k]=fabs(q[k]/1000/w[k]);c=(v[k]=1.2)?1:0.852*pow(1+.867/v[k],.3);s[k]=s1[k]*c;h[k]=s[k]*q[k]*fabs(q[k]);}for(i=1;i=LOOP;i++){Dh[i]=0;sq[i]=0;for(k=1;k=p;k++)if(fabs(IO[k])==i||JO[k]==i){Dh[i]+=fabs(IO[k])==i?h[k]:-h[k];sq[i]+=s[k]*fabs(q[k]);}Dq[i]=-Dh[i]/2/sq[i];}for(i=1;i=LOOP;i++)if(fabs(Dh[i]).001)gotoa1;a2:printf(pleaseinputresultdataname......);scanf(%s,F);fp=fopen(F,w);fprintf(fp,pipe=%dLoop=%dok=%dxs=%3.1f\n,p,LOOP,ok,xs);fprintf(fp,--------------------------------------------------------------------------\n);fprintf(fp,No_fromtoL(m)\tD(mm)q(L/s)\th(m)v(m/s)IOJO\n);fprintf(fp,--------------------------------------------------------------------------\n);for(k=1;k=p;k++){if(q[k]*IO[k]0)fprintf(fp,\n%2d%4d--%2d,k,B[k],E[k]);elsefprintf(fp,\n%2d%4d--%2d,k,E[k],B[k]);fprintf(fp,%6.0f\t%d\t%7.2f\t%5.2f\t%1.2f\t%2d\t%1d\t,L[k],10*(int)(D[k]*100+0.5),q[k],h[k],v[k],IO[k],JO[k]);}fprintf(fp,\n);fprintf(fp,--------------------------------------------------------------------------\n);for(i=1;i=LOOP;i++){fprintf(fp,Dh[%d]=%5.4fm,i,Dh[i]);if(fmod(i,2)==0)fprintf(fp,\n);}fprintf(fp,--------------------------------------------------------------------------\n);fclose(fp);}

1 / 2
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功