Professional Documents
Culture Documents
in Scilab
Prashant Dave
Indian Institute of Technology Bombay
(IIT Bombay)
Introduction
2 / 35
Fzi
Flash Drum
Lxi
3 / 35
Contd.
We have following Equations
1. Equilibrium Relations
yi = ki xi (i = 1, 2, 3)
2. Overall Mass Balance
F=L+V
3. Component Balance
Fzi = Lxi + Vyi = Lxi + Vki xi
4.
X
xi = 1
4 / 35
Contd.
Set of Non-linear Algebraic Equations
We have 5 equations and 5 unknown
Can be written as
f1 (x1 , x2 , x3 , L, V) = 0
f2 (x1 , x2 , x3 , L, V) = 0
f3 (x1 , x2 , x3 , L, V) = 0
f4 (x1 , x2 , x3 , L, V) = 0
f5 (x1 , x2 , x3 , L, V) = 0
or
F(x) = 0
5 / 35
CA2
CA1
Tank 1
Tank 2
CA3
Tank 3
By Mass Balance
dCA1 /dt = 1/ (CA0 CA1 ) kCA1
dCA2 /dt = 1/ (CA1 CA2 ) kCA2
dCA3 /dt = 1/ (CA2 CA3 ) kCA3
Here
= /V
6 / 35
Contd.
7 / 35
8 / 35
Assumptions
1. Isothermal Conditions
2. Zero order reaction
3. Well mixed
4. All reactants enters at the same time
Approximation
1. Reactant B is in excess so its concentration does
not change
9 / 35
Mathematical Formulation
The reaction rate
rA = f(T, CA )
reaction rate is given by
rA = dCA /dt = kA CA
ZCA
Zt
dCA /CA = kA
CA0
dt
0
we get
log(CA /CA0 ) = kA t
and Substituting
CA = CA0 Cc
log((CA0 Cc )/(CA0 )) = kA t
10 / 35
Data Analysis
Data has been given
1. t
2. CA0
3. Cc
11 / 35
Slope
kA = 0.314min1
Data is Exact
Effect of noise on experimental data
12 / 35
Effect of Noise
Add noise to the data (using random numbers)
Calculate slope using First and Last data point
13 / 35
Effect of Noise
Add noise to the data (using random numbers)
Calculate slope using First and Last data point
command in Scilab)
14 / 35
Effect of Noise
Add noise to the data (using random numbers)
Calculate slope using First and Last data point
command in Scilab)
Calculate slope using Points calculated by L.S. Fit
15 / 35
Effect of Noise
Add noise to the data (using random numbers)
Calculate slope using First and Last data point
command in Scilab)
Calculate slope using Points calculated by L.S. Fit
Which slope is closer to the slope of original data ?
16 / 35
XA = 0.4
V1
FA0
XA = 0.8
V2
FA0
17 / 35
Mathematical Formulation
Mass balance over elemental volume dV of the reactor
rA dV = FA0 dXA
Rearranging and integrating
ZV
ZXA2
dV/FA0 =
dXA /rA
0
XA1
ZXA1
V = FA0
dXA /rA
XA2
Contd..
and
ZXA2
V2 = FA0
dXA /rA
XA1
Total Volume
V = V1 + V2
19 / 35
Role of Scilab
Need to integrate the above Equations
Create a function file to integrate above equations
Use help inttrap command in Scilab for
integration
20 / 35
Role of Scilab
Need to integrate the above Equations
Create a function file to integrate above equations
Use help inttrap command in Scilab for
integration
The results are
V1 = 72.26dm3
V2 = 154.67dm3
and
V = 226.93dm3
21 / 35
22 / 35
Mathematical formulation
By mechanical energy balance
dp/ = d(u2 /2gc ) + (u2 /2gc )fdL/rH
dp = 2 d(u2 /2gc ) + 2 (u2 /2gc )fdL/rH
Also
u = G
udu = (G2 3 )d
and
= Mp/RT
23 / 35
Contd.
On Substitution, we get
(M/RT)pdp G2 /(gc )d/ + G2 fdL/(2gc rH )
Integrating between stations a and b
(M/2RT)(p2a p2b ) G2 /(gc ) ln a /b = G2 fL/(2gc rH )
Using
pa /pb
in place of
a /b
and rearranging
q
pb = p2a (2RT/M)G2 fL/(2gc rH ) + G2 /(gc ) ln pa /pb
24 / 35
Role of Scilab
25 / 35
Role of Scilab
Result is
pa = 1.22bar
26 / 35
CA2
CA1
Tank 1
Tank 2
CA3
Tank 3
27 / 35
Mathematical Formulation
Determination of State variable
Making a Mass Balance over each tank, we get
28 / 35
Role of Scilab
Use ode to solve set of differential equations
Create a function file to solve the set of differential
equations
29 / 35
CA0
Tank 1
CA1
CA2
Tank 2
CA3
Tank 3
CAM
1
FeedBack
controller
E = Error
+
Cset
A3
mathematical Formulation
From the previous problem, we have
E(t) dt)
31 / 35
Role of Scilab
Use ode to solve set of differential equations
Create a function file to solve the set of differential
equations
32 / 35
Concluding Remarks
etc.)
Work required in this direction
Still a powerful tool for numerical and
mathematical calculation
33 / 35
References
1. Patwardhan, S.,C., Lecture Notes for
Computational Methods in Chemical Engineering
2. McCabe, L.,W., Smith, J.,C., Harriott, P., Unit
Operations of Chemical Engineering, Fifth Edition,
1993
3. Fogler, H.,S., Elements of Chemical Reaction
Engineering, Third Edition, 2004,
4. Luyben, W., L., Process Modeling, Simulation, and
Control for Chemical Engineers, Second Edition,
1990
34 / 35
Thank You.
35 / 35