Lecture 10 - Model Identification

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

EE392m - Spring 2005 Control Engineering 10-1 Gorinevsky What is System Identification?

Experiment System Plant Model Identification

• 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 real-life control EE392m - Spring 2005 Control Engineering 10-2 Gorinevsky 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 - Spring 2005 Control Engineering 10-3 Gorinevsky 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 TIME • FIR modeling can be used for building simplified control design models from complex sims

EE392m - Spring 2005 Control Engineering 10-4 Gorinevsky 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 (SEC) • Impulse estimate: impulse(t) = step(t)-step(t-1) • Still noisy IMPULSE RESPONSE OF PAPER WEIGHT 0.3

0.2

0.1

0

0 100 200 300 400 500 600 TIME (SEC) EE392m - Spring 2005 Control Engineering 10-5 Gorinevsky Noise reduction

Noise can be reduced by statistical averaging: • Collect data for multiple step inputs and perform 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 - Spring 2005 Control Engineering 10-6 Gorinevsky Linear Regression - univariate

STEP RESPONSE OF PAPER WEIGHT • Simple fitting problem:1.5 – Given model step 1 y(t) response y(t) – And process step 0.5 ϕ(t) response ϕ(t) 0 – Find the gain factor θ 0 200 400 600 800 1000 TIME (SEC) y(t) = θϕ(t) + e(t) y = Φθ + e

ϕ Solution assuming ⎡ y(1) ⎤ ⎡ (1) ⎤ ⎡ e(1) ⎤ uncorrelated noise: = ⎢ ⎥ Φ = ⎢ ⎥ = ⎢ ⎥ y M , M , e M ΦT ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ θ = y ⎣⎢ y(N )⎦⎥ ⎣⎢ϕ(N )⎦⎥ ⎣⎢e(N )⎦⎥ ΦT Φ

EE392m - Spring 2005 Control Engineering 10-7 Gorinevsky Linear Regression

• Linear regression is one of the main System ID tools

Regression weights Regressor Error of the fit Data K = θ ϕ + y(t) ∑ j j (t) e(t) ϕ j=1 y = Φθ + e ϕ ϕ θ ⎡ 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 - Spring 2005 Control Engineering 10-8 Gorinevsky Linear regression -

• Makes sense only when matrix Φ is tall, N > K, more data available than the number of unknown parameters. – Statistical averaging • Least square solution:θ ||e||2 → min = ()()− Φ T − Φθ → Lθ y y min ∂L = −2Φ T ()y − Φθ = 0 ∂

−1 θˆ = ()ΦT Φ ΦT y

• Can be computed using Matlab pinv or left matrix division \

EE392m - Spring 2005 Control Engineering 10-9 Gorinevsky Linear regression - least squares

• Correlation interpretation of the least squares solution ϕ −1 − θˆ = ()ΦT Φ ΦT y θˆ = R 1c ϕ ϕ 1 T 1 T ϕ R = Φ Φ c = Φ y ϕ N N ⎡ N N ⎤ ⎡ϕN ⎤ 2 (t) ϕ(t) (t) (t) y(t) ⎢ ∑ 1 K ∑ K 1 ⎥ ⎢ ∑ 1 ⎥ 1 ⎢ t=1 t=1 ⎥ 1 ⎢ t=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 ⎦ Information matrix Correlation vector

EE392m - Spring 2005 Control Engineering 10-10 Gorinevsky Example: First-order ARMA model

ϕ y(t) = ay(t −1) + gu(t −1) + e(t) • Linearϕ regression representation (t) = y(t −1) ⎡a⎤ 1 θ = y(t) = θ ϕ (t) + θ ϕ (t) + e(t) = − ⎢ ⎥ 1 1 2 2 2 (t) u(t 1) ⎣g⎦ −1 θˆ = ()ΦT Φ ΦT y • This (type of) approach is considered in most of the technical literature on identification • Matlab Identification Toolbox Lennart Ljung, System Identification: Theory – Limited industrial use for the User, 2nd Ed, 1999 • Fundamental issue: – Small error in a might large change in the system response

EE392m - Spring 2005 Control Engineering 10-11 Gorinevsky Regularization

• Linear regression, where Φ T Φ is ill-conditioned • Instead of ||e||2 → min solve a regularized problem

e 2 + r θ 2 → min y = Φθ + e where r is a small regularization • A.N.Tikhonov (1963) – see http://solon.cma.univie.ac.at/~neum/ms/regtutorial.pdf • Regularized solution

−1 θˆ = ()ΦT Φ + rI ΦT y

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

EE392m - Spring 2005 Control Engineering 10-12 Gorinevsky Regularization

• Analysis through SVD (singular value decomposition) K ,K N ,K K T V ∈ R ;U ∈ R ; S = diag{s } Φ = USV j j=1 U TU = VV T = I • Regularized solution K − ⎡ ⎤ T 1 T ⎪⎧ s j ⎪⎫ T θˆ = ()Φ Φ + rI Φ y = V ⎢diag⎨ ⎬ ⎥U y ⎢ ⎪s 2 + r ⎪ ⎥ ⎣ ⎩ j ⎭ j=1 ⎦ Φ • Cut off the singular2 values of that are smaller than r 10

1 10 Inverse singular values 1/s

0 10 INVERSE -1 Regularized inverse 10 s values -2 2 10 + -2 -1 0 1 2 s 0.1 10 10 10 10 10 SINGULAR VALUE s EE392m - Spring 2005 Control Engineering 10-13 Gorinevsky 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 k=1 See IDINPUT in Matlab • Linear regression representation = − − − − 1 (t) u(t 1) ⎡ u(t 1) u(t 2) K u(t K) ⎤ ⎡ h(1) ⎤ ,Φ = ⎢ ⎥,θ = ⎢ ⎥ M ⎢ M M O M ⎥ ⎢ M ⎥ = − − − − − − + K (t) u(t K) ⎣⎢u(t N ) u(t N 1) K u(t N K 1)⎦⎥ ⎣⎢h(K)⎦⎥

−1 Regularized LS solution: θˆ = ()ΦT Φ + rI ΦT y EE392m - Spring 2005 Control Engineering 10-14 Gorinevsky 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 - Spring 2005 Control Engineering 10-15 Gorinevsky Example: FIR model ID

FIR estimate

• Linear regression 0.2 estimate of the FIR 0.15 0.1 model 0.05 0 -0.05 • Impulse response for 0 1 2 3 4 5 6 7 Impulse Response the simulated system: 0.2

0.15 0.1 0.05 0

-0.05 0 1 2 3 4 5 6 7 Time (sec) H = tf([1 .5],[1 1.1 1]); P = c2d(H,0.25); EE392m - Spring 2005 Control Engineering 10-16 Gorinevsky Nonlinear parametric model ID

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

: loss index L = ∑ y(t) − yˆ(t |θ ) 2 L = ∑ y(t) − yˆ(t |θ ) 2 → min y(t) Model including the parameters θ • Iterative numerical optimization. u(t) Computation of L as a subroutine sim

Lennart Ljung, “Identification for Control: Simple Process Models,” IEEE Conf. on Decision and Control, Las Vegas, NV, 2002 EE392m - Spring 2005 Control Engineering 10-17 Gorinevsky Parametric SysID of step response τ • First order process with deadtime • Most common industrial process model g

• Response to a control step applied at tB

TD − − τ θ ⎧g()1− e(t tB TD ) / , for t > t − T y(t | ) = γ + B D ⎨ ≤ − ⎩ 0, for t tB TD γ ⎡ ⎤ Example: θ ⎢ g ⎥ = ⎢ ⎥ Paper ⎢ τ ⎥ machine ⎢ ⎥ process ⎣TD ⎦

EE392m - Spring 2005 Control Engineering 10-18 Gorinevsky Step1: Gain and Offset Estimation

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

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

EE392m - Spring 2005 Control Engineering 10-19 Gorinevsky Step 2: Rise Time & Dead Time Estimation

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

EE392m - Spring 2005 Control Engineering 10-20 Gorinevsky 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 Nonlinear Regression 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 sec.; MD response - solid; estimated response - dashed

EE392m - Spring 2005 Control Engineering 10-21 Gorinevsky Linear Filtering in SysID

• A trick that helps: pre-filter data uyPlant • Consider data model y = h *u + e SysID hˆ • F is a linear filtering operator, usually LPF Fy = F(h * u) + Fe uyPlant F { {e y f f F(h * u) = (Fh) * u = h * (Fu) F SysID hˆ • Can estimate h from filtered y and filtered u • Or can estimate filtered h from filtered y and ‘raw’ u • Pre-filter bandwidth limits the estimation bandwidth EE392m - Spring 2005 Control Engineering 10-22 Gorinevsky Multivariable Identification

• Step/impulse response identification is a key part of the industrial multivariable packages

• Apply SISO ID to various input/output pairs • Need n tests: excite each input in turn and collect all outputs at that

EE392m - Spring 2005 Control Engineering 10-23 Gorinevsky