You are on page 1of 23

Process Control for Chemical Engineers:

Block Diagram Simulation

Muhammad Mufti Azis, Ph.D


Danang Tri Hartanto, M.Eng
Department of Chemical Engineering,
Faculty of Engineering
Universitas Gadjah Mada, Indonesia

Updated: Apr 2022


Learning Objective:

• Student should be able to develop transfer function for a


dynamic model in Laplace domain
• Student should be able to run open loop simulation in
MATLAB and SIMULINK
Agenda
• Understand the concept of linearization
• Understand the concept of deviation/perturbation variable
• Conversion from time domain (t) to Laplace domain (s)
• Setting up transfer function
• Conducting Open Loop Simulation in MATLAB and SIMULINK
Block Diagram
Feedback Control System

Major role for a Chemical Engineer


Block Diagram Simulation
The steps are:
𝑑𝐶𝐴
Formulate Model Based on Conservative and 𝐹𝐶𝐴0 − 𝐹𝐶𝐴 − 𝑉𝑘𝐶𝐴2 = 𝑉
𝑑𝑡
Constitutive Relationship

2
𝑑𝐶𝐴
𝐹𝐶𝐴0 − 𝐹𝐶𝐴 − 𝑉𝑘𝐶𝐴,𝑆𝑆 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 ∙ 𝐶𝐴 − 𝐶𝐴,𝑆𝑆 =𝑉
Linearize Non-linear Terms 𝑑𝑡

𝐹
𝐾𝑝 ′ 𝑑𝐶𝐴′ 1 ′ 𝐾𝑝 = 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆
Express in Deviation Variables 𝜏
𝐶𝐴0 =
𝑑𝑡
+ ∙ 𝐶𝐴
𝜏 𝑉
𝜏=
𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆

𝐾𝑝
Take the Laplace Transform 𝐶𝐴′ (𝑠) =
(𝜏𝑠 + 1)

𝐶𝐴0 (𝑠)

Simulate with MATLAB/SIMULINK


Linearization

Linearization plays a major role in Process Control as Laplace domain requires all
equations in linear form
Definition of a linier system
Linearization

Linearization method follows Taylor series expansion


Linearization
Example:

Example: y=(1.5x2+3) at x=1 → y(1)=4.5


Estimation of y(1.5) can be conducted in following way:
Linearization Taylor series: y(1.5)=y(1)+y’(1)*(1.5-1)=4.5+3(1)*0.5=6
Exact value: y(1.5)=1.5*(1.5)2+3=6.3750
There is a difference of 0.3750
Linearization Exercise
Linearize following equations around the steady-state values!
Linearization Exercise
Example:

𝐹𝑜𝑢𝑡 = 𝐾 ℎ

𝐾
The linearization result is: 𝐹𝑜𝑢𝑡 = 𝐹𝑜𝑢𝑡,𝑠𝑠 + (ℎ − ℎ𝑠𝑠 )
2 ℎ𝑠𝑠

Let us define: ′
𝐹𝑜𝑢𝑡 = 𝐹𝑜𝑢𝑡 − 𝐹𝑜𝑢𝑡,𝑆𝑆 ℎ′ = ℎ − ℎ𝑆𝑆
𝐾
Thus: ′
𝐹𝑜𝑢𝑡 = ∙ ℎ′
2 ℎ𝑠𝑠
Express Deviation Variable
In process control, we are interested to see the dynamic of the system when the
system encounters a small deviation/perturbation. Hence, most of the time, we work
on deviation variable that originates from Taylor Series

F’(x)=F(x)-F(xs)

x’=x-xs
Express Deviation Variable
Example: mole balance of component A in a CSTR that reacts with 2nd order
kinetics can be expressed as below:
𝑑𝐶𝐴
𝐹𝐶𝐴0 − 𝐹𝐶𝐴 − 𝑉𝑘𝐶𝐴2 = 𝑉
𝑑𝑡
Input Output variables: CA0 and CA
Under Steady-State Condition: 2
𝐹𝐶𝐴0.SS − 𝐹𝐶𝐴,𝑆𝑆 − 𝑉𝑘𝐶𝐴,𝑆𝑆 =0

Method 1: we expand all Input Output variables with Taylor Series


𝐶𝐴0 = 𝐶𝐴0,𝑆𝑆 + 𝐶𝐴0 𝐶𝐴 = 𝐶𝐴,𝑆𝑆 + 𝐶𝐴′ 𝐶𝐴2 = 𝐶𝐴,𝑆𝑆
2
+ 2𝐶𝐴,𝑆𝑆 ∙ 𝐶𝐴′

Thus, we can rewrite the mole balance equation as:


𝑑𝐶𝐴
𝐹(𝐶𝐴0,𝑆𝑆 + 𝐶𝐴0 ) − 𝐹(𝐶𝐴,𝑆𝑆 + 𝐶𝐴′ ) − 𝑉𝑘(𝐶𝐴,𝑆𝑆
2
+ 2𝐶𝐴,𝑆𝑆 ∙ 𝐶𝐴′ ) = 𝑉
𝑑𝑡
Express Deviation Variable
Mole balance of component A after linearization:


𝑑𝐶𝐴
𝐹(𝐶𝐴0,𝑆𝑆 + 𝐶𝐴0 ) − 𝐹(𝐶𝐴,𝑆𝑆 + 𝐶𝐴′ ) − 𝑉𝑘(𝐶𝐴,𝑆𝑆
2
+ 2𝐶𝐴,𝑆𝑆 ∙ 𝐶𝐴′ ) = 𝑉
𝑑𝑡

We can rearrange the equation to yield:


2 ′
𝑑𝐶𝐴′
𝐹𝐶𝐴0,𝑆𝑆 − 𝐹𝐶𝐴,𝑆𝑆 − 𝑉𝑘𝐶𝐴,𝑆𝑆 + 𝐹𝐶𝐴0 − 𝐹𝐶𝐴′ − 2𝐶𝐴,𝑆𝑆 ∙ 𝐶𝐴′ 𝑉𝑘 =𝑉
𝑑𝑡

=0
(look at under steady state condition in previous slide)

𝑑𝐶𝐴′
Thus, we obtain: ′
𝐹𝐶𝐴0 − 𝐹𝐶𝐴′ − 2𝐶𝐴,𝑆𝑆 ∙ 𝐶𝐴′ 𝑉𝑘 =𝑉
𝑑𝑡


𝑑𝐶𝐴′
𝐹 𝐶𝐴0 − 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 𝐶𝐴′ =𝑉
𝑑𝑡
Express Deviation Variable
Method 2: Short Cut method by taking derivative with respect to variables
The mole balance of component A:
𝑑𝐶𝐴
𝐹𝐶𝐴0 − 𝐹𝐶𝐴 − 𝑉𝑘𝐶𝐴2 = 𝑉
𝑑𝑡
Let, 𝑃 = 𝐹𝐶𝐴0 − 𝐹𝐶𝐴 − 𝑉𝑘𝐶𝐴2
Since the variable here are CA0 and CA , thus:

𝜕𝑃 ′
𝜕𝑃 𝑑𝐶 𝐴
ቤ 𝐶𝐴0 + ቤ 𝐶𝐴′ = 𝑉
𝜕𝐶𝐴0 𝑆𝑆 𝜕𝐶𝐴 𝑆𝑆 𝑑𝑡
Thus, we obtain:


𝑑𝐶 𝐴
𝐹 𝐶𝐴0 − 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 𝐶𝐴′ = 𝑉
𝑑𝑡
Taking Laplace Transform
The linearized form of mole balance component A in deviation variable can be
described as:
′ ′
𝑑𝐶𝐴′
𝐹 𝐶𝐴0 − 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 𝐶𝐴 = 𝑉
𝑑𝑡
Input Output variables: CA0 and CA

Basic formula of Laplace transform: ℒ 𝐹 𝑡 = 𝐹 𝑠 = න 𝐹 𝑡 . 𝑒 −𝑠𝑡 𝑑𝑡
0
𝑑𝐹 𝑡
ℒ = 𝑠 ∙ 𝐹 𝑠 − 𝐹(𝑡)ቚ
𝑑𝑡 𝑡=0

If we use deviation variable and the system is initially in steady state condition which
is common for process control case, then F=Fss at t=0, thus: F’=F-Fss= 0
→ wonderful !

Now, you get the idea why it is


beneficial to work in deviation
variable for Process Control !
Taking Laplace Transform
Again, the linearized form of mole balance component A in deviation variable can
be described as:
′ ′
𝑑𝐶𝐴′
𝐹 𝐶𝐴0 − 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 𝐶𝐴 = 𝑉
𝑑𝑡
If we assume that the system is in steady state initially (t=0), then it is fairly easy to
take the Laplace transform for the above equation:

𝐹𝐶𝐴0 𝑠 − 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 𝐶𝐴′ (𝑠) = 𝑉𝑠𝐶𝐴′ (𝑠൯

We can rearrange the equation to yield:


𝐾𝑝
𝐶𝐴′ (𝑠) = ′
𝐶𝐴0 (𝑠)
(𝜏𝑠 + 1)
𝐹 𝑉
𝐾𝑝 = 𝜏=
𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆
The transfer function for this system can be expresses as:
′ 𝐾𝑝
𝐶𝐴0 (𝑠) 𝐶𝐴′ (𝑠)
(𝜏𝑠 + 1)
input output
Open-Loop Simulation
The transfer function of a process (Gp) for CSTR can be described as:
′ 𝐾𝑝
𝐶𝐴0 (𝑠) 𝐶𝐴′ (𝑠)
(𝜏𝑠 + 1)
input output
Gp(s)
𝐹 𝑉
Where: 𝐾𝑝 = 𝜏=
𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆 𝐹 + 2𝑉𝑘𝐶𝐴,𝑆𝑆

Typically, we want to get the response of CA’ by taking a step change in input (CA0’)

CA0’ 𝐺𝑝(𝑠) CA’

This simulation is classified as Open-Loop Simulation as we don’t introduce any control


mechanism to this system. When we introduced control mechanism such as, Feedback
Control System, then it is called a Closed-Loop simulation
Open-Loop Simulation
Method 1: Running the simulation in MATLAB

′ 𝐾𝑝
𝐶𝐴0 (𝑠) 𝐶𝐴′ (𝑠)
(𝜏𝑠 + 1)
input output
Gp(s)

For simplicity, let’s assume the values of Kp=4 and τ=2

′ 4
𝐶𝐴0 (𝑠) 𝐶𝐴′ (𝑠)
(2𝑠 + 1)
input output
Matlab code: Gp(s)
%Program to compute step response of 1 unit step change of input
clear all
clc
close all

Kp=4;
taup=2;
t=0:0.5:10;
G1=tf(Kp,[taup 1]);
Y=step(G1,t);
plot(t,Y,'LineWidth',4)
grid on
Open-Loop Simulation
Method 2: Running the simulation in SIMULINK
′ 4
𝐶𝐴0 (𝑠) 𝐶𝐴′ (𝑠)
(2𝑠 + 1)
input output
Gp(s)

Block diagram in SIMULINK:

Blok: Sinks →Scope

Blok: Source

Blok: Continuous
→Transfer Fcn Blok: Sinks →To Workspace
Revisit time to drain a tank (2022)

Figure 1: Tank nomenclature


Source:
https://www.thechemicalengineer.com/features/
rules-of-thumb-time-to-drain-a-tank/ Table 1: Flow rate formulas for different discharge scenarios from a tank. In each
case the pressure drop accounts for the terminal pressures and the liquid head.
The resulting units are volumetric m3/min or ft3/min
Revisit time to drain a tank (2022)

Source:
https://www.thechemicalengineer.com/feat
ures/rules-of-thumb-time-to-drain-a-tank/
TERIMA KASIH

You might also like