Lecture 8 - Model Identification • • • • • What is system identification? Direct pulse response identification Linear regression Regularization Parametric model ID, nonlinear LS EE392m - Winter 2003 Control Engineering 8-1 What is System Identification? Experiment Plant Data Identification Model • White-box identification – estimate parameters of a physical model from data – Example: aircraft flight model • Gray-box identification Rarely used in real-life control – 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 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 systems – simplified models, short cycle time EE392m - Winter 2003 Control Engineering 8-3 Impulse response identification • Simplest approach: apply control impulse and collect the data IMP ULS E RES P ONS E 1 0.8 0.6 0.4 0.2 0 0 1 2 3 4 5 6 7 TIME • Difficult to apply a short impulse big enough such that the response is much larger than the noise NOIS Y IMP ULS E RES P ONS E 1 0.5 0 -0.5 0 1 • Can be used for building simplified control design models from complex sims EE392m - Winter 2003 Control Engineering 2 3 4 5 6 TIME 8-4 7 Step response identification • Step (bump) control input and collect the data – used in process control S TEP RES P ONS E OF P AP ER WEIGHT 1.5 1 Actuator bumped 0.5 0 0 200 400 600 TIME (S EC) 800 1000 • Impulse estimate still noisy: impulse(t) = step(t)-step(t-1) IMP ULS E RES P ONS E OF P AP ER WEIGHT 0.3 0.2 0.1 0 0 EE392m - Winter 2003 100 Control Engineering 200 300 400 TIME (S EC) 500 600 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 N y (t ) = ∑θ jϕ j (t ) + e(t ) Error y = Φθ + e j =1 y (1) ϕ1 (1) K ϕ K (1) θ1 e(1) O M , θ = M , e = M y = 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 the number of unknown parameters. – Statistical averaging • Least square solution: ||e||2 → min y = Φθ + e θˆ = (Φ T Φ ) Φ T y −1 – Matlab pinv or left matrix division \ • Correlation interpretation: N N 2 K ∑ ϕ K (t )ϕ1 (t ) ∑ϕ 1 (t ) t =1 1 t =1 , M O M R= N N N 2 ∑ ϕ1 (t )ϕ K (t ) K ϕ ∑ K (t ) t =1 t =1 EE392m - Winter 2003 Control Engineering θˆ = R −1c N ∑ ϕ1 ( t ) y ( t ) 1 t =1 M c= N N ∑ ϕ K (t ) y (t ) t =1 8-8 Example: linear first-order model y (t ) = ay (t − 1) + gu (t − 1) + e(t ) • Linear regression representation ϕ1 (t ) = y (t − 1) a θ = ϕ 2 (t ) = u(t − 1) g −1 T T ˆ θ = (Φ Φ ) Φ y • 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 mean 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 parameter • Regularized solution −1 T T ˆ θ = (Φ Φ + rI ) Φ 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) Φ = USV T ; V ∈ R n ,n ;U ∈ R m ,m ; S = diag{s j }nj =1 • Regularized solution n s − 1 θˆ = (Φ T Φ + rI ) Φ T y = V diag 2 j U T y s j + r j =1 • Cut off the singular values of Φ that are smaller than r REGULARIZED INVERS E 2 1.5 s s 2 + 0.1 1 0.5 0 EE392m - Winter 2003 0 1 2 Control Engineering 3 s 4 5 8-11 Linear regression for FIR model P RBS EXCITATION S IGNAL • Identifying impulse response by 1 0.5 applying multiple steps 0 -0.5 • PRBS excitation signal -1 • FIR (impulse response) model 0 K y ( t ) = ∑ h ( k )u ( t − k ) + e( t ) k =1 10 20 30 40 PRBS = Pseudo-Random Binary Sequence, see IDINPUT in Matlab • Linear regression representation ϕ1 (t ) = u(t − 1) M ϕ K (t ) = u (t − K ) EE392m - Winter 2003 h (1) θ = M h ( K ) Control Engineering −1 T T ˆ θ = (Φ Φ + rI ) Φ y 8-12 50 Example: FIR model ID P RBS e xcita tion • PRBS excitation input 1 0.5 0 -0.5 -1 0 200 400 600 800 1000 800 1000 S YS TEM RES P ONS E • Simulated system 1 output: 4000 0.5 samples, random 0 -0.5 noise of the -1 amplitude 0.5 0 200 400 600 TIME EE392m - Winter 2003 Control Engineering 8-13 Example: FIR model ID FIR es tima te • 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 5 6 7 Impuls e Re s pons e • Impulse response for the simulated system: 0.2 0.15 0.1 0.05 0 -0.05 T=tf([1 .5],[1 1.1 1]); 0 P=c2d(T,0.25); EE392m - Winter 2003 1 2 3 4 Time (s ec) Control Engineering 8-14 Nonlinear parametric model ID • Prediction model depending on the unknown parameter vector θ u (t ) → MODEL(θ ) → yˆ (t | θ ) Loss Index V V = ∑ y (t ) − yˆ (t | θ ) • Loss index J = ∑ y (t ) − yˆ (t | θ ) θ Optimizer 2 2 • Iterative numerical optimization. Computation of V as a subroutine y (t ) u (t ) Model including the parameters θ 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 • Response to a control step applied at tB g (1 − e( t −tB −TD ) /τ ), for t > tB − TD y (t | θ ) = γ + 0, for t ≤ tB − TD γ g θ = τ TD g TD Example: Paper machine process EE392m - Winter 2003 Control Engineering 8-16 Gain estimation • For given τ , TD , the modeled step response can be presented in the form y (t | θ ) = γ + g ⋅ y1 (t | τ , TD ) • This is a linear regression 2 w1 = g k =1 w2 = γ y (t | θ ) = ∑ wkϕ k (t ) ϕ1 (t ) = y1 (t | τ , TD ) ϕ 2 (t ) = 1 • Parameter estimate and prediction for given τ , TD wˆ (τ , TD ) = (Φ Φ ) Φ T y T EE392m - Winter 2003 −1 yˆ (t | τ , TD ) = γˆ + gˆ ⋅ y1 (t | τ , TD ) Control Engineering 8-17 Rise time/dead time estimation • For given τ , TD , the loss index is N V = ∑ y (t ) − yˆ (t | τ , TD ) 2 t =1 • Grid τ , TD 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 P roce s s pa ra me te rs : Ga in = 0.134; Tde l = 0.00; Tris e = 119.8969 1 1.6 1.4 Nonlinear Regression ID 0.8 0.6 1.2 1 0.4 0.8 Linear Regression ID of the first-order model 0.2 0 -0.2 -0.4 0 10 20 30 40 EE392m - Winter 2003 50 60 70 0.6 Nonlinear Regression ID 0.4 0.2 0 80 -0.2 0 100 200 300 400 500 600 700 time in s e c.; MD re s pons e - s olid; e s tima te d re s pons e - da s he d Control Engineering 8-19 800 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 yf 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