You are on page 1of 76

CHE 509: Process Dynamics

MODULE 2:
Chemical Process Modeling

Ayorinde Bamimore, Ph.D.


Department of Chemical Engineering
Obafemi Awolowo University
The Chemical Process

Energy

Chemical
Raw materials Process Finished Product

Energy

Fig. 2.1. The Chemical Process

Obafemi Awolowo University 2


Chemical Engineering
The Variables of a Process

INPUT
Disturbances

Measured Unmeasured

Measured
OUTPUT
INPUT Chemical
Controlled
Manipulated Process Unmeasured Variables
Variables

Fig. 2.2. The variables of a process


Obafemi Awolowo University 3
Chemical Engineering
Defining The Variables of a Process
State variables are generally recognized as the minimum set of
variables essential for completely describing the internal state or
condition of a process. The state variables are therefore the time
indicators of the internal state of the process system.
Thus the output variables are, in actual fact, those by which one
obtains information about the internal state of the process.
It is possible to further classify input variables as:
 Those input variables that are at our disposal to independently
stimulate the process freely as we choose are called manipulated (or
control) variables.
 Those over which we have no control (i.e. those whose values we are in
no position to decide at will) are called disturbance variables.

Obafemi Awolowo University 4


Chemical Engineering
Formulating Process Models

Accumulation = IN – OUT + Gen. – Disap. (2.1a)

Population Accumulation = Immigration – Emigration


+ Birth Rate – Death Rate (2.1b)

Obafemi Awolowo University 5


Chemical Engineering
State Space Representation of Dynamic Systems
 Dynamic systems are often modelled using state space
model.
 State-space model is a mathematical representation of a
physical system as a set of input, output and state
variables related by first-order differential or difference
equations.
 The state-space refers to the Euclidean space in which
the variables on the axes are the state variables.

Obafemi Awolowo University 6


Chemical Engineering
State Space Representation of Dynamic Systems

Fig. 2.3a. A three-dimensional Euclidean space


Obafemi Awolowo University 7
Chemical Engineering
Continuous Time State Space Model
The continuous time nonlinear state space equation can
be written as:
𝑑𝑥1
= f1 (𝑥1 , … , 𝑥𝑛 , 𝑢1 , … , 𝑢𝑚 )
𝑑𝑡
𝑑𝑥2
= f2 (𝑥1 , … , 𝑥𝑛 , 𝑢1 , … , 𝑢𝑚 ) (2.2a) state equation
𝑑𝑡
⋮ ⋮
𝑑𝑥𝑛
= fn (𝑥1 , … , 𝑥𝑛 , 𝑢1 , … , 𝑢𝑚 )
𝑑𝑡

N.B: Any ordinary differential equation of any order can


be cast as a set of first order ordinary differential
equations as follows:
Obafemi Awolowo University 8
Chemical Engineering
Continuous Time State Space Models
𝑦1 = 𝑔1 (𝑥1 , … , 𝑥𝑛 , 𝑢1 , … , 𝑢𝑚 )
𝑦2 = 𝑔2 (𝑥1 , … , 𝑥𝑛 , 𝑢1 , … , 𝑢𝑚 ) (2.2b) output equation
⋮ ⋮
𝑦𝑝 = 𝑔𝑝 (𝑥1 , … , 𝑥𝑛 , 𝑢1 , … , 𝑢𝑚 )

The general nonlinear state space model can be casted as:


𝑑𝑥
= 𝑓(𝑥 (𝑡), 𝑢(𝑡)) (2.3a) state equation
𝑑𝑡
𝑦 = 𝑔(𝑥 (𝑡), 𝑢(𝑡)) (2.3b) output equation

Linear Time Variant (LTV) Model


𝑑𝑦
= 𝐴(𝑡)𝑥(𝑡) + 𝐵(𝑡)𝑢(𝑡) (2.4a) state equation
𝑑𝑥
𝑦 = 𝐶 (𝑡)𝑥(𝑡) + 𝐷 (𝑡)𝑢(𝑡) (2.4b) output equation
Obafemi Awolowo University 9
Chemical Engineering
Continuous Time State Space Model
Linear Time Invariant (LTI) Model
𝑑𝑥
= 𝐴𝑥(𝑡) + 𝐵𝑢(𝑡) (2.5a) state equation
𝑑𝑡
𝑦 = 𝐶𝑥 (𝑡) + 𝐷𝑢(𝑡) (2.5b) output equation

Obafemi Awolowo University 10


Chemical Engineering
Example 2.1
The differential equation governing the behavior of an
amplifier, servomotor, gearbox and potentiometer system as
shown below:
u(t) y(t)
Amplifier Servomotor Gearbox Potentiometer
U(s) Y(s)

Fig. 2.3.
𝑑3 𝑦 𝑑2 𝑦 𝑑𝑦
+ 32 + 60 = 45000𝑢 (2.6)
𝑑𝑡 3 𝑑𝑡 2 𝑑𝑡
where 𝑦 is the potentiometer output voltage and 𝑢 is the
amplifier input voltage.
Question: Express Eq.(2.6) as a system of first order and
obtain the state space matrices.

Obafemi Awolowo University 11


Chemical Engineering
Example 2.1

Solution
Let 𝑦 = 𝑥1
By successive differentiating wrt t, we have:
𝑑𝑦 𝑑𝑥1
= = 𝑥2 (2.7a)
𝑑𝑡 𝑑𝑡
𝑑2 𝑦 𝑑𝑥2
= = 𝑥3 (2.7b)
𝑑𝑡 2 𝑑𝑡

𝑑3 𝑦 𝑑𝑦 𝑑2 𝑦 𝑑𝑥3
= ( )= (2.7c)
𝑑𝑡 3 𝑑𝑡 𝑑𝑡 2 𝑑𝑡

Obafemi Awolowo University 12


Chemical Engineering
Example 2.1
Substituting and re-arranging, we have

𝑑𝑥1
= 𝑥2 (2.7d)
𝑑𝑡
𝑑𝑥2
= 𝑥3 (2.7e)
𝑑𝑡
𝑑𝑥3
= −60𝑥2 −32𝑥3 + 45000𝑢 (2.7f)
𝑑𝑡

Output equation
𝑦 = 𝑥1 (2.7g)

Obafemi Awolowo University 13


Chemical Engineering
Example 2.1
In matrix form, we have
𝑥1 0 1 0 𝑥1 0
[𝑥2 ] = ⌈0 0 1 ⌉ [𝑥2 ] + [ 0 ] 𝑢 (2.7h)
𝑥3 0 −60 −32 𝑥3 45000
𝑥1
𝑦 = [1 0 0] [𝑥2 ] (2.7i)
𝑥3
NB:
Eq.(2.7h and i) is the form of Eq. (2.5) with D=0

Obafemi Awolowo University 14


Chemical Engineering
Transfer Function Matrices from State Space Equations
Recall Eq.(2.5)
𝑑𝑦
= 𝐴𝑥(𝑡) + 𝐵𝑢(𝑡) (2.5a) state equation
𝑑𝑡
𝑦 = 𝐶𝑥 (𝑡) + 𝐷𝑢(𝑡) (2.5b) output equation

Taking Laplace transform of Eq.(2.5a), gives


𝑠𝑋(𝑠) − 𝐴𝑋(𝑠) = 𝐵𝑈(𝑠) + 𝑥(0) (2.8a)
𝑋(𝑠)(𝑠𝐼 − 𝐴) = 𝐵𝑈(𝑠) + 𝑥(0) (2.8b)
𝑋(𝑠) = (𝑠𝐼 − 𝐴)−1 𝐵𝑈(𝑠) (2.8c)

𝑑𝑓
NB: 𝐿 [ ] = 𝑠𝐹 (𝑠) − 𝑓(0) (2.8ci)
𝑑𝑡
𝐿[𝑓(𝑡)] = 𝐹(𝑠) (2.8cii)

Obafemi Awolowo University 15


Chemical Engineering
Transfer Function Matrices from State Space Equations
Taking Laplace transform of Eq.(2.5b), gives

𝑌(𝑠) = 𝐶𝑋(𝑠) + 𝐷𝑈(𝑠) (2.8d)

Substituting (2.8c) into (2.8d), we have


𝑌(𝑠) = 𝐶 [(𝑠𝐼 − 𝐴)−1 𝐵𝑈(𝑠)] + 𝐷𝑈(𝑠) (2.8e)

𝑌 (𝑠 )
= 𝐺(𝑠) = 𝐶 (𝑠𝐼 − 𝐴)−1 𝐵 + 𝐷 (2.9f)
𝑈𝑠)

𝑌 (𝑠 ) 𝑎𝑑𝑗(𝑠𝐼−𝐴)
= 𝐺(𝑠) = 𝐶 𝐵+𝐷 (2.9g)
𝑈(𝑠) det⁡(𝑠𝐼−𝐴)

Obafemi Awolowo University 16


Chemical Engineering
Transfer Function Matrices from State Space Equations
NB
 Eq.(2.9f) is usually used for converting state space model to
transfer function model.
 The denominator of Eq.(2.9f) is referred to as the
characteristics equation.

|𝒔𝑰 − 𝑨| = 𝟎 (2.9h)

 The roots of Eq.(2.9h) give the poles of the system.


 It must be noted that there may be more roots than there are
poles, since cancellation of factors in the characteristics
polynomial det(sI – A) may occur when Eq.(2.9g) is worked out.

Obafemi Awolowo University 17


Chemical Engineering
The Concept of Stability

Fig. 2.4: Three possible response of a dynamic


system to a disturbance
Obafemi Awolowo University 18
Chemical Engineering
The Concept of Stability
Three possible responses of a process “disturbed” from its
initial steady state by a forcing function:

[1.] Response 1: Proceed to a new steady state and settles


there, or
[2.] Response 2: Fail to attain steady state conditions because
its output grows indefinitely, or
[3.] Response 3: Fail to attain steady state conditions because
the process oscillates indefinitely with constant amplitude.
Response [1] can be said to be stable while [2] and [3] are
unstable.

Obafemi Awolowo University 19


Chemical Engineering
Stability of Continuous LTI systems
A linear system is stable if and only if all its poles have negative
real parts so that they lie in the left half of the complex plane;
otherwise it is unstable.

Fig. 2.5: Complex plane showing the location of systems


poles(x) and zeros(o)

Obafemi Awolowo University 20


Chemical Engineering
Stability of Continuous LTI systems - Example
Determine the stability of a system with transfer function
(𝑠 + 1)
𝑔(𝑠) =
(𝑠 − 2)(3𝑠 + 2)

(𝑠 − 2)(3𝑠 + 2) = 0

Poles as: 𝑠 = +2 and s=-2/3=-0.67


Since it has at least one pole in the RHP, the system is
UNSTABLE

Obafemi Awolowo University 21


Chemical Engineering
Realization of Continuous State Space Equation
The reverse procedure of constructing state equations from a
given transfer matrix is known as a state variable realization.

Laplace Transforming
AB G(s)
CD State space realization

Obafemi Awolowo University 22


Chemical Engineering
Minimal Realization of SISO Systems

Obafemi Awolowo University 23


Chemical Engineering
Discrete Time State Space Model
The continuous nonlinear Eq.(2.3) can often be
discretized to obtain its discrete equivalent:

𝑥(𝑘 + 1) = 𝑓(𝑥 (𝑘 ), 𝑢(𝑘 )) (2.10a) state equation


𝑦(𝑘) = 𝑔(𝑥 (𝑘 ), 𝑢(𝑘 )) (2.10b) output equation

where 𝑥 (𝑘 ) is a vector of state variables, 𝑢(𝑘 ) is a vector


of input variables and 𝑦(𝑘 ) is a vector of output variables.
Most discrete systems can be modeled by a set of first
order difference equations of the form in (2.10).

Obafemi Awolowo University 24


Chemical Engineering
Discrete Time Models
Discrete Linear Time Variant (LTV) Model
𝑥(𝑘 + 1) = 𝐴𝑑 (𝑘)𝑥(𝑘) + 𝐵𝑑 (𝑘)𝑢(𝑘) (2.11a) state equation
𝑦(𝑘) = 𝐶 (𝑘)𝑥(𝑘) + 𝐷 (𝑘)𝑢(𝑘) (2.11b) output equation

Discrete Linear Time Invariant (LTI) Model


𝑥(𝑘 + 1) = 𝐴𝑑 𝑥(𝑘) + 𝐵𝑑 𝑢(𝑘) (2.12a) state equation
𝑦(𝑘) = 𝐶𝑥 (𝑘) + 𝐷𝑢(𝑘) (2.12b) output equation

Matrices 𝐴𝑑 and 𝐵𝑑 can be obtained using “exact discretization”


The subroutine in MATLAB for obtaining 𝐴𝑑 and 𝐵𝑑 from 𝐴
and 𝐵 is given by “c2d”.

Obafemi Awolowo University 25


Chemical Engineering
Example 2.2
A discrete system is governed by the difference equation:
𝑦(𝑘 + 3) − 2.4𝑦(𝑘 + 2) + 1.85𝑦(𝑘 + 1) − 0.45𝑦(𝑘) = 400𝑢(𝑘) (2.13)
where 𝑢(𝑘) is the input to the system and 𝑦(𝑘) is the output.
Question: Obtain the state space matrices 𝐴𝑑 , 𝐵𝑑 , 𝐶 and 𝐷.
Solution
Let 𝑦(𝑘) = 𝑥1 (𝑘), (2.14)
Then successive differentiation gives:
⇒ 𝑦(𝑘 + 1) = 𝑥1 (𝑘 + 1) = 𝑥2 (𝑘) (2.14a)
⇒ 𝑦(𝑘 + 2) = 𝑥2 (𝑘 + 1) = 𝑥3 (𝑘) (2.14b)
⇒ 𝑦(𝑘 + 3) = 𝑥3 (𝑘 + 1) (2.14c)

Substituting in Eq.(2.13), we have:


𝑥3 (𝑘 + 1) − 2.4𝑥3 (𝑘) + 1.85𝑥2 (𝑘) − 0.45𝑥1 (𝑘) = 400𝑢(𝑘) (2.14d)

Obafemi Awolowo University 26


Chemical Engineering
Example 2.2
In matrix form, Eqs.(2.14a,b and d) can be written as:
𝑥1 (𝑘 + 1) 0 1 0 𝑥1 (𝑘) 0
[𝑥2 (𝑘 + 1)] = ⌈ 0 0 1 ⌉ [𝑥2 (𝑘)] + [ 0 ] 𝑢(𝑘) (2.14e)
𝑥3 (𝑘 + 1) 0.45 −1.85 −2.4 𝑥3 (𝑘) 400

𝑥1 (𝑘)
𝑦 = [1 0 0] [𝑥2 (𝑘)] (2.14f)
𝑥3 (𝑘)

NB: This is in the form of Eq.(2.12a and b)

Obafemi Awolowo University 27


Chemical Engineering
The z-transfer function
By taking the z-transform of Eq.(2.12a-b), taking 𝑥 (0) = 0

𝑥(𝑘 + 1) = 𝐴𝑑 𝑥(𝑘) + 𝐵𝑑 𝑢(𝑘) (2.12a) state equation


𝑦(𝑘) = 𝐶𝑥 (𝑘) + 𝐷𝑢(𝑘) (2.12b) output equation

𝑧𝑋(𝑧) = 𝐴𝑑 𝑋(𝑧) + 𝐵𝑑 𝑈(𝑧) (2.15a) state equation


𝑌(𝑧) = 𝐶𝑋(𝑧) + 𝐷𝑈(𝑧) (2.15b) output equation
Eliminating 𝑋(𝑧) yields the transfer function
𝑌 (𝑧 )
= 𝐺(𝑧) = 𝐶 (𝑧𝐼 − 𝐴𝑑 )−1 𝐵𝑑 + 𝐷 (2.15c)
𝑈(𝑧)
NB: The system poles are included in the roots (eigenvalues)
of the characteristic equation:
|𝑧𝐼 − 𝐴𝑑 | = 0 (2.15d)
Obafemi Awolowo University 28
Chemical Engineering
Stability of Discrete LTI Systems
The discrete system is asymptotically stable if and only if all
the eigenvalues of Eq.2.15d lie inside the unit circle |𝑧| = 1

Fig. 2.6: Complex plane showing stable and unstable


region for a discrete time system

Obafemi Awolowo University 29


Chemical Engineering
Stability of Discrete LTI Systems - Example
Determine the stability of a system with transfer function
(𝑧 + 1)
𝑔(𝑠) =
(𝑧 − 1)(3𝑧 + 2)

(𝑧 − 1)(3𝑧 + 2) = 0

Poles as: 𝑧 = +1 and z=-2/3=-0.67

Since the system has a pole on the unit circle, it is marginally


stable.

Obafemi Awolowo University 30


Chemical Engineering
Realization of Discrete State Space Equation
This is the artifice of constructing𝐴𝑑 , 𝐵𝑑 , 𝐶 and 𝐷 given 𝐺(𝑧)

Laplace Transforming

Ad Bd G(z)
CD State space realization

Obafemi Awolowo University 31


Chemical Engineering
Dynamic Models of Representative Processes

Example 2.3: Thermocouple junction in a fluid


𝑇𝑚 =Temperature of thermocouple junction

𝑇𝑚

𝑇 𝑇=Temperature of fluid

Questions
(1) Derive the dynamic equation governing temperature
change at the thermocouple junction.
(2) Find the transfer function model.

Obafemi Awolowo University 32


Chemical Engineering
Example 2.3
Recall,
Accumulation = IN – OUT (2.16a)
Defining variables
𝑐 =specific heat capacity of the junction
𝑚 =mass of the junction
ℎ =heat transfer coefficient between the fluid and the junction
𝐴 =heat transfer area of the junction.
In thermocouple, energy is transferred into the junction, so
OUT term in Eq.(2.16a) will be zero.
The mode of heat transfer to the junction is by convection,
therefore, recall, Newton’s law of cooling

Obafemi Awolowo University 33


Chemical Engineering
Example 2.3

𝑑𝑇𝑚
𝑚𝑐 = ℎ𝐴(𝑇 − 𝑇𝑚 ) (2.16b)
𝑑𝑡

Obafemi Awolowo University 34


Chemical Engineering
Example 2.3

At steady state, Eq.(2.16b) can be written as:


𝑑𝑇𝑚𝑠𝑠
𝑚𝑐 = 0 = ℎ𝐴(𝑇𝑠𝑠 − 𝑇𝑚𝑠𝑠 ) (2.16c)
𝑑𝑡
Now, we subtract Eq.(2.16c) from 2.16b to obtain
𝑑(𝑇𝑚 −𝑇𝑚𝑠𝑠 )
𝑚𝑐 = ℎ𝐴[(𝑇 − 𝑇𝑠𝑠 ) − (𝑇𝑚 − 𝑇𝑚𝑠𝑠 )] (2.16d)
𝑑𝑡
By setting 𝑇 − 𝑇𝑠𝑠 = 𝛿𝑇, and 𝑇𝑚 − 𝑇𝑚𝑠𝑠 = 𝛿𝑇𝑚 , we have

NB: we have introduced new variables, 𝛿𝑇 and 𝛿𝑇𝑚 which are


called deviation variables.
𝑑𝛿𝑇
𝑚𝑐 𝑚 = ℎ𝐴[𝛿𝑇 − 𝛿𝑇𝑚 ] (2.16e)
𝑑𝑡
Laplace transforming Eq.2.16e, we have:
Obafemi Awolowo University 35
Chemical Engineering
Example 2.3
𝑚𝑐
𝑠𝛿𝑇𝑚 (𝑠) = 𝛿𝑇(𝑠) − 𝛿𝑇𝑚 (𝑠) (2.16e)
ℎ𝐴

𝑚𝑐
Taking = 𝜏 and re-arranging, we have:
ℎ𝐴
𝛿𝑇𝑚 (𝑠) 1
= (2.16f)
𝛿𝑇 (𝑠) 𝜏𝑠+1
NB:
Eq.(2.16f) is referred to as the transfer function relating the
variation of the thermocouple temperature to the surrounding
fluid temperature.
Eq.(2.16f) is a first order transfer function with time constant
of 𝜏 and a gain of 1.

Obafemi Awolowo University 36


Chemical Engineering
Example 2.4: Two Non-Interacting Tanks in Series

Consider the flow into two non-interacting tanks in series:

𝑞𝑖 Assumptions
Constant density
Outflow varies linearly with height
𝑞1 = 𝛽1 ℎ1
𝑞1 𝑞2 = 𝛽2 ℎ2
𝐴1 , ℎ1

𝐴2 , ℎ2 𝑞2

Fig. 2.9: Two non-interacting tanks in series

Obafemi Awolowo University 37


Chemical Engineering
Example 2.4: Two Non-Interacting Tanks in Series

Questions:
[1] Derive the equations describing the variations of ℎ1 and ℎ2
with time.
𝛿ℎ1 𝛿ℎ2
[2] Determine the transfer functions: (a) and (b)
𝛿𝑞𝑖 𝛿𝑞𝑖
Solution
Recall,
Accumulation = IN – OUT (2.16a)
𝑑𝑚
= 𝑚̇𝑖𝑛 − 𝑚̇𝑜𝑢𝑡 (2.17a)
𝑑𝑡
𝑑
Tank1: (𝜌𝐴1 ℎ1 ) = 𝜌𝑞𝑖 − 𝜌𝑞1 = 𝜌𝑞𝑖 − 𝜌𝛽1 ℎ1 (2.17b)
𝑑𝑡

Obafemi Awolowo University 38


Chemical Engineering
Example 2.4: Two Non-Interacting Tanks in Series

𝑑
Tank 2: (𝜌𝐴2 ℎ2 ) = 𝜌𝑞1 − 𝜌𝑞2 = 𝜌𝛽1 ℎ1 − 𝜌𝛽2 ℎ2 (2.17c)
𝑑𝑡
The two odes describing the states of the tanks can then be
written as:
𝑑ℎ1 −𝛽1 1
= ℎ1 + 𝑞𝑖 (2.17d)
𝑑𝑡 𝐴1 𝐴1
𝑑ℎ2 𝛽1 𝛽2
= ℎ1 − ℎ2 (2.17e)
𝑑𝑡 𝐴2 𝐴2
In vector form, this can be written as
−𝛽1
ℎ̇1 0 ℎ 1
𝐴1 1
[ ]=[𝛽 ] [ ] + [𝐴1 ] 𝑞𝑖 (2.17f)
ℎ̇2 1 −𝛽 2 ℎ2 0
𝐴2 𝐴2

Obafemi Awolowo University 39


Chemical Engineering
Example 2.4: Two Non-Interacting Tanks in Series

If we intend controlling ℎ1 and ℎ2


ℎ1 1 0 ℎ1
[ ]=[ ][ ] (2.17g)
ℎ2 0 1 ℎ2
𝑎𝑑𝑗(𝑠𝐼−𝐴)
Recall that 𝐺(𝑠) = 𝐶 𝐵+𝐷 (2.9g)
det⁡(𝑠𝐼−𝐴)
−𝛽1
0 𝑥 0
𝐴1
Let 𝐴 = [ ]=[ ]
𝛽1 −𝛽2 𝑦 𝑧
𝐴2 𝐴2

𝑥 0 𝑠−𝑥 0
(𝑠𝐼 − 𝐴) = 𝑠 [1 0
]−[ ]=[ ] (2.17h)
0 1 𝑦 𝑧 −𝑦 𝑠−𝑧

Obafemi Awolowo University 40


Chemical Engineering
Example 2.4: Two Non-Interacting Tanks in Series

𝑎𝑑𝑗(𝑠𝐼 − 𝐴) = [cofactor(𝑠𝐼 − 𝐴)]T (2.17i)

+ − 𝑇

𝑠−𝑧 ⏞
−𝑦 𝑠−𝑧 𝑦 𝑇 𝑠−𝑧 0
=[ ] =[ ] =[ ] (2.17j)
+ 0 𝑠−𝑥 𝑦 𝑠−𝑥
0 ⏞
𝑠−𝑥
𝑠−𝑧 𝑦
𝑑𝑒𝑡(𝑠𝐼 − 𝐴) = | | = (𝑠 − 𝑥 )(𝑠 − 𝑧) (2.17k)
0 𝑠−𝑥
𝑠−𝑧 0
[ ] 1 𝑠 −𝑧 0
𝑦 𝑠−𝑥
(𝑠𝐼 − 𝐴)−1 = = [ ] (2.17l)
(𝑠−𝑥 )(𝑠−𝑧) (𝑠−𝑥 )(𝑠−𝑧) 𝑦 𝑠−𝑥

Obafemi Awolowo University 41


Chemical Engineering
Example 2.4: Two Non-Interacting Tanks in Series

1
1 𝑠−𝑧 0
−1
(𝑠𝐼 − 𝐴) 𝐵 = [ ] [𝐴1] (2.17m)
(𝑠−𝑥)(𝑠−𝑧) 𝑦 𝑠−𝑥
0
1
𝐴1 (𝑠−𝑥)
= [ 𝑦 ] (2.17n)
𝐴1 (𝑠−𝑥)(𝑠−𝑧)

1 1
1 0 𝐴1 (𝑠−𝑥) 𝐴1 (𝑠−𝑥)
𝐶 (𝑠𝐼 − 𝐴)−1 𝐵 = [ ][ 𝑦 ] =[ 𝑦 ] (2.17o)
0 1
𝐴1 (𝑠−𝑥)(𝑠−𝑧) 𝐴1 (𝑠−𝑥)(𝑠−𝑧)

Obafemi Awolowo University 42


Chemical Engineering
Example 2.4: Two Non-Interacting Tanks in Series

Substituting back for x, y and z, we have


1
𝛿ℎ1 ( )
(2.17p)
𝛽1
= 𝐴
𝛿𝑞𝑖 ( 1 )𝑠+1
𝛽1

1
𝛿ℎ1 ( )
(2.17q)
𝛽2
=
𝛿𝑞𝑖 𝐴 𝐴
(( 1 )𝑠+1)(( 2 )𝑠+1)
𝛽1 𝛽2

Obafemi Awolowo University 43


Chemical Engineering
Example 2.5: Single Nonlinear Tank

Consider a single nonlinear tank shown below:

Assumptions
Constant density
𝑞𝑖 Outflow varies directly as the square
root of the height
𝑞𝑜 = 𝑐 √ℎ

𝐴, ℎ
𝑞𝑜

Fig. 2.9: A single nonlinear tank

Obafemi Awolowo University 44


Chemical Engineering
Example 2.5: Single Nonlinear Tank

Question:
[1] Derive the mathematical model relating change in level
with time.
[2] Find the steady state solution of the model.
[3] Obtain a linearized model of the system.
[4] Obtain the process transfer function.
[5] Obtain the equation for a change in the level of the tank
when there is:
(a) a step change of size b in the input variable 𝑞𝑖
(b) a unit step change in the input variable 𝑞𝑖
[6] Find the pole of the system and comment on the stability
of the system.
Obafemi Awolowo University 45
Chemical Engineering
Example 2.5: Single Nonlinear Tank

Solution
[1] Recall,
Accumulation = IN – OUT (2.18a)
𝑑𝑚
= 𝑚̇𝑖𝑛 − 𝑚̇𝑜𝑢𝑡 (2.18b)
𝑑𝑡
𝑑
(𝜌𝐴ℎ) = 𝜌𝑞𝑖 − 𝜌𝑞𝑜 = 𝜌𝑞𝑖 − 𝜌𝑐 √ℎ (2.18c)
𝑑𝑡
𝑑ℎ 1 𝑐
= 𝑞𝑖 − √ℎ (2.18d)
𝑑𝑡 𝐴 𝐴

𝑑ℎ
[2] At steady state, = 0, hence, 𝑞𝑖𝑠𝑠 = 𝑐√ℎ 𝑠𝑠
𝑑𝑡
[3] Note that the obtained model (Eq.2.18d) is nonlinear
because of the square root term.

Obafemi Awolowo University 46


Chemical Engineering
Linearization of Nonlinear Models

Most chemical process models are nonlinear in nature. Most


often we linearize them. Why linearizing? We linearize for
the following reasons:

1) Linear models are easier to understand (than nonlinear


models)
2) Linear models are often employed to perform stability
analysis
3) Linear models are required for control systems design
for most design methods.

Obafemi Awolowo University 47


Chemical Engineering
Linearization of one state variable and one input variable model

Consider a function with one state variable and one input


variable:
𝑑𝑥
𝑥̇ = = 𝑓(𝑥, 𝑢) (i)
𝑑𝑡
Using a Taylor Series expansion, we have
𝜕𝑓 𝜕𝑓
𝑥̇ = 𝑓 (𝑥𝑠𝑠 , 𝑢𝑠𝑠 ) + | (𝑥 − 𝑥𝑠𝑠 ) + | (𝑢 − 𝑢𝑠𝑠 ) + ⋯
𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠
(ii)
𝑑𝑥 𝑑(𝑥−𝑥𝑠𝑠 )
Note that 𝑓(𝑥𝑠𝑠 , 𝑢𝑠𝑠 ) = 0, and = , then
𝑑𝑡 𝑑𝑡
𝑑(𝑥−𝑥𝑠𝑠 ) 𝜕𝑓 𝜕𝑓
≈ | (𝑥 − 𝑥𝑠𝑠 ) + | (𝑢 − 𝑢𝑠𝑠 ) (iii)
𝑑𝑡 𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠
Using the deviation variables, 𝛿𝑥 = (𝑥 − 𝑥𝑠𝑠 ) and 𝛿𝑢 =
(𝑢 − 𝑢𝑠𝑠 )

Obafemi Awolowo University 48


Chemical Engineering
Linearization of one state variable and one input variable model

𝑑𝛿𝑥 𝜕𝑓 𝜕𝑓
≈ | 𝛿𝑥 + | 𝛿𝑢 (iv)
𝑑𝑡 𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠

𝑑𝛿𝑥
≈ 𝑎𝛿𝑥 + 𝑏𝛿𝑢 (v)
𝑑𝑡
𝜕𝑓 𝜕𝑓
where 𝑎 = | and 𝑏 = | (vi)
𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠
If there is a single output equation that is a function of the
states and the input, then

𝑦 = 𝑔(𝑥, 𝑢) (vii)

Truncated Taylor’s series approximation of (vii) gives:

Obafemi Awolowo University 49


Chemical Engineering
Linearization of one state variable and one input variable model

𝜕𝑔
𝑦 = 𝑔(𝑥𝑠𝑠 , 𝑢𝑠𝑠 ) + | (𝑥 − 𝑥𝑠𝑠 ) + 𝑔|𝑥𝑠𝑠,𝑢𝑠𝑠 (𝑢 − 𝑢𝑠𝑠 ) + ⋯
𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠
(viii)
Note that 𝑔(𝑥𝑠𝑠 , 𝑢𝑠𝑠 ) = 𝑦𝑠𝑠 , then
𝜕𝑔 𝜕𝑔
𝑦 − 𝑦𝑠𝑠 ≈ | (𝑥 − 𝑥𝑠𝑠 ) + | (𝑢 − 𝑢𝑠𝑠 ) (ix)
𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠

𝑑𝛿𝑦 𝜕𝑔 𝜕𝑔
≈ | 𝛿𝑥 + | 𝛿𝑢 (x)
𝑑𝑡 𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠

𝑑𝛿𝑦
≈ 𝑐𝛿𝑥 + 𝑑𝛿𝑢 (xi)
𝑑𝑡

Obafemi Awolowo University 50


Chemical Engineering
Linearization of one state variable and one input variable model

𝜕𝑔 𝜕𝑔
where 𝑐 = | and 𝑑 = | (xii)
𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠

Obafemi Awolowo University 51


Chemical Engineering
Example 2.5: Single Nonlinear Tank (Cont’d)

Questions:
[3] Obtain a linearized model of the system.
[4] Obtain the process transfer function.
[5] Obtain the equation for a change in the level of the tank
when there is:
(a) a step change of size b in the input variable 𝑞𝑖
(b) a unit step change in the input variable 𝑞𝑖
[6] Find the pole of the system and comment on the stability
of the system.

Obafemi Awolowo University 52


Chemical Engineering
Example 2.5: Single Nonlinear Tank (Cont’d)

[3] Recall, the nonlinear dynamic model of the tank

𝑑ℎ 1 𝑐
= 𝑓(ℎ, 𝑞𝑖 ) = 𝑞𝑖 − √ℎ (2.18d)
𝑑𝑡 𝐴 𝐴

𝑑𝛿𝑥 𝜕𝑓 𝜕𝑓
≈ | 𝛿𝑥 + | 𝛿𝑢 (iv)
𝑑𝑡 𝜕𝑥 𝑥𝑠𝑠 ,𝑢𝑠𝑠 𝜕𝑢 𝑥𝑠𝑠 ,𝑢𝑠𝑠

Taylor’s series approximation (2.18d) gives:


𝑑𝛿ℎ 𝜕𝑓 𝜕𝑓
≈ | 𝑠𝑠
𝛿ℎ + | 𝛿𝑞𝑖 (2.18e)
𝑑𝑡 𝜕ℎ ℎ𝑠𝑠 ,𝑞 𝜕𝑞𝑖 ℎ ,𝑞 𝑠𝑠
𝑖 𝑠𝑠 𝑖

Obafemi Awolowo University 53


Chemical Engineering
Example 2.5: Single Nonlinear Tank (Cont’d)

𝑑𝛿ℎ 𝜕𝑓 𝜕𝑓
≈ | 𝛿ℎ + | 𝛿𝑞𝑖 (2.18e)
𝑑𝑡 𝜕ℎ ℎ𝑠𝑠 ,𝑞 𝑠𝑠 𝜕𝑞𝑖 ℎ ,𝑞 𝑠𝑠
𝑖 𝑠𝑠 𝑖

𝑑𝛿ℎ 𝑐 1
≈− 𝛿ℎ + 𝛿𝑞𝑖 (2.18f)
𝑑𝑡 2𝐴√ℎ𝑠𝑠 𝐴
By comparing the tank system with an electrical system
Variables Analogous to
𝐴 Tank capacitance
2𝐴√ℎ𝑠𝑠 Tank resistance
=𝑅
𝑐
𝑅𝐴 Tank’s time constant, 𝜏

Obafemi Awolowo University 54


Chemical Engineering
Example 2.5: Single Nonlinear Tank (Cont’d)

𝑑𝛿ℎ 1 1
= − 𝛿ℎ + 𝛿𝑞𝑖 (2.18g)
𝑑𝑡 𝜏 𝐴
[4] Obtain the process transfer function.
Taking the Laplace transform of (2.18g), we have
1 1
𝑠𝛿ℎ(𝑠) − 𝛿ℎ(0) = − 𝛿ℎ(𝑠) + 𝛿𝑞𝑖 (𝑠) (2.18h)
𝜏 𝐴
Setting 𝛿ℎ(0) to zero and re-arranging, gives
𝛿ℎ(𝑠) (𝜏/𝐴) 𝑅𝐴
= = (2.18i)
𝛿𝑞𝑖 (𝑠) 𝜏𝑠+1 𝑅𝐴𝑠+1

Obafemi Awolowo University 55


Chemical Engineering
Example 2.5: Single Nonlinear Tank (Cont’d)

[5] Obtain the equation for a change in the level of the tank
when there is:
(a) a step change of size b in the input variable 𝑞𝑖
(b) a unit step change in the input variable 𝑞𝑖
Solution
(𝜏/𝐴)
𝛿ℎ(𝑠) = 𝛿𝑞𝑖 (𝑠) (2.18j)
𝜏𝑠+1
𝑏
Given that 𝛿𝑞𝑖 (𝑡) = 1, it implies 𝛿𝑞𝑖 (𝑠) =
𝑠
(𝜏/𝐴) 𝑏
𝛿ℎ(𝑠) = (2.18k)
𝜏𝑠+1 𝑠

Obafemi Awolowo University 56


Chemical Engineering
Example 2.5: Single Nonlinear Tank (Cont’d)

𝑏 1 1
𝛿ℎ(𝑠) = ( ) (2.18l)
𝐴 𝑠 𝑠+1
𝜏
The expression inside the bracket can be split into partial
fractions thus:
1 1 𝑃 𝑄 𝜏 𝜏
( 1) = + 1 = − 1 (2.18m)
𝑠 𝑠+ 𝑠 𝑠+ 𝑠 𝑠+
𝜏 𝜏 𝜏
Thus, Eq.(2.18l) becomes
𝑏 𝜏 𝜏
𝛿ℎ(𝑠) = ( − 1 ) (2.18n)
𝐴 𝑠 𝑠+
𝜏
Taking the Inverse Laplace transform of (2.18m) gives

Obafemi Awolowo University 57


Chemical Engineering
Example 2.5: Single Nonlinear Tank (Cont’d)

𝜏𝑏
𝛿ℎ(𝑡) = (1 − 𝑒 −𝑡/𝜏 ) (2.18o)
𝐴

When b=1, (2.18m) becomes:


𝜏
𝛿ℎ(𝑡) = (1 − 𝑒 −𝑡/𝜏 ) (2.18p)
𝐴
[6] Find the pole of the system and comment on the stability
of the system.
𝛿ℎ(𝑠) (𝜏/𝐴) 𝑅𝐴
Recall, = = (2.18i)
𝛿𝑞𝑖 (𝑠) 𝜏𝑠+1 𝑅𝐴𝑠+1

Pole=−𝟏/𝝉. Since it is negative, it implies the system is


stable.
Obafemi Awolowo University 58
Chemical Engineering
Example 2.6: Single Nonlinear Tank

Consider again a single nonlinear tank shown below:

Tank’s model

𝑞𝑖 𝑑ℎ 1 𝑐
= 𝑓(ℎ, 𝑞𝑖 ) = 𝑞𝑖 − √ℎ (2.18d)
𝑑𝑡 𝐴 𝐴

𝐴, ℎ
𝑞𝑜

Fig. 2.9: A single nonlinear tank

Obafemi Awolowo University 59


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

Assuming the area of the tank is 10𝑐𝑚2 and the normal


level is 9𝑐𝑚 when inflow is 6𝑐𝑚3 /𝑠.
Obtain
[1] the constant c in the model of the tank
[2] the general model of the tank
[3] the response equation for change in the level of the
tank when the inflow is suddenly increased to 7.5 𝑐𝑚3 /𝑠.
Hence, find the nonlinear and linearized system solutions
via
(a) the analytical solution
(b) computer simulation using MATLAB/SIMULINK.

Obafemi Awolowo University 60


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

Solution
Given that, ℎ𝑠𝑠 = 9𝑐𝑚, 𝑞𝑖𝑠𝑠 = 6𝑐𝑚3 /𝑠
Recall that at steady state:⁡𝑞𝑖𝑠𝑠 = 𝑐√ℎ 𝑠𝑠 (2.18q)
Substituting gives, 𝑐 = 2

[2] the general model of the tank


Nonlinear model
𝑑ℎ 1 1
= 𝑞𝑖 − √ℎ (2.18d)
𝑑𝑡 10 5
Linearized model
𝑑𝛿ℎ 1 1
= 𝛿𝑞𝑖 − 𝛿ℎ (2.18f)
𝑑𝑡 10 30

Obafemi Awolowo University 61


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

[3]Obtain the response equation for change in the level of the


tank when the inflow is suddenly increased to 7.5 𝑐𝑚3 /𝑠.
Hence, find the nonlinear and linearized system solutions via
(a) the analytical solution
(b) computer simulation using MATLAB/SIMULINK.
Solution
Analytical solution of the nonlinear model
When 𝑞𝑖 = 7.5⁡𝑐𝑚3 /𝑠, Recall that
𝑑ℎ
10 = 𝑞𝑖 − 2√ℎ (2.18d)
𝑑𝑡

𝑑ℎ
10 = 7.5 − 2√ℎ (2.18r)
𝑑𝑡

Obafemi Awolowo University 62


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

Eq.(2.18r) can be re-arranged thus:


𝒉
𝒅𝒉 𝒕
𝒅𝒕 (2.18s)
∫ =∫
𝒉=𝟗 𝟕. 𝟓 − 𝟐√𝒉 𝒕=𝟎 𝟏𝟎
The integral in Eq.(2.18s) can be evaluated by using
substitution method, thus
Put ℎ = 𝑥 2 , it implies that: 𝑑ℎ = 2𝑥𝑑𝑥 and 𝑥 = √ℎ
Eq.(2.18s) thus becomes:
𝑥
2𝑥 𝑡
𝑑𝑡 (2.18t)
∫ ( ) 𝑑𝑥 = ∫
𝑥=3 7.5 − 2𝑥 𝑡=0 10
2𝑥
Expressing into partial fractions through Long division:
7.5−2𝑥

Obafemi Awolowo University 63


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

⁡ −1⁡⁡⁡⁡⁡⁡⁡
7.5 − 2𝑥 ⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡⁡2𝑥
⁡ −7.5 + 2𝑥
⁡ 7.5⁡⁡⁡⁡⁡⁡⁡

Thus:
2𝑥 7.5 7 1
= −1 + analogous to =3+ (2.18)
7.5−2𝑥 7.5−2𝑥 2 2
Eq.(2.18t) thus becomes:
𝑥
7.5 𝑡
𝑑𝑡 (2.18u)
∫ (−1 + ) 𝑑𝑥 = ∫
𝑥=3 7.5 − 2𝑥 𝑡=0 10

Obafemi Awolowo University 64


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

Recall,

𝑎 𝑎 (2.18v)
∫( ) 𝑑𝑥 = ln⁡(𝑏𝑥 + 𝑐)
⁡ 𝑏𝑥 + 𝑐 𝑏

Eq.(2.18p) thus becomes:


7.5 𝑥 𝑡 𝑡
[−𝑥 − ln⁡(7.5 − 2𝑥)] =[ ] (2.18w)
2 𝑥=3 10 𝑡=0

𝑡
[−𝑥 − 3.75ln⁡(7.5 − 2𝑥)] − [−3 − 3.75ln⁡(7.5 − 6)] = (2.18x)
10
But 𝑥 = √ℎ
𝑡
−[√ℎ + 3.75ln⁡(7.5 − 2√ℎ)] + 4.5205 = (2.18y)
10

Obafemi Awolowo University 65


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

𝑡
− [√ℎ + 3.75 (ln(2⁡(3.75 − √ℎ)))] + 4.5205 = (2.18z)
10
𝑡
−[√ℎ + 3.75(ln2 + ln(3.75 − √ℎ))] + 4.5205 = (2.18aa)
10
𝑡
−[√ℎ + 3.75ln(3.75 − √ℎ)] − 3.75ln2 + 4.5205 = (2.18ab)
10
𝑡−19.212
−[√ℎ + 3.75ln(3.75 − √ℎ)] = (2.18ac)
10
NB:
Eq.(2.18ac) is the general nonlinear solution of the tank model
As 𝑡 → ∞
−[√ℎ + 3.75ln(3.75 − √ℎ)] = ∞ (2.18ad)
[√ℎ + 3.75ln(3.75 − √ℎ)] = −∞ (2.18ae)

Obafemi Awolowo University 66


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

ln(3.75 − √ℎ) = −∞ (2.18af)


3.75 − √ℎ = 𝑒 −∞ = 0 (2.18ag)
√ℎ = 3.75 (2.18ah)
ℎ(nonlinear) = 3.752 = 14.06𝑐𝑚 (2.18ai)

NB:
We are lucky here to be able to obtain analytical solution
because the problem at hand is not complex. In some
situations, analytical solution may not be feasible and so one
resolves to a computer simulation.

Obafemi Awolowo University 67


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

Analytical solution of the linearized model


Recall
𝜏𝑏
𝛿ℎ(𝑡) = (1 − 𝑒 −𝑡/𝜏 ) (2.18o)
𝐴
2√ℎ𝑠𝑠
With b=7.5 − 6 = 1.5𝑐𝑚 /𝑠, 𝐴 = 10𝑐𝑚, 𝑅 =
3
= 3, 𝜏 =
𝑐
𝑅𝐴 = 30
𝛿ℎ(𝑡) = 4.5(1 − 𝑒 −𝑡/30 ) (2.18aj)

As 𝑡 → ∞, 𝛿ℎ(∞) = 4.5,
ℎ(∞) = ℎ 𝑠𝑠 + 𝛿ℎ(∞) = 9 + 4.5 = 13.5𝑐𝑚

Obafemi Awolowo University 68


Chemical Engineering
Comparison between Nonlinear and Linearized Solution

Fig. 2.10: Comparison between linearized and nonlinear solution

Obafemi Awolowo University 69


Chemical Engineering
Example 2.6: Single Nonlinear Tank (Cont’d)

Comparison between nonlinear and linearized solution


Nonlinear solution
𝑡−19.212
−[√ℎ + 3.75ln(3.75 − √ℎ)] = (2.18ac)
10
Linearized solution

ℎ(𝑡) = ℎ 𝑠𝑠 + 4.5(1 − 𝑒 −𝑡/30 )=9+4.5(1 − 𝑒 −𝑡/30 ) (2.18aj)

Obafemi Awolowo University 70


Chemical Engineering
Comparison between Nonlinear and Linearized Solution

t h(nonlinear) h(Linear)
0 9.00 9.00
10 10.28 10.28
20 11.22 11.19
30 11.91 11.84
40 12.43 12.31
50 12.82 12.65
60 13.12 12.89
70 13.34 13.06
80 13.51 13.19
90 13.64 13.28
100 13.74 13.34

Obafemi Awolowo University 71


Chemical Engineering
Comparison between Nonlinear and Linearized Solution

t h(nonlinear) h(Linear)
110 13.82 13.39
120 13.87 13.42
130 13.92 13.44
140 13.95 13.46
150 13.98 13.47
160 14.00 13.48
170 14.01 13.48
180 14.02 13.49
190 14.03 13.49
200 14.04 13.49

Obafemi Awolowo University 72


Chemical Engineering
Limitations of Linearized Model
• A linearized model best represents a nonlinear system at
operating points not so far from the linearization point.
• At operating points very far from the linearization point,
a linearized model deviates significantly from the
nonlinear system.
• Thus, the performance of a controller designed based
on the linearized model degrades.

Obafemi Awolowo University 73


Chemical Engineering
Limitations of Linearized Model

Fig. 2.11: Basic idea of linearization

Obafemi Awolowo University 74


Chemical Engineering
SIMULINK MODEL of the Nonlinear Dynamic Model

Nonlinear model
𝑑ℎ 1 1
= 𝑞𝑖 − √ℎ (2.18d)
𝑑𝑡 10 5

Fig. 2.12: SIMULINK model of the nonlinear ODE


Obafemi Awolowo University 75
Chemical Engineering
SIMULINK MODEL of the Linearized Dynamic Model

Linearized model
𝑑𝛿ℎ 1 1
= 𝛿𝑞𝑖 − 𝛿ℎ (2.18f)
𝑑𝑡 10 30

Fig. 2.13: SIMULINK model of the linearized ODE


Obafemi Awolowo University 76
Chemical Engineering

You might also like