Monday 10 November 2014

Matlab Program to design Distillation column by shortcut and rigorous method

1 Function definition for the function psat() for calculating saturation temperature by using Antonie equation :

function[prhex,prhept,proct]=psat(t)
    hexa=13.8193;hexb=2696.04;hexc=-48.833;
    hepta=13.8622;heptb=2910.26;heptc=-56.718;
    octa=13.9346;octb=3123.13;octc=-63.515;
    prhex=exp(hexa-((hexb/(t+hexc))));
    prhept=exp(hepta-((heptb/(t+heptc))));
    proct=exp(octa-((octb/(t+octc))));
end

2 The main body of the programme where the function psat() has been called is:
  xihex=input('enter the composition of hexane');
    xihept=input('enter the composition of heptane');
    xioct=input('enter the composition of octane');
    pt=input('enter the total pressure');
    mlkd=(0.98*xihex)/((0.98*xihex)+(0.01*xihept));
    disp('the mole fraction of hexane in distillate is');
disp(mlkd);
mhkd=(0.01*xihept)/((0.98*xihex)+(0.01*xihept));
disp('the composition of heptane in distillate is:');
disp(mhkd);
moctd=0;
mlfrhex=((0.02*xihex)/((0.02*xihex)+(0.99*xihept)+(1*xioct)));
mlfrhept=((0.99*xihept)/((0.02*xihex)+(0.99*xihept)+(1*xioct)));
mlfroct=((1*xioct)/((0.02*xihex)+(0.99*xihept)+(1*xioct)));
    for t=250:0.1:423
            [p,q,r]=psat(t);
            kihex1=p/pt;
            kihept1=q/pt;
            kioct1=r/pt;
            sumkixi=(kihex1*mlkd)+(kihept1*mhkd)+(kioct1*moctd);
            if(sumkixi>0.99 && sumkixi<1)
                disp('temp of condenser')
                disp(t)
                break
            end
    end
    disp('the value of equilibrium constant of light key at bubble point is:');
    disp(kihex1);
    disp('the value of equilibrium constant of heavy key at bubble point is:');
    disp(kihept1);
    for temp=250:0.1:573
        [a,b,c]=psat(temp);
            kihex=a/pt;
            kihept=b/pt;
            kioct=c/pt;
            sumy=(mlfrhex/kihex)+(mlfrhept/kihept)+(mlfroct/kioct);
        if(sumy>0.99 && sumy<1)
            disp('temp of reboiler')
            disp(temp)
            break
        end
    end
alpha=kihex1/kihept1;
disp('the value of relative volatility is');
disp(alpha);

s=mlkd+mhkd+moctd;
disp('now the minimum number of stages by Fenske equation is calculated');

sum=mlfrhex+mlfrhept+mlfroct;
nmin=(log(((mlkd/mhkd)/(mlfrhex/mlfrhept)))/log(alpha))-1;
disp('the minimum number of trays required are')
disp(nmin)
disp('minimum number of stages including reboiler are')
nminn=nmin+1;
disp(nminn)
disp('now the calculation of minimum reflux by undrewood method is done:')
alpha1=kihex1/kihept1;
alpha2=kihept1/kihept1;
alpha3=kioct1/kihept1;
for phi=alpha2:0.01:alpha1
   sumf=((alpha1*xihex)/(alpha1-phi))+((alpha2*xihept)/(alpha2-phi))+((alpha3*xioct)/(alpha3-phi));
   if(sumf>-0.1&sumf<0.2)
       disp('the value of phi is')
       disp(phi)
       break;
   end;
end;
disp('the moles of all the four components in distillate are calculated below by simple material balnce calculations:')
summoles=(0.98*xihex*100)+(0.01*xihept*100)
disp('the total moles in distillate are')
disp(summoles)
sumrd=(((alpha1*mlkd)/(alpha1-phi))+((alpha2*mhkd)/(alpha2-phi))+((alpha3*moctd)/(alpha3-phi)))-1;
disp('minimum reflux ratio is')
disp(sumrd);
disp('now the calculations will be done on the basis of Gilliland corelations for claculating actual number of stages')
disp('actual reflux ration is taken as 1.5 times the minimum reflux ratio')
rd=1.5*sumrd;
x=(rd-sumrd)/(rd+1);
y=1-exp(((1+(54.4*x))/(11+(117.2*x)))*((x-1)/(x.^0.5)));
n=round((y+nminn)/(1-y));
disp('required number of stages are')
disp(n)
mlbottom=(0.02*xihex*100)+(0.99*xihept*100)+(1*xioct*100);
rationrns=[(xihept/xihex)*((mlfrhex/mhkd)^2)*(mlbottom/summoles)]^0.206;
ns=round((rationrns/(rationrns+1))*n);
nr=n-ns;
disp('stages in stripping section')
disp(ns);
disp('stages in rectifying section')
disp(nr);
for i=340:0.1:450
    [x,y,z]=psat(i);
    khex=x/pt;
    khept=y/pt;
    koct=z/pt;
    summation=(khex*mlfrhex)+(khept*mlfrhept)+(koct*mlfroct);
    if(summation>0.99 && summation<1)
        ftemp=i;
        disp('temp and composition and at tray 1 is')
        disp(ftemp)
        break
    end
end
v=(summoles)*(rd+1)
l=summoles*rd
lbar=l+100
yhex1=(x/pt)*mlfrhex;
yhept1=(y/pt)*mlfrhept;
yoct1=(z/pt)*mlfroct;
x1=(yhex1+(mlbottom/v)*mlfrhex)/(lbar/v);
x2=(yhept1+(mlbottom/v)*mlfrhept)/(lbar/v);
x3=(yoct1+(mlbottom/v)*mlfroct)/(lbar/v);
k=[yhex1,yhept1,yoct1,x1,x2,x3];
disp(k);
nt=n;
for i=2:1:nt
    if(i~=2)
        x1=xnewhex;
        x2=xnewhept;
        x3=xnewoct;
    end
    xbnrhex=x1/(x1+x2+x3);
    xbnrhept=x2/(x1+x2+x3);
    xbnroct=x3/(x1+x2+x3); 
    for j=250:0.1:450
    [x,y,z]=psat(j);
    khex=x/pt;
    khept=y/pt;
    koct=z/pt;
    summation=(khex*xbnrhex)+(khept*xbnrhept)+(koct*xbnroct);
    if(summation>0.99 && summation<1)
        ftemp=j;
        disp('temp and composition at tray'); disp(i); disp('is');
        disp(ftemp)
        break
    end
    end
   
    yhex1=(x/pt)*xbnrhex;
    yhept1=(y/pt)*xbnrhept;
    yoct1=(z/pt)*xbnroct;
xnewhex=(yhex1+((mlbottom/v)*mlfrhex))/(lbar/v);
xnewhept=(yhept1+((mlbottom/v)*mlfrhept))/(lbar/v);
xnewoct=(yoct1+((mlbottom/v)*mlfroct))/(lbar/v);
t=[yhex1,yhept1,yoct1,xnewhex,xnewhept,xnewoct];
disp(t);
    if(i==ns)
    disp('the feed plate location is');
    disp(ns);
    nf=i+1;
    for j=250:0.1:450
    [x,y,z]=psat(j);
    khex=x/pt;
    khept=y/pt;
    koct=z/pt;
    summation=(khex*xnewhex)+(khept*xnewhept)+(koct*xnewoct);
    if(summation>0.99 && summation<1)
        yhex1=(x/pt)*xnewhex;
    yhept1=(y/pt)*xnewhept;
    yoct1=(z/pt)*xnewoct;
        break
    end
    end
    break
    end
end
for i=nf:1:n
    if(i~=nf)
       yhex1=ynewhex;
       yhept1=ynewhept;
       yoct1=ynewoct;
    end
    xhexr=(yhex1-(mlkd/(rd+1)))/(rd/(rd+1));
    xheptr=(yhept1-(mhkd/(rd+1)))/(rd/(rd+1));
    xoctr=(yoct1-(moctd/(rd+1)))/(rd/(rd+1));
    xnrhex=xhexr/(xhexr+xheptr+xoctr);
    xnrhept=xheptr/(xhexr+xheptr+xoctr);
    xnroct=xoctr/(xhexr+xheptr+xoctr);
    for j=150:0.1:450
    [x,y,z]=psat(j);
    khex=x/pt;
    khept=y/pt;
    koct=z/pt;
    summation=(khex*xnrhex)+(khept*xnrhept)+(koct*xnroct);
    if(summation>0.99 && summation<1)
        ftemp=j;
        disp('temp and composition at tray'); disp(i); disp('is');
        disp(ftemp)
        break
    end
    end
    ynewhex=(x/pt)*xnrhex;      
    ynewhept=(y/pt)*xnrhept;
    ynewoct=(z/pt)*xnroct;
    w=[ynewhex,ynewhept,ynewoct,xnrhex,xnrhept,xnroct];
    disp(w);

end
coded by: Ravisha Goswami, Mamta Nainwal & group; Chemical Batch 2010-14, BTKIT Dwarahat

Friday 7 November 2014

Process Calculation questions


1.        5 marks questions
a)        At 360 K the vapour pressure of n-heptane and toluene are 71.2 kPa and 48.9 kPa respectively. Determine the composition of the liquid and vapour in equilibrium at 360 K and 65 kPa for ideal mixture.
b)      SO2 reacts with O2 to form SO3. If the reaction is carried out with 50% excess air, but reaction goes 60% completion. Calculate mol fraction of gases in reactants and products.
c)      If 50 kg of dry solid containing 6% water is obtained by drying 65 kg of wet material, what was the initial moisture content?
2.         10 marks questions
a)      A triple effect evaporator is used to concentrate 1000 kg of aqueous solution from a concentration of 20% solute to 80% solute. Assuming an equal amount of vaporization in each effect, calculate the composition and weight of solution entering the second and third effects.
b)        A continuous distillation column is used to regenerate solvent for use in a solvent extraction unit. The column treats 200 kmol/h of a feed containing 10% (mol %) ethyl alcohol and rest water. The overhead product (89 % alcohol) is sent to the extraction unit and bottom product (0.3% alcohol) is wasted. What is the daily requirement of make-up alcohol in the solvent extraction unit?
c)         The gaseous reaction A→2B+C takes place isothermally in a constant pressure reactor. The feed mixture containing 50% A and the rest inert materials, the ratio of final to initial volume is found to be 1.8. Find the percent conversion of A
d)   A feed of 100 kmol/h of air is to be partially separated by membrane. Calculate the amounts of two products (retentate and permeate) for the following cases: i) 50% recovery of O2 to the permeate and 87.5% recovery of N2 to the Retentate ii) 50% recovery of O2 to the permeate and 50 mol% purity of O2 in the permeate


Ref: STOICHIOMETRY AND PROCESS CALCULATIONS 

Front Cover