Title: Empirikus modellezs
1Empirikus modellezés
- Dr. Abonyi János
- Veszprémi Egyetem Folyamatmérnöki tanszék
- www.fmt.vein.hu/mod_phd
- www.fmt.vein.hu/softcomp
abonyij_at_fmt.vein.hu
2Tartalom
- Minek ide modell ?
- Empirikus?
- Fekete doboz modellek
- Idoben folytonos modellek identifikációja
- Idoben diszkrét
- Szürke doboz modellek
- Szemi-mechanisztikus modellek
3Mérnöki feladatok - modell
4Importance of process modelse.g. Design of
model-based controllers
Without model
With model
Modeling, identification
Tuning of controller
System analysis
Controller specification
30
10
5Classification of Models
PROCESS MODELS
Dynamic Models
Steady State Models
(
used in control)
(
used in design, optimization)
Fundamental
Data Driven
(
first principles model)
(
empirical models)
Linearization
Nonlinear
Nonlinear
Diff.
Linear Models
Empirical
Models
Eqn. (lumped or
(e.g. Artificial
distributed))
Neural Networks,
Bilinear etc.)
Reduced Order
Discrete-Time
Continuous-Time
Frequency Domain
Models
(
z-domain)
(State-space)
(
Laplace domain)
6Modell osztályok
7Információ - modell
8Physical/chemical (fundamental, global)
- Model structure by theoretical analysis
- Material/energy balances
- Heat, mass, and momentum transfer
- Thermodynamics, chemical kinetics
- Physical property relationships
- Model complexity must be determined (assumptions)
- Can be computationally expensive (not real-time)
- May be expensive/time-consuming to obtain
- Good for extrapolation, scale-up
- Does not require experimental data to obtain
(data required for validation and fitting)
Chapter 2
9Development of Empirical Models From Process Data
- In some situations it is not feasible to develop
a theoretical (physically-based model) due to - 1. Lack of information
- 2. Model complexity
- 3. Engineering effort required.
- An attractive alternative Develop an empirical
dynamic model from input-output data. - Advantage less effort is required
- Disadvantage the model is only valid (at best)
for the range of data used in its
development.i.e., empirical models usually dont
extrapolate very well.
Chapter 7
10- Black box (empirical)
- Large number of unknown parameters
- Can be obtained quickly (e.g., linear regression)
- Model structure is subjective
- Dangerous to extrapolate
Chapter 2
11- Semi-empirical
- Compromise of first two approaches
- Model structure may be simpler
- Typically 2 to 10 physical parameters estimated
(nonlinear regression) - Good versatility, can be extrapolated
- Can be run in real-time
- number of parameters affects accuracy of model,
but confidence limits on the parameters fitted
must be evaluated - objective function for data fitting minimize
sum of squares of errors between data points and
model predictions (use optimization code to fit
parameters) - nonlinear models such as neural nets are becoming
popular (automatic modeling)
Chapter 2
12Semi-empirical approach
Experience
Measurement
A priori info
13Fekete-doboz modellek
Ez a feladat
14Typical process models
15Tipikus vizsgálójelek
Dirac-delta (impulzus, injektálás)
Heaviside (egységugrás)
PRBS
16Tipikus válaszok
17Fitting First and Second-Order Models Using Step
Tests
- Simple transfer function models can be obtained
graphically from step response data. - A plot of the output response of a process to a
step change in input is sometimes referred to as
a process reaction curve. - If the process of interest can be approximated by
a first- or second-order linear model, the model
parameters can be obtained by inspection of the
process reaction curve.
Chapter 7
18Graphical analysis of the process reaction curve
to obtain parameters of a first-order plus time
delay (FOPTD) model.
Chapter 7
19First-Order Plus Time Delay Model (cont.)
For this FOPTD model, we note the following
charac-teristics of its step response
1. The response attains 63.2 of its final
response at time, t ???.
2. The line drawn tangent to the response at
maximum slope (t ?) intersects the y/KM1
line at (t ? ? ? ). 3. The step response is
essentially complete at t5t. In other
words, the settling time is ts5t.
204. Sundaresan and Krishnaswamys Method
- They proposed that two times, t1 and t2, be
estimated from a step response curve,
corresponding to the 35.3 and 85.3 response
times, respectively. - The time delay and time constant are then
estimated from the following equations
- These values of q and t approximately minimize
the difference between the measured response and
the model, based on a correlation for many data
sets.
21Gyakorlat I.
grafikus.xls
22Megoldás
23Estimating Second-order Model Parameters Using
Graphical Analysis
Chapter 7
- In general, a better approximation to an
experimental step response can be obtained by
fitting a second-order model to the data.
- Figure includes two limiting cases
, where the system becomes first order, and
, the critically damped case. - The larger of the two time constants, , is
called the dominant time constant.
24Smiths Method
- Determine t20 and t60 from the step response.
- Find ? from Fig
- Find t60/t from and then calculate t (since t60
is known).
25Gyakorlat II.
grafikus.xls
26Megoldás
- 1.5/30.5
- Leolvasható kszi0.5
- Tau3/1.52
- G(s) 2 / (4s2 2s 1) e(-0.5s)
- K 2
- tau 2
- kszi 0.5
- Th 0.5
27Development of Discrete-Time Dynamic Models
- A digital computer by its very nature deals
internally with discrete-time data or numerical
values of functions at equally spaced intervals
determined by the sampling period. - Thus, discrete-time models such as difference
equations are widely used in computer control
applications. - One way a continuous-time dynamic model can be
converted to discrete-time form is by employing a
finite difference approximation. - Consider a nonlinear differential equation,
where y is the output variable and u is the
input variable.
28- This equation can be numerically integrated
(though with some error) by introducing a finite
difference approximation for the derivative. - For example, the first-order, backward difference
approximation to the derivative at is
where is the integration interval specified
by the user and y(k) denotes the value of y(t) at
.
29Second-Order Difference Equation Models
- Parameters in a discrete-time model can be
estimated directly from input-output data based
on linear regression. - This approach is an example of system
identification (Ljung, 1999). - As a specific example, consider the second-order
difference equation.It can be used to predict
y(k) from data available at time (k 1)
and (k 2) . - In developing a discrete-time model, model
parameters a1, a2, b1, and b2 are considered to
be unknown.
30Rendszer identifikáció - optimalizálás
31- This model can be expressed in the standard form
by defining
- The parameters are estimated by minimizing a
least squares error criterion
32The sum of the squares function
which can be written as,
where the superscript T denotes the matrix
transpose and
33The least squares estimates is given by,
providing that matrix XTX is nonsingular so that
its inverse exists. Note that the matrix X is
comprised of functions of uj for example, if
This model is in LS form if X1 1, X2 u, and
X3 u2.
34Time series models (ARMAX) General form of the
discrete time model used for system
identification is the ARMAX model.
Autoregressive, Moving Average, Exogeneous
inputs. Autoregressive refers to the fact that
the output is a linear combination of previous
values of the output. Moving Average refers to
the noise model. Exogeneous implies that there is
an input to the system along with knowledge of
its previous values. Thus the model is
35-
-
36Variants are Autoregressive Moving Average
(ARMA) No access to knowledge of the
input Autoregressive exogeneous (ARX) Assume
that only disturbance is white noise Finite
Impulse response (FIR) Output is a linear
combination of only past input values. The output
will drop to zero in finite time if the input
becomes zero. Note on z transform We can use the
z transform on the ARMAX model and its variants
to specify the z domain transfer function as
37Nonlinear dynamic models
38L.S. parameter calculation of ARMAX models We
can put the general ARMAX model into a vector
form for instant i as For all data values
, taken over a range of data i1, n, form a
vector y , and a matrix F values thus all the
data can be collected together to form the
following
39Gyakorlat III. dyndata.xls
40Objektum
output
h
input
F
41Lineáris BK modell
Diszkretizálás (Euler)
Elsorendu lineáris közelítés
Paraméterek meghatározhatóak LKN módszerével
adott u(k) es y(k) dinamikus adatsorból.
42Adatok rendezve
43Eszköz Excelben
44És az eredmény
45Ugyanez Matlabban
- Folyadektartaly
- Egyszeru linearis bemenet-kimenet modell
- y(k) ay(k-1) bu(k-1) c
- a,b,c ismeretlen parameterek,
- u(k) es y(k) a bemenet es kimenet k-ik
idopontban -
- clear all
- u() es y() oszlop-vektorok
- load data_dyn
- u Fv()
- y Hv()
- Linearis LKN formaba hozzuk min Ax-b2 (x
szerint, x a b c) - b y(2end)
- A y(1end-1) u(1end-1) ones(size(b,1),1)
- LKN megoldasa (nincsenek korlatok)
- x A \ b
- Szabad futasu szimulacio
- ym zeros(size(y))
- ym(1) y(1)
model1.m
46Application of a priori information
In addition to measurement, usually we have a
priori information, too.
A priori információ (korlátok)
Szürke doboz modell
Mérési adatok
A priori information can be used as constraints.
- Application goals, for example
- to reduce measurement noise
- to comply conservation laws
47Gray-box models
- a priori information ? constraints on parameters
Quadratic programming
- H and d contain input-output data
- ? and ? contain constraints froma priori
knowledge
48Felhasználható a priori ismeret
- Stability
- Gain
- Settling time
49Example Gain
- Lower and upper bounds as constraints
50Example Two-tank system
- Output Level in the tank (0-100)
51Input-output data
Flowrate
Level in the tank
52A priori knowledge
- Open-loop stability
- Gain Kmin 0, Kmax 2.5
- Settling time
53Identified models
- 1. No a priori information
- 2. Open-loop stability and constraints on gain
- 3. 2 Beállási ido
54Good dynamic estimationsfor all three of
models...
55... but very differentlocal behaviors ...
56 and in model-based control
No a priori information
All a priori information
57Gyakorlat V. dyndata.xls
pl. Legyen 15 az erosítés
58Ugyanez Matlabban
- Folyadektartaly
- Linearis bemenet-kimenet modell korlatokkal
- y(k) ay(k-1) bu(k-1) c
- a,b,c ismeretlen parameterek,
- u(k) es y(k) a bemenet es kimenet k-ik
idopontban - clear all
- addpath('./MinQ5')
- u() es y() oszlop-vektorok
- load data_dyn
- u Fv()
- y Hv()
- Linearis LKN formaba hozzuk min Ax-b2 (x
szerint, x a b c) - b y(2end)
- A y(1end-1) u(1end-1) ones(size(b,1),1)
- QP (kvadratikus) formaban min c'x0.5x'Gx
(x szerint) - c -A'b
- G A'A
- Egyenlotlensegi korlatozas Acx gt bc formaban
model3.m
59Semi-empirical approach
Experience
Measurement
A priori info
60szemi-mechanisztikus modellezés
Fehér- és fekete-doboz modelleket kombinálunk
A szemi-mechanisztikus modellekben a nem ismert
tagokat fekete-doboz modellekkel helyettesítjük.
A neurális hálózat egy hatékony nemlineáris
fekete-doboz modell, amelyet mérési adatok
alapján az ismeretlen tagok becslésére lehet
használni.
61Nem ismert jelenségek fekete doboz modell
A vegyészmérnöki gyakorlatban elterjedtek az
anyag- és energiamérlegen alapuló modellek. Az
ilyen modellek általános formája
A hibrid modell
- Felmértjük,
- milyen változókat nem mérünk,
- milyen jelenségeket nem ismerünk
- milyen paramétereket nem tudunk meghatározni
- Amit nem ismerünk Fekete doboz modell
62Alkalmazási példa
Egy folyamatos tökéletesen kevert tankreaktor
exoterm elsorendu reakcióval.
63CSTR objektum
64GLC szabályozás
GLC elve A transzformáció hatására a
transzformált (külso) input és a transzformált
output közötti összefüggés linearis legyen
A GLC szabályozó a teljes nemlineáris állapottér
modellt használja és szüksége van az összes
állapotváltozó mérésére.
On-line koncentárció mérés (közvetlen v.
közvetett)
Modell bizonytalanság
65Szemi-mechanisztikus GLC
Szemi-mechanisztikus modell alkalmazása a
szabályozóban
Visszacsatoló kompenzátor
ysp
u
v
y
Lineáris szabályozó
Objektum
NN
x
66Neurális hálózat tanítása
1. lépés. Back-propagation
- Zárt köri vizsgálattal input-output adatok
felvétele - Tanítási minta számítása (reakcióho
becslés) - Back propagation tanítás az
input-output minta alapján
2. lépés. Sensitivity Analysis (back-propagation)
- - Zárt köri vizsgálattal input-output adatok
felvétele - Back propagation tanítása a szabadon futó
modellnek (Instabilitás!)
mért
számított
67Eredmények (pontos modell)
Szemi-mech. GLC
GLC
A szabályozóban használt modell nem tér el az
objektum szimulációs modelljétol.
68Gyakorlat IV. dyndata.xls Félempirikus modell
Lineáris modell kiegészítése gyökös taggal
Paraméterek meghatározhatóak LKN módszerével
adott u(k) es y(k) dinamikus adatsorból.
69Ugyanez Matlabban
- Folyadektartaly
- Felempirikus bemenet-kimenet modell
- y(k) a1y(k-1) a2sqrt(y(k-1)) bu(k-1)
c - a1,a2,b,c ismeretlen parameterek,
- u(k) es y(k) a bemenet es kimenet k-ik
idopontban -
- clear all
- u() es y() oszlop-vektorok
- load data_dyn
- u Fv()
- y Hv()
- Linearis LKN formaba hozzuk min Ax-b2 (x
szerint, x a1 a2 b c) - b y(2end)
- A y(1end-1) sqrt(y(1end-1)) u(1end-1)
ones(size(b,1),1) - LKN megoldasa (nincsenek korlatok)
- x A \ b
- Szabad futasu szimulacio
- ym zeros(size(y))
- ym(1) y(1)
model2.m
70Szemi-mechanisztikus hibrid modell stepdata.xls
Stacioner esetben
A paraméter (keresztmetszet) ismertnek
feltételezve. c paraméter (kifolyási tényezo)
meghatározható a stacioner görbébol.
71Ugyanez Matlabban
- Folyadektartaly
- Felmechanisztikus hibrid modell (euler
diszkretizalas) Adh/dt F - f(h) - (dy/dt)(k) a(u(k) f(y(k)))
- a parameter 1/A 0.1
- f hibrid modell fuggvenye, stacioner
osszefuggesbol - 0 Fs - f(hs)
- u(k) es y(k) a bemenet es kimenet k-ik
idopontban - clear all
- Stacioner osszefugges kinyerese, tudjuk hogy Fs
csqrt(Hs) - load data_ss
- LKN egy parameterre
- c mean(Fs./sqrt(Hs))
- u() es y() oszlop-vektorok
- load data_dyn
- u Fv()
- y Hv()
- Szabad futasu szimulacio
- dt 1 ido lepeskoz
- a 0.1 ismert parameter
model4.m
72Mechanisztikus modellismeretlen paraméterekkel
Cél
Modell kimenet és az adatsor közötti különbség
csökkentése.
Nemlineáris optimalizálási feladat.
73Ugyanez Matlabban
- Folyadektartaly
- Teljes mechanisztikus modell (folytonos)
- Ady(t)/dt u(t) csqrt(y(t))
- A, c ismeretlen parameterek
(keresztmetszet, kifoly.tenyezo) - u(k) es y(k) a bemenet es kimenet k-ik
idopontban - Hasznalja az fcost5.m es az fmodel5.m
fuggvenyeket -
- clear all
- load data_dyn
- Valtozok
- global u y ym param
- u Fv
- y Hv
- ym zeros(size(y))
- Parameterek illesztese (kiindulasi pont 5 1)
- x fmins('fcost5',5 1)
- Vegso futas
- fcost5(x)
model5.m fcost5.m
74Neurális hálózat modell
NN modell
NN
Neurális hálózat identifikációja adott u(k) es
y(k) dinamikus adatsorból Back-propagation
módszerrel.
75Ugyanez Matlabban
- Neuralis halozat tanitasi mintazat
(normalizalva) - nnin u(1end-1)' y(1end-1)' / 100
- nnout y(2end)' / 100
- Neuralis halozat strukturaja es kezdo (veletlen)
parameter vektora - global ni nh no
- ni 2 2 bemenet
- nh 3 3 rejtett neuron (tanh)
- no 1 1 kimeneti neuron (lin)
- theta rand(1,nhninhnonhno)-0.5
- NN betanitasa (back-propagation)
- x,fx fmin_lm('nn_yfun','nn_jxfun',theta,nnout,
40 10,nnin) - theta x
- Csekolas
- nnout2 nn_yfun(theta,nnin)
- figure(1)
- plot(nnout100,nnout2100,'.')
model6.m
76Szemi-mechanisztikus modell
Szemi-mech. modell
NN
Neurális hálózat identifikálható adott u(k) és
y(k) dinamikus adatsorból Back-propagation
módszerrel.
77Ugyanez Matlabban
- Neuralis halozat tanitasi mintazat
(normalizalva) - nnin u(1end-1)' y(1end-1)' / 100
- nnout y(2end)' / 100
- Neuralis halozat strukturaja es kezdo (veletlen)
parameter vektora - global ni nh no
- ni 2 2 bemenet
- nh 3 3 rejtett neuron (tanh)
- no 1 1 kimeneti neuron (lin)
- theta rand(1,nhninhnonhno)-0.5
- NN betanitasa (back-propagation)
- x,fx fmin_lm('nn_yfun','nn_jxfun',theta,nnout,
40 10,nnin) - theta x
- Csekolas
- nnout2 nn_yfun(theta,nnin)
- figure(1)
- plot(nnout100,nnout2100,'.')
model7.m
78Hybrid fuzzy convolution model
- Separation of Steady-state and dynamic behavior ?
Block oriented models (Wiener, Hammerstein
modell) - This decomposition reduces model complexity ?
application - a priori information about steady-state or
dynamic behavior can be utilized - Easy implementation for predictive control
(gain-scheduling)
79The idea
Hammerstein
Wiener
- Steady-state part Fuzzy model
- Dynamical partConvolution model
80Identification based ona priori information
- Dynamical model convolution model
- Identification
- Steady-state model nonlinear optimization
- Dynamical model linear LSQ, QP
81Example Water heater
- Input Voltage of filament(0-5V)
- Output Outlet temperature (C)
82Identified model
Dynamical part
Steady-state part
83Application in control
- Successful application in PCC and GPC controllers
84Application of a priori information
In addition to measurement, usually we have a
priori information, too.
A priori információ (korlátok)
Szürke doboz modell (spline)
Mérési adatok
A priori information can be used as constraints.
- Application goals, for example
- to reduce measurement noise
- to comply conservation laws
85Application of engineering knowledge
Model from engineering
Algebraic equations e.g. conservation law
Differential equations e.g. reaction rates
Constraints onspline function
Constraints onspline derivative
86Application of constraints
Linear constraints for parameters
Optimize the cost function subject to given
constraints
Equality constraints in cost function
The cost function is modified
87Introduction (spline)
88Cubic spline interpolation
The cubic splines are piecewise third-order
polynomials The individual polynomials are
interconnected at knots.
Advantage the function and its first derivative
are continuous.
89Parameters of cubic spline
90Example 1 Estimation of kinetic parameters
The example is estimation of kinetic parameters
of a chemical reaction-network
Parameters for simulation (assumed not
known) k11, k20,5, k310, k45
Gray-box estimation (spline)
91Example 1 Results
92Example 1 Results
93Example 2 industrial batch reactor
Measured components
C
Non-measured components
A
B
- By-product formation assumed first-order
kinetic. - Catalyst is added at t 60 min (product
formation). - Initial concentrations are known.
- Total mass is constant (batch operation).
94Example 2 Algorithm
1. Estimation of reaction rates (LSQ)
2. Estimation of concentration profiles by const.
splines
95Example 2 Results
300
ABCABC
250
200
3
C
conc. g/dm
150
100
A
50
A
B
B
C
C
0
0
50
100
150
200
250
time min
96Summary