资源描述:
《给水排水管道工程.doc》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、给水排水管道工程课程设计指导书环境科学与工程学院第一部分城市给水管网水力计算程序及例题1程序框图NoYeso开始输入原始数据计算管段摩阻计算各环水头损失闭合差及校正流量计算管段流量闭合差#include#includeintsgn(doublex);main(){FILE*fp;intk,i,ko,q,p,flag=0;doubleh[M];doubl
2、el[]={750,885,715,850,610,610,610,610,610,750,885,715,850,800,680,680,680,680,290,885,715,850};doubleD[]={0.45,0.45,0.3,0.25,0.5,0.25,0.25,0.25,0.4,0.7,0.6,0.45,0.2,0.5,0.25,0.25,0.15,0.2,0.45,0.45,0.45,0.35};doubleQ[]={………};intio[]={………};intjo[]={………};doublef[N+1]
3、,r[N+1],dq[N+1];for(k=0;k<=M-1;k++){Q[k]=Q[k]*0.001;}for(k=0;k<=M-1;k++){Q[k]=Q[k]*sgn(io[k]);}ko=0;loop:for(k=0;k<=M-1;k++){h[k]=10.67*pow(fabs(Q[k]),1.852)*l[k];h[k]=h[k]/(pow(100,1.852)*pow(D[k],4.87))*sgn(Q[k]);}for(i=1;i<=N;i++){f[i]=0;r[i]=0;dq[i]=0;for(k=0;k
4、<=M-1;k++){if(abs(io[k])!=i)gotomap;f[i]=f[i]+h[k];r[i]=r[i]+(h[k]/Q[k]);map:if(abs(jo[k])!=i)continue;f[i]=f[i]+h[k]*sgn(jo[k]);r[i]=r[i]+(h[k]/Q[k]);}dq[i]=-(f[i]/(r[i]*2));}for(i=1;i<=N;i++){if(fabs(f[i])>0.01)break;}if(i==N+1)flag=1;if(flag==1)gotolike;for(k=0;
5、k<=M-1;k++){p=abs(io[k]);q=abs(jo[k]);Q[k]=Q[k]+dq[p]+(dq[q]*sgn(jo[k]));}ko=ko+1;if(flag==0)gotoloop;like:printf("");for(i=1;i<=N;i++){printf("%f,%f",f[i],dq[i]);}printf("ep=%f",0.01);printf("n=%d,m=%d,ko=%d",N,M,ko);for(k=0;k6、intf("k=%d,l=%f,h=%f,",k+1,l[k],h[k]/(io[k]/fabs(io[k])));printf("Q=%f,",Q[k]*1000/(io[k]/fabs(io[k])));printf("v=%f",4*Q[k]/(io[k]/fabs(io[k]))/(3.1416*pow(D[k],2)));}fp=fopen("119.txt","a");if(fp==NULL){printf("erro");exit(0);}else{fprintf(fp,"");for(i=1;
7、i<=N;i++){fprintf(fp,"%f,%f",f[i],dq[i]);}fprintf(fp,"ep=%f",0.01);fprintf(fp,"n=%d,m=%d,ko=%d",N,M,ko);for(k=0;k8、rintf(fp,"v=%f",4*Q[k]/(io[k]/fabs(io[k]))/(3.1416*pow(D[k],2)));}}fprintf(fp,"h=");for(k=0;k