油氣儲(chǔ)運(yùn)網(wǎng)
標(biāo)題: 油庫設(shè)計(jì)熱力計(jì)算完整程序 [打印本頁]
作者: yifang 時(shí)間: 2012-9-12 19:13
標(biāo)題: 油庫設(shè)計(jì)熱力計(jì)算完整程序
油庫設(shè)計(jì)熱力計(jì)算完整程序
#define Tqi 13.3
#define Ttu 3.4
#define D 23.76
#define H 12.53
#define PI 3.14159
#define P 800
#define fn 6
#define v 4.5
#define i 0.1
#define N 5
#define Tys 55.0
#define Tyz 70.0
#define Kding 0.35
#define Kdi 0.12
#define Fding 460.1
#define Fbi 935.3
#define Fdi 433
#define nd_80 35
#define md_20 897
#define u 0.0581
#include <stdio.h>
#include <math.h>
float R0(float MPa)
{ if(MPa>0.5)
return (0.00086);
else if(MPa<0.2)
return (0.0026);
else return (0.0017);
}
double Insert(double x1,double x2,double y1,double y2,double x)
{
return (y1+(y2-y1)/(x2-x1)*(x-x1));
}
float Md(float t)
{ return (md_20-(1.825-0.001315*md_20)*(t-20));
}
float Br(float t)
{ int j;
float t1,t2,C1,C2;
float C[12]={1.696,1.729,1.758,1.792,1.825,1.859,
1.888,1.921,1.955,1.985,2.018,2.047};
for(j=0;j<=11;j++)
{ if(j*10.0<=t&&(j+1)*10.0>=t)
{ t1=j*10.0; t2=(j+1)*10.0;
C1=C[j]; C2=C[j+1];
break;
}
}
return (Insert(t1,t2,C1,C2,t));
}
float Pz(float md)
{ int k;
float B[30]={1.151,1.130,1.108,0.997,0.974,0.953,
0.931,0.910,0.888,0.866,0.845,0.824,
0.803,0.782,0.760,0.739,0.718,0.696,
0.674,0.653,0.632,0.612,0.592,0.572,
0.553,0.534,0.516,0.497,0.479,0.462};
float md1,md2,B1,B2;
for(k=0;k<=29;k++)
{ if(md>=k/100.0+0.73&&md<=(k+1)/100.0+0.73)
{ md1=k/100.0+0.73; md2=(k+1)/100.0+0.73;
B1=B[k]; B2=B[k+1];
break;
}
}
return (Insert(md1,md2,B1,B2,md));
}
float Fr( float Gr, float Pr, float A, float d)
{ float e,n,a2,Td;
if(Gr*Pr>2.0e7)
{e=0.135; n=1.0/3;}
else if(Gr*Pr>=500&&Gr*Pr<=2.0e7)
{e=0.54; n=1.0/4;}
else {e=1.18; n=1.0/8;}
a2=e*A/d*pow((Gr*Pr),n);
return a2;
}
float BI_wen(float Tz,float Ty,float MPa,float d)
{ float Td,Tb,md_Td,c,A,B;
float Gr,Pr,a2,K0; double nd_Td;
Tb=Tz-5;
do
{Tb-=0.01;
Td=(Tb+Ty)/2;
nd_Td=nd_80*(1.0e-6)*exp((-u)*(Td-80));
md_Td=Md(Td);
c=Br(Td);
A=117.5/Md(15.0)*(1-0.00054*Td);
B=Pz(md_Td/1000);
Gr=9.81*B*1.0e-3*(Tb-Ty)*d*d*d/(nd_Td*nd_Td);
Pr=(nd_Td*c*1.0e3*md_Td)/A;
a2=Fr(Gr,Pr,A,d);
K0=1/((1/a2)+R0(MPa));
}
while(fabs(Ty+K0/a2*(Tz-Ty)-Tb)>0.01);
printf("\n\t |%5.2f +(%5.2f/%5.2f)*(%5.2f-%5.2f)-%5.2f|=|%f|<=0.01",Ty,K0,a2,Tz,Ty,Tb,(Ty+K0/a2*(Tz-Ty)-Tb));
printf("\n\t Tb=%5.2f, K0=%5.1f.",Tb,K0);
return K0;
}
void main()
{ float Hbao,Ty,Dr,a,S,Kbi,K,Tj,md,c,Tz,MPa,d,K0,F,L;
double Q1,Q2,Q3,Q;
printf("\n\t Input the value of Tz,MPa and d:\t");
scanf("%f%f%f",&Tz,&MPa,&d);
a=10+6*sqrt(v);
Tj=((4*H/D+1)*Tqi+Ttu)/(4*H/D+2);
{ if((Tyz-Tj)/(Tys-Tj)<2)
Ty=(Tys+Tyz)/2.0;
else Ty=Tj+(Tyz-Tys)/(log((Tyz-Tj)/(Tys-Tj)));
}
S=i*pow((1+i),N)/(pow((1+i),N)-1);
Dr=0.032+0.00013*Ty;
Hbao=sqrt(fn*Dr*3.6/4.187*8400*(Tys-Tqi)/(P*S))-Dr*3.6/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