CHE 509: Process Dynamics: Empirical Modeling of Dynamical Systems

Download as pdf or txt
Download as pdf or txt
You are on page 1of 61

CHE 509: Process Dynamics

MODULE 6:
Empirical Modeling of Dynamical Systems

Ayorinde Bamimore, Ph.D.


Department of Chemical Engineering
Obafemi Awolowo University
Module Objective
 To develop empirical models for dynamical
systems from input/output data.

The area of research in Process Systems


Engineering (PSE) that deals with this is
called “System Identification”.

Obafemi Awolowo University 2


Chemical Engineering
What is Process Identification?

Process Identification involves constructing a process model

strictly from experimentally obtained input/output data, with

no response to any laws concerning the fundamental nature

and properties of the system.

Obafemi Awolowo University 3


Chemical Engineering
The Process Identification Problem

The process identification problem can be posed


thus:
Given u(t), the input to a dynamic process and y(t), the
process response to this input function, what is g(.), the
process transfer function model?

u (t) y (t)
?
Black box

Fig. 6.1: The Problem statement of process identification


Obafemi Awolowo University 4
Chemical Engineering
Empirical vs Theoretical Modeling

Table 6.1: comparison between empirical and theoretical modeling


Theoretical modeling Process identification
1 Usually involves fewer measurements; Requires extensive measurements, because it
requires experimentation only for the relies entirely on experimentation for the
estimation of unknown model parameters model development
2 Provides information about the internal Provides information only about that portion
state of the process of the process which can be influenced by
control action (i.e., the observable part)
3 Promotes fundamental understanding of Treats the process like a “black box”
the internal workings of the process
4. Requires fairly accurate and complete Requires no such detailed knowledge; only
process knowledge that output data be obtainable in response to
input changes
5 Not particularly useful for poorly Quite often proves to be the only alternative
understood and/or complex processes for modeling the behavior of poorly
understood and/or complex processes
6. Naturally produces both linear and Requires special methods to produce
nonlinear process models nonlinear models

Obafemi Awolowo University 5


Chemical Engineering
Types of Empirical Models

Step response

Impulse response

Linear Linear autoregressive

Empirical
Models Neural networks
Non-Linear Fuzzy models

Non-linear autoregressive
Hammerstein
Wiener

Fig. 6.2a: Types of empirical models

Obafemi Awolowo University 6


Chemical Engineering
System Identification Procedure

System Identification entails the following four (4) basic


steps (See Page 3 of Yucai Zhu):

(1) Identification tests or experiments

(2) Model order/ structure selection

(3) Parameter estimation

(4) Model validation

Obafemi Awolowo University 7


Chemical Engineering
System Identification Procedure

Page 9 of the book: Ljung, L. (1987,


2nd Edition, 1999). System
Identification: Theory for the User.
Prentice Hall, Englewood Cliffs, N.J

Fig. 6.2b: The system identification loop

Obafemi Awolowo University 8


Chemical Engineering
System Identification Procedure

(1) Identification tests or experiments

 The input-output data are usually collected from an


identification test or experiment that is designed to make the
measured data maximally informative about the system
properties that are of interest to the user.
 Central to conducting an identification test is the issue of choice
of input/excitation signal. The input function must be designed
in such a way that the process to be identified will be forced to
exhibit its inherent characteristics.

Obafemi Awolowo University 9


Chemical Engineering
System Identification Procedure

The typical input functions usually employed in system identification includes:


 Step
 Impulse
 Pulse (rectangular or arbitrary)
 Sine waves
 White noise
 Pseudo random binary sequences
After collecting the input-output data, usually this is divided into two: the

identification and the validation data. The identification data will be used

for process identification while the validation data will be used for validation.

Obafemi Awolowo University 10


Chemical Engineering
System Identification Procedure

(2) Model order/ structure selection

A set of candidate models is obtained by specifying their


common properties; a suitable model is searched for within
this set. This is the most theoretical part of the system
identification procedure. It is here that a priori knowledge and
engineering intuition and insight have to be combined with the
formal (mathematical) properties of models.

Obafemi Awolowo University 11


Chemical Engineering
System Identification Procedure

(3) Parameter estimation


 When the data are available and the model set is
determined, the next step is to find the best model in this
set. For model parameter estimation, an error criterion
(loss function) is specified.
 Often the sum of the squares of some error signals
(residuals) is used as the criterion. The values of the
parameters are determined by minimizing the loss function.

Obafemi Awolowo University 12


Chemical Engineering
System Identification Procedure

(4) Model validation

When a model is identified, the next step is model validation. This


step is to test whether the estimated model is sufficiently good for
the intended use of the model. First of all, a check to see if the
model is in agreement with the a priori knowledge of the system.
Then a check if the model can fit the test or experimental data well,
preferably using a data sequence that has not been used in model
estimation. The final validation of the model is the application of
the model.
Obafemi Awolowo University 13
Chemical Engineering
Tools for System Identification

The following are the common tools usually employed for process

identification:

 Graphical tool

 Linear regression

 Non-linear regression

 MATLAB System Identification Toolbox

Obafemi Awolowo University 14


Chemical Engineering
Linear Regression

a) The general linear model is given by:

[6.1]

Experimentally observed variable is given by:

= [6.2]

Writing out this equation for each observation, , i = 1, 2,…, n

y1 = [6.3]

y2 = [6.4]

Obafemi Awolowo University 15


Chemical Engineering
Linear Regression

y3 = [6.5]

:
:
yn = [6.6]

In Matrix form we have:

= + [6.7]

Y=Xβ+ϵ [6.8]
Obafemi Awolowo University 16
Chemical Engineering
Linear Regression

Using the method of least squares of error, we can determine the model
parameters.
[6.9]

i = ith data
j = jth function
S = (Y – Xβ)T(Y – Xβ) [6.10]
To find the value of which minimizes S, differentiating the function wrt
and setting it zero gives
[6.11]

[6.12]

Obafemi Awolowo University 17


Chemical Engineering
Linear Regression

For a polynomial function

[5.13]

[5.14]

N.B:
The tricks in solving Linear regression problem is in populating matrices X
and Y
Linear regression = if the empirical model is linear with respect to the
model parameters

Nonlinear regression = if the empirical model is nonlinear with respect


to the model parameters

Obafemi Awolowo University 18


Chemical Engineering
Nonlinear Regression

A general nonlinear model can be written as

y = f (u1, u2, u3, …, β1, β2, β3, …) [6.15]

where y = model output; uj = inputs; βj = model

parameters

For example in , where y = , u = CA

This model is linear with respect to parameter and nonlinear with

respect to n.

Obafemi Awolowo University 19


Chemical Engineering
Nonlinear Regression

The model parameters can be determined by

[6.16]

where Yi = output measurement at point i

= model prediction at point i

Obafemi Awolowo University 20


Chemical Engineering
Methods of Identification

Time-domain fitting of step test data

In this method the process to be identified is forced by a unit step input. The
process response (i.e., the output) to this input is recorded. An appropriate
model is then fitted to the step response data.
The candidate models to chose from are:
(a) First Order Plus Time Delay

If the candidate model considered for the process is FOPTD, given below:

[6.17]

Obafemi Awolowo University 21


Chemical Engineering
Methods of Identification

Transient response to a step input function of size M is given


by:

[6.18]

Model parameters to identify: , and .

Obafemi Awolowo University 22


Chemical Engineering
Methods I: From step response graph

u (t)

= steady state gain


Δu

= Time for the output to


t=0 t reach 62.3% of its final
y (t) value

= Time delay, this can


Δy
easily be read from the
0.623 Δy
graph
ϴ τ
t=0 t=θ t=τ+θ t

Fig. 6.3a: Step response of a FOPTD system


Obafemi Awolowo University 23
Chemical Engineering
Method II

The equation can be rewritten as:

[6.19]

where = ultimate value of the step response data


Model parameters to identify: , τ, θ
= MK
=

Eq(6.19) can be rearranged in the linear form as follows:

[6.20a]

y = mx + c [6.20b]

Obafemi Awolowo University 24


Chemical Engineering
Method II

[6.20a]

c=
y=mx + c [6.20b]

m=
Fig. 6.3b: Plot of vs t

Obafemi Awolowo University 25


Chemical Engineering
Second-Order-Plus-Time-Delay (SOPTD)

(b) Second-order-plus-time-delay (SOPTD)

Given SOPTD model:

[6.21]

The transient response of the model to step input function of size M is given be:

[6.22]

Parameters: , , ,

Obafemi Awolowo University 26


Chemical Engineering
Second-Order-Plus-Time-Delay with Numerator Dynamics

(c) Single zero, two poles, plus time delay


Given the model:

[6.23]
The transient response of the model to step input function of size M
is given be:

[6.24]
Parameters: , , , ,

Obafemi Awolowo University 27


Chemical Engineering
Worked Examples

Example 1: The Figure below (Fig. 6.3c) shows the response

of the temperature T in a continuous stirred-tank reactor to a

step change in feed flow rate w from 120 to 125 kg/min.

Find an approximate first-order model for the process at

these operating conditions.

Obafemi Awolowo University 28


Chemical Engineering
Example 1

Fig. 6.3c: Temperature response of a stirred-tank for a step change in feed flow rate.

Obafemi Awolowo University 29


Chemical Engineering
Solution to Example 1

First note that

Because

the steady-state gain is

Obafemi Awolowo University 30


Chemical Engineering
Solution to Example 1

The time constant obtained from the tangent construction shown in


the (Fig.6.4) is Note that this result is consistent with the
“63.2% method,” because

Consequently, the resulting process model is


where the steady state gain is 4°C/kg/min.

Obafemi Awolowo University 31


Chemical Engineering
Example 2

Example 2: Identification of an Industrial Distillation Column: The

temperature on Tray #16 of a certain industrial distillation column

is regulated by the flowrate of the underflow reflux to the tray just

below it. The typical steady-state operating values for these

variables are 380oF and 25,000 lb/hr respectively. The result of a

step test carried out on this column is represented below in Table

6.2.

Obafemi Awolowo University 32


Chemical Engineering
Table 6.2: Step Response Data

Obafemi Awolowo University 33


Chemical Engineering
Table 6.2: Step Response Data

Obafemi Awolowo University 34


Chemical Engineering
Solution to Example 2

A candidate model being entertained for this process is:

[6.25a]

Use the information provided to estimate the unknown parameters

It is to be noted here that the data given are in terms of actual process

variables; they must be expressed in terms of deviations from initial

steady-state values. Thus, from Table 6.2, we obtain the output y(s) and

input u(s) as:


Obafemi Awolowo University 35
Chemical Engineering
Solution to Example 2

y(t)=T 380; u(t)=R 25000 [6.25b]

A careful inspection of the step-response data indicates that the ultimate

change in the Tray #16 temperature as a result of the implemented

reflux flow change is, on the average, 15.0oF, i.e.,

Observe from Table 6.2 that the magnitude of the step change in reflux

rate = (27500 25000) = 2500(lb/hr)

Obafemi Awolowo University 36


Chemical Engineering
Solution to Example 2

The steady state gain is then estimated as:

We next obtain the variable and set it up in Table

6.3 below:

Obafemi Awolowo University 37


Chemical Engineering
Solution to Example 2 (Table 6.3)

Obafemi Awolowo University 38


Chemical Engineering
Solution to Example 2

Obafemi Awolowo University 39


Chemical Engineering
Solution to Example 2

Applying linear regression on these data against the


expression

[6.26]

we obtain ,

Assignment
(a) Use graphical method to estimate the parameter
(b) Use nonlinear regression to estimate the parameters

Obafemi Awolowo University 40


Chemical Engineering
Example 3

Example 3: Consider the step response data y(k) in Table


6.4 below. At t=0, a unit step change in u occurs, but the first
output change is not observed until the next sampling instant.
(a) Estimate the model parameters in the second order
difference equation from the input-output data.

[6.27]
(b) Fit a second order transfer function model to this data
using nonlinear regression
(c) Compare the models obtained in (a) and (b) with the
original data.

Obafemi Awolowo University 41


Chemical Engineering
Example 3
Table 6.4
Table 5: Step Response Data

Obafemi Awolowo University 42


Chemical Engineering
Example 3

First, generate the matrices thus


6.27

[6.28]

N.B: y(k) = 0 for k < 0; u(k) = 0 for k < 0


Obafemi Awolowo University 43
Chemical Engineering
Example 3

Y=X [6.29]

Y(K – 1 ) Y(K – 2 ) U(K – 1 ) U(K – 2 )

[6.30]

Obafemi Awolowo University 44


Chemical Engineering
Example 3

Table 6.4: Data regression for Example Using


3
we have

Obafemi Awolowo University 45


Chemical Engineering
Example 3

The steady state gain for a second-order difference equation


is obtained thus:

[6.31a]

let and denote the new steady-state values after a step


change in u. Substituting these values in the above equation
gives:
Gain [6.31b]

Obafemi Awolowo University 46


Chemical Engineering
Example 3

(b) Given a second order transfer function model

g(s) = [6.32]

The transient response of this model to step input of size M is given


by:

[6.33]

Obafemi Awolowo University 47


Chemical Engineering
Example 3

In discrete time k, the model can be rewritten as:

[6.34]

The problem can now be posed as

[6.35]

Obafemi Awolowo University 48


Chemical Engineering
MATLAB Solution to Example 3

STEP 1: Create a MATLAB function file and name it “fun_che509”


Table 6.5: MATLAB function “fun_che509”
function f = fun_509(x)
t1=1, ymeas_1=0.058
t2=2, ymeas_2=0.217
t3=3, ymeas_3=0.360
t4=4, ymeas_4=0.488
t5=5, ymeas_5=0.600
t6=6, ymeas_6=0.692
t7=7, ymeas_7=0.772
t8=8, ymeas_8=0.833
t9=9, ymeas_9=0.888
t10=10, ymeas_10=0.925

Obafemi Awolowo University 49


Chemical Engineering
MATLAB function to obtain model parameters

%%tau1=x(1), tau2=x(2) and K=x(3)


y1=x(3)*(1-((x(1)*exp(-t1/x(1))-x(2)*exp(-t1/x(2)))/(x(1)-x(2)))) ;
y2=x(3)*(1-((x(1)*exp(-t2/x(1))-x(2)*exp(-t2/x(2)))/(x(1)-x(2)))) ;
y3=x(3)*(1-((x(1)*exp(-t3/x(1))-x(2)*exp(-t3/x(2)))/(x(1)-x(2)))) ;
y4=x(3)*(1-((x(1)*exp(-t4/x(1))-x(2)*exp(-t4/x(2)))/(x(1)-x(2)))) ;
y5=x(3)*(1-((x(1)*exp(-t5/x(1))-x(2)*exp(-t5/x(2)))/(x(1)-x(2)))) ;
y6=x(3)*(1-((x(1)*exp(-t6/x(1))-x(2)*exp(-t6/x(2)))/(x(1)-x(2)))) ;
y7=x(3)*(1-((x(1)*exp(-t7/x(1))-x(2)*exp(-t7/x(2)))/(x(1)-x(2)))) ;
y8=x(3)*(1-((x(1)*exp(-t8/x(1))-x(2)*exp(-t8/x(2)))/(x(1)-x(2)))) ;
y9=x(3)*(1-((x(1)*exp(-t9/x(1))-x(2)*exp(-t9/x(2)))/(x(1)-x(2)))) ;
y10=x(3)*(1-((x(1)*exp(-t10/x(1))-x(2)*exp(-t10/x(2)))/(x(1)-x(2)))) ;

Obafemi Awolowo University 50


Chemical Engineering
Solution to Example 3

f = (ymeas_1-y1)^2+(ymeas_2-y2)^2+(ymeas_3-y3)^2+(ymeas_4-
y4)^2+ (ymeas_5-y5)^2+(ymeas_6-y6)^2+(ymeas_7-y7)^2+(ymeas_8-
y8)^2+ (ymeas_9-y9)^2+(ymeas_10-y10)^2; % Cost function

STEP 2: Invoke the function “fun_che509” from the command window


using

[x,fval] =patternsearch(@fun_509,[3,1,1])

We obtain the results:

Obafemi Awolowo University 51


Chemical Engineering
Solution to Example 3

The analytical solution

[6.36]

Corresponds to the difference equation:

6.37

where

Obafemi Awolowo University 52


Chemical Engineering
Solution to Example 3

, , ,

Obafemi Awolowo University 53


Chemical Engineering
Example 3

Comparison of Results

Linear Regression Nonlinear Regression

Obafemi Awolowo University 54


Chemical Engineering
Example 4

Example 4: An experiment has been performed to

determine the steady-state power delivered by a gas

turbine-driven generator as a function of fuel flow rate.

The following normalized data were obtained:

Obafemi Awolowo University 55


Chemical Engineering
Example 4

Fuel Flow Rate Power Generated

Table 6.5: Data


1.0 2.0 regression for Example 4
2.3 4.4

2.9 5.4

4.0 7.5

4.9 9.1

5.8 10.8

6.5 12.3

7.7 14.3

8.4 15.8

9.0 16.8

Obafemi Awolowo University 56


Chemical Engineering
Example 4

The linear model , should be satisfactory

because the data trend reveal a monotonic trend. Compare

the best linear and quadratic model

Solution

Recall, Y = X [6.8]

[6.38]

Obafemi Awolowo University 57


Chemical Engineering
Example 4

[6.38]

y 1 u

Using , we

have ,

Obafemi Awolowo University 58


Chemical Engineering
Example 4

Y=X [6.8]

[6.39]

Obafemi Awolowo University 59


Chemical Engineering
Example 4

Obafemi Awolowo University 60


Chemical Engineering
Example 4
Table 6.5: A Comparison of Model Predictions from Example 7.1 (SSE = Sum of squared errors)

Obafemi Awolowo University 61


Chemical Engineering

You might also like