1、首先要得到相平衡方程和精馏段、提馏段方程,再根据逐板计算求得精馏塔的理论塔板数。源程序:#include #include #include static double R,L,F,W,T0,P,E;static double Xf,Xd,Xw,q,Xe;static double P1,P2;/td 和 tb 的变量static double K1;static double K2;static double X1;static double X2;static double Y1;static double Y2;static double A1;static double B1;stat
2、ic double C1;static double A2;static double B2;static double C2;static double F1;static double F2;double Pressure(double A,double B,double C,double T)double temp1=101325.0/760.0;double temp2=A*1.0-B*1.0/(C+T)*1.0;double temp3=pow(10.0,temp2);double result=temp1*temp3;return result;double Ftd(double
3、y,double P1,double P2)double temp1=pow(K1,2);double temp2=pow(C1+T0,2);double temp3=pow(K2,2);double temp4=pow(C2+T0,2);double temp5=temp1*P*temp2;double temp6=temp3*P*temp4;double temp7=-1.0*y*P1*B1*log(10);double temp8=-1.0*(1-y)*P2*B2*log(10);double result=temp7/temp5+temp8/temp6;return result;do
4、uble Ftb(double x,double P1,double P2)double temp2=pow(C1+T0,2);double temp4=pow(C2+T0,2);double temp5=P*temp2;double temp6=P*temp4;double temp7=1.0*x*P1*B1*log(10);double temp8=1.0*(1-x)*P2*B2*log(10);double result=temp7/temp5+temp8/temp6;return result;double Tdm(double y)double Td=T0;double P1;dou
5、ble P2;KTdm:P1=Pressure(A1,B1,C1,Td);P2=Pressure(A2,B2,C2,Td);K1=P1*1.0/P;K2=P2*1.0/P;X1=y*1.0/K1;X2=(1-y)*1.0/K2;F1=X1+X2-1;F2=Ftd(y,P1,P2);if(fabs(F1)=E)Td=Td-F1*1.0/F2;goto KTdm;return Td;double Tbm(double x)double Tb=T0;double P1;double P2;KTbm:P1=Pressure(A1,B1,C1,Tb);P2=Pressure(A2,B2,C2,Tb);K
6、1=P1/P;K2=P2/P;Y1=x*K1;Y2=(1-x)*K2;F1=Y1+Y2-1;F2=Ftb(x,P1,P2);if(fabs(F1)=E)Tb=Tb-F1*1.0/F2;goto KTbm;return Tb;void main()double Td;double Tb;double x;double y;int n=0;int m=0;int N,M;int Nt;int flag;char end;printf(“Please input Rn“);scanf(“%lf“,printf(“Please input Ln“);scanf(“%lf“,printf(“Please
7、 input Fn“);scanf(“%lf“,printf(“Please input Wn“);scanf(“%lf“,printf(“Please input Pn“);scanf(“%lf“,printf(“Please input T0n“);scanf(“%lf“,printf(“Please input En“);scanf(“%lf“,printf(“Please input Xfn“);scanf(“%lf“,printf(“Please input Xdn“);scanf(“%lf“,printf(“Please input Xwn“);scanf(“%lf“,printf
8、(“Please input qn“);scanf(“%lf“,printf(“Please input Xen“);scanf(“%lf“,printf(“Please input A1n“);scanf(“%lf“,printf(“Please input B1n“);scanf(“%lf“,printf(“Please input C1n“);scanf(“%lf“,printf(“Please input A2n“);scanf(“%lf“,printf(“Please input B2n“);scanf(“%lf“,printf(“Please input C2n“);scanf(“
9、%lf“,/-/-y=Xd;flag=1;while(flag)flag=0;/-框框 -x=0.0;Td=Tdm(y);P1=Pressure(A1,B1,C1,Td);P2=Pressure(A2,B2,C2,Td);K1=P1/P;K2=P2/P;Kup:Y1=x*K1;Y2=(1.0-x)*K2;if(fabs(Y1+Y2-1.0)=E)x=1.0*(x+E);goto Kup;/-n=n+1;if(x=Xe)flag=1;y=R*x/(R+1.0)+Xd/(R+1.0);N=n-1;/-/-x=Xw;flag=1;while(flag)flag=0;/-框框 -y=1;Tb=Tbm(x);P1=Pressure(A1,B1,C1,Tb);P2=Pressure(A2,B2,C2,Tb);K1=P1/P;K2=P2/P;Kdown:X1=y/K1;X2=(1-y)/K2;if(fabs(X1+X2-1)=E)y=y-E;goto Kdown;/-m=m+1;if(xXf)flag=1;x=1.0*(L+q*F)*y/(L+q*F-W)+1.0*W*Xw/(L+q*F-W);M=m;/-/-Nt=N+M;printf(“n%dn“,Nt);printf(“Print any key to exit!“);scanf(“%c“,scanf(“%c“,return;