Professional Documents
Culture Documents
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:
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
Graph no.1
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:
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).
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:
D2=6;
D2/12;
D=linspace(D1,D2);% Use linspace function for generate the linearly spaced vectors.
%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)
plot(D,C)
%Find the value of minimum cost from different value of annual cost at specific value of diameter.
[M,I]=(min(C))%I show the no of given specefic diameter at which minimum cost will show
disp(D(I))
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.
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:
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
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:
CODE:
t2=40;
Xt=1-(1./((1+K*t).^N))
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.
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
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(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
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:
N=6;
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:
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:
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.
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.
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
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
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
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:
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.
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:
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.
𝑃 = (𝑇, 𝑃, 𝑇𝑖 ,′ 𝑃𝐶𝐻𝐼𝑃′ )
𝑉 = (𝑇, 𝑉, 𝑇𝑖 ,′ 𝑠𝑝𝑙𝑖𝑛𝑒′)
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.