• No results found

Version 6 of the System Identification Toolbox

N/A
N/A
Protected

Academic year: 2021

Share "Version 6 of the System Identification Toolbox"

Copied!
9
0
0

Loading.... (view fulltext now)

Full text

(1)

Version 6 of the System Identification Toolbox

Lennart Ljung,

Division of Automatic Control

Department of Electrical Engineering

Link¨

opings universitet, SE-581 83 Link¨

oping, Sweden

WWW:

http://www.control.isy.liu.se

E-mail:

ljung@isy.liu.se,

@isy.liu.se

3rd December 2003

AUTOMATIC CONTROL

COM

MUNICATION SYSTEMS

LINKÖPING

Report no.:

LiTH-ISY-R-2560

Submitted to The 13th IFAC Symposium on System Identification,

Rotterdam, The Netherlands

Technical reports from the Control & Communication group in Link¨oping are available athttp://www.control.isy.liu.se/publications.

(2)

VERSION 6 OF THE SYSTEM IDENTIFICATION TOOLBOX

Lennart Ljung

Division of Automatic Control, Link¨oping University, SE-58183, Link¨oping, Sweden, email:ljung@isy.liu.se

Abstract: This paper describes the new developments in Mathwork’s System Iden-tification Toolbox to be run with Matlab. There are three main additions to the new version: (1) Frequency domain input/output data as well as frequency response data can be directly used to fit models. (2) Simple continuous-time process models of the type Static Gain, Time Constant, Dead Time can be directly estimated as a new model object class. (3) A function advice can be applied both to data sets and to estimated models, in order to provide guidance and advice through the sometime complex identification process.

1. INTRODUCTION

The System Identification Toolbox (SITB) for use with Matlab was first released in 1987. It has gone through several updates, some of which have been reported at earlier IFAC Symposia on System Identification; see (Ljung 1994), (Ljung 1997), and (Ljung 2000).

Version 6 of the System Identification Tool-box, (Ljung 2003) has the following three major additions

• A new model object, idproc, is introduced. It covers simple Process Models of the kind Static Gain + Time Constant + Time Delay. • Input-Output data in the frequency domain can be used for identification as well as fre-quency response data, (frd and idfrd ob-jects).

• A new feature, the function advice has been introduced to guide the inexperienced user through the many options and choices of sys-tem identification. It is also intended to give succinct summaries also for the experienced user. It can be applied to any iddata and idmodel object.

These three items will be described in somewhat more detail in this contribution.

2. SIMPLE PROCESS MODELS 2.1 General Motivation

Simple continuous time process models of the kind Static Gain + Time Constant + Time Delay are dominating for control design in process indus-try. No doubt, the most common identification method in practice is to perform a step response experiment and adjust two or three parameters to the measured response. Nevertheless, such models have not been treated very much in the System Identification literature. The situation resembles that in control design, where the practice is domi-nated by PID-regulator tuning, which, with some exceptions, e.g. (˚Astr¨om and H¨agglund 1995), is not widely treated in the literature.

The recent research area of Identification for con-trol, e.g. (Gevers 1993), (van den Hof and Schrama 1995), (Kosut et al. 1992), (Zang et al. 1995), (Ljung 1998) has produced many interesting re-sults around the interplay between (reduced com-plexity) model estimation and control design. In industrial practice identification for control really is construction of a simple two- or three-parameter model, most often from a transient or possibly relay experiment, followed by tuning of a PI(D)-regulator, based on these two-three parameters.

(3)

2.2 Typical Models and Methods

Perhaps the most commonly used process model is

G(s) = K

1 + sTp1e

−sTd (1)

Among variants of this model, we can have a model without delay (Td= 0):

G(s) = K

1 + sTp1 (2)

and/or introduce an enforced integration (self-regulating process)

G(s) = K

s(1 + sTp1)e

−sTd (3)

Moreover, on can postulate two real poles with or without a zero

G(s) = K(1 + sTz) (1 + sTp1)(1 + sTp2)e

−sTd (4)

A further possibility is to allow resonant poles (”under-damped models”):

G(s) = K(1 + sTz)

1 + 2ζsTr+ (sTr)2 (5) Clearly a variety of models can be defined based on these components.

Several papers and books discuss how to esti-mate models like (1) from transient response data (e.g. (˚Astr¨om and H¨agglund 1995), (Rake 1980), (Ziegler et al. 1943)). Most of the classical meth-ods are graphical or semi-graphical, like finding the steepest tangent to the step response and calculate its intersection with the time axis, etc, or computing areas below the response curve and so on. See e.g. (˚Astr¨om and H¨agglund 1995) for a recent overview of such approaches.

2.3 A Prediction Error Identification Perspective In a standard system identification framework, e.g. (Ljung 1999b), estimation of process models like (1) - (5) is of course no different from estimat-ing any other parameterized linear model. Any of the models of the previous section can be written as

G(s, θ) (6)

where θ comprises the model parameters K, Tp1, Td etc. To estimate the parameters we have collected a data set ZN ={u(1), y(1), . . . , u(N), y(N)} of sampled inputs and outputs. Suppose the sam-pling interval is constant and equal to T . The model (6) is sampled with this sampling inter-val, according to the input inter-sample behavior (zero-order-hold, first-order-hold, band-limited) giving the discrete time model

GT(q, θ) (7)

(q is the shift operator) and the model outputs ˆ

y(t|θ) = GT(q, θ)u(t), t = 1, . . . N. (8) The parameters are then estimated by solving the non-linear least squares problem

ˆ θN = arg min θ N X t=1 (y(t) − ˆy(t|θ))2 (9) It is also straightforward to include a model of additive noise

y(t) = G(p, θ)u(t) + H(p, θ)e(t) (10) where p denotes the differentiation operator (re-placing s). Determining the proper sampled pre-dictor from (10) and letting ˆy(t|θ) denote the corresponding predicted outputs, gives a method (9) that also estimates the noise model.

Moreover, an estimation focus can be defined as discussed in (Ljung 1999a). For a model with H = 1, the estimation focus filter L simply means that the inputs and outputs are first filtered through L.

The asymptotic properties of the estimated model are well known: Suppose the true frequency func-tion for the sampled system is G(T )0 (eiω) (or, more

generally, the frequency function of the linear time invariant second order equivalent of the true sys-tem, see (Ljung 2001)). Then for H = 1 we have, (Ljung 1999b) ˆ θN → arg min θ Z π −π|GT(e , θ) − G(T ) 0 (eiω)|2 × Φu(ω)|L(eiω)|2 (11) Here L is the ”focus filter”, and Φu is the in-put spectrum. The expression describes exactly in what way the simple process model like (1) approximates the true system. We also see how the focus filter may steer the fit to important frequency ranges.

In a sense, (11) also explains the success of simple process models. Even a three-parameter model like (1) has substantial ”local flexibility”. The delay term may pick up the true system’s phase, even if there is no dead-time in the system. For successful control design it is often sufficient to have a rough picture of the Nyquist curve in a limited, but important frequency region, and (11) illustrates how this can be achieved.

2.4 Basic Syntax

The way to refer to the different types of process models is through acronyms built up from the basic symbols:

(4)

• An integer denoting the number of poles (not counting a possible integration)

• ’D’ for time Delay • ’I’ for Integration

• ’Z’ for a zero (numerator term) • ’U’ for under-damped (complex) poles. For example, the models (1) to (5) are denoted by P1D, P1, P1ID, P2ZD and P2ZU, respectively. The basic syntax to create such a model is m0 = idproc(’P1D’)

and for estimating it from data m = pem(data,’P1D’)

The standard property/value pairs for various options can be added to the list of arguments. This includes the possibility to estimate initial conditions, add noise models, etc. Also, fixing certain parameters is possible, as well as defining upper and lower bounds for them.

For multi-input systems, different type of models can be applied to each input. This is handled by letting the model descriptions be cell arrays as in m = pem(data,{’P1D’,’P2U’})

2.5 GUI support

The estimation of process models is also included in the standard Graphical User Interface (GUI)-setup of the System Identification Toolbox. Estimated process models are included in the “Model Board” and can be subjected to any of the examination and visualization tools.

The definition of the process models is also sup-ported by a GUI. It has pop-up menus and check-boxes for defining the structure and also allows fixing and bounding the parameter values. See Figure 1 for an illustration.

3. FREQUENCY DOMAIN DATA 3.1 Input-Output Fourier Data

If the input-output data are given in the frequency domain as Fourier transforms, the prediction error approach to estimating process models still can be applied. See, e.g. Section 7.7 in (Ljung 1999b) or chapters 5–8 in (Pintelon and Schoukens 2001). The iddata object now allows definition of in-put/output data in the frequency domain over arbitrary frequencies as in

dat = iddata(Y,U,’Frequencies’,W,... ’Domain’,’Freq’,’Ts’,0);

Note that the sampling interval, T , (’Ts’) is still relevant, since it has information of how the signal

Fig. 1. The GUI for defining process models. For multi-input the pop-up menu at the top left selects the input, or you declare that all inputs have the same structure. The check boxes below determine whether Integration, Time Delay and/or a Zero should be in-cluded. The text above writes out the cur-rently chosen structure. Up to the right, ini-tial or fixed parameter values are selected, and also possible upper and lower bounds on the parameters. The zone below this concerns a number of options about disturbance mod-els, initial states etc. Below that is a zone for iteration information and control.

Fourier transforms Y and U have been computed from time domain data. Discrete time Fourier Transforms conceptually have the frequency argu-ment eiωT. Note however, that frequency domain data, unlike time domain data allow continuous time signals (T = 0).

With frequency domain data objects, several Matlab commands are naturally overloaded: DF = fft(dat)

da = abs(dat) df = phase(dat) etc.

Models can now be estimated directly from iddata objects in the frequency domain. The syntax for this is entirely transparent. If the fre-quency domain data is denoted as continuous time, a continuous time model is estimated di-rectly (without d2c transformations). All the tool-box commands for simulation and validation han-dle time/frequency domain data in a transparent manner. The only restriction is that, for the mo-ment, estimation of noise models and time-series models is not supported for frequency domain data. The reason is the more complex criteria of fit that must be used for continuous-time and non-equidistantly spaced frequency data. See, e.g. page 230 in (Ljung 1999b).

(5)

3.2 Frequency Response Data

The estimation code also accepts frequency re-sponse data objects, like frd in the Control System Toolbox or idfrd in the SITB. It is of-ten the case that experimental frequency domain response data are stored as frequency functions rather that as inputs and outputs, separately. This also could be more economical, e.g. by using loga-rithmically spaced frequencies. There is also data acquisition equipment, frequency analyzers, that collect and deliver the result of the experiment as frequency response data.

A new function that estimates idfrd objects (fre-quency functions and disturbance spectra) from time or frequency iddata objects is

g = spafdr(data)

which allows Frequency Dependent Resolution, with a logarithmic frequency grid as default along with a resolution that as adopted to the grid. This could be an efficient way of compressing measured data. It is often the case that a courser resolution (in rad/s) can be used at higher frequencies, and that a constant relative resolution is to be preferred. Figure 2 illustrates the effect of the frequency dependent resolution.

10−1 100 101 102 10−2 10−1 100 101 102 10−1 100 101 102 10−2 10−1 100 101 102

Fig. 2. Estimate of the frequency function for the data set IDDATA1, using SPA (above) and SPAFDR (below) with default arguments for frequency vector and resolution. Thin line: the true frequency response.

Frequency domain data offer useful potentials also for other problems:

• The focus filter can be implemented as spe-cific frequencies for which the fit should be made. For example,

m = oe(dat,[2 2 1],’focus’,[0.2 1]) will concentrate the fit to the pass band from 0.2 to 1 rad/s. The desired frequency bands may not necessarily be known a priori, but could be selected from a preliminary model, like using frequencies that correspond to the

Nyquist curve being in the third quadrant, or being close to the critical point−1. Example: m = n4sid(data,5);

f = idfrd(m);

ph = phase(squeeze(f.resp));

fs = fselect(f,find(ph>-pi & ph<-pi/2)); mp = pem(fs,’p1d’);

• If the inter-sample input behavior is band-limited, moving to the frequency domain will be the easiest way to handle the sampling. The FFT (discrete Fourier transform) of the input will then be equal to the Fourier trans-form of the underlying continuous time input signal. The FFT of the output will simi-larly correctly describe the continuous time Fourier transform of that part of the output that originates from the input, and we can directly fit a continuous time model:

z = iddata(y,u,0.5); zf = fft(z);

zf.Ts = 0;

mp = oe(zf,[2 2 1])

3.3 GUI support

Frequency domain iddata and frequency response data as frd or idfrd objects can be imported into the GUI in the same way as time domain data. The icons for the different types of data sets are marked by different background colors. The data preprocessing menus allow the transfor-mation between the various representations. Also the use of data objects of different types for es-timation and validation is entirely transparent. For example, if an IDFRD object is chosen as validation data, the Model output view shows the frequency responses of the models, together with the data.

4. THE ADVICE FEATURE

The function advice in (Ljung 2003) takes any data object or any model object as an argument and delivers a text that comments the objects and gives some hints how to proceed.

This is accomplished by a hidden property (called utility) of these objects, that is a structure with several fields. The Matlab functions assignin and inputname allows you to update a workspace variable (in this case its utility-property) even if it is not the output of a function called. This makes it possible to adjoin to a model or a data set a “diary” of what has been done, and thus give relevant advice of further things that can be tested.

For data objects, advice tests things like • excitation

(6)

• feedback in data

• if a step or impulse occurs “too early” in the set. There is a technical side that is more treacherous: It is quite common to see applications where the data is a single step or impulse response, where the step/impulse occurs in the first few data points. Such data could very well be used for reasonable model-ing if the signal–to–noise ratio is good. How-ever, many estimation techniques (like esti-mating ARX-model and subspace methods) effectively shift the data (up to a number of samples that is about the model order) in order to avoid estimation data points prior to the start of the data collection. This makes the data look like a response to a constant input, and no reasonable models can be built. It is my experience that this problem is the single most common reason for complaints about the identification process from first-time users.

• possible detrending

• points to the possibility to assign input inter-sample behavior

• etc

For model objects advice

• points out that compare and resid should be run if this has not been done. It also checks whether this was done on a separate validation set.

• comments on what has been seen in the residual analysis test resid. Based on χ2 -tests it gives advice whether higher order dynamics and noise models are required. • checks if the model order can be reduced. • allows comparisons of several models,

advice(m1,m2,m3) and points out which one should be preferred.

• etc

The function is best illustrated by an example of how it works:

>>load iddata1 >>advice(z1)

All your inputs have been denoted as ’zero order hold’ (’zoh’), i.e. they are assumed to be piecewise constant over the sampling interval. If the input is a sampled continuous signal and you plan to build or convert to time continuous models, it is recommended to mark the Intersample property as ’First order hold’: Data.int = ’foh’ or Data.int = {’foh’,’foh’, ...} for multiinput signals.

You may mix ’zoh’ with ’foh’ for the different inputs in the latter

case.

All inputs and outputs are not zero mean. It it generally recommended to remove the means by DAT = DETREND(DAT), except in the following two cases: 1. The signals are measured relative

to a level that corresponds to a physical equlibrium. This could e.g. be the case if step responses

are recorded from an equlibrium point. 2. There is an integrator in the

system, and the input and output levels are essential to describe the effect of the integration. There is no significant indication of feedback in the data.

The input is persistantly exciting of order more than 50. This means that you will not encounter identifiability problems if estimating models of order lower than so.

>>m=arx(z1,[1 1 1]); >>advice(m)

You should run a comparison test COMPARE(VDATA,m)

where VDATA preferably is a different data set from the estimation data z1. You can then run ADVICE(m) again. You should run a residual test

RESID(VDATA,m)

where VDATA preferably is a different data set from the estimation data z1. You can then run ADVICE(m) again. >>compare(z1,m);

>>resid(z1,m); >>advice(m)

There is a very strong indication that the dynamics of the model is

not adequately described.

A first general advice is to run RESID(VDATA,m,’FR’) to check in which frequency ranges the model error is

present. If the model error is unacceptable, you will have to increase the model order. In particular you should pay attention to lags 2 3 6 from input 1.

(7)

Modify KU and the orders NB so that these lags are included in the model.

There is a very strong indication that the residuls are not white. To get a good noise model you need to increase the orders associated with the noise parameters, or just increase

the order of a state-space model.

5. CONCLUSIONS

The three new features that have been added to the System Identification Toolbox, viz. estimating and validation with frequency domain data, simple process models, and the advice func-tion correspond to the most common requests from users. There is a risk that adding new fea-tures to a software package will make the use of it more complicated. To handle this risk, it has been important to make the syntax for frequency and time domain data entirely transparent, and also to make sure that the estimation and examination of process models follow the same syntax as for other models.

6. REFERENCES

Gevers, M. (1993). Towards a joint design of iden-tification and control?. In: Essays on control: Perspectives in the theory and its applications (H L Trentelman and J C Willems, Eds.). ECC ’93 Groningen.

Kosut, R.L., G. C. Goodwin and M. P. Polis (Eds) (1992). Special Issue on System Identification for Robust Control Design, IEEE Trans. Au-tomatic Control, Vol 37.

Ljung, L. (1998). Identification for control – what is there to learn?. In: Learning, Control and Hybrid Systems (Y. Yamamoto and S. Hara, Eds.). Vol. 241 of Springer Lecture Notes in Control and Information Sciences. Springer Verlag. Berlin. pp. 207–221.

Ljung, L. (1999a). Estimation focus in system identification: Prefiltering, noise models, and prediction. In: IEEE Conference on Decision and Control.

Ljung, L. (1999b). System Identification - Theory for the User. 2nd ed.. Prentice-Hall. Upper Saddle River, N.J.

Ljung, L. (2001). Estimating linear time invariant models of non-linear time-varying systems. European Journal of Control 7(2-3), 203–219. Semi-plenary presentation at the European Control Conference, Sept 2001.

Ljung, L. (2003). System Identification Toolbox for use with Matlab. Version 6.. 6th ed.. The MathWorks, Inc. Natick, MA.

Ljung, Lennart (1994). A graphical user interface (gui) to the system identification toolbox. In: Proc. 10th IFAC Symposium on System Iden-tification (SYSID’94). Vol. 4. Copenhagen, Denmark. pp. 29–33.

Ljung, Lennart (1997). Developments for the sys-tem identification toolbox for matlab. In: Proc. of the 11th IFAC Symposium on Sys-tem Identification. Vol. 1. Kitakyushi, Japan. pp. 969–975. SYSID.

Ljung, Lennart (2000). Version 5 of the sys-tem identification toolbox for use with mat-lab - with object orientation. In: Proc IFAC Symposium SYSID 2000. Santa Barbara. pp. ThPM5–5.

Pintelon, R. and J. Schoukens (2001). System Identification – A Frequency Domain Ap-proach. IEEE Press. New York.

Rake, H. (1980). Step response and frequency response methods. Automatica 16, 519–526. ˚

Astr¨om, K. J. and T. H¨agglund (1995). PID Controllers: Theory, Design, and Tuning. 2nd ed.. Instrument Society of America. Triangle Research Park, N.C.

van den Hof, P. M. J. and R.J.P. Schrama (1995). Identification and control–closed loop issues. Automatica 31(12), 1751–1770.

Zang, Z., R. R. Bitmead and M. Gevers (1995). Iterative Weighted Least-squares Identifica-tion and Weighted LQG Control Design. Au-tomatica 31(11), 1577–1594.

Ziegler, J. G., N. B. Nichols and N.Y. Rochester (1943). Process lags in automatic-control cir-cuits. Trans. ASME 65, 443–444.

(8)

Abstract

(9)

Avdelning, Institution

Division, Department

Division of Automatic Control

Department of Electrical Engineering

Datum Date

2003-12-03

Spr˚ak Language 2 Svenska/Swedish 2 X Engelska/English 2 ... Rapporttyp Report category 2 Licentiatavhandling 2 Examensarbete 2 C-uppsats 2 D-uppsats 2 X ¨Ovrig rapport 2 ... URL f¨or elektronisk version

http://www.control.isy.liu.se

ISBN

...

ISRN

...

Serietitel och serienummer Title of series, numbering

LiTH-ISY-R-2560

ISSN

1400-3902

...

Titel

Title Version 6 of the System Identification Toolbox F¨orfattare

Author Lennart Ljung, ,

Sammanfattning Abstract

.

Nyckelord Keywords

References

Related documents

If the model is too complex to be used for control design, it can always to reduced: In that case we know exactly the dierence between the validated model and the reduced one..

46 Konkreta exempel skulle kunna vara främjandeinsatser för affärsänglar/affärsängelnätverk, skapa arenor där aktörer från utbuds- och efterfrågesidan kan mötas eller

Generally, a transition from primary raw materials to recycled materials, along with a change to renewable energy, are the most important actions to reduce greenhouse gas emissions

För att uppskatta den totala effekten av reformerna måste dock hänsyn tas till såväl samt- liga priseffekter som sammansättningseffekter, till följd av ökad försäljningsandel

The increasing availability of data and attention to services has increased the understanding of the contribution of services to innovation and productivity in

Av tabellen framgår att det behövs utförlig information om de projekt som genomförs vid instituten. Då Tillväxtanalys ska föreslå en metod som kan visa hur institutens verksamhet

But even though the playing can feel like a form of therapy for me in these situations, I don't necessarily think the quality of the music I make is any better.. An emotion

The informal settlement must be understood alongside other urban and housing typologies — apartment block, suburb, gated community, garden city, skyscraper, tower in the