1

Nonlinear models - Outline
s

2

General aspects Black-box models Grey-box models Special issues for non-linear models

Identiﬁcation of Linear and Nonlinear Dynamical Systems Theme 3: Nonlinear Models

s s s

Lennart Ljung Division of Automatic Control Linköping University Sweden

System Identiﬁcation: Nonlinear Models Lennart Ljung

Berkeley, 2005

AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

System Identiﬁcation: Nonlinear Models Lennart Ljung

Berkeley, 2005

AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

General Aspects
Let Z t denote all available (input-output) data up to time t. A mathematical model for the system is a function from these data to the space where the output at time t, y(t) lives, in general y (t|t − 1) = g(Z ˆ
t−1

3

Nonlinear models - Outline
s s

4

General aspects Black-box models • Choice of regressors and nonlinear function • Functions for a scalar regressor • Expansion into multiple regressors • Examples of “named” structures Grey-box Models Special issues for non-linear models

, t)

The function can be thought of as a predictor of the next output. A parametric model structure is a parameterized family of such models:
s

g(Z t−1 , θ) All aspects on curve ﬁtting applies pretty much also to this case. The difﬁculty is the enormous richness in possibilities of parameterizations. There are two main cases s Black-box models: General models of great ﬂexibility
s

s

Grey-box models: Models that incorporate some knowledge of the character of the actual system.
Berkeley, 2005
AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

System Identiﬁcation: Nonlinear Models Lennart Ljung

System Identiﬁcation: Nonlinear Models Lennart Ljung

Berkeley, 2005

AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

Black-box Models: General Comments
The general mapping g(Z t−1 , θ) is normally too ﬂexible. Let us split it into one mapping from Z t−1 to a regression vector ϕ(t) of ﬁxed dimension d and a mapping g from Rd to R (assuming the output to be scalar): g(Z t−1 , θ) = g(ϕ(t), θ) ϕ(t) = ϕ(Z t−1 ) Leaves two problems 1. Choose the mapping g(ϕ, θ) 2. Choose the regression vector ϕ(t) ( or ϕ(t, θ) = ϕ(Z t−1 , θ))

5

NL Black Box: Choice of g

6

First, consider ϕ to be scalar. Basic form
N

g(ϕ, θ) =
k=1

αk κ(βk (ϕ − γk ))

s s

κ(x) = cos(x): Fourier transform κ(x) = U (x): Unit pulse, gives piecewise constant functions g. κ(x) = H(x): Step at x = 0, gives also piecewise constant functions • Soft version: κ(x) =
1 1+e−x

• Soft version: κ(x) = e−x

2

/2

s

s

α coordinates, β scale or dilation, γ location

System Identiﬁcation: Nonlinear Models Lennart Ljung

Berkeley, 2005

AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

System Identiﬁcation: Nonlinear Models Lennart Ljung

Berkeley, 2005

AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

Several Regressors

7

Examples of Named Structures

8

Consider now ϕ to be a d-dimensional vector, but let still κ(x) be a function of one variable. How to interpret κ(β(ϕ − γ))?

s

β(ϕ − γ) = ϕ − γ||β = (ϕ − γ) β(ϕ − γ) γ a d-dimensional vector, β a d|d-matrix (positive deﬁnite) or scaled version of the identity matrix with β a scalar. Describes an ellipsoid in Rd .

T

ANN: artiﬁcial Neural Networks • One hidden layer sigmoidal: κ(x) = • Radial Basis Networks: κ(x) = e−x

1 1+e−x , /2

ridge extension

2

s

Wavelets: κ is the “mother wavelet” and βj = 2j , γk = 2−j k (double indexing) as ﬁxed choices (Neuro)-Fuzzy models: κ are the membership functions, tensor expansion

Ridge

β(ϕ − γ) = β T ϕ − γ β a d-dimensional vector, γ a scalar. Describes a hyperplane in Rd

s

Tensor

κ is a product of factors corresponding to the components of the d vector: κ(β(ϕ − γ)) = k=1 κ(βk (ϕk − γk )) γ and β are d-dimensional vectors and subscript denotes component.

System Identiﬁcation: Nonlinear Models Lennart Ljung

Berkeley, 2005

AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

System Identiﬁcation: Nonlinear Models Lennart Ljung

Berkeley, 2005

AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET

31 % 4 3 2 1 0 −1 −2 −3 −4 −5 0 16 200 400 600 800 1000 Berkeley. previous outputs from the model have to be fed back into the model computations on-line: 1 1 The model structures are really basis function expansions.5 -1 0 −3 100 200 300 400 500 600 −4 0 200 400 600 800 1000 1200 System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. . NARMAX and NBJ. Inputs u(t − k) T Simulated model outputs ys (t − k. . . since the basis functions are variants of the same function κ. a graphical description looks like a network. . when only the input sequence u is used. by replacing the measured output by the simulated output from the previous step: ys (t. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.19 % 5 4 3 2 1 0 −1 −2 −3 −4 0 15 Wavenet Model (Radial BF ANN Model) Wavenet model: Fit 57. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Sigmoidal ANN model Sigmoidal NN: Fit 54. Σ g Σ κ Σ κ Σ System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. .71 % 4 3 14 These are data from a forest harvest machine: OUTPUT #1 4 2 0 -2 -4 0 2 1 100 200 300 INPUT #1 400 500 600 0 −1 −2 1. A tougher test is to check how the model would behave in simulation. u(t − 1)]T The (one-step ahead) predicted output at time for a given model θ is then yp (t|θ) = g([y(t − 1). 2005 1200 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung System Identiﬁcation: Nonlinear Models Lennart Ljung . Σ Σ . .e. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Recurrent Networks 11 Network Aspects – Several Layers 12 For NOE. u(t − 1)] .5 1 0. θ) ˆ Predicted model outputs yp (t − k|θ) ˆ NFIR-models use past inputs NARX-models use past inputs and outputs NOE-models use past inputs and past simulated outputs NARMAX-models use inputs. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. θ). The simulated output is obtained as above. 2005 1200 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET 200 400 600 800 1000 Berkeley. . However. u(t − 1)]T . { Σ . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET 9 Choice of Regressors 10 Four players: s s s Outputs y(t − k). θ) ˆ It uses the previous measurement y(t − 1). .5 0 -0.Simulation and Prediction Suppose ϕ(t) = [y(t − 1). i. κ κ Σ Σ . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Example: Hydraulic Crane Data 13 Linear Model Black: Measured Output Blue: Model Simulated Output Linear model: Fit 41. One can also let the regressors be outputs from a previous layer of the network: Input layer Hidden layers Output layer Σ κ q-1 q-1 ϕ } } } 1 } ϕ Σ κ Σ g θ 1 θ 1 θ These are called recurrent networks and require considerable more computational work to ﬁt to data. outputs predicted outputs NBJ-models use all four regressor types Regressors for dynamical systems are typically chosen among those: s s s s s System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. . θ) = g([ˆs (t − 1. . κ κ . . θ) ˆ y Notice a possible stability problem! System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.

Another example:.. . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung . . % Attack .. u(t). 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Example: Missile 19 The Equations 20 function [dx.. y 0 1 2 3 4 5 6 7 8 9 10 y2 0 −1 5 0 1 2 3 4 5 6 7 8 9 10 y3 0 −5 0 1 2 3 4 5 6 7 8 9 10 100 0 −100 500 5 y 0 1 2 3 4 5 6 7 8 9 10 0 −500 y 0 1 2 3 4 5 [s] 6 7 8 9 10 System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.. . .5*p(6)*p(17)*x(1)/u(5)+ .. % Angular . 4 . .. % Slide angle. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.. MISSILE A non-linear missile system... but could be very demanding in practice. 16 unknown parameters. u). .. x(2).g. y] = missile(t. System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.. 1/p(20)*(p(17)*p(18)*(p(8)*x(4)+0. 5 outputs.Nonlinear models . usually involving ad hoc non-linear observers..... so that the transformed data stand a better chance to describe the system in a linear relationship.Outline s s s 17 Physical Modeling Perform physical modeling (e. ..5 3 23 Semi-physical Models 24 0 1 2 3 4 5 6 7 8 9 10 0 1 2 3 4 5 6 7 8 9 10 0 −0...5 0..5*p(9)*p(17)*x(2)/u(5)+ .. θ) ˙ y(t) = h(x(t)... 21 Initial Fit between Model and Data Tunn: measurement. p.. % Angular velocity around y-axis.. form.. p(23)*(u(6)-x(1)).5 100 Apply non-linear transformations to the measured data.. Berkeley. .. Output equation. (-p(18)*u(4)*(p(3)*x(4)+p(4)*u(2)))/(p(22)*u(5))x(1)*x(5)+x(2)+p(23)*(u(9)/u(5)-x(4))+p(16)*x(5)ˆ2.5 0 −0. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET . Tjock: simulation 20 1 22 0 −20 1 p(10)*u(2))*u(4)-(p(19)-p(21))*x(1)*x(3))+ p(23)*(u(7)-x(2)).. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. x(3). (-p(18)*u(4)*(p(1)*x(5)+p(2)*u(3)))/(p(22)*u(5))x(3)+x(1)*x(4)+p(23)*(u(10)/u(5)-x(5)) ]. u(t). . dx = [1/p(19)*(p(17)*p(18)*(p(5)*x(5)+0. .. System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley..5*p(13)*p(17)*x(3)/u(5)+p(14)*u(1)+ p(15)*u(3))*u(4)-(p(20)-p(19))*x(1)*x(2))+ p(23)*(u(8)-x(3)). -p(18)*u(4)*(p(3)*x(4)+p(4)*u(2))/p(22) ]. % % % % % Angular velocity around x Angular velocity around y Angular velocity around z Acceleration in y-directi Acceleration in z-directi 10 inputs. θ) (or in DAE. y y 2 0 1 2 3 4 5 6 7 8 9 10 4 0 −100 200 y 0 1 2 3 4 5 6 7 8 9 10 5 0 −200 y 0 1 2 3 4 5 [s] 6 7 8 9 10 System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. . Differential Algebraic Equations... . . Some more sophistical noise modeling is possible. % Angular p(7)*u(1))*u(4)-(p(21)-p(20))*x(2)*x(3))+ . in M ODELICA) and denote unknown physical parameters by θ. y = [x(1).) For each parameter θ this deﬁnes a simulated (predicted) output y (t|θ) which is the parameterized ˆ function y (t|θ) = g(Z t−1 . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET % State equations.. Tjock: simulation 5 y1 0 −5 0..... -p(18)*u(4)*(p(1)*x(5)+p(2)*u(3))/p(22).... . Collect the model equations as x(t) = f (x(t). x. The approach is conceptually simple. To be a correct predictor this really assumes white measurement noise. .. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Equations . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Adjusted Fit between Model and Data Tunn: measurement.. 1/p(21)*(p(17)*p(18)*(p(11)*x(5)+p(12)*x(4)*x(5)+ 0. θ) ˆ in somewhat implicit form. “Rules: Only high-school physics and max 10 minutes” Simple examples: .. 18 General aspects Black-box models Grey-box Models • Physical Modeling • Semi-physical Modeling • Block-models • Local Linear Models Special issues for non-linear models s System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.

2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Nonlinear models . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Semi-physical Model 45 29 Neural Network Model 45 30 40 40 35 35 30 30 25 25 20 20 15 15 10 0 5 10 15 20 25 tid (timmar) 30 35 40 45 50 10 0 5 10 15 20 25 tid (timmar) 30 35 40 45 50 System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.Outline s s s 31 Block-oriented Models Building Blocks: 32 General aspects Black-box models Grey-box Models • Physical Modeling • Semi-physical Modeling • Block-oriented models • Local Linear Models Special issues for non-linear models Linear Dynamic System G(s) s Nonlinear static function f (u) System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. 0 5 10 15 20 25 tid (timmar) 30 35 40 45 50 System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.5 40 26 1 35 30 0.. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. 28 Suppose we had measured the temperature x(t) in the solar panel: 40 x(t + 1) − x(t) = d2 I(t) − d3 x(t) − d0 x(t) · u(t) 35 y(t + 1) − y(t) = d0 x(t) · u(t) − d1 y(t) Eliminate x(t): y(t) =(1 + d1 )y(t − 1) + (1 − d3 ) + (d3 − 1)(1 + d1 ) y(t − 1)u(t − 1) u(t − 2) 30 25 20 y(t − 2)u(t − 1) + d0 d2 u(t − 1) · I(t − 2) u(t − 2) − d0 u(t − 1)y(t − 1) + d0 (1 + d1 )u(t − 1)y(t − 2) 15 10 Reparameterize with θ being the coefﬁciente above. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Linear Model 45 27 Think . 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. ignoring links between them.A Solar Heated House 25 Data Storage Temperature (degree C) 45 Fan OFF and ON 1.5 0 5 10 15 20 25 30 35 40 45 50 Solar Intensity Pump Storage 10 8 6 4 2 0 0 5 10 15 20 25 30 35 40 45 50 System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. I(t) : Solar intensity u(t) : Pump velocity System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET el an rP la So Pump 25 0 20 0 5 10 15 20 25 hours 12 30 35 40 45 50 -0.5 y(t) : temperature in storage..

4 0.4 Measured data: Inflöde u 1. .2 0 0 10 20 30 40 50 60 70 80 0 y (k) (t) = ϕT (t)θ(k) the whole model will be a linear regression.4 1. this gives a parameterization of the output as HammersteinWiener y (t|θ) = g(Z t−1 .2 0 0 10 20 30 40 50 60 70 80 0 0 10 20 30 40 50 60 70 80 y (t) = ˆ k=1 wk (h. If the regime variable is partitioned into d values ρk .61 % 4 3 35 Local Linear Models Non-linear systems are often handled by linearization around a working point. .2 Let the measured working point variable (tank level in example) be denoted by ρ(t) (sometimes called regime variable).6 0.2 1 T yh∗ (t) = θh∗ ϕ(t) ˆ ϕ(t) = 1 θh∗ = γ ∗ −y(t − Ts ) αh∗ βh∗ T u(t − Ts ) T 0.4 0. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Tank Example. ˆ System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. ctd 37 Data and Linear Model Linear Model (d = 1) 1. Example: Tank with inﬂow u and outﬂow y and level h: Equations: 36 2 1 0 −1 √ ˙ h=− h+u √ y= h Linearize around level h∗ with corresponding ﬂows u∗ = y ∗ = √ h∗ : −2 −3 −4 −5 −6 0 1 ˙ h = − √ (h − h∗ ) + (u − u∗ ) 2 h∗ 1 y = y ∗ + √ (h − h∗ ) 2 h∗ 200 400 600 800 1000 Berkeley.4 If the prediction y (k) (t) corresponding to ρk is linear in the parameters.5 0.4 1.8 Ts = sampling time 0. hk )ˆhk (t) y Choices of weights wk : .6 0.5 0. .. the predicted output will be d 1 1 0.4 0.8 0.6 0.2 38 Sampled data model around level h∗ : 1. System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.4 1. System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. ˆ 0 10 20 30 40 50 60 70 80 0. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. computed at a grid of values of h∗ d 1 0. The idea behind Local Linear Models is to deal with the nonlinearities by selecting or averaging over relevant linearized models. However. ρk )ˆ(k) (t) y 0. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET Local Linear Models Five models (d = 5) 1. θ) ˆ and the general approach of model ﬁtting can be applied. in this contexts many algorithmic variants have been suggested.Common Models 33 Other Combinations 34 Wiener Hammerstein With the linear blocks parameterized as a linear dynamic system and the static blocks parameterized as a function (“curve”).2 0 0 10 20 30 40 50 60 70 80 0. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET .8 1 Nivå h 1.8 y (t) = ˆ k=1 wk (ρ(t). 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.2 39 Local Linear Models: General Comments 40 Two models (d=2) 1. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET The Hydraulic Crane Again Hammerstein model: Fit 71. 2005 1200 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley. 2005 AUTOMATIC CONTROL COMMUNICATION SYSTEMS LINKÖPINGS UNIVERSITET System Identiﬁcation: Nonlinear Models Lennart Ljung Berkeley.6 Total model: select or average over these local predictions.2 0.