You are on page 1of 19

ASSIGNMENT NO.

FIRST TUTORIAL
QUESTION NO:1
In petroleum industries, it is common that the molecular weight of an oil fraction is unknown
and thus must be estimated by using a correlation. A correlation that is widely used is
developed by Riazi and Daubert, which is also referred to as the API (American Petroleum
Institute) method. The correlation can be applied to hydrocarbons with molecular weight
ranging from 70-700, which is nearly equivalent to boiling point range of 300-850 K, and the
API gravity range of 14.4-93. This molecular weight (M) correlation is given as a function of
the average boiling point (Tb) and the specific gravity at 60°F {SG) of the oil fraction of
interest as follows:

Where, Tb is in K and SG is related to the API gravity {API):

a) Estimate the molecular weight of an oil fraction that has an average boiling point of
344.7°C and an API gravity of 50.

b) Plot on the same graph M vs.T (400 < Tb< 600 K) with API gravity = 20, 40, and 60.

SOLUTION:
a) Estimate the molecular weight of an oil fraction that has an average boiling point of
344.7°C and an API gravity of 50.

STEPS:
 First of all create a M-file. Write the given data and find the unknowns with the help of
relations as shown in the code below.
 Use different commands like ’fprintf’ to find the unknowns.
CODE:
%Part(a) Solution
%Given Parameters
TB=344.7+273; %Boiling Temperature values from °C to kelvin
1|Page Group Members: Muhammad Shahryar Khan
Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

API=50; %Given API value of oil


%To Find
%Molecular weight of an oil fraction(M)
%Given Relations
SG=141.5/(API+131.5); %Specific gravity relation with API
fprintf('\n Part (a) Molecular Weight of Oil fraction: \n')
M=42.965*exp(2.097e-4*(TB)-(7.78712*SG)+(2.08476e-
3*(TB)*SG))*(TB^1.26007)*(SG^4.98308); % Molecular weight relation
fprintf('\n M=%3.4f g/gmole ',M )
%Part (b)
Tb=400:600; %Boiling Temperature range in kelvin
APIo=20:40:60; % Given API values
SGo=141.5./(APIo+131.5); %SG values for given APIo values
%Molecular Weight Calculations
M1=42.965*exp(2.097e-4.*(Tb)-7.78712*SGo(1)+2.08476e-
3.*(Tb*SGo(1))).*Tb.^1.26007*SGo(1)^4.98308; %Molecular Weight for SGo(1)in g/gmol
M2=42.965*exp(2.097e-4.*(Tb)-7.78712*SGo(2)+2.08476e-
3.*(Tb*SGo(2))).*Tb.^1.26007*SGo(2)^4.98308; %Molecular Weight for SGo(2)in g/gmole
M3=42.965*exp(2.097e-4.*(Tb)-7.78712*SGo(3)+2.08476e-
3.*(Tb*SGo(3))).*Tb.^1.26007*SGo(3)^4.98308; %Molecular Weight for SGo(3)in g/gmole
For graph plotting:
plot(M1,Tb,'x--',M2,Tb,'o--',M3,Tb,'s:')
title('Molecular weight VS Boiling Temperatures')
xlabel('Molecular Weight (g/gmole)')
ylabel('Boiling Temperatures (Kelvin)')
legend('APIo=20','APIo=40','APIo=60')
The graph is shown below of the above code.

Graph no.1

2|Page Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

QUESTION NO: 2
In chemical industry, the cost of piping system (pipes and fittings) and pumping are
important costs that should be considered. The annual cost of a pipeline with a standard
carbon steel pipe and a motor-driven centrifugal pump is given by:

Where L is the length of the pipeline in ft. D is the pipe diameter in inch, and P is the power
of the pump in hp, which can be calculated from:

In the above equation, Q is the volumetric flow rate of the fluid in gpm.

(a) Plot the annual cost as a function of pipe diameter, say from 0.25 to 6 in, for 1000 ft
pipeline with a fluid rate of 20 gpm.

(b) What is the annual cost needed if a pipe with a diameter of 1 in is used? Is there an
optimum diameter for this pipeline?

SOLUTION:
(a) Plot the annual cost as a function of pipe diameter, say from 0.25 to 6 in, for 1000 ft
pipeline with a fluid rate of 20 gpm.

STEPS:

 Create the M-file of given data.


 First write the given value of length and diameters (D1, D2) of pipeline on Mfile.
 Use Linspace function to create a vector with those values that will in inclusive range from
D1to D2. So,
D = linspace (D1, D2)

 Also write the given value of volumetric flow rate (Q) on Mfile.
 Write the given formula of power and annual cost on Mfile.
 Calculate the values of power and annual cost by using the values of diameter D
= linspace (D1,D2)
 After finding the values of power and annual cost, plot the values of annual cost with the
values of pipe diameter (D).

3|Page Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

 Find the value of minimum cost at specific value of diameter (D) by using a given function.
[M, I]= (min(C))

Disp (D (I))

CODE:

L=1000;%where L is length of pipeline in ft

D1=0.25;%D is the diameter of pipe in inch

D1/12;%convert the inch into ft(1inch = 12ft)

D2=6;

D2/12;

D=linspace(D1,D2);% Use linspace function for generate the linearly spaced vectors.

Q=20;%Q is the volumetric flow rate of the fluid in gpm

%First step is calculate the value of power of pump(P) in (hp) by using given formula

P=(4.4*10^-8)*((L*Q^3./D.^5)+(1.92*10^-9)*(L*Q^2.68)./D.^4.68)

%Next step is find the value of annual cost(C)of pipeline by using diameter(D)

C=((0.45*L)+(0.245*L*D.^1.5)+(325*P.^0.5)+(6.16*P.^0.925)+102)

%Then plot the annual cost(C) as a function of pipe diameter(D)

plot(D,C)

%Find the value of minimum cost from different value of annual cost at specific value of diameter.

% M show minimum cost

[M,I]=(min(C))%I show the no of given specefic diameter at which minimum cost will show

disp(D(I))

4|Page Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

Graph no.2: Plot the annual cost (C) as function of diameter (D)

 I = 15 is the number which show the value of diameter (D = 1.0631). The value of minimum
cost will show at this diameter.

Fig no.1

(b) What is the annual cost needed if a pipe with a diameter of 1 in is used? Is there an
optimum diameter for this pipeline?

SOLUTION:
STEPS:

 Then calculate the value of power (P) and annual cost (C) by using the value of diameter
D=1.

5|Page Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

 After completing the coding on Mfile, save this file with any name and run the code on
command window. The answer will be shown on command window.
 Compare both value of annual cost which calculate at D=1 and use the specific value of
diameter from range of 0.25 to 1inch for find the minimum cost.
CODE:

%Find the annual cost of pipe at D=1

D=1;%the unit of diametr(D) is also in (inch)

D/12;%Convert the inch into ft by dividing with value of 12

%Calculate the value of power(P)by using the value of D=1

P=(4.4*10^-8)*((L*Q^3./D.^5)+(1.92*10^-9)*(L*Q^2.68)./D.^4.68)

%Then find the the value of annual cost(C)by using the value of(D=1)

C=((0.45*L)+(0.245*L*D.^1.5)+(325*P.^0.5)+(6.16*P.^0.925)+102)

The calculated value of power and annual cost for D =1 will be given below:

Fig no.2

(b) Reason for using optimum diameter D=1.0631:

D (1.0631) is optimum diameter of pipeline. It will provide the minimum cost as compared to the
values of D (1) which provides the high cost of pipeline. As one increase in the pipe diameter
leads to increase in annual capital costs, and decrease in operating cost. Selection of an optimum
pipe diameter for a particular fluid flow will therefore be a vital economic decision. And we choose
those value of diameter that corresponding to this minimum annual capital cost. And this diameter
is known as economic pipe diameter. So, D (1.0631) is the optimum and economic diameter of
pipe line.
6|Page Group Members: Muhammad Shahryar Khan
Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

QUESTION NO 3:
A first order reaction is carried out in a series of N equal-size mixed flow reactors. The total
conversion (X) achieved for this system is given by :

Where k is the reaction constant (= 0.075 hr-1) and τ is the mean residence time in a single
mixed reactor.

(a) Plot the total conversion of this reaction as a function of τ (0 < τ < 40 hrs) for N = 4.

(b) Plot on the same graph the total conversion as a function of τ for N= 2.

(c) Calculate the total conversion if the number of equal-size mixed reactors is 6 and the
residence time of the fluid in a single reactor is 5 hrs

(d) Suppose we allocate a total of 10 hrs for this reaction ( =1/’0 hrs, the summation is
over all reactors) and a large conversion is desired, would you suggest having a lot of small
mixed reactors or a few large mixed reactors? Explain your reasoning using some
calculations. Hint: a larger reactor has a larger fluid residence time.

SOLUTION:
(a) Plot the total conversion of this reaction as a function of τ (0 < τ < 40 hrs) for N = 4

STEPS:

 Create an Mfile of given data.


 First write the given value of rate constant (K), residence time (t1, t2) on Mfile,
 Use colon operator function (:) to find the range between t1 and t2.
 Write the given formula of total conversion (Xt) on Mfile.
 Plot the graph between the values of total conversion (Xt) and values of residence time (t)
for N=4

7|Page Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

CODE:

K=0.075;%where K is a rate constant in perhour

N=4;%N is the number of equal-size mixed flow reactors

t1=0;%t1,t2 is the residence time in hour

t2=40;

t=t1:t2%t is mean residence time in a single mixed reactor

%Calculate the value of total conversion(Xt) at N=4 by using given formula

Xt=1-(1./((1+K*t).^N))

%plot the total conversion (Xt)as function of residence time(t)

plot(t,Xt)

Graph no.3: Plot the conversion (Xt) as function of residence time (t) for N=4

(b) Plot on the same graph the total conversion as a function of τ for N= 2.

STEPS:

 Hold on retain the current plot and certain axes properties so that subsequent graphing
command add to the existing graph.
 Hold off function reset axes properties to their default before draw in d new plot.

8|Page Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

 Plot the second graph between the values of total conversion (Xt) and values of residence
time (t) for N=2 on same plot by using the hold on and hold off function.
CODE:

N=2

%Find the value of total conversion(Xt)at N=2

Xt=1-(1./((1+K*t).^N))

%Use the function of hold on and hold off to plot the second graph on previous plot with
different color line

hold on

%plot the total conversion(Xt)as function of residence time(t)

plot(t,Xt,'r-')

hold off

Graph no.4: Plot the conversion (Xt) as function of residence time (t) for N=4, N=2 on same plot

9|Page Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

SOLUTION:
(c) Calculate the total conversion if the number of equal-size mixed reactors is 6 and the
residence time of the fluid in a single reactor is 5 hrs

STEPS:

 Calculate the value of total conversion for the number of equal-size mixed reactors (N= 6) and
the residence time of the fluid in a single reactor is 5 hrs.
CODE:

%Calculate the value of total conversion(Xt) at N=6 and t=5hr

N=6;

t=5;%t=5hr is a residence time of fluid in a single reactor

Xt=1-(1./((1+K*t).^N))

Fig no. 3

SOLUTION:

(d) Suppose we allocate a total of 10 hrs for this reaction ( =1/’0 hrs, the summation is
over all reactors) and a large conversion is desired, would you suggest having a lot of small
mixed reactors or a few large mixed reactors? Explain your reasoning using some
calculations. Hint: a larger reactor has a larger fluid residence time.

STEPS:

 Then use the value of number of equal size mixed reactor (N=6) and residence time (t = 10 hr,
summation is over all reactor) for calculate the value of total conversion.
 The other calculated value of total conversion for N=6 and t=5 will be given below:

10 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

Fig no.4

 The maximum value of conversion will be achieved at N=6 and t=10 hr as compared to
previous value of conversion for N=6 and t=5.
CODE:

%Then find the value of total conversion(Xt)at N=6 and ti=10hr

ti=10;%ti is the residence time of all reactors

Xt=1-(1./((1+K*ti).^N))

(d) Reason of using a lot of small mixed reactors as compared to large reactors:

We suggest a lot of small mixed reactors as compared to the few large mixed reactor. Because the
residence time of fluid will less in small mixed reactors and maximum value of conversion will be
achieved. But in large rectors, the residence time of fluid will increase as compared residence time
of small mixed reactors. So, low value of conversion will achieve for large reactors.

QUESTION NO:4
A mixture containing 50 wt% toluene (T), 35 wt% benzene (B), and 15 wt% xylene (X) is fed
to a distillation column. The top product from the column contains 6.3 wt% toluene, 91.4
wt% benzene, and 2.3 wt% xylene. The bottom product is fed to a second column. The top
product from the second column contains 91.6 wt% toluene, 4.25 wt% benzene, and 4.15
wt% xylene. 10 wt% of the toluene fed to the process is recovered in the bottom product
from the second column, and 83.3 wt% of the xylene fed to the process is recovered in the
same stream. Determine the compositions and flow rates of all streams if the feed flow rate
is 100 kg/minute.

11 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

SOLUTION:
STEPS
 First from the data in the question convert the wt% into compositions.
 After that from the equations find the value of nT4 and nX4

Fig no.5

 After that put the values of compositions and flow rates in the given six equations.
 Form a 6×6 matrix with the help of equations and find the values of unknown.
 Use (X = A\B) to find the matrix of unknown values.

Fig no.5
 After that find the flow rates of stream 2 and 4.
12 | P a g e Group Members: Muhammad Shahryar Khan
Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

 From these flow rates we can find the compositions of toluene, xylene and benzene in
stream 2 and 4.
 The formula for finding the composition is given in the code.

Fig no. 6(values at n2) Fig no. 7(values at n4)

CODE:
Wtf=0.5;%composition of toluene in feed stream
Wbf=0.35;%composition of benzene in feed stream
Wxf=0.15;%composition of xylene in feed stream
F=100;%f;ow rate of feed stream is in kg/min
%
Wt1=0.063;%composition of toluene in stream1
Wb1=0.914;%composition of benzene in stream1
Wx1=0.023;%composition of xylene in stream1
%
Wt3=0.916;%composition of toluene in stream3
Wb3=0.0425;%composition of benzene in stream3
Wx3=0.0415;%composition of xylene in stream3
%
Rt=0.1;%recovered toluene from stream4
Rx=0.833;%recovered xylene from stream4
%
nT4=Rt*Wtf*F%flow rate of toluene in stream4
nX4=Rx*Wxf*F%flow rate of xylene in strean4
%as we are given with the equations in the question we can form a matrix by
%putting the values of compositions and flow rates of each stream
A=[0.063 1 0 0 0 0; 0.023 0 0 1 0 0; 0 0 -1 0 0.0425 1; 0.914 0 1 0 0 0; 0 1 0 0 -0.916 0; 0 0 0 1 -0.0415 0];
B=[50;15;0;35;5;12.495];
X=A\B;
fprintf('\n X1=%.4f n1 \n X2=%.4f nT2 \n X3=%.4f nB2 \n X4=%.4f nX2 \n X5=%.4f n3 \n X6=%.4f nB4 \n',X)
%now we lnow the values of n1 nT2 nB2 nX2 n3 nB4. so now we can calculate
%n2 n4 Wt2 Wb2 Wx2 Wt4 Wb4 Wx4
nT2=48.5420;
nB2=13.8468;
nX2=14.4677;
n2=nT2+nB2+nX2%flow rate of stream 2
nT4=5;%toluene is 10% of F in stream 4
13 | P a g e Group Members: Muhammad Shahryar Khan
Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

nX4=12.495;%xylene is 83.3% of F in stream 4


nB4=11.8265;
n4=nT4+nX4+nB4%flow rate of stream 4
%compositions of three components in stream 2
Wt2=nT2/n2
Wb2=nB2/n2
Wx2=nX2/n2
%composition of three components in stream 4
Wt4=nT4/n4
Wb4=nB4/n4
Wx4=nX4/n4

QUESTION NO:5
(a) Determine the bubble temperature (t) of a liquid binary mixture containing 20 mol%
acetone (xi) and 80 mol% methanol at 1 atm (P). Also calculate the mol fraction of acetone
in vapor phase (yi) at that bubble temperature. From thermodynamics, the following
equations can be set up:

(b) Plot the bubble point temperature as a function of the mol fraction of component 1 in
the liquid phase (x1). Note: y-axis: t, x-axis: x1

14 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

SOLUTION:
a) Determine the bubble temperature (t) of a liquid binary mixture containing 20 mol%
acetone (xi) and 80 mol% methanol at 1 atm (P). Also calculate the mol fraction of acetone
in vapor phase (yi) at that bubble temperature. From thermodynamics, the following
equations can be set up

STEPS:
 Create an M-file on MATLAB.
 Write the values that are given in the problem and that will be used in the formulas as
shown below.
 Write formulas that are required for the bubble temperature. Then, calculate mole
fractions.

Fig no.8

(b) Plot the bubble point temperature as a function of the mol fraction of component 1 in
the liquid phase (x1). Note: y-axis: t, x-axis: x1
STEPS:
 Now plot a graph between x1 and temperature, for this write the data in M-file to plot a
graph as shown below.

Fig no.9

15 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

Graph no.5: plot between T and mole fractions in liquid phase.


CODE:
p=101.325; % pressure is in kpa here
x1=0.2; % x1 is used for the acetone
T1sat=2795.82/(14.3916-4.6183)-230;
T2sat=3644.3/(16.5938-4.6183)-239.76;
gamma1=exp(0.64*(1-x1).^2);
Tx=60.56; % this is average of T1,T2sat.
logP1sat=14.3916-2795.82/(Tx+230);
P1sat=exp(logP1sat);
T=2795.82/(14.3916-logP1sat)-230 % This gives the value of bubble point temperature
y1=(x1*gamma1*P1sat)/p
y2=1-y1 % this is used to find y2 also
For graph plotting:
P=101.325;
T=linspace(56.0681,64.5538,5);
x1=linspace(0,1,5);
plot(x1,T)
xlabel('x1')
ylabel('T')
title('Plot between Temperature and mole fraction in liquid phase')% done by
saad
ANSWERS:

16 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

Fig no.10

Given above are the values of bubble temperature and mole fractions of vapor phase.

QUESTION NO:6
The mean molar heat capacity of nitrogen between 298 K and T at 1 atm has been
tabulated as follow:

T [K] 373.0 473.0 573.0 673.0 773.0 873.0 973.0


Cp 29.19 29.29 29.46 29.68 29.97 30.27 30.56
[J/mol.K]

Determine the mean molar heat capacity of nitrogen between 298 K and
a. 450 K
b. 525 K
c. 740 K

SOLUTION:
STEPS:
 First create an m file and from the data given in the table write the values of T and Cp in
the form of matrix.
 Also form a matrix from the three values of temperature given after the table and name
this matrix as To.
 After that write the formula for interpolation in the m file.

𝐶𝑝 = (𝑇, 𝐶𝑝 , 𝑇𝑜 ,′ 𝑃𝐶𝐻𝐼𝑃′ )

 At the end save the file and click on the run button to run the code.
 The answers for this m file will be shown in the command window.

CODE:
T=[373 473 573 673 773 873 973];% temperature is in (K)
Cp=[29.19 29.29 29.46 29.68 29.97 30.27 30.56];% heat capacity is in J/mol.K
To=[450 525 740];
Cp=interp1(T,Cp,To,'PCHIP');
%from this we get diffrent values of Cp at To
%For interpolation we can also other methods like cubic,linear,nearest and
%spline method.
fprintf('\n Cp1=%3f \n Cp2=%3f \n Cp3=%3f \n',Cp)
%fprintf command is sed to display the answers in rows.

17 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

ANSWERS:

Fig no.11

As you can see all the answers are in different line. This is due to fprintf command in the code.
This command can be used to display the answers in rows.

QUESTION NO:7
The vapor pressure (P) of water and the specific volume (v) of saturated water vapor are
tabulated in a steam table:

T [oC] 0.01 3.0 6.0 9.0 12.0 15.0 18.0

P (kPa) 0.6113 0.7577 0.9349 1.1477 1.4022 1.7051 2.0640

v (m3/kg) 206.136 168.132 137.734 113.386 93.784 77.926 65.038

Determine the vapor pressure of water and the specific volume (v) of saturated water vapor
at:
a) 1°C
b) 10°C
c) 14°C

SOLUTION:
STEPS:
 First create an m file and from the data given in the table write the values of T and P and
V in the form of matrix.
 Also form a matrix from the three values of temperature given after the table and name
this matrix as Ti.
 After that write the formula P and V separately for interpolation in the m file.

𝑃 = (𝑇, 𝑃, 𝑇𝑖 ,′ 𝑃𝐶𝐻𝐼𝑃′ )
𝑉 = (𝑇, 𝑉, 𝑇𝑖 ,′ 𝑠𝑝𝑙𝑖𝑛𝑒′)

18 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar
ASSIGNMENT NO.2

 At the end save the file and click on the run button to run the code.
 The answers will be shown in the command window.
 For interpolation we can use different methods and the will be approximately equal.

CODE:
T=[0.01 3.0 6.0 9.0 12.0 15.0 18.0];%temperature is in degree centigrade
P=[0.6113 0.7577 0.9349 1.1477 1.4022 1.7051 2.0640];%vapour prssure is in kPa
V=[206.136 168.132 137.734 113.386 93.784 77.926 65.038];%specific volume is in m3/kg
Ti=[1 10 14];%temperature is in degree centigrade
P=interp1(T,P,Ti,'spline');%can alo use oyher methods and this is 1D interpoltion
fprintf('\n P1=%4f \n P2=%4f \n P3=%4f \n',P)
V=interp1(T,V,Ti,'PCHIP');
fprintf('\n V1=%4f \n V2=%4f \n V3=%4f \n',V)

ANSWERS:

Fig no.12

After using fprintf command the answers will be like Fig: 2. Fprintf command is written in the
code.

19 | P a g e Group Members: Muhammad Shahryar Khan


Hafza Asghar
Minahil Mukhtar
Saad Babar

You might also like