Lecture 8 - Model Identification

• What is identification? • Direct pulse response identification • • Regularization • Parametric model ID, nonlinear LS

EE392m - Winter 2003 Control Engineering 8-1 What is System Identification? Plant Identification Model

• White-box identification – estimate of a physical model from data – Example: aircraft flight model • Gray-box identification – given generic model structure estimate parameters from data – Example: neural network model of an engine • Black-box identification – determine model structure and estimate parameters from data – Example: security pricing models for stock market Rarely used in used Rarely real-life control EE392m - Winter 2003 Control Engineering 8-2 Industrial Use of System ID

• Process control - most developed ID approaches – all plants and processes are different – need to do identification, cannot spend too much time on each – industrial identification tools • Aerospace – white-box identification, specially designed programs of tests • Automotive – white-box, significant effort on model development and calibration • Disk drives – used to do thorough identification, shorter cycle time • Embedded – simplified models, short cycle time

EE392m - Winter 2003 Control Engineering 8-3 Impulse response identification

• Simplest approach: apply control impulse and collect the IMPULSE RESPONSE data 1 0.8 0.6 0.4 0.2 0 0 1 2 3 4 5 6 7 • Difficult to apply a short impulse big enough suchTIME that the response is much larger than the noise NOISY IMPULSE RESPONSE 1

0.5

0

-0.5 0 1 2 3 4 5 6 7 • Can be used for building simplified TIME control design models from complex sims

EE392m - Winter 2003 Control Engineering 8-4 Step response identification

• Step (bump) control input and collect the data STEP RESPONSE OF PAPER WEIGHT – used in process control 1.5

1 Actuator bumped 0.5

0 0 200 400 600 800 1000 TIME (S EC) • Impulse estimate still noisy: impulse(t) = step(t)-step(t-1) IMPULSE RESPONSE OF PAPER WEIGHT

0.3

0.2

0.1

0

0 100 200 300 400 500 600 TIME (S EC) EE392m - Winter 2003 Control Engineering 8-5 Noise reduction

Noise can be reduced by statistical averaging: • Collect data for mutiple steps and do more averaging to estimate the step/pulse response • Use a parametric model of the system and estimate a few model parameters describing the response: dead time, rise time, gain • Do both in a sequence – done in real process control ID packages • Pre-filter data

EE392m - Winter 2003 Control Engineering 8-6 Linear regression

• Mathematical aside – linear regression is one of the main System ID tools

Data Regression weights Regressor Error ϕ N = θ ϕ + y = Φθ + e y(t) ∑ j j (t) e(t) j=1 ϕ ϕ θ  y(1)   1(1) K K (1)   1   e(1)  ϕ θ y =  ,Φ =  , =  ,e =    M   M O M   M   M  θ y(N )  1(N ) K K (N )  K  e(N )

EE392m - Winter 2003 Control Engineering 8-7 Linear regression

• Makes sense only when matrix Φ is tall, N > K, more data available than y = Φθ + e the number of unknown parameters. ϕ – Statistical averaging −1 2 → θˆ = ()ΦT Φ ΦT • Least square solution: ϕ||e|| min y – Matlabϕ pinv or left matrix ϕdivision \ ϕ −1 • Correlation interpretation: θˆ = R c  N N  ϕN  2 (t) ϕ(t) (t) (t) y(t)  ∑ 1 K ∑ K 1   ∑ 1  t=1 t=1 t=1 = 1   = 1   R M O M , c M N  N N  N  N   (t) (t) 2 (t)   ϕ (t) y(t) ∑ 1 K K ∑ K  ∑ K   t=1 t=1   t=1  EE392m - Winter 2003 Control Engineering 8-8 Example: linear first-order model ϕy(t) = ay(t −1) + gu(t −1) + e(t) • Linear regressionϕ representation (t) = y(t −1) a −1 1 θ = θˆ = ()ΦT Φ ΦT y = −   2 (t) u(t 1) g • This approach is considered in most of the technical literature on identification Lennart Ljung, System Identification: Theory for the User, 2nd Ed, 1999 • Matlab Identification Toolbox – Industrial use in aerospace mostly – Not really used much in industrial process control • Main issue: – small error in a might large change in response EE392m - Winter 2003 Control Engineering 8-9 Regularization

• Linear regression, where Φ T Φ is ill-conditioned • Instead of ||e||2 → min solve a regularized problem 2 2 e + r θ → min y = Φθ + e r is a small regularization • Regularized solution −1 θˆ = ()ΦT Φ + rI ΦT y

• Cut off the singular values of Φ that are smaller than r

EE392m - Winter 2003 Control Engineering 8-10 Regularization

• Analysis through SVD (singular value decomposition) Φ = T ∈ n,n ∈ m,m = n USV ; V R ;U R ;S diag{s j} j=1 • Regularized solution n −   T 1 T  s j  T θˆ = ()Φ Φ + rI Φ y = V diag  U y  s2 + r     j  j=1 • Cut off the singular values of Φ that are smaller than r REGULARIZED INVERSE 2

1.5 s 1 s2 + 0.1 0.5

0 0 1 2 3 4 5 s EE392m - Winter 2003 Control Engineering 8-11 Linear regression for FIR model

PRBS EXCITATION SIGNAL • Identifying impulse response by 1 0.5

applying multiple steps 0 • PRBS excitation signal -0.5 -1 • FIR (impulse response) model 0 10 20 30 40 50 K PRBS = y(t) = h(k)u(t − k) + e(t) Pseudo-Random Binary Sequence, ∑ see IDINPUT in Matlab ϕ k=1 • Linear regression representation = − ϕ1 (t) u(t 1)  h(1)  − θ =   θˆ = ()ΦT Φ + 1ΦT M  M  rI y = − K (t) u(t K) h(K)

EE392m - Winter 2003 Control Engineering 8-12 Example: FIR model ID

PRBS excitation • PRBS excitation 1 input 0.5 0

-0.5

-1 0 200 400 600 800 1000 SYSTEM RESPONSE • Simulated system 1

output: 4000 0.5 samples, random 0 noise of the -0.5 amplitude 0.5 -1 0 200 400 600 800 1000 TIME

EE392m - Winter 2003 Control Engineering 8-13 Example: FIR model ID

FIR estimate

• Linear regression 0.2 estimate of the FIR0.15 0.1 model 0.05 0 -0.05 0 1 2 3 4 5 6 7 Impulse Response

• Impulse response 0.2 for the simulated 0.15 0.1 system: 0.05 0 -0.05 T=tf([1 .5],[1 1.1 1]); 0 1 2 3 4 5 6 7 P=c2d(T,0.25); Time (s ec)

EE392m - Winter 2003 Control Engineering 8-14 Nonlinear parametric model ID

• Prediction model depending on Optimizer the unknown parameter vector θ θ Loss Index V u(t) → MODEL(θ ) → yˆ(t |θ )

• Loss index V = ∑ y(t) − yˆ(t |θ ) 2 J = ∑ y(t) − yˆ(t |θ ) 2 y(t) Model including the parameters θ • Iterative numerical optimization. u(t) Computation of V as a subroutine sim

Lennart Ljung, “Identification for Control: Simple Process Models,” IEEE Conf. on Decision and Control, Las Vegas, NV, 2002 EE392m - Winter 2003 Control Engineering 8-15 Parametric ID of step response τ • First order process with deadtime • Most common industrial process model g • Response to a control step applied at tB

(t−t −T ) /τ θ g()1− e B D , for t > t − T TD y(t | ) = γ + B D  ≤ −  0, for t tB TD γ   Example: θ  g  =   Paper  τ  machine   process TD 

EE392m - Winter 2003 Control Engineering 8-16 Gain estimation

τ • For given , T D , the modeled step response can be presented in the form θ = γ + ⋅ τ y(t | ) g y1(t | ,TD ) • This is a linear regression θ 2 = ϕ = = ϕ w1 γg 1(t) y1(t | ,TD ) y(t | ) ∑ wk k (t) = = ϕ = τ k 1 w2 2 (t) 1

τ • Parameter estimate and prediction for given ,TD − τ = ()ΦT Φ 1ΦT τ = γ + ⋅ τ wˆ ( ,TD ) y yˆ(t | ,TD ) ˆ gˆ y1(t | ,TD )

EE392m - Winter 2003 Control Engineering 8-17 Rise time/dead time estimation

τ • For given , T D , the loss index is N = − ˆ τ 2 V ∑ y(t) y(t | ,TD ) t=1 τ = τ • Grid , T D and find the minimum of V V ( ,TD )

EE392m - Winter 2003 Control Engineering 8-18 Examples: Step response ID

• Identification results for real industrial process data • This algorithm works in an industrial tool used in 500+ industrial plants, many processes each

Process parameters: Gain = 0.134; Tdel = 0.00; Trise = 119.8969 1 1.6

1.4 0.8 Nonlinear 1.2 0.6 Regression ID 1

0.4 0.8 Linear 0.2 0.6 ID 0.4 0 Regression ID of the first-order 0.2

-0.2 model 0

-0.4 -0.2 0 10 20 30 40 50 60 70 80 0 100 200 300 400 500 600 700 800 time in s ec.; MD res ponse - solid; estimated response - dashed

EE392m - Winter 2003 Control Engineering 8-19 Linear filtering

• A trick that helps: pre-filter data • Consider data model y = h *u + e • L is a linear filtering operator, usually LPF Ly = L(h *u) + Le { {e y f f L(h *u) = (Lh)*u = h *(Lu) • Can estimate h from filtered y and filtered u • Or can estimate filtered h from filtered y and ‘raw’ u • Pre-filter bandwidth will limit the estimation bandwidth EE392m - Winter 2003 Control Engineering 8-20 Multivariable ID

• Apply SISO ID to various input/output pairs •Need n tests - excite each input in turn

• Step/pulse response identification is a key part of the industrial Multivariable Predictive Control packages.

EE392m - Winter 2003 Control Engineering 8-21