老板说要计算2700块踏板的精馏塔,手算不可能,得靠编程。于是先试着用R写了代码,来计算已有实例中的理论塔板数。经过几次修改,得到正确的结果。
已知条件:
- 泡点进料,所以q=1;
- xD=0.95,xF=0.40,xW=0.02;
- 平衡线方程:$x=y/(2.47-1.47*y)$;
- 精馏段操作线方程:$y=0.677*x+0.306$;
- 提馏段操作线方程:$y=1.467*x-0.009$.
R代码:
x<-1
y<-0.95
n<-0
X<-c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)
Y<-X
while(x>=0.02){
x<-y/(2.47-1.47*y);
n<-n+1;
X[n]<-x;
Y[n]<-y;
if(x>=0.4){
y<-0.677*x+0.306;
h<-n;
}
else{
y<-1.467*x-0.009;
}
}
cat("理论塔板数:",n,"\n","精馏段塔板数:",h,"\n","提留段塔板数:",n-h,"\n","进料板:",h+1)
## 理论塔板数: 15
## 精馏段塔板数: 6
## 提留段塔板数: 9
## 进料板: 7
cat("各塔板气液组成:","\n",X,"\n",Y)
## 各塔板气液组成:
## 0.885 0.7943 0.6862 0.5762 0.4811 0.4098 0.3619 0.3065 0.2418 0.1762 0.1186 0.07409 0.0429 0.02256 0.009898
## 0.95 0.9051 0.8438 0.7705 0.6961 0.6317 0.5835 0.5219 0.4406 0.3457 0.2495 0.165 0.09968 0.05394 0.0241
网友评论