Upcoming SlideShare
×

# Distillation Scilab Problem

773 views

Published on

Graphical McCabe-Thiele Method to determine minimum & actual number of plates..

0 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

Views
Total views
773
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
17
0
Likes
0
Embeds 0
No embeds

No notes for slide

### Distillation Scilab Problem

1. 1. Distillation Problem: Providing with the following fractions: bottoms, XB; feed, XF: distillate, XD; q; & RD from any of the chosen mixtures, write a scilab program showing a graphical representation of McCabe-Thiele method and determine the minimum & actual number of plates or stages obtained from the equilibrium curve and the diagonal line. Program Listing: clc; clear; disp ('Select Choice Of Mixture in Distillation'); disp ('1) Benzene - Toluene'); disp ('2) Acetic Acid - Water'); disp ('3) Ethanol - Water'); sc = input ('Select The Number of Your Choice:'); if sc == 1 a1 = 4.01814; b1 = 1203.835; c1 = -53.226; a2 = 4.23679; b2 = 1426.448; c2 = -45.957; xl = ('Benzene in Liquid (mole fraction)'); yl = ('Benzene in Vapor (mole fraction)'); tit = ('Benzene - Toluene Equilibrium System'); elseif sc == 2 a1 = 5.40221; b1 = 1838.675; c1 = -31.737; a2 = 4.68206; b2 = 1642.54; c2 = -39.764; xl = ('Acetic acid in Liquid (mole fraction)'); yl = ('Acetic acid in Vapor (mole fraction'); tit = ('Acetic acid - Water Equilibrium System'); elseif sc == 3 a1 = 4.92531; b1 = 1432.526; c1 = -61.819; a2 = 5.40221; b2 = 1838.675; c2 = -31.737; xl = ('Ethanol in Liquid (mole fraction)'); yl = ('Ethanol in Vapor (mole fraction'); tit = ('Ethanol - Water Equilibrium System'); else printf('Invalid Choices'); end initval=300; A1 = a1; B1 = b1; C1 = c1; A2 = a2; B2 = b2; C2 = c2; x = 0:0.1:1.0; for i=1:length(x) function temp0=f(T), temp0=x(i).*(10.^(A1-(B1./(T+C1))))+(1-x(i)).*(10.^(A2-(B2/(T+C2))))-1.013; endfunction temp = fsolve(initval,f); y(i)=x(i).*(10.^(A1-(B1./(temp+C1))))/(x(i).*(10.^(A1-(B1./(temp+C1))))+(1-x(i)).*(10.^(A2-(B2/ (temp+C2))))); end
2. 2. printf('x ttt y ttt') for i=1:11 printf('n %f t %f ',x(i),y(i)) end diagonal =(0:1); plot(x,y,diagonal,diagonal) mtlb_grid on; mtlb_axis equal; xlabel(xl); ylabel(yl); title(tit); clear; cs = input ('Enter the same choice from above: '); if cs == 1 function xypoint = distillation(xy1,xory) if (xory == 2) xypoint=0.000068+(2.370166*xy1)-(2.880267*(xy1^2))+(2.689467*(xy1^3))-(1.612034*(xy1^4)) +(0.432692*(xy1^5)); else xypoint=-0.000053+(0.473581*xy1)-(0.276536*(xy1^2))+(1.749841*(xy1^3))-(2.133077*(xy1^4)) +(1.185847*(xy1^5)); end endfunction elseif cs == 2 function xypoint=distillation(xy1,xory) if (xory == 2) xypoint=0.0000021654+(1.8978779773*xy1)-(1.7944366293*(xy1^2))+(1.7126031845*(xy1^3))- (1.3343692357*(xy1^4))+(0.8734031048*(xy1^5))-(0.154542857*(xy1^6)); else xypoint=0.0000000450+(0.5259889986*xy1)+(0.2719247341*(xy1^2))+(0.0954240691*(xy1^3)) +(0.1104568853*(xy1^4))-(0.0477386359*(xy1^5))+(0.0439433441*(xy1^6)); end endfunction elseif cs == 3 function xypoint = distillation(xy1,xory) if (xory==2) xypoint=0.0000009331+(2.0315450622*xy1)-(1.9530996352*(xy1^2))+(1.6139657074*(xy1^3))- (1.0638499102*(xy1^4))+(0.4696314204*(xy1^5))-(0.0981944462*(xy1^6)); else xypoint=0.0000004738+(0.4865803536*xy1)+(0.3028607250*(xy1^2))-(0.1929426575*(xy1^3)) +(0.7581636067*(xy1^4))-(0.7010833099*(xy1^5))+(0.3464105409*(xy1^6)); end endfunction else printf('Invalid Choices!'); end
3. 3. printf('nThis program will solve problems on mr=(xd-ycoorr)/(xd-xcoorr); Distillation of your choicen'); bmin=ycoorr-(mr*xcoorr); xd=input('Enter fraction in distillate: '); rmin=(xd/bmin)-1; xf=input('Enter fraction in feed: '); printf('Minimum reflux is = %fn',rmin); xb=input('Enter fraction in bottoms: '); ref=input('Enter reflux ratio: '); q=input('Enter q value: '); if q==1 then xcoorr=xf; j=2; else ycoor(1)=xd; delm=(xd/(ref+1))-(xf/(1-q)); printf('-------------Solving for minimum number of delb=((-1*q)/(1-q))-(ref/(ref+1)); plates---------n'); xcoorr=delm/delb; xcoor(j)=distillation(ycoor(j-1),1); end while xcoor(j)>xb ycoorr=((ref/(ref+1))*xcoorr)+(xd/(ref+1)); ycoor(j)=xcoor(j); mb=(ycoorr-xb)/(xcoorr-xb); n=j; bact=ycoorr- (mb*xcoorr); j=j+1; j=1;ycoor(1)=xd; xcoor(j)=distillation(ycoor(j-1),1); j=j+1; end xcoor(j)=distillation(ycoor(j-1),1); printf('Minimum number of Plates = %dn',n); if xcoor(j)>= xcoorr then xmin(1)=xd; ycoor(j)=((ref/(ref+1))*xcoor(j))+(xd/(ref+1)); ymin(1)=xd; fplate=j; for j=1:1:n end printf('fraction x=%f y=%f plate no.= if xcoor(j) < xcoorr then ycoorr (j) = (mb*xcoor(j) %dn',xcoor(j+1),ycoor(j),j); +bact; xmin(2*j)=xcoor(j+1);xmin((2*j)+1)=xcoor(j+1); end ymin(2*j)=ycoor(j);ymin((2*j)+1)=xcoor(j+1); n=j; end while(xcoor(j)>xb) plot(xmin,ymin,'m'); j=j+1; if q==1 then xmin(1)=xd; xcoor(j) = distillation (ycoor(j-1),1); ymin(1)=xd; if xcoor(j) >= xcoorr then xcoorr=xf; ycoor(j) = ((ref/(ref+1))*xcoor(j))+(xd/(ref+1)); ycoorr=distillation(xcoorr,2); fplate=j; elseif q==0 then end ycoorr=xf; if xcoor(j) < xcoorr then ycoor(j)=(mb*xcoor(j)) xcoorr=distillation(ycoorr,1); +bact; else end if q>1 then xcoor=xf; n=j; elseif q<0 then xcoorr=distillation (xb,1); end else xcoorr=distillation(xf,1); printf('-----------Solving for Actual Number of end, Plates--------n'); xcoorr=xcoorr+0.0001; xact(1)=xd; ycoorf=(((-1*q)/(1-q))*xcoorr)+(xf/(1-q)); yact(1)=xd; ycoorr=distillation(xcoorr,2); for j=1:1:n-1 dcoorr=ycoorf-ycoorr; printf('fraction x=%f y=%f plate no. = while abs(dcoorr)> 0.0005 %dn',xcoor(j+1),ycoor(j),j); xcoorr=xcoorr+0.0001; xact(2*j)=xcoor(j+1);xact((2*j)+1)=xcoor(j+1); ycoorf=(((-1*q)/(1-q))*xcoorr)+(xf/(1-q)); yact(2*j)=ycoor(j);yact((2*j)+1)=ycoor(j+1); ycoorr=distillation(xcoorr,2); end dcoorr=ycoorf-ycoorr; plot(xact,yact,'c'); end, printf('Feed is introduced in plate number end %dn',fplate);
4. 4. Sample Output: