C++油气集输程序
#include <stdio.h>#include <math.h>
int main()
{
int i,temp=1,flag=0;
double sum=0,sumC=0,Mpj=0;
double z,w={0};
double C= {0,25.9,6.6,12.3,12.4,12.4,16.5,913.9};
int M={0,16,30,44,58,72,86,472};
for(i=1;i<=7;i++)
sum+=C;sumC=sum;
for(i=1;i<=7;i++)
{
w=C/sum;Mpj+=w/M;
}
Mpj=1/Mpj;
for(i=1;i<=7;i++)
{
z=(Mpj*w)/M;
}
double sumx=0,Mid,sumz=0;
double y,sumy=0;
double WL={0},sumWL=0,Wg={0},sumWg=0;
double x={0};
double K1={0,100,17,5.2,2.4,0.8,0.23,0.018};
double K2={0,255,43,13,4.95,1.65,0.6,0.0375};
for(flag=0;flag<2;flag++)
{
double L1=0,V2=1;
sumx=0;
while(fabs(sumx-1)>1e-6)
{
Mid=(L1+V2)/2;sumx=0;
for(i=1;i<=7;i++)
{
x=z/(Mid+(1-Mid)*K1);sumx+=x;
}
if(sumx-1>0)
L1=Mid;
else
V2=Mid;
}
printf("在第%d级分离后,组成为:L=%f,V=%f\n\n",flag+1,Mid,1-Mid);
sumy=0;
for(i=1;i<=7;i++)
{
y=K1*x;
sumy+=y;
}
double Pg;
sum=0;
for(i=1;i<7;i++)
sum+=y*M;
sum=sum+y*114;
Pg=sum/22.4;
printf("在第%d级分离后,气相密度为: %f \n\n",flag+1,Pg);
temp--;
sumWL=0;
sumWg=0;
for(i=1;i<=7;i++)
{
WL=(x*Mid*C)/z;
sumWL+=WL;
Wg=C-WL;
sumWg+=Wg;
}
printf(" Ci Xi Yi Zi WLi Wgi\n");
for(i=1;i<=6;i++)
{
printf("\n");
printf(" C%d %f %f %f %f %f %f\n",i,C,x,y,z,WL,Wg);
}
printf("\n");
printf(" C7+%f %f %f %f %f %f\n",C,x,y,z,WL,Wg);
printf("\n");
printf("合计%f %f %f %f %f %f\n\n",sumC,sumx,sumy,sumz,sumWL,sumWg);
if(flag==0)
{
for(i=1;i<=7;i++)
{
K1=K2;z=x;sumz+=z;
}
}
}
sumy=0;
}
正需要,非常感谢楼主!! 谢谢楼主分享! {:4_98:}{:4_98:}{:4_98:}{:4_98:} 谢谢分享,下载学习
页:
[1]