NNSYSID and NNCTRL tools for system identification and control with neural networks

8
NEURAL NETWORKS Tools for system identification and control with neural networks by Magnus Nergaard, Ole Ram and Niels Kjelstad Poulsen Two toolsets for use with MATLAB have been developed: the neural network based system identification toolbox (NNSYSID) and the neural network based control system design toolkit (NNCTRL).The NNSYSID toolbox has been designed to assist identification of nonlinear dynamic systems. It contains a number of nonlinear model structures based on neural networks, effective training algorithms and tools for model validation and model structure selection. The NNCTRL toolkit is an add-on to NNSYSID and provides tools for design and simulation of control systems based on neural networks. The user can choose among several designs such as direct inverse control, internal model control, nonlinear feedforward, feedback linearisation, optimal control, gain scheduling based on instantaneous linearisation of neural network models and nonlinear model predictive control. This article gives an overview of the design of NNSYSID and NNCTRL. eural networks have become a popular tool for identification and control of unknown nonlinear systems. The networks are generic N nonlinear model structures which have proven to be suitable for blackbox modelling. Despite this fact there are currently no commercial software packages available exclusively for system identification and control system design with neural networks. Most neural network packages available on the market have been developedaccording to the 'Swiss army knife' principle in the sense that they are general-purpose programs rather than being specialised for specific applications. Typically, a large number of network architectures and training algorithms are provided and it has obviously been the intention of the developers that it should be possible to solve fundamentally different types of problems with the same software package. Some examples of general- purpose software that might be applied to system identification and, to a very limited extent, control system design are Neuralworks Professional II/PLUS from Neuralware Inc., The Neural Network Toolbox for MATLAB from The MathWorks Inc., NeuroSolutions from NeuroDimension Inc., and NeuroLab from Mikumi Berkeley R&D Corporation. As for the 'Swiss army knife', it is, however, a common weakness of the general-purpose packages that they must settle for a compromise with respect to their applicability for specific problems. For example, pre- defined network architectures suitable for system identification and functions that are relevant for validation of nonlinear models of dynamic systems are only present to a very limited extent. The lack of tools for design of controllers based on neural network models is particularly pronounced. The reason for this might be that development of generic software for control system design is relatively difficult as several types of control designs exist. Additionally, the user must be able to select an arbitrary reference trajectory and to add various ad hoc solutions in order to deal with possible disturbances, sensor noise, limitations in the actuators etc. In addition to NNSYSID and NNCTRL a few non- commercial tools for system identification and control system design have recently become available. One of these is the neural model based predictive control toolbox for MATLAB and the accompanying black box identi- COMPUTING & CONTROL ENGINEERING JOURNAL FEBRUARY 2001 29

Transcript of NNSYSID and NNCTRL tools for system identification and control with neural networks

Page 1: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

Tools for system identification and control with neural networks by Magnus Nergaard Ole Ram and Niels Kjelstad Poulsen

Two toolsets for use with MATLAB have been developed the neural network based system identification toolbox (NNSYSID) and the neural network based control system design toolkit (NNCTRL) The NNSYSID toolbox has been designed to assist identification of nonlinear dynamic systems It contains a number of nonlinear model structures based on neural networks effective training algorithms and tools for model validation and model structure selection The NNCTRL toolkit is an add-on to NNSYSID and provides tools for design and simulation of control systems based on neural networks The user can choose among several designs such as direct inverse control internal model control nonlinear feedforward feedback linearisation optimal control gain scheduling based on instantaneous linearisation of neural network models and nonlinear model predictive control This article gives an overview of the design of NNSYSID and NNCTRL

eural networks have become a popular tool for identification and control of unknown nonlinear systems The networks are generic N nonlinear model structures which have

proven to be suitable for blackbox modelling Despite this fact there are currently no commercial software packages available exclusively for system identification and control system design with neural networks Most neural network packages available on the market have been developed according to the Swiss army knife principle in the sense that they are general-purpose programs rather than being specialised for specific applications Typically a large number of network architectures and training algorithms are provided and it has obviously been the intention of the developers that it should be possible to solve fundamentally different types of problems with the same software package Some examples of general- purpose software that might be applied to system identification and to a very limited extent control system design are Neuralworks Professional IIPLUS from Neuralware Inc The Neural Network Toolbox for MATLAB from The MathWorks Inc NeuroSolutions from NeuroDimension Inc and NeuroLab from Mikumi

Berkeley RampD Corporation As for the Swiss army knife it is however a common

weakness of the general-purpose packages that they must settle for a compromise with respect to their applicability for specific problems For example pre- defined network architectures suitable for system identification and functions that are relevant for validation of nonlinear models of dynamic systems are only present to a very limited extent

The lack of tools for design of controllers based on neural network models is particularly pronounced The reason for this might be that development of generic software for control system design is relatively difficult as several types of control designs exist Additionally the user must be able to select an arbitrary reference trajectory and to add various ad hoc solutions in order to deal with possible disturbances sensor noise limitations in the actuators etc

In addition to NNSYSID and NNCTRL a few non- commercial tools for system identification and control system design have recently become available One of these is the neural model based predictive control toolbox for MATLAB and the accompanying black box identi-

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 29

NEURAL NETWORKS

fication toolbox The latter toolbox has many similarities to the NNSYSID toolbox but offers a useful GUI as front end for the user The first mentioned toolbox focuses on model predictive control and has thus little overlap with the NNCTRL toolkit It allows the user to design predictive controllers based on fairly general criteria including criteria with constrained control inputs Both

make heavy use of the optimisation toolbox for Matlab Other tools are ORBIT (operating regime based modelling and identification toolkit) and ORBITcd (ORBIT control design toolkit) Both toolkits are for use with MATLAB and SIMULINK and contain advanced tools for regime based identification and for design of control systems based on the identified models

The regime based identification scheme underlying the ORBIT toolkits is fundamentally different from the modelling technique on which NNSYSID and NNCTRL are based Regime based identification is a modelling technique in which a global nonlinear model is patched together from several models each being valid in a certain operating regime One advantage of this approach is that it allows the user to incorporate knowledge about the physics of the system in the model (grey-box modelling) When the local models are linear this model repre- sentation is particularly relevant for control by gain scheduling NNSYSID and NNCTRL support the more conventional approach in which a single neural network is trained to describe the system in its entire range of operation

The implementation of NNSYSID and NNCTRL was governed by the following philosophy

Limit superfluous flexibility by restricting attention to the most popular type of neural network namely the multilayer perceptron network with one hidden layer Provide a set of predefined model structures relevant for system identification and control In general reduce the amount of adjustable parameters Emphasise development of evaluation tools that are relevant for validation of the identified neural network models Easily expandable It must be possible for the user to incorporate ad hoc

solutions specific to the system under consideration Approach problems in a way common to the control engineering community The neural network field may often appear confusing as much of the terminology is different from what people from other fields are used to

The tools have been developed for the MATLAB environment for several reasons MATLAB is a very versatile numerical software package that runs on most hardware platforms and it has an extensive interactive environment for data visualisation Addi- tionally MATLAB is widely used in the control engineering community The MathWorks Inc that develops MATLAB provides a neural network toolbox already However as mentioned previously this is a general-purpose toolbox that lacks the specialisation needed for serious system identification and control system design NNSYSID and NNCTRL have therefore been implemented to run completely independently of the neural network toolbox

All functions in the NNSYSID toolbox have been written as lsquom-functionsrsquo but some cmex duplicates have been coded for speeding up the most time-consuming functions (a cmex file is a subroutine written in C that can be called from MATLAB) The NNCTRL toolkit consists of a combination of script files and m-functions Both toolsets require Mathworksrsquo signal processing toolbox In addition to this it is in the NNCTRL toolkit

1

validate model

+ accepted

Fig 1 System identification procedure

an advantage if SIMULINK is available for building models of dynamic systems The NNSYSID toolbox is a necessary requirement for being able to run the NNCTRL toolkit but not vice versa

NNSYSID toolbox The task of inferring

models of dynamic systems from a set of experimental data relates to a variety of areas If the system to be identified can be described in terms of a linear model then quite formalised methods exist for approaching the problem and several advanced tools are available When it is unreasonable to assume linearity and when the physical insight into the systemrsquos dynamics is too limited to propose a suitable nonlinear model structure the task becomes much

30 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

more complex In this case a generic nonlinear model structure such as a neural network is required

Procedure Fig 1 shows the procedure usually followed when

identifying a dynamic system It is seen that iterations back and forth between the steps must be expected The approach to the identification procedure is usually influenced by the available a priori knowledge of the system and the intended application of the model

The toolbox does not assist the user in designing the experiment It is assumed that experimental data describing the underlying system in its entire range of operation has been obtained in advance with a proper choice of sampling frequency

u(t) denotes the input to the system andy(t) denotes the output

The toolbox is designed to cover the remaining three stages of the procedure as well as the paths leading from validation and back to the previous stages The following subsections will present the functions contained in the toolbox

Selecting a model structure Assuming that a data set has been acquired the next

step is to select a set of candidate models Unfortunately this is more difficult in the nonlinear case than in the linear Not only is it necessary to choose a set of regressors but a network architecture must be chosen as well The selection of model structures provided in the toolbox follows essentially the suggestions given in for example Reference 3 The procedure is to select the regressors as for the conventional linear model structures and then afterwards to determine the best possible neural network architecture with the selected regressors as inputs

The toolbox provides the six model structures listed below cp(t) is the regression vector e is the parameter vector containing the weights of the neural network g is the function realised by the neural network and (t I 0) denotes the one step ahead prediction of the output

NNARX structure

NNOE structure

NNARMAXl structure

e(t) is the prediction error E(t) = y( t ) -$(t I e) and C is a monic polynomial in the delay operator with roots inside the unit circle C(4-l) = 1 + clq- + cPq-D

NNARMAX2 structure

NNSSIF structure (state space innovations form)

Notice that C(8) in this case is a matrix To obtain an observable model structure a set of pseudo-observability indices must be specified

NNIOL structure (input-output linearisation)

where f and g are two separate networks This structure differs from the previous ones in that it is not motivated by a linear model structure NNIOL models are particu- larly relevant for control by input-output linearisation

For NNAFS and NNIOL model structures there is an algebraic relationship between prediction and past data The remaining model structures are more complicated since they all contain feedback from the network output (prediction) to the network input In the neural network terminology such structures are called recurrent neural networks The feedback may lead to undesired limit cycles or instability in certain regimes of the operating range This will typically occur if either the model structure or the data material is insufficient The NNARMAXl structure has been provided to remedy these problems by using a linear moving average filter on the past prediction errors

When a particular class of model has been selected the next choice to be made is the number of past signals used as regressors (ie the model order or lag space) It is desirable that the user has sufficient physical insight to choose these properly However the toolbox provides the

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 31

NEURAL NETWORKS

function l$schit which can be useful in the deterministic case It implements a method based on so-called lsquolipschitz coefficientsrsquo which has been proposed in Reference 4

The toolbox supports two-layer perceptron networks only

The network architecture ie how many weights Klwlr to include is often the most difficult to select It is common to initially select an architecture that is relatively large compared to the size of the training data set and subsequently use regularisation or pruning to balance the flexibilityparsimonious dilemma appropri- ately Fig 2 shows a NNARMAX(222) model structure with five hidden units

Estimate a model The model estimation stage includes choosing a

criterion of fit and an iterative search algorithm for finding the network parameters (the weights) that mini- mise the criterion (ie training the network) The toolbox provides functions for minimisation of the fairly general regularised mean square error criterion

The matrix D can be an arbitrary diagonal matrix but most often D = al or D = 0 is used

For multi-output systems it is possible to train NNARX and state-space models according to the criterion

WNZN) =

The function nnigls implements the iterated generalised least squares procedure for iterative estimation of net- work weights and noise covariance matrix The inverse of the estimated covariance matrix is in this case used as weighting matrix (A) in the criterion (QW estimation)

Table 1 Functions for nonlinear system identification

32

nnarx nnarmaxl

nnarmax2

nnoe nnssif nniol

nnarxm nnigls nnrarx nnrarmxl nnrarmx2

identify a neural network ARX (or AR) model identify a neural network ARMAX (or ARMA model) linear noise filter identify a neural network ARMAX (or ARMA) j model identify a neural network output error model identify a neural network state space model ~

identify a neural network model suited for 1-0 linearisation type control identify a multi-output NNARX model IGLS procedure for multi-output systems I

recursive counterpart to NNARX I

recursive counterpart to NNARMAXl I

recursive CounterDart to NNARMAX2

Newcomers to the neural network field are often confused by the many variations of training algorithms described in the literature or provided in the software they are using However system identification and control are usually small or medium-sized problems compared to other neural network application areas and lack of computer memory is rarely a problem The default training is thus carried out with a Levenberg-Marquardt method This is a so-called batch algorithm and it provides a very robust and fast convergence Moreover it does not require a number of exotic design parameters which makes it easy to use Alternatively it is possible to train the networks with a recursive prediction error algorithm This may have some advantages over batch algorithms such as the Levenberg-Marquardt algorithm when large neural networks are trained on large data sets since the memory requirement in this case is reduced The recursive algorithm has been implemented with three different types of forgetting exponential forgetting constant trace and the EFRA algorithm (exponential forgetting and resetting algorithm) algorithm

The functions for identifying models based on recurrent networks allow the use of skipping to prevent transient effects due to unknown initial conditions from corrupting the model

The toolbox contains the functions listed in Table 1 for estimating models with particular structures

Validation and model comparison When a network has been trained the functions listed

in Table 2 are available for validation of the model The most common method of validation is to analyse predictions and prediction errors (residuals) by cross- validation on a fresh set of data a so-called test or validation data set The functions nvalid ioleval and ifvalid carry out an analysis comprising a comparison of actual and predicted outputs and plots the auto- correlation function and distribution of the residuals Also a linear model is extracted from the network at each sampling instant to give the user an impression of the lsquodegree of nonlinearityrsquo xcorrel computes a series of cross-correlation functions to check that the residuals are independent of (past) inputs and outputs nnfpe is Akaikersquos final prediction error estimate which in this case has been modified for networks trained according to a regularised criterion and nnloo produces the leave- one-out estimate kpredict calculates the k-step ahead predictions and nnsimul makes a pure simulation of the model from inputs alone

Stepping backwards in the procedure In Fig 1 a number of paths are shown that lead from

validation and back to the previous stages The path from validation to training symbolises that it might be possible to obtain a better model if the network is trained with another weight decay parameter or if the weights are initialised differently Since it is likely that the train-

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

ing algorithm converges to a non-global minimum the network should be trained a couple of times with different initialisations of the weights Regularisation by weight decay has a smoothing effect on the criterion and several of the local minima are often removed when this is used

Another path leads back to model structure selection Because the model structure selection problem has been divided into two separate sub-problems this can mean two things namely lsquotry another set of regressorsrsquo or lsquotry another network architecturersquo While the regressors typically have to be selected on a trial-and-error basis it is to some extent possible to automate the network architecture selection The most commonly used method is to prune a very large network until the optimal architecture is reached The toolbox provides the so- called optimal brain surgeon (OBS) algorithm for pruning the networks (Table 3) OBS was originally proposed in the literature but in Reference 5 it has been modified to cover networks trained according to a regularised criterion

Additional functions The toolbox contains a number of additional functions

such as demonstration programs that demonstrates the functionality of the toolbox

NNCTRL toolkit The NNCTRL toolkit is an add-on to the NNSYSID

toolbox It is called a toolhit to emphasise that it is not just a collection of m-functions as are other MATLAB toolboxes Design and simulation of neural network based control systems has been found too complex to fit easily into ordinary MATLAB functions Also it is desirable that the programs used for simulating a control system in MATLAB have a structure similar to what they would have if the control system were to be implemented on a real-time platform

The toolkit has been given a structure that facilitates incorporation of new control concepts This is an attractive feature when the ones provided in advance are insufficient for the problem under consideration or when the user simply would like to test new ideas Furthermore since all tools have been written in MATLAB code it is easy to understand and modify the existing code if desired

Program structure All controllers have been

implemented within the same framework This

Table 2 Functions for evaluation of trained networks

nnvalid ifvalid

j ioleval kpredict ~ nnsimul I xcorrel 1 nnfpe nnloo

validation of 1-0 model of dynamic system validation of models generated by NNSSIF validation of models generated by NNIOL compute and plot k-step ahead predictions simulate model of dynamic system display different cross-correlation functions I

FPE-estimate for model of dynamic system leave-one-out estimate for NNARX model rsquo

1

I

Table 3 Functions for finding the optimal network architecture

I nnprune 8 optimal brain suraeon (OBS)

prune models of dynamic systems with

framework contains different standard components such as reading a design parameter file variable initialisation reference signal generation system simulation a constant gain PID controller data storage plots and more The control systems can be divided into two fundamentally different categories

Dzrect design the controller is in itself a neural network Indirect design The controller is not a neural network but the design is based on a neural network model of the system to be controlled

The program structure is slightly different for each category Both program structures are depicted in Fig 4 Each box in Fig 4 symbolises a MATLAB script file or function The three basic components are

A function describing the system to be controlled The system can be specified either as a SIMULINK model a MATLAB function containing the differential equations or a neural network model of the system The SIMULINK and MATLAB options are of course only

Fig 2 NNARMAX2 model structure The lag space [ n m p] = [2 2 21 and the network has five hidden units Notice this is a recurrent network since the two past prediction errors e(t- 1 e(t- 2) are used as inputs to the network

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 33

NEURAL NETWORKS

Ouiput (solid) and one-stsp ahead prediction (dashed) 1

0 50 100 150 200 250 300 350 400 450 SO0 tirne (samples)

Predicilon error (y-yhal) 2 I

Histogram over prediction enorr 25 -20 -15 -lO -5 0 5 10 15 20 25

I la9

60

40

20

0 5

Z Z ~ineatized network parameien

I

0 4 1

Fig 3 Screen dumps from some of the validation functions

34 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

-

relevant when a physical model exists A MATLAB script file containing initialisations specified by the user Some initialisations that are typically required are choice of reference signal sampling frequency name of SIMULINWMATLAB function implementing the system to be controlled PID or neural network based controller design parameters for the controller The file has a prespecified name and format associated with the controller type When working with NNCTRL a lsquotemplatersquo initialisation file is copied to the working directory and modified to comply with the application under consideration The main program that automatically reads the initial- isation file and subsequently simulates and controls the system

-F main loop begin

compute reference

compute output from process

update I design controller weights for next sample

compute control signal

time updates

end loop

plot simulation results

SlMULlNK MATLAB or neural net model

I

Fig 4 Program structures Indirect design a controller is designed for a pretrained network at each sample Direct design the controller is often trained online and for this reason the lsquoupdate weightsrsquo stage is included When an acceptable performance has been reached this stage is omitted in the final use

A brief overview of the control designs supported by the toolkit is given in the following subsections

Direct inverse control invcon Direct inverse control is probably the design which

is encountered most often in the literature A neural network is trained to behave as the lsquoinversersquo of the system to be controlled in the sense that the neural network is taught to calculate the control input that was used to drive the systemrsquos output to the present value After training this network is used as a controller The reference (desired output) is supplied to the network which in turn predicts the control input needed to obtain this system output one sample later

The NNCTRL toolkit does not only support simulation of direct inverse control It also contains function for training of inverse models Two training schemes are possible an offline method known as generalised training and an online method known as specialised training The criterion to be minimised is different in the two cases which causes the different approaches to minimisation Generalised training is the most simple to carry out but specialised training is usually preferred in practice as it leads to better controllers Specialised training is related to model- reference adaptive control and can in principle be used for control of time-varying systems It is suitable for systems that are not one-to-one and it is possible to optimise the inverse model for specific reference trajectories

It is also possible to train it so that the closed-loop system behaves as a specified transfer function model Both recursive gradient algorithms and recursive Gauss- Newton based algorithms with different types of forgetting are provided for the specialised training

Internal model control MQ imccon In IMC the control signal is synthesised from both

an inverse and a lsquoforwardrsquo model of the system to be controlled Therefore it is in this case necessary to train two neural networks An advantage of IMC is that it can compensate for constant disturbances acting on the system The inverse model is trained as described above

Feedforward with inverse models 8con One might prefer to use feedback control for stabilisa-

tion and disturbance attenuation only and then use feedforward control to ensure a fast reference tracking The toolkit allows the user to employ an inverse neural network model of the system as feedforward controller in combination with a conventional PLD-controller for feed- back control This strategy appeals to many industrial users who often prefer to optimise an existing control system rather than substitute it for a completely new design A discussion of the principle can be found in Reference 6

Feedback 1inearisationfblcon Feedback linearisation is a popular method for control

of certain classes of nonlinear systems The NNCTRI toolkit provides a simple discrete time input-output

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 35

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

Page 2: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

fication toolbox The latter toolbox has many similarities to the NNSYSID toolbox but offers a useful GUI as front end for the user The first mentioned toolbox focuses on model predictive control and has thus little overlap with the NNCTRL toolkit It allows the user to design predictive controllers based on fairly general criteria including criteria with constrained control inputs Both

make heavy use of the optimisation toolbox for Matlab Other tools are ORBIT (operating regime based modelling and identification toolkit) and ORBITcd (ORBIT control design toolkit) Both toolkits are for use with MATLAB and SIMULINK and contain advanced tools for regime based identification and for design of control systems based on the identified models

The regime based identification scheme underlying the ORBIT toolkits is fundamentally different from the modelling technique on which NNSYSID and NNCTRL are based Regime based identification is a modelling technique in which a global nonlinear model is patched together from several models each being valid in a certain operating regime One advantage of this approach is that it allows the user to incorporate knowledge about the physics of the system in the model (grey-box modelling) When the local models are linear this model repre- sentation is particularly relevant for control by gain scheduling NNSYSID and NNCTRL support the more conventional approach in which a single neural network is trained to describe the system in its entire range of operation

The implementation of NNSYSID and NNCTRL was governed by the following philosophy

Limit superfluous flexibility by restricting attention to the most popular type of neural network namely the multilayer perceptron network with one hidden layer Provide a set of predefined model structures relevant for system identification and control In general reduce the amount of adjustable parameters Emphasise development of evaluation tools that are relevant for validation of the identified neural network models Easily expandable It must be possible for the user to incorporate ad hoc

solutions specific to the system under consideration Approach problems in a way common to the control engineering community The neural network field may often appear confusing as much of the terminology is different from what people from other fields are used to

The tools have been developed for the MATLAB environment for several reasons MATLAB is a very versatile numerical software package that runs on most hardware platforms and it has an extensive interactive environment for data visualisation Addi- tionally MATLAB is widely used in the control engineering community The MathWorks Inc that develops MATLAB provides a neural network toolbox already However as mentioned previously this is a general-purpose toolbox that lacks the specialisation needed for serious system identification and control system design NNSYSID and NNCTRL have therefore been implemented to run completely independently of the neural network toolbox

All functions in the NNSYSID toolbox have been written as lsquom-functionsrsquo but some cmex duplicates have been coded for speeding up the most time-consuming functions (a cmex file is a subroutine written in C that can be called from MATLAB) The NNCTRL toolkit consists of a combination of script files and m-functions Both toolsets require Mathworksrsquo signal processing toolbox In addition to this it is in the NNCTRL toolkit

1

validate model

+ accepted

Fig 1 System identification procedure

an advantage if SIMULINK is available for building models of dynamic systems The NNSYSID toolbox is a necessary requirement for being able to run the NNCTRL toolkit but not vice versa

NNSYSID toolbox The task of inferring

models of dynamic systems from a set of experimental data relates to a variety of areas If the system to be identified can be described in terms of a linear model then quite formalised methods exist for approaching the problem and several advanced tools are available When it is unreasonable to assume linearity and when the physical insight into the systemrsquos dynamics is too limited to propose a suitable nonlinear model structure the task becomes much

30 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

more complex In this case a generic nonlinear model structure such as a neural network is required

Procedure Fig 1 shows the procedure usually followed when

identifying a dynamic system It is seen that iterations back and forth between the steps must be expected The approach to the identification procedure is usually influenced by the available a priori knowledge of the system and the intended application of the model

The toolbox does not assist the user in designing the experiment It is assumed that experimental data describing the underlying system in its entire range of operation has been obtained in advance with a proper choice of sampling frequency

u(t) denotes the input to the system andy(t) denotes the output

The toolbox is designed to cover the remaining three stages of the procedure as well as the paths leading from validation and back to the previous stages The following subsections will present the functions contained in the toolbox

Selecting a model structure Assuming that a data set has been acquired the next

step is to select a set of candidate models Unfortunately this is more difficult in the nonlinear case than in the linear Not only is it necessary to choose a set of regressors but a network architecture must be chosen as well The selection of model structures provided in the toolbox follows essentially the suggestions given in for example Reference 3 The procedure is to select the regressors as for the conventional linear model structures and then afterwards to determine the best possible neural network architecture with the selected regressors as inputs

The toolbox provides the six model structures listed below cp(t) is the regression vector e is the parameter vector containing the weights of the neural network g is the function realised by the neural network and (t I 0) denotes the one step ahead prediction of the output

NNARX structure

NNOE structure

NNARMAXl structure

e(t) is the prediction error E(t) = y( t ) -$(t I e) and C is a monic polynomial in the delay operator with roots inside the unit circle C(4-l) = 1 + clq- + cPq-D

NNARMAX2 structure

NNSSIF structure (state space innovations form)

Notice that C(8) in this case is a matrix To obtain an observable model structure a set of pseudo-observability indices must be specified

NNIOL structure (input-output linearisation)

where f and g are two separate networks This structure differs from the previous ones in that it is not motivated by a linear model structure NNIOL models are particu- larly relevant for control by input-output linearisation

For NNAFS and NNIOL model structures there is an algebraic relationship between prediction and past data The remaining model structures are more complicated since they all contain feedback from the network output (prediction) to the network input In the neural network terminology such structures are called recurrent neural networks The feedback may lead to undesired limit cycles or instability in certain regimes of the operating range This will typically occur if either the model structure or the data material is insufficient The NNARMAXl structure has been provided to remedy these problems by using a linear moving average filter on the past prediction errors

When a particular class of model has been selected the next choice to be made is the number of past signals used as regressors (ie the model order or lag space) It is desirable that the user has sufficient physical insight to choose these properly However the toolbox provides the

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 31

NEURAL NETWORKS

function l$schit which can be useful in the deterministic case It implements a method based on so-called lsquolipschitz coefficientsrsquo which has been proposed in Reference 4

The toolbox supports two-layer perceptron networks only

The network architecture ie how many weights Klwlr to include is often the most difficult to select It is common to initially select an architecture that is relatively large compared to the size of the training data set and subsequently use regularisation or pruning to balance the flexibilityparsimonious dilemma appropri- ately Fig 2 shows a NNARMAX(222) model structure with five hidden units

Estimate a model The model estimation stage includes choosing a

criterion of fit and an iterative search algorithm for finding the network parameters (the weights) that mini- mise the criterion (ie training the network) The toolbox provides functions for minimisation of the fairly general regularised mean square error criterion

The matrix D can be an arbitrary diagonal matrix but most often D = al or D = 0 is used

For multi-output systems it is possible to train NNARX and state-space models according to the criterion

WNZN) =

The function nnigls implements the iterated generalised least squares procedure for iterative estimation of net- work weights and noise covariance matrix The inverse of the estimated covariance matrix is in this case used as weighting matrix (A) in the criterion (QW estimation)

Table 1 Functions for nonlinear system identification

32

nnarx nnarmaxl

nnarmax2

nnoe nnssif nniol

nnarxm nnigls nnrarx nnrarmxl nnrarmx2

identify a neural network ARX (or AR) model identify a neural network ARMAX (or ARMA model) linear noise filter identify a neural network ARMAX (or ARMA) j model identify a neural network output error model identify a neural network state space model ~

identify a neural network model suited for 1-0 linearisation type control identify a multi-output NNARX model IGLS procedure for multi-output systems I

recursive counterpart to NNARX I

recursive counterpart to NNARMAXl I

recursive CounterDart to NNARMAX2

Newcomers to the neural network field are often confused by the many variations of training algorithms described in the literature or provided in the software they are using However system identification and control are usually small or medium-sized problems compared to other neural network application areas and lack of computer memory is rarely a problem The default training is thus carried out with a Levenberg-Marquardt method This is a so-called batch algorithm and it provides a very robust and fast convergence Moreover it does not require a number of exotic design parameters which makes it easy to use Alternatively it is possible to train the networks with a recursive prediction error algorithm This may have some advantages over batch algorithms such as the Levenberg-Marquardt algorithm when large neural networks are trained on large data sets since the memory requirement in this case is reduced The recursive algorithm has been implemented with three different types of forgetting exponential forgetting constant trace and the EFRA algorithm (exponential forgetting and resetting algorithm) algorithm

The functions for identifying models based on recurrent networks allow the use of skipping to prevent transient effects due to unknown initial conditions from corrupting the model

The toolbox contains the functions listed in Table 1 for estimating models with particular structures

Validation and model comparison When a network has been trained the functions listed

in Table 2 are available for validation of the model The most common method of validation is to analyse predictions and prediction errors (residuals) by cross- validation on a fresh set of data a so-called test or validation data set The functions nvalid ioleval and ifvalid carry out an analysis comprising a comparison of actual and predicted outputs and plots the auto- correlation function and distribution of the residuals Also a linear model is extracted from the network at each sampling instant to give the user an impression of the lsquodegree of nonlinearityrsquo xcorrel computes a series of cross-correlation functions to check that the residuals are independent of (past) inputs and outputs nnfpe is Akaikersquos final prediction error estimate which in this case has been modified for networks trained according to a regularised criterion and nnloo produces the leave- one-out estimate kpredict calculates the k-step ahead predictions and nnsimul makes a pure simulation of the model from inputs alone

Stepping backwards in the procedure In Fig 1 a number of paths are shown that lead from

validation and back to the previous stages The path from validation to training symbolises that it might be possible to obtain a better model if the network is trained with another weight decay parameter or if the weights are initialised differently Since it is likely that the train-

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

ing algorithm converges to a non-global minimum the network should be trained a couple of times with different initialisations of the weights Regularisation by weight decay has a smoothing effect on the criterion and several of the local minima are often removed when this is used

Another path leads back to model structure selection Because the model structure selection problem has been divided into two separate sub-problems this can mean two things namely lsquotry another set of regressorsrsquo or lsquotry another network architecturersquo While the regressors typically have to be selected on a trial-and-error basis it is to some extent possible to automate the network architecture selection The most commonly used method is to prune a very large network until the optimal architecture is reached The toolbox provides the so- called optimal brain surgeon (OBS) algorithm for pruning the networks (Table 3) OBS was originally proposed in the literature but in Reference 5 it has been modified to cover networks trained according to a regularised criterion

Additional functions The toolbox contains a number of additional functions

such as demonstration programs that demonstrates the functionality of the toolbox

NNCTRL toolkit The NNCTRL toolkit is an add-on to the NNSYSID

toolbox It is called a toolhit to emphasise that it is not just a collection of m-functions as are other MATLAB toolboxes Design and simulation of neural network based control systems has been found too complex to fit easily into ordinary MATLAB functions Also it is desirable that the programs used for simulating a control system in MATLAB have a structure similar to what they would have if the control system were to be implemented on a real-time platform

The toolkit has been given a structure that facilitates incorporation of new control concepts This is an attractive feature when the ones provided in advance are insufficient for the problem under consideration or when the user simply would like to test new ideas Furthermore since all tools have been written in MATLAB code it is easy to understand and modify the existing code if desired

Program structure All controllers have been

implemented within the same framework This

Table 2 Functions for evaluation of trained networks

nnvalid ifvalid

j ioleval kpredict ~ nnsimul I xcorrel 1 nnfpe nnloo

validation of 1-0 model of dynamic system validation of models generated by NNSSIF validation of models generated by NNIOL compute and plot k-step ahead predictions simulate model of dynamic system display different cross-correlation functions I

FPE-estimate for model of dynamic system leave-one-out estimate for NNARX model rsquo

1

I

Table 3 Functions for finding the optimal network architecture

I nnprune 8 optimal brain suraeon (OBS)

prune models of dynamic systems with

framework contains different standard components such as reading a design parameter file variable initialisation reference signal generation system simulation a constant gain PID controller data storage plots and more The control systems can be divided into two fundamentally different categories

Dzrect design the controller is in itself a neural network Indirect design The controller is not a neural network but the design is based on a neural network model of the system to be controlled

The program structure is slightly different for each category Both program structures are depicted in Fig 4 Each box in Fig 4 symbolises a MATLAB script file or function The three basic components are

A function describing the system to be controlled The system can be specified either as a SIMULINK model a MATLAB function containing the differential equations or a neural network model of the system The SIMULINK and MATLAB options are of course only

Fig 2 NNARMAX2 model structure The lag space [ n m p] = [2 2 21 and the network has five hidden units Notice this is a recurrent network since the two past prediction errors e(t- 1 e(t- 2) are used as inputs to the network

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 33

NEURAL NETWORKS

Ouiput (solid) and one-stsp ahead prediction (dashed) 1

0 50 100 150 200 250 300 350 400 450 SO0 tirne (samples)

Predicilon error (y-yhal) 2 I

Histogram over prediction enorr 25 -20 -15 -lO -5 0 5 10 15 20 25

I la9

60

40

20

0 5

Z Z ~ineatized network parameien

I

0 4 1

Fig 3 Screen dumps from some of the validation functions

34 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

-

relevant when a physical model exists A MATLAB script file containing initialisations specified by the user Some initialisations that are typically required are choice of reference signal sampling frequency name of SIMULINWMATLAB function implementing the system to be controlled PID or neural network based controller design parameters for the controller The file has a prespecified name and format associated with the controller type When working with NNCTRL a lsquotemplatersquo initialisation file is copied to the working directory and modified to comply with the application under consideration The main program that automatically reads the initial- isation file and subsequently simulates and controls the system

-F main loop begin

compute reference

compute output from process

update I design controller weights for next sample

compute control signal

time updates

end loop

plot simulation results

SlMULlNK MATLAB or neural net model

I

Fig 4 Program structures Indirect design a controller is designed for a pretrained network at each sample Direct design the controller is often trained online and for this reason the lsquoupdate weightsrsquo stage is included When an acceptable performance has been reached this stage is omitted in the final use

A brief overview of the control designs supported by the toolkit is given in the following subsections

Direct inverse control invcon Direct inverse control is probably the design which

is encountered most often in the literature A neural network is trained to behave as the lsquoinversersquo of the system to be controlled in the sense that the neural network is taught to calculate the control input that was used to drive the systemrsquos output to the present value After training this network is used as a controller The reference (desired output) is supplied to the network which in turn predicts the control input needed to obtain this system output one sample later

The NNCTRL toolkit does not only support simulation of direct inverse control It also contains function for training of inverse models Two training schemes are possible an offline method known as generalised training and an online method known as specialised training The criterion to be minimised is different in the two cases which causes the different approaches to minimisation Generalised training is the most simple to carry out but specialised training is usually preferred in practice as it leads to better controllers Specialised training is related to model- reference adaptive control and can in principle be used for control of time-varying systems It is suitable for systems that are not one-to-one and it is possible to optimise the inverse model for specific reference trajectories

It is also possible to train it so that the closed-loop system behaves as a specified transfer function model Both recursive gradient algorithms and recursive Gauss- Newton based algorithms with different types of forgetting are provided for the specialised training

Internal model control MQ imccon In IMC the control signal is synthesised from both

an inverse and a lsquoforwardrsquo model of the system to be controlled Therefore it is in this case necessary to train two neural networks An advantage of IMC is that it can compensate for constant disturbances acting on the system The inverse model is trained as described above

Feedforward with inverse models 8con One might prefer to use feedback control for stabilisa-

tion and disturbance attenuation only and then use feedforward control to ensure a fast reference tracking The toolkit allows the user to employ an inverse neural network model of the system as feedforward controller in combination with a conventional PLD-controller for feed- back control This strategy appeals to many industrial users who often prefer to optimise an existing control system rather than substitute it for a completely new design A discussion of the principle can be found in Reference 6

Feedback 1inearisationfblcon Feedback linearisation is a popular method for control

of certain classes of nonlinear systems The NNCTRI toolkit provides a simple discrete time input-output

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 35

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

Page 3: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

more complex In this case a generic nonlinear model structure such as a neural network is required

Procedure Fig 1 shows the procedure usually followed when

identifying a dynamic system It is seen that iterations back and forth between the steps must be expected The approach to the identification procedure is usually influenced by the available a priori knowledge of the system and the intended application of the model

The toolbox does not assist the user in designing the experiment It is assumed that experimental data describing the underlying system in its entire range of operation has been obtained in advance with a proper choice of sampling frequency

u(t) denotes the input to the system andy(t) denotes the output

The toolbox is designed to cover the remaining three stages of the procedure as well as the paths leading from validation and back to the previous stages The following subsections will present the functions contained in the toolbox

Selecting a model structure Assuming that a data set has been acquired the next

step is to select a set of candidate models Unfortunately this is more difficult in the nonlinear case than in the linear Not only is it necessary to choose a set of regressors but a network architecture must be chosen as well The selection of model structures provided in the toolbox follows essentially the suggestions given in for example Reference 3 The procedure is to select the regressors as for the conventional linear model structures and then afterwards to determine the best possible neural network architecture with the selected regressors as inputs

The toolbox provides the six model structures listed below cp(t) is the regression vector e is the parameter vector containing the weights of the neural network g is the function realised by the neural network and (t I 0) denotes the one step ahead prediction of the output

NNARX structure

NNOE structure

NNARMAXl structure

e(t) is the prediction error E(t) = y( t ) -$(t I e) and C is a monic polynomial in the delay operator with roots inside the unit circle C(4-l) = 1 + clq- + cPq-D

NNARMAX2 structure

NNSSIF structure (state space innovations form)

Notice that C(8) in this case is a matrix To obtain an observable model structure a set of pseudo-observability indices must be specified

NNIOL structure (input-output linearisation)

where f and g are two separate networks This structure differs from the previous ones in that it is not motivated by a linear model structure NNIOL models are particu- larly relevant for control by input-output linearisation

For NNAFS and NNIOL model structures there is an algebraic relationship between prediction and past data The remaining model structures are more complicated since they all contain feedback from the network output (prediction) to the network input In the neural network terminology such structures are called recurrent neural networks The feedback may lead to undesired limit cycles or instability in certain regimes of the operating range This will typically occur if either the model structure or the data material is insufficient The NNARMAXl structure has been provided to remedy these problems by using a linear moving average filter on the past prediction errors

When a particular class of model has been selected the next choice to be made is the number of past signals used as regressors (ie the model order or lag space) It is desirable that the user has sufficient physical insight to choose these properly However the toolbox provides the

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 31

NEURAL NETWORKS

function l$schit which can be useful in the deterministic case It implements a method based on so-called lsquolipschitz coefficientsrsquo which has been proposed in Reference 4

The toolbox supports two-layer perceptron networks only

The network architecture ie how many weights Klwlr to include is often the most difficult to select It is common to initially select an architecture that is relatively large compared to the size of the training data set and subsequently use regularisation or pruning to balance the flexibilityparsimonious dilemma appropri- ately Fig 2 shows a NNARMAX(222) model structure with five hidden units

Estimate a model The model estimation stage includes choosing a

criterion of fit and an iterative search algorithm for finding the network parameters (the weights) that mini- mise the criterion (ie training the network) The toolbox provides functions for minimisation of the fairly general regularised mean square error criterion

The matrix D can be an arbitrary diagonal matrix but most often D = al or D = 0 is used

For multi-output systems it is possible to train NNARX and state-space models according to the criterion

WNZN) =

The function nnigls implements the iterated generalised least squares procedure for iterative estimation of net- work weights and noise covariance matrix The inverse of the estimated covariance matrix is in this case used as weighting matrix (A) in the criterion (QW estimation)

Table 1 Functions for nonlinear system identification

32

nnarx nnarmaxl

nnarmax2

nnoe nnssif nniol

nnarxm nnigls nnrarx nnrarmxl nnrarmx2

identify a neural network ARX (or AR) model identify a neural network ARMAX (or ARMA model) linear noise filter identify a neural network ARMAX (or ARMA) j model identify a neural network output error model identify a neural network state space model ~

identify a neural network model suited for 1-0 linearisation type control identify a multi-output NNARX model IGLS procedure for multi-output systems I

recursive counterpart to NNARX I

recursive counterpart to NNARMAXl I

recursive CounterDart to NNARMAX2

Newcomers to the neural network field are often confused by the many variations of training algorithms described in the literature or provided in the software they are using However system identification and control are usually small or medium-sized problems compared to other neural network application areas and lack of computer memory is rarely a problem The default training is thus carried out with a Levenberg-Marquardt method This is a so-called batch algorithm and it provides a very robust and fast convergence Moreover it does not require a number of exotic design parameters which makes it easy to use Alternatively it is possible to train the networks with a recursive prediction error algorithm This may have some advantages over batch algorithms such as the Levenberg-Marquardt algorithm when large neural networks are trained on large data sets since the memory requirement in this case is reduced The recursive algorithm has been implemented with three different types of forgetting exponential forgetting constant trace and the EFRA algorithm (exponential forgetting and resetting algorithm) algorithm

The functions for identifying models based on recurrent networks allow the use of skipping to prevent transient effects due to unknown initial conditions from corrupting the model

The toolbox contains the functions listed in Table 1 for estimating models with particular structures

Validation and model comparison When a network has been trained the functions listed

in Table 2 are available for validation of the model The most common method of validation is to analyse predictions and prediction errors (residuals) by cross- validation on a fresh set of data a so-called test or validation data set The functions nvalid ioleval and ifvalid carry out an analysis comprising a comparison of actual and predicted outputs and plots the auto- correlation function and distribution of the residuals Also a linear model is extracted from the network at each sampling instant to give the user an impression of the lsquodegree of nonlinearityrsquo xcorrel computes a series of cross-correlation functions to check that the residuals are independent of (past) inputs and outputs nnfpe is Akaikersquos final prediction error estimate which in this case has been modified for networks trained according to a regularised criterion and nnloo produces the leave- one-out estimate kpredict calculates the k-step ahead predictions and nnsimul makes a pure simulation of the model from inputs alone

Stepping backwards in the procedure In Fig 1 a number of paths are shown that lead from

validation and back to the previous stages The path from validation to training symbolises that it might be possible to obtain a better model if the network is trained with another weight decay parameter or if the weights are initialised differently Since it is likely that the train-

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

ing algorithm converges to a non-global minimum the network should be trained a couple of times with different initialisations of the weights Regularisation by weight decay has a smoothing effect on the criterion and several of the local minima are often removed when this is used

Another path leads back to model structure selection Because the model structure selection problem has been divided into two separate sub-problems this can mean two things namely lsquotry another set of regressorsrsquo or lsquotry another network architecturersquo While the regressors typically have to be selected on a trial-and-error basis it is to some extent possible to automate the network architecture selection The most commonly used method is to prune a very large network until the optimal architecture is reached The toolbox provides the so- called optimal brain surgeon (OBS) algorithm for pruning the networks (Table 3) OBS was originally proposed in the literature but in Reference 5 it has been modified to cover networks trained according to a regularised criterion

Additional functions The toolbox contains a number of additional functions

such as demonstration programs that demonstrates the functionality of the toolbox

NNCTRL toolkit The NNCTRL toolkit is an add-on to the NNSYSID

toolbox It is called a toolhit to emphasise that it is not just a collection of m-functions as are other MATLAB toolboxes Design and simulation of neural network based control systems has been found too complex to fit easily into ordinary MATLAB functions Also it is desirable that the programs used for simulating a control system in MATLAB have a structure similar to what they would have if the control system were to be implemented on a real-time platform

The toolkit has been given a structure that facilitates incorporation of new control concepts This is an attractive feature when the ones provided in advance are insufficient for the problem under consideration or when the user simply would like to test new ideas Furthermore since all tools have been written in MATLAB code it is easy to understand and modify the existing code if desired

Program structure All controllers have been

implemented within the same framework This

Table 2 Functions for evaluation of trained networks

nnvalid ifvalid

j ioleval kpredict ~ nnsimul I xcorrel 1 nnfpe nnloo

validation of 1-0 model of dynamic system validation of models generated by NNSSIF validation of models generated by NNIOL compute and plot k-step ahead predictions simulate model of dynamic system display different cross-correlation functions I

FPE-estimate for model of dynamic system leave-one-out estimate for NNARX model rsquo

1

I

Table 3 Functions for finding the optimal network architecture

I nnprune 8 optimal brain suraeon (OBS)

prune models of dynamic systems with

framework contains different standard components such as reading a design parameter file variable initialisation reference signal generation system simulation a constant gain PID controller data storage plots and more The control systems can be divided into two fundamentally different categories

Dzrect design the controller is in itself a neural network Indirect design The controller is not a neural network but the design is based on a neural network model of the system to be controlled

The program structure is slightly different for each category Both program structures are depicted in Fig 4 Each box in Fig 4 symbolises a MATLAB script file or function The three basic components are

A function describing the system to be controlled The system can be specified either as a SIMULINK model a MATLAB function containing the differential equations or a neural network model of the system The SIMULINK and MATLAB options are of course only

Fig 2 NNARMAX2 model structure The lag space [ n m p] = [2 2 21 and the network has five hidden units Notice this is a recurrent network since the two past prediction errors e(t- 1 e(t- 2) are used as inputs to the network

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 33

NEURAL NETWORKS

Ouiput (solid) and one-stsp ahead prediction (dashed) 1

0 50 100 150 200 250 300 350 400 450 SO0 tirne (samples)

Predicilon error (y-yhal) 2 I

Histogram over prediction enorr 25 -20 -15 -lO -5 0 5 10 15 20 25

I la9

60

40

20

0 5

Z Z ~ineatized network parameien

I

0 4 1

Fig 3 Screen dumps from some of the validation functions

34 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

-

relevant when a physical model exists A MATLAB script file containing initialisations specified by the user Some initialisations that are typically required are choice of reference signal sampling frequency name of SIMULINWMATLAB function implementing the system to be controlled PID or neural network based controller design parameters for the controller The file has a prespecified name and format associated with the controller type When working with NNCTRL a lsquotemplatersquo initialisation file is copied to the working directory and modified to comply with the application under consideration The main program that automatically reads the initial- isation file and subsequently simulates and controls the system

-F main loop begin

compute reference

compute output from process

update I design controller weights for next sample

compute control signal

time updates

end loop

plot simulation results

SlMULlNK MATLAB or neural net model

I

Fig 4 Program structures Indirect design a controller is designed for a pretrained network at each sample Direct design the controller is often trained online and for this reason the lsquoupdate weightsrsquo stage is included When an acceptable performance has been reached this stage is omitted in the final use

A brief overview of the control designs supported by the toolkit is given in the following subsections

Direct inverse control invcon Direct inverse control is probably the design which

is encountered most often in the literature A neural network is trained to behave as the lsquoinversersquo of the system to be controlled in the sense that the neural network is taught to calculate the control input that was used to drive the systemrsquos output to the present value After training this network is used as a controller The reference (desired output) is supplied to the network which in turn predicts the control input needed to obtain this system output one sample later

The NNCTRL toolkit does not only support simulation of direct inverse control It also contains function for training of inverse models Two training schemes are possible an offline method known as generalised training and an online method known as specialised training The criterion to be minimised is different in the two cases which causes the different approaches to minimisation Generalised training is the most simple to carry out but specialised training is usually preferred in practice as it leads to better controllers Specialised training is related to model- reference adaptive control and can in principle be used for control of time-varying systems It is suitable for systems that are not one-to-one and it is possible to optimise the inverse model for specific reference trajectories

It is also possible to train it so that the closed-loop system behaves as a specified transfer function model Both recursive gradient algorithms and recursive Gauss- Newton based algorithms with different types of forgetting are provided for the specialised training

Internal model control MQ imccon In IMC the control signal is synthesised from both

an inverse and a lsquoforwardrsquo model of the system to be controlled Therefore it is in this case necessary to train two neural networks An advantage of IMC is that it can compensate for constant disturbances acting on the system The inverse model is trained as described above

Feedforward with inverse models 8con One might prefer to use feedback control for stabilisa-

tion and disturbance attenuation only and then use feedforward control to ensure a fast reference tracking The toolkit allows the user to employ an inverse neural network model of the system as feedforward controller in combination with a conventional PLD-controller for feed- back control This strategy appeals to many industrial users who often prefer to optimise an existing control system rather than substitute it for a completely new design A discussion of the principle can be found in Reference 6

Feedback 1inearisationfblcon Feedback linearisation is a popular method for control

of certain classes of nonlinear systems The NNCTRI toolkit provides a simple discrete time input-output

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 35

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

Page 4: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

function l$schit which can be useful in the deterministic case It implements a method based on so-called lsquolipschitz coefficientsrsquo which has been proposed in Reference 4

The toolbox supports two-layer perceptron networks only

The network architecture ie how many weights Klwlr to include is often the most difficult to select It is common to initially select an architecture that is relatively large compared to the size of the training data set and subsequently use regularisation or pruning to balance the flexibilityparsimonious dilemma appropri- ately Fig 2 shows a NNARMAX(222) model structure with five hidden units

Estimate a model The model estimation stage includes choosing a

criterion of fit and an iterative search algorithm for finding the network parameters (the weights) that mini- mise the criterion (ie training the network) The toolbox provides functions for minimisation of the fairly general regularised mean square error criterion

The matrix D can be an arbitrary diagonal matrix but most often D = al or D = 0 is used

For multi-output systems it is possible to train NNARX and state-space models according to the criterion

WNZN) =

The function nnigls implements the iterated generalised least squares procedure for iterative estimation of net- work weights and noise covariance matrix The inverse of the estimated covariance matrix is in this case used as weighting matrix (A) in the criterion (QW estimation)

Table 1 Functions for nonlinear system identification

32

nnarx nnarmaxl

nnarmax2

nnoe nnssif nniol

nnarxm nnigls nnrarx nnrarmxl nnrarmx2

identify a neural network ARX (or AR) model identify a neural network ARMAX (or ARMA model) linear noise filter identify a neural network ARMAX (or ARMA) j model identify a neural network output error model identify a neural network state space model ~

identify a neural network model suited for 1-0 linearisation type control identify a multi-output NNARX model IGLS procedure for multi-output systems I

recursive counterpart to NNARX I

recursive counterpart to NNARMAXl I

recursive CounterDart to NNARMAX2

Newcomers to the neural network field are often confused by the many variations of training algorithms described in the literature or provided in the software they are using However system identification and control are usually small or medium-sized problems compared to other neural network application areas and lack of computer memory is rarely a problem The default training is thus carried out with a Levenberg-Marquardt method This is a so-called batch algorithm and it provides a very robust and fast convergence Moreover it does not require a number of exotic design parameters which makes it easy to use Alternatively it is possible to train the networks with a recursive prediction error algorithm This may have some advantages over batch algorithms such as the Levenberg-Marquardt algorithm when large neural networks are trained on large data sets since the memory requirement in this case is reduced The recursive algorithm has been implemented with three different types of forgetting exponential forgetting constant trace and the EFRA algorithm (exponential forgetting and resetting algorithm) algorithm

The functions for identifying models based on recurrent networks allow the use of skipping to prevent transient effects due to unknown initial conditions from corrupting the model

The toolbox contains the functions listed in Table 1 for estimating models with particular structures

Validation and model comparison When a network has been trained the functions listed

in Table 2 are available for validation of the model The most common method of validation is to analyse predictions and prediction errors (residuals) by cross- validation on a fresh set of data a so-called test or validation data set The functions nvalid ioleval and ifvalid carry out an analysis comprising a comparison of actual and predicted outputs and plots the auto- correlation function and distribution of the residuals Also a linear model is extracted from the network at each sampling instant to give the user an impression of the lsquodegree of nonlinearityrsquo xcorrel computes a series of cross-correlation functions to check that the residuals are independent of (past) inputs and outputs nnfpe is Akaikersquos final prediction error estimate which in this case has been modified for networks trained according to a regularised criterion and nnloo produces the leave- one-out estimate kpredict calculates the k-step ahead predictions and nnsimul makes a pure simulation of the model from inputs alone

Stepping backwards in the procedure In Fig 1 a number of paths are shown that lead from

validation and back to the previous stages The path from validation to training symbolises that it might be possible to obtain a better model if the network is trained with another weight decay parameter or if the weights are initialised differently Since it is likely that the train-

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

ing algorithm converges to a non-global minimum the network should be trained a couple of times with different initialisations of the weights Regularisation by weight decay has a smoothing effect on the criterion and several of the local minima are often removed when this is used

Another path leads back to model structure selection Because the model structure selection problem has been divided into two separate sub-problems this can mean two things namely lsquotry another set of regressorsrsquo or lsquotry another network architecturersquo While the regressors typically have to be selected on a trial-and-error basis it is to some extent possible to automate the network architecture selection The most commonly used method is to prune a very large network until the optimal architecture is reached The toolbox provides the so- called optimal brain surgeon (OBS) algorithm for pruning the networks (Table 3) OBS was originally proposed in the literature but in Reference 5 it has been modified to cover networks trained according to a regularised criterion

Additional functions The toolbox contains a number of additional functions

such as demonstration programs that demonstrates the functionality of the toolbox

NNCTRL toolkit The NNCTRL toolkit is an add-on to the NNSYSID

toolbox It is called a toolhit to emphasise that it is not just a collection of m-functions as are other MATLAB toolboxes Design and simulation of neural network based control systems has been found too complex to fit easily into ordinary MATLAB functions Also it is desirable that the programs used for simulating a control system in MATLAB have a structure similar to what they would have if the control system were to be implemented on a real-time platform

The toolkit has been given a structure that facilitates incorporation of new control concepts This is an attractive feature when the ones provided in advance are insufficient for the problem under consideration or when the user simply would like to test new ideas Furthermore since all tools have been written in MATLAB code it is easy to understand and modify the existing code if desired

Program structure All controllers have been

implemented within the same framework This

Table 2 Functions for evaluation of trained networks

nnvalid ifvalid

j ioleval kpredict ~ nnsimul I xcorrel 1 nnfpe nnloo

validation of 1-0 model of dynamic system validation of models generated by NNSSIF validation of models generated by NNIOL compute and plot k-step ahead predictions simulate model of dynamic system display different cross-correlation functions I

FPE-estimate for model of dynamic system leave-one-out estimate for NNARX model rsquo

1

I

Table 3 Functions for finding the optimal network architecture

I nnprune 8 optimal brain suraeon (OBS)

prune models of dynamic systems with

framework contains different standard components such as reading a design parameter file variable initialisation reference signal generation system simulation a constant gain PID controller data storage plots and more The control systems can be divided into two fundamentally different categories

Dzrect design the controller is in itself a neural network Indirect design The controller is not a neural network but the design is based on a neural network model of the system to be controlled

The program structure is slightly different for each category Both program structures are depicted in Fig 4 Each box in Fig 4 symbolises a MATLAB script file or function The three basic components are

A function describing the system to be controlled The system can be specified either as a SIMULINK model a MATLAB function containing the differential equations or a neural network model of the system The SIMULINK and MATLAB options are of course only

Fig 2 NNARMAX2 model structure The lag space [ n m p] = [2 2 21 and the network has five hidden units Notice this is a recurrent network since the two past prediction errors e(t- 1 e(t- 2) are used as inputs to the network

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 33

NEURAL NETWORKS

Ouiput (solid) and one-stsp ahead prediction (dashed) 1

0 50 100 150 200 250 300 350 400 450 SO0 tirne (samples)

Predicilon error (y-yhal) 2 I

Histogram over prediction enorr 25 -20 -15 -lO -5 0 5 10 15 20 25

I la9

60

40

20

0 5

Z Z ~ineatized network parameien

I

0 4 1

Fig 3 Screen dumps from some of the validation functions

34 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

-

relevant when a physical model exists A MATLAB script file containing initialisations specified by the user Some initialisations that are typically required are choice of reference signal sampling frequency name of SIMULINWMATLAB function implementing the system to be controlled PID or neural network based controller design parameters for the controller The file has a prespecified name and format associated with the controller type When working with NNCTRL a lsquotemplatersquo initialisation file is copied to the working directory and modified to comply with the application under consideration The main program that automatically reads the initial- isation file and subsequently simulates and controls the system

-F main loop begin

compute reference

compute output from process

update I design controller weights for next sample

compute control signal

time updates

end loop

plot simulation results

SlMULlNK MATLAB or neural net model

I

Fig 4 Program structures Indirect design a controller is designed for a pretrained network at each sample Direct design the controller is often trained online and for this reason the lsquoupdate weightsrsquo stage is included When an acceptable performance has been reached this stage is omitted in the final use

A brief overview of the control designs supported by the toolkit is given in the following subsections

Direct inverse control invcon Direct inverse control is probably the design which

is encountered most often in the literature A neural network is trained to behave as the lsquoinversersquo of the system to be controlled in the sense that the neural network is taught to calculate the control input that was used to drive the systemrsquos output to the present value After training this network is used as a controller The reference (desired output) is supplied to the network which in turn predicts the control input needed to obtain this system output one sample later

The NNCTRL toolkit does not only support simulation of direct inverse control It also contains function for training of inverse models Two training schemes are possible an offline method known as generalised training and an online method known as specialised training The criterion to be minimised is different in the two cases which causes the different approaches to minimisation Generalised training is the most simple to carry out but specialised training is usually preferred in practice as it leads to better controllers Specialised training is related to model- reference adaptive control and can in principle be used for control of time-varying systems It is suitable for systems that are not one-to-one and it is possible to optimise the inverse model for specific reference trajectories

It is also possible to train it so that the closed-loop system behaves as a specified transfer function model Both recursive gradient algorithms and recursive Gauss- Newton based algorithms with different types of forgetting are provided for the specialised training

Internal model control MQ imccon In IMC the control signal is synthesised from both

an inverse and a lsquoforwardrsquo model of the system to be controlled Therefore it is in this case necessary to train two neural networks An advantage of IMC is that it can compensate for constant disturbances acting on the system The inverse model is trained as described above

Feedforward with inverse models 8con One might prefer to use feedback control for stabilisa-

tion and disturbance attenuation only and then use feedforward control to ensure a fast reference tracking The toolkit allows the user to employ an inverse neural network model of the system as feedforward controller in combination with a conventional PLD-controller for feed- back control This strategy appeals to many industrial users who often prefer to optimise an existing control system rather than substitute it for a completely new design A discussion of the principle can be found in Reference 6

Feedback 1inearisationfblcon Feedback linearisation is a popular method for control

of certain classes of nonlinear systems The NNCTRI toolkit provides a simple discrete time input-output

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 35

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

Page 5: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

ing algorithm converges to a non-global minimum the network should be trained a couple of times with different initialisations of the weights Regularisation by weight decay has a smoothing effect on the criterion and several of the local minima are often removed when this is used

Another path leads back to model structure selection Because the model structure selection problem has been divided into two separate sub-problems this can mean two things namely lsquotry another set of regressorsrsquo or lsquotry another network architecturersquo While the regressors typically have to be selected on a trial-and-error basis it is to some extent possible to automate the network architecture selection The most commonly used method is to prune a very large network until the optimal architecture is reached The toolbox provides the so- called optimal brain surgeon (OBS) algorithm for pruning the networks (Table 3) OBS was originally proposed in the literature but in Reference 5 it has been modified to cover networks trained according to a regularised criterion

Additional functions The toolbox contains a number of additional functions

such as demonstration programs that demonstrates the functionality of the toolbox

NNCTRL toolkit The NNCTRL toolkit is an add-on to the NNSYSID

toolbox It is called a toolhit to emphasise that it is not just a collection of m-functions as are other MATLAB toolboxes Design and simulation of neural network based control systems has been found too complex to fit easily into ordinary MATLAB functions Also it is desirable that the programs used for simulating a control system in MATLAB have a structure similar to what they would have if the control system were to be implemented on a real-time platform

The toolkit has been given a structure that facilitates incorporation of new control concepts This is an attractive feature when the ones provided in advance are insufficient for the problem under consideration or when the user simply would like to test new ideas Furthermore since all tools have been written in MATLAB code it is easy to understand and modify the existing code if desired

Program structure All controllers have been

implemented within the same framework This

Table 2 Functions for evaluation of trained networks

nnvalid ifvalid

j ioleval kpredict ~ nnsimul I xcorrel 1 nnfpe nnloo

validation of 1-0 model of dynamic system validation of models generated by NNSSIF validation of models generated by NNIOL compute and plot k-step ahead predictions simulate model of dynamic system display different cross-correlation functions I

FPE-estimate for model of dynamic system leave-one-out estimate for NNARX model rsquo

1

I

Table 3 Functions for finding the optimal network architecture

I nnprune 8 optimal brain suraeon (OBS)

prune models of dynamic systems with

framework contains different standard components such as reading a design parameter file variable initialisation reference signal generation system simulation a constant gain PID controller data storage plots and more The control systems can be divided into two fundamentally different categories

Dzrect design the controller is in itself a neural network Indirect design The controller is not a neural network but the design is based on a neural network model of the system to be controlled

The program structure is slightly different for each category Both program structures are depicted in Fig 4 Each box in Fig 4 symbolises a MATLAB script file or function The three basic components are

A function describing the system to be controlled The system can be specified either as a SIMULINK model a MATLAB function containing the differential equations or a neural network model of the system The SIMULINK and MATLAB options are of course only

Fig 2 NNARMAX2 model structure The lag space [ n m p] = [2 2 21 and the network has five hidden units Notice this is a recurrent network since the two past prediction errors e(t- 1 e(t- 2) are used as inputs to the network

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 33

NEURAL NETWORKS

Ouiput (solid) and one-stsp ahead prediction (dashed) 1

0 50 100 150 200 250 300 350 400 450 SO0 tirne (samples)

Predicilon error (y-yhal) 2 I

Histogram over prediction enorr 25 -20 -15 -lO -5 0 5 10 15 20 25

I la9

60

40

20

0 5

Z Z ~ineatized network parameien

I

0 4 1

Fig 3 Screen dumps from some of the validation functions

34 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

-

relevant when a physical model exists A MATLAB script file containing initialisations specified by the user Some initialisations that are typically required are choice of reference signal sampling frequency name of SIMULINWMATLAB function implementing the system to be controlled PID or neural network based controller design parameters for the controller The file has a prespecified name and format associated with the controller type When working with NNCTRL a lsquotemplatersquo initialisation file is copied to the working directory and modified to comply with the application under consideration The main program that automatically reads the initial- isation file and subsequently simulates and controls the system

-F main loop begin

compute reference

compute output from process

update I design controller weights for next sample

compute control signal

time updates

end loop

plot simulation results

SlMULlNK MATLAB or neural net model

I

Fig 4 Program structures Indirect design a controller is designed for a pretrained network at each sample Direct design the controller is often trained online and for this reason the lsquoupdate weightsrsquo stage is included When an acceptable performance has been reached this stage is omitted in the final use

A brief overview of the control designs supported by the toolkit is given in the following subsections

Direct inverse control invcon Direct inverse control is probably the design which

is encountered most often in the literature A neural network is trained to behave as the lsquoinversersquo of the system to be controlled in the sense that the neural network is taught to calculate the control input that was used to drive the systemrsquos output to the present value After training this network is used as a controller The reference (desired output) is supplied to the network which in turn predicts the control input needed to obtain this system output one sample later

The NNCTRL toolkit does not only support simulation of direct inverse control It also contains function for training of inverse models Two training schemes are possible an offline method known as generalised training and an online method known as specialised training The criterion to be minimised is different in the two cases which causes the different approaches to minimisation Generalised training is the most simple to carry out but specialised training is usually preferred in practice as it leads to better controllers Specialised training is related to model- reference adaptive control and can in principle be used for control of time-varying systems It is suitable for systems that are not one-to-one and it is possible to optimise the inverse model for specific reference trajectories

It is also possible to train it so that the closed-loop system behaves as a specified transfer function model Both recursive gradient algorithms and recursive Gauss- Newton based algorithms with different types of forgetting are provided for the specialised training

Internal model control MQ imccon In IMC the control signal is synthesised from both

an inverse and a lsquoforwardrsquo model of the system to be controlled Therefore it is in this case necessary to train two neural networks An advantage of IMC is that it can compensate for constant disturbances acting on the system The inverse model is trained as described above

Feedforward with inverse models 8con One might prefer to use feedback control for stabilisa-

tion and disturbance attenuation only and then use feedforward control to ensure a fast reference tracking The toolkit allows the user to employ an inverse neural network model of the system as feedforward controller in combination with a conventional PLD-controller for feed- back control This strategy appeals to many industrial users who often prefer to optimise an existing control system rather than substitute it for a completely new design A discussion of the principle can be found in Reference 6

Feedback 1inearisationfblcon Feedback linearisation is a popular method for control

of certain classes of nonlinear systems The NNCTRI toolkit provides a simple discrete time input-output

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 35

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

Page 6: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

Ouiput (solid) and one-stsp ahead prediction (dashed) 1

0 50 100 150 200 250 300 350 400 450 SO0 tirne (samples)

Predicilon error (y-yhal) 2 I

Histogram over prediction enorr 25 -20 -15 -lO -5 0 5 10 15 20 25

I la9

60

40

20

0 5

Z Z ~ineatized network parameien

I

0 4 1

Fig 3 Screen dumps from some of the validation functions

34 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

NEURAL NETWORKS

-

relevant when a physical model exists A MATLAB script file containing initialisations specified by the user Some initialisations that are typically required are choice of reference signal sampling frequency name of SIMULINWMATLAB function implementing the system to be controlled PID or neural network based controller design parameters for the controller The file has a prespecified name and format associated with the controller type When working with NNCTRL a lsquotemplatersquo initialisation file is copied to the working directory and modified to comply with the application under consideration The main program that automatically reads the initial- isation file and subsequently simulates and controls the system

-F main loop begin

compute reference

compute output from process

update I design controller weights for next sample

compute control signal

time updates

end loop

plot simulation results

SlMULlNK MATLAB or neural net model

I

Fig 4 Program structures Indirect design a controller is designed for a pretrained network at each sample Direct design the controller is often trained online and for this reason the lsquoupdate weightsrsquo stage is included When an acceptable performance has been reached this stage is omitted in the final use

A brief overview of the control designs supported by the toolkit is given in the following subsections

Direct inverse control invcon Direct inverse control is probably the design which

is encountered most often in the literature A neural network is trained to behave as the lsquoinversersquo of the system to be controlled in the sense that the neural network is taught to calculate the control input that was used to drive the systemrsquos output to the present value After training this network is used as a controller The reference (desired output) is supplied to the network which in turn predicts the control input needed to obtain this system output one sample later

The NNCTRL toolkit does not only support simulation of direct inverse control It also contains function for training of inverse models Two training schemes are possible an offline method known as generalised training and an online method known as specialised training The criterion to be minimised is different in the two cases which causes the different approaches to minimisation Generalised training is the most simple to carry out but specialised training is usually preferred in practice as it leads to better controllers Specialised training is related to model- reference adaptive control and can in principle be used for control of time-varying systems It is suitable for systems that are not one-to-one and it is possible to optimise the inverse model for specific reference trajectories

It is also possible to train it so that the closed-loop system behaves as a specified transfer function model Both recursive gradient algorithms and recursive Gauss- Newton based algorithms with different types of forgetting are provided for the specialised training

Internal model control MQ imccon In IMC the control signal is synthesised from both

an inverse and a lsquoforwardrsquo model of the system to be controlled Therefore it is in this case necessary to train two neural networks An advantage of IMC is that it can compensate for constant disturbances acting on the system The inverse model is trained as described above

Feedforward with inverse models 8con One might prefer to use feedback control for stabilisa-

tion and disturbance attenuation only and then use feedforward control to ensure a fast reference tracking The toolkit allows the user to employ an inverse neural network model of the system as feedforward controller in combination with a conventional PLD-controller for feed- back control This strategy appeals to many industrial users who often prefer to optimise an existing control system rather than substitute it for a completely new design A discussion of the principle can be found in Reference 6

Feedback 1inearisationfblcon Feedback linearisation is a popular method for control

of certain classes of nonlinear systems The NNCTRI toolkit provides a simple discrete time input-output

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 35

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

Page 7: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

-

relevant when a physical model exists A MATLAB script file containing initialisations specified by the user Some initialisations that are typically required are choice of reference signal sampling frequency name of SIMULINWMATLAB function implementing the system to be controlled PID or neural network based controller design parameters for the controller The file has a prespecified name and format associated with the controller type When working with NNCTRL a lsquotemplatersquo initialisation file is copied to the working directory and modified to comply with the application under consideration The main program that automatically reads the initial- isation file and subsequently simulates and controls the system

-F main loop begin

compute reference

compute output from process

update I design controller weights for next sample

compute control signal

time updates

end loop

plot simulation results

SlMULlNK MATLAB or neural net model

I

Fig 4 Program structures Indirect design a controller is designed for a pretrained network at each sample Direct design the controller is often trained online and for this reason the lsquoupdate weightsrsquo stage is included When an acceptable performance has been reached this stage is omitted in the final use

A brief overview of the control designs supported by the toolkit is given in the following subsections

Direct inverse control invcon Direct inverse control is probably the design which

is encountered most often in the literature A neural network is trained to behave as the lsquoinversersquo of the system to be controlled in the sense that the neural network is taught to calculate the control input that was used to drive the systemrsquos output to the present value After training this network is used as a controller The reference (desired output) is supplied to the network which in turn predicts the control input needed to obtain this system output one sample later

The NNCTRL toolkit does not only support simulation of direct inverse control It also contains function for training of inverse models Two training schemes are possible an offline method known as generalised training and an online method known as specialised training The criterion to be minimised is different in the two cases which causes the different approaches to minimisation Generalised training is the most simple to carry out but specialised training is usually preferred in practice as it leads to better controllers Specialised training is related to model- reference adaptive control and can in principle be used for control of time-varying systems It is suitable for systems that are not one-to-one and it is possible to optimise the inverse model for specific reference trajectories

It is also possible to train it so that the closed-loop system behaves as a specified transfer function model Both recursive gradient algorithms and recursive Gauss- Newton based algorithms with different types of forgetting are provided for the specialised training

Internal model control MQ imccon In IMC the control signal is synthesised from both

an inverse and a lsquoforwardrsquo model of the system to be controlled Therefore it is in this case necessary to train two neural networks An advantage of IMC is that it can compensate for constant disturbances acting on the system The inverse model is trained as described above

Feedforward with inverse models 8con One might prefer to use feedback control for stabilisa-

tion and disturbance attenuation only and then use feedforward control to ensure a fast reference tracking The toolkit allows the user to employ an inverse neural network model of the system as feedforward controller in combination with a conventional PLD-controller for feed- back control This strategy appeals to many industrial users who often prefer to optimise an existing control system rather than substitute it for a completely new design A discussion of the principle can be found in Reference 6

Feedback 1inearisationfblcon Feedback linearisation is a popular method for control

of certain classes of nonlinear systems The NNCTRI toolkit provides a simple discrete time input-output

COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001 35

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001

Page 8: NNSYSID and NNCTRL tools for system identification and control with neural networks

NEURAL NETWORKS

linearisation scheme based on a neural network model of the system to be controlled The scheme linearises the system and allows the user to specify the desired behaviour of the closed-loop system in terms of a transfer function

Optimal control op tcon An augmentation of the online training scheme for

inverse models is provided for training of a simple optimal neural network controller The extension consists of an additional term which is added to the criterion to penalise the magnitude of the control inputs After training the network is applied to the system in the same fashion as for the inverse model controller

Instantaneous linearisation lincon apccon Linearisation of neural network models has become a

popular technique for design of control systems The controller is in this case not a neural network in itself Instead a neural network of the system to be controlled is used for providing a new affine model of the system at each sampling instant Based on these locally valid models one can employ virtually any conventional controller design The NNCTRL toolkit supports the following designs but others are easily incorporated

0 Pole placement It is possible to design a fairly general class of pole placement controllers with or without zero cancellation compensation for disturbances with known characteristics Minimum variance Simplified version of the generalised minimum variance controller described in Reference 7 Approximate GPC The generalised predictive con- troller (GPC) is described in Reference 8

Nonlinear predictive control npccon The instantaneous linearisation technique has its

shortcomings when the nonlinearities in the system are not relatively smooth For these cases a true nonlinear predictive controller is provided in which the predictions unlike for the concept above are determined directly by evaluation of a neural network model The optimisation problem is in this case much harder to solve as numerical search is necessary The toolkit provides two efficient and robust algorithms for minimisation of the GPC criterion

Conclusions In recent years a variety of neural network archi-

tectures and training schemes have been proposed for identification and control For newcomers to the field it is not easy to get an overview of the many different approaches and to understand what each has to offer Secondly it can be hard to find software tools that can solve the desired problem since most neural network tools are very general in that the same tool can solve completely different types of problems This article

has described two toolsets that were developed to accommodate the need for tools based on principles and conventions familiar to people coming from the conventional system identification and (adaptive) control communities

The NNSYSID toolbox was implemented under the philosophy lsquoalways try simple things firstrsquo and should be regarded as the next step if one fails to identify a satisfactory linear model of the system It has been a key issue that the basis was a relatively simple type of neural network and that training validation architecture selection etc were made as automatic as possible

The NNCTRL toolkit is an add-on to NNSYSID and provides a number of ready-made structures for control with neural networks The toolkit has an open archi- tecture which allows the user to add the extensions and ad hoc modifications that are found necessary

Addendum The NNSYSID toolbox and the NNCTRL toolkit is

freeware and can be downloaded from the website at The Department of Automation Technical University of Denmark Their respective addresses are

httpllwwwiaudtudWresearchcontrollnnsysid html httpwwwiaudtudWresearchcontrolnnctrlhtml

References 1 DE SMEDT P DECLERCQ E and DE KEYSER R lsquoA neural model

based predictive control toolbox for MATLAB in BOULLART L LCCUFIER M and MATTSSON S E (Eds) Proceedings of the 7th IFAC Symposium on Computer-Aided Control System Design IFAC 1997 pp305-IO (httpwwwautoctrlrugacbdfilipnmbpchttnl)

2 DECLERQ E lsquoNonlinear black box identification for Matlab version 11rsquo DeDartment of Control Engineering and Automation Universitv Gent Blsquoelgium 1998 (http wwwautoctrl rugacbefi l iplbla)

MARSSON H DELYON B GLORENNEC P-Y and IUDITSKY A 3 SJOBERG J ZHANG Q LJUNG L BENVENISTE A HJAL

lsquoNonlinear rsquoblack-box modeling in system identification a unified overviewrsquo Azttomatica December 199531 (U) pp1691-1724

4 HE X and ASADA H lsquoA new method for identifying orders of input-output models for nonlinear dynamical systemsrsquo Proc of the American Control Conference California 1993 pp2520-2523

5 PEDERSEN M W HANSEN 1 K and LARSEN J lsquoPruning with generalisation based weight saliencies P B D BS in TOURETZKY D S MOZER M C and HASSELMO M E (Eds) lsquoAdvances in neural information processing systemsrsquo The MIT Press 19968 pp521-527

6 N0RGAARD M RAW O POULSEN N K and HANSEN L K lsquoNeural networks for modelling and control of dynamic systemsrsquo (Advance Textbooks in Control and Signal Processing Springer 2000)

7 ASTROM K J and WITTENMARK B lsquoAdaptive controlrsquo (Addison- Wesley Reading MA USA 2nd edition 1995)

8 CLARKE D W MOTHADI C and TUFFS P S lsquoGeneralized predictive control-Part I The basic algorithmrsquo Automatica 1987 23 (2) pp137-148

0 IEE 2001

This work was supported in part by the Danish Technical Research Council under contract no 9502714 M Nmgaard and N K Poulsen are with the Department of Mathematical Modelling and 0 Ravn is with the Department of Automation Technical University of Denmark DK-2800 Kgs Lyngby Denmark E-mail pmniaudtudk (M Nsrgaard) oriau dtudk (0 Ravn) and nkpimmdtudk (N K Poulsen

36 COMPUTING amp CONTROL ENGINEERING JOURNAL FEBRUARY 2001