|
#include <stdio.h>
#include <math.h>
int main()
{
int i,temp=1,flag=0;
double sum=0,sumC=0,Mpj=0;
double z[8],w[8]={0};
double C[8]= {0,25.9,6.6,12.3,12.4,12.4,16.5,913.9};
int M[8]={0,16,30,44,58,72,86,472};
for(i=1;i<=7;i++)
sum+=C[i];sumC=sum;
for(i=1;i<=7;i++)
{
w[i]=C[i]/sum;Mpj+=w[i]/M[i];
}
Mpj=1/Mpj;
for(i=1;i<=7;i++)
{
z[i]=(Mpj*w[i])/M[i];
}
double sumx=0,Mid,sumz=0;
double y[8],sumy=0;
double WL[8]={0},sumWL=0,Wg[8]={0},sumWg=0;
double x[8]={0};
double K1[8]={0,100,17,5.2,2.4,0.8,0.23,0.018};
double K2[8]={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[i]=z[i]/(Mid+(1-Mid)*K1[i]);sumx+=x[i];
}
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[i]=K1[i]*x[i];
sumy+=y[i];
}
double Pg;
sum=0;
for(i=1;i<7;i++)
sum+=y[i]*M[i];
sum=sum+y[7]*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[i]=(x[i]*Mid*C[i])/z[i];
sumWL+=WL[i];
Wg[i]=C[i]-WL[i];
sumWg+=Wg[i];
}
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[i],x[i],y[i],z[i],WL[i],Wg[i]);
}
printf("\n");
printf(" C7+%f %f %f %f %f %f\n",C[7],x[7],y[7],z[7],WL[7],Wg[7]);
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[i]=K2[i];z[i]=x[i];sumz+=z[i];
}
}
}
sumy=0;
}
|
-
-
油氣集輸程序.rar
2013-5-3 09:42 上傳
點擊文件名下載附件
913 Bytes, 下載次數(shù): 23
售價: 3 金幣 [記錄]
|