Simulation of McCabe
Simulation of McCabe
Introduction
The McCabe Thiele method is used for the separation of a binary mixture of
components having different volatilities. The McCabe-Thiele method is considered
to be the simplest and perhaps most instructive method for the analysis of binary
distillation. It uses the fact that the composition at each theoretical
tray (equilibrium stage) is completely determined by the mole fraction of one of
the two components and is based on the assumption of constant molar overflow
which requires that:
the molar heats of vapor of the feed components are equal
for every mole of liquid vaporized, a mole of vapour is condensed
THE MATLAB
CODE
WORKING
The Matlab program asks user to input some
variables which should be carefully fed by the
user and provides some variables as output and a
graph of y vs. x for the more volatile component.
The graph shows the equilibrium curve and the
stages represented between the equilibrium curve and the operating lines of the
enriching and stripping section.
INPUT VARIABLES
The following were taken as input for the Matlab program :Feed flow rate f
Fraction of more volatile component in the feed xf
Liquid fraction in feed liq
Fraction of the more volatile component in the distillate xd
Fraction of the more volatile component in the residue - xw
Reflux ratio R
Relative volatility
OUTPUT VARIABLES
The following were the variables given as output by the Matlab program :Distillate flow rate D
2.
3.
4.
5.
6.
Command - Function
Disp( ) - The disp( ) command displays the text inserted between the single
inverted commas. It also displays the value of the function inserted in the
brackets of disp command.
Input( ) - The input( ) command asks the user to input the value of the
variable. It displays the string entered in the inverted commas, waits for the
input, evaluates any expressions in the input and returns the result.
If loop if evaluates an expression, and executes a group of statements only
when the expression is true.
While loop while loop repeatedly executes statements as long as an
expression remains true.
Linspace the linspace function specifies the upper and lower limits of the
variable
Plot plots y vs. x for the current program. It is used in the program for
plotting stages.
7. Hold on the hold function clears the current graph when we make subsequent
calls to plot a function. Hold on retains the current graph and adds another
graph to it.
8. Solve solves the set of equations specified.
9. Subs substitutes the value of the variable in the specified equation.
CODE
plot(k,o);
if intx>xf;
e=linspace(xf,intx);
r=e.*q/(q-1)-xf/(q-1);
disp('a');
plot(e,r);
end
if intx<xf;
e=linspace(intx,xf);
r=e.*q/(q-1)-xf/(q-1);
plot(e,r);
end
b=linspace(xw,intx);
j=b.*(inty-xw)/(intx-xw)-xw*(inty-xw)/(intx-xw)+xw;
plot(b,j);
grid on;
t=xd;t1=xd;p=xd;
i=0;
syms x y
while t>xw;
h=solve(y == a*x/(1+x*(a-1)), y == t1+0*x);
plot([h.x,t],[p,p],'m')
t=h.x;
if t>intx;
p=subs(R*x/(R+1)+xd/(R+1),h.x);
plot([h.x,h.x],[p,h.y],'m')
t1=p;
i=i+1;
end
if t<intx;
p=subs(x.*(inty-xw)/(intx-xw)-xw*(inty-xw)/(intx-xw)+xw,h.x);
plot([h.x,h.x],[p,h.y],'m')
t1=p;
i=i+1;
end
end
disp('The no. of stages required is ');
disp(i);
disp('The no. of trays required is ');
disp(i-1);
end
if q==1;
intx=xf;
inty=xf*R/(R+1)+xd/(R+1);
hold on;
ezplot('y=x',[0,1]);
x=linspace(0,1);
y=a*x./(1+x*(a-1));
plot(x,y);
k=linspace(intx,xd);
o=k.*R/(R+1)+xd/(R+1);
plot(k,o);
q1=linspace(xf,inty);
q2=xf;
plot(q2,q1,'k');
b=linspace(xw,intx);
j=b.*(inty-xw)/(intx-xw)-xw*(inty-xw)/(intx-xw)+xw;
plot(b,j);
grid on;
t=xd;t1=xd;p=xd;
i=0;
syms x y
while t>xw;
h=solve(y == a*x/(1+x*(a-1)), y == t1+0*x);
plot([h.x,t],[p,p],'m')
t=h.x;
if t>intx;
p=subs(R*x/(R+1)+xd/(R+1),h.x);
plot([h.x,h.x],[p,h.y],'m')
t1=p;
i=i+1;
end
if t<intx;
p=subs(x.*(inty-xw)/(intx-xw)-xw*(inty-xw)/(intx-xw)+xw,h.x);
plot([h.x,h.x],[p,h.y],'m')
t1=p;
i=i+1;
end
end
disp('The no. of stages required is ');
disp(i);
disp('The no. of trays required is ');
disp(i-1);
end
CODE FOR MINIMUM NUMBER OF TRAYS
hold on;
ezplot('y=x',[0,1]);
x=linspace(0,1);
y=a*x./(1+x.*(a-1));
plot(x,y);
g=0
while xd>xw;
x1=linspace(xd./(a-xd.*(a-1)),xd);
y1=xd;
plot(x1,y1,'m');
y2=linspace(xd./(a-xd.*(a-1)),xd);
x2=xd./(a-xd.*(a-1));
plot(x2,y2,'m')
xd=xd./(a-xd.*(a-1));
g=g+1;
end
disp('The minimum number of stages required is ');
disp(g);
hold off;
RESULT
Graph for minimum number of trays
Figure shows the graph for a given set of values f=100, xd=.9, liq=.8, xf=.6,
xw=.2, a=2.45, R=2
Graph for finding the number of trays
Figure shows the graph for a particular set of values with number of stages 10.