An interactive language for computer -aided identification and control system design R S A AI-Thigatand N E Gough
A new interactive command language was developed to implement integrated computer~ided design in computer control applications. It is intended to operate at the supervisory level in a real-time hierarchical system. The integrated approach is based on convolution algebra and provides a unified conceptual framework for studying the behaviour o f practical systems in the time domain. Consequently, as an alternative to choosing fixed system structures and design procedures, the user may evaluate experimental procedures suggested by the underlying
theory. The language has been implemented on a minicomputer at Bradford University and applied to industrial control problems. The highly flexible and practical aspects o f the language are demonstrated. Considerable progress has been made in the development of computer packages which take the drudgery out of design calculations for control systems and allow the user to concentrate on the fundamental aspects of the analysis. The batch-processed state-space package of Kalman and Engler ~ and the interactive frequency-response procedures developed at the Control System Centre, UMIST, 2 are well-known examples. A new interpretive computer language is described which gives the user greater freedom to manipulate multivariable system structures and present the results of a design as easily-understood time responses. For an interactive system to have real advantages over a batch processed version, the structure of the program must be arranged so that the user can alter data and re-enter the program. In its simplest form the program prints out a message telling the user how to proceed. An advantage of this scheme is the guidance it gives to the inexperienced user. However, he must be aware of the implications of his response and, when he becomes familiar with the program, the guidance becomes unnecessary and boredom may set in. Another disadvantage due to the fixed sequence in which information is entered is that a typing mistake can only be rectified by re-entering a sequence of characters. Furthermore, such programs have at least three additional disadvantages: Application - They can only be used to solve problems specifically envisaged by the programmer. A problem which cannot be reformulated in terms of his specification will be unsolvable. tUniversity of Petroleum and Minerals, Dhahran, Saudi Arabia. Postgraduate School of Control Engineering, University of Bradford, Bradford, West Yorkshire BD7 1DP, U K
1 14
Programming - The method is cumbersome from the programmer's viewpoint as well as being inefficient in storage. Amendment - Changes to the program will require a complete overhaul of all communicational messageswith a considerable risk of program disruption. These difficulties have been overcome elegantly through command-driven programming. Programs in this class scan a line constructed according to some syntax, decode the line and perform the action required. For example, the classical control system design techniques of Bode, Nyquist, Nichols and the root locus were included in a large command-driven suite of programs at Imperial College, Shearer et el. 3 State variable control and eigenvalue assignment are covered by the interactive procedures of Fallside eta/. 4 in which a light pen and visual display are employed to facilitate data input to the computer. Similar techniques are also being used elsewhere, particularly in the preparation of a Scandanavian control library incorporating the command-driven identification procedures of Wieslander.s The computer-aided identification and control system design language CAIAD described in this paper forms the basis for a wholly command-driven suite of programs. Based on an earlier single-input single-output version,6 the present time domain package has been extended to include the identification and design of multivariable control systems.7
THE CAIAD
COMMAND
LANGUAGE
CAIAD is a flexible high level language which is metalinguistically definable with specific semantics. It may be used to construct modular computer-aided design packages which can interface with user-defined data sets and any separately developed program. The language was defined on an interpretative basis for two reasons. First, interpreters can be tailored to provide a language and facilities appropriate to a given application; secondly, program development is eased by the conversational on-line feature of an interpreter. In CAIAD, the commands resemble the English verb describing the function the user wants accomplished, thus providing a natural language in the interactive man-machine environment. Direct accessibility to every variable in the data sets was considered to be an essential feature. A variable, matrix element, row or entire matrix can be defined or edited without encountering any unnecessary step. Accumulative results can be displayed simultaneously for the purpose of comparison. Another important feature of CAtAD which cannot be accomplished by conversational programs, is its suitability for pre-programming, so that commands can be
computer-aided design
prepared off-line and run in batch mode. This is valuable since a system description can be preserved on paper-tape or cassette tape and the user may then quickly run the program in batch mode until a state is reached when interaction becomes necessary. CAIAD provides two facilities not found in existing computer-aided control system design packages: an interpretive desk calculator and an elaborate set of block diagram algebra. The desk calculator is similar in principle to the language BASIC; all statements are executed immediately after they have been entered. The block diagram algebra provides a base for multivariable system descriptions using convolution algebra. It enables the step-by-step determination of control strategies with intermediate inspection of results. Of greatest importance is its use far examining the characteristic modes of the system and synthesizing controller weighting sequences. The power of this algebra is enhanced by a structural approach to the design. Once a procedure has been established it can be stored as a named structure and executed subsequently by an appropriate command. This procedural approach permits the nesting of structures and this can be performed a specified number of times. Thus iterative calculations are possible, for example to optimize a control system response with respect to certain parameters and to give inspection of intermediate results. Communicational difficulties have been overcome in CAIAD through the construction of a dictionary with an associated directive providing information about commands, sub-commands, variables and general facilities. Different levels of information are possible, so that the dictionary can become a simple reminder or else a comprehensive educational facility. This provision improves the man-machine interface in three ways: • The user has free access to guidance at any level only when he needs it and thus fewer errors arise due to boredom. • The programs are more efficiently written and core-store limitations become less of a problem. • Portability between different applications is attained, since only dictionary modules need to be altered. Finally, the interactive nature of CAIAD is enhanced by the provision of an attention interrupt facility with run-time messages.
such as the order of a state-space representation is simply denoted ORDER. For a variable described by two words, the name is constructed from the first character of the first word and the second word, for example sampling period is denoted SPER. For three words a similar rule applies, for example steady-state gain is SSG.
Commands and sub-commands At least two levels of directives are utilized within CAIAD since not all functions can be completed by single commands. In addition some operational commands help the user to continue working within a function, without the need to leave it for operational purposes. Although commands and sub-commands may have the same names, a sub-command has a limited function to perform within the main command. No two commands can a~ppear on the same input line and the effect of a command is multiply effective, so that it remains along the whole line. In contrast, several sub-commands can appear on the same line and, although they are also multiply effective, their effect is terminated as soon as another legal sub-command appears or the line is exhausted. The dictionary description of a demand includes the function - a short definition of its purpose - syntax and notes governing its specification and use. It is useful to classify the various commands as follows:
Operational directives which control the movement of data within CAIAD, affecting directly the work area on the disc, files and a directory of system representation stored. Mon-machine communicational directives which enable data to be entered into the program or output as an annotated listing or graphical display. Mochine-mochine communicationol directives which perform supervisory functions from data collection to updating of control algorithm parameters in the slave machine. Functional directives, each associated with a class of mathematical techniques and algorithms. A command line takes the form of a name followed usually by one or more operands: keyword or positional. The operands provide the specific information required by the command to perform the requested operation. For example, to rename a data set and specify new attributes: RENAME 'old name' 'system type' 'new name' 'system form'
LANGUAGE DEFINITION Expressing the commands in everyday English avoids difficulties of memorizing many commands but poses difficult programming problems to define a compact language which does not require excessive typing on the part of the user. This is achieved partly by introducing redundancy into the command and variable names, and partly by the dictionary.
Naming convention Although it is legal to write the full word, only the first three characters are meaningful to the language processor. This naming convention is consistently applicable with respect to commands~ sub-commands and data sets. Each data set is stored and identified by a unique data set-name which allows it to be retrieved from its allocated file. The convention used to name variables is a compound one, since a single variable or matrix may be specified by several words. Thus a single word may be used directly,
volume 9 number 2 april 1977
•
J
i
.~r
Operands
CAIAD PACKAGE S T R U C T U R E Hardware The target system for which CAIAD has been designed is a Hewlett-Packard 2100 A with 16 k core store and two discs - one fixed. The peripherals include a teletype, Tektronix visual display with hard copier and paper-tape reader. The HP 2100 A is linked to an EAL 680 and analogue computer and a Ferranti Argus 700 direct digital control computer. Thus data from various pilot plants is collected in the form of normal operating records.
Software The programs have been prepared in FORTRAN. They are read from disc by a supervisor in small blocks, so that a machine with large core store is not required.
115
Formally, a functional directive is regarded as an automaton M taking an input set U from the database according to a rule R and producing an output set Y through a mapping ~ such that
M=
is the algorithm or program performing the computations and this can be a set of several automata corresponding to a sub-command. Although the user can enter any command irrespective of the preceeding one, a typical control system design proceeds from identification of the system representation. In CAIAD there are two possible approaches. The first is heuristic and requires the user to postulate a model and then match the model to plant data using correlation analysis. Alternatively, he may use a least squares regression to estimate the model parameters. Learning algorithms may be requested to assist in assessing model structures.8 Often the model parameters may be taken as a priori or the weighting function may have been obtained experimentally, so that parameter estimation is unnecessary. The system description is then entered via the keyboard or paper-tape and preserved on file. In common with the identification section, the design section of the control system offers the choice of heuristic or synthetic procedures. Fixed configuration procedures available include: three-term control, Kalman filtering and optimal control, and non-interacting control. On completion of the design, during which the system may have been repeatedly simulated to ensure satisfactory time responses, diagnostic criteria are applied to ensure loop integrity, insensitivity to model inaccuracy and good noise rejection.
F O R M OF T H E L A N G U A G E Data input and fixed design configurations Some of the basic features of CAIAD are illustrated here using two simple examples. Consider first the three-input three-output system described by the state space triplet (A, B, C) where
A =
B =
C =
-1.268 -0.04528 1.002 - 1 . 9 5 7 0.0 0.0 0.0 0.0
1.498 951.5 8.520 1240.0 -10.0 0.0 0.0 -100.0
0.1
0.0
1.0
5.679
0.0
0.0
1.136 - 3 . 1 4 6 1.136 0.0 1.0 0.0 0.0
0.0 1.0 0.0
0.0 -0.5 0.0 0.0 1.0
0.0 0.0 -1.0
There is no difficulty in entering: a system in state space, transfer function or pole-zero forms in either the continuous or discrete domains. Furthermore, it is possible to transform from one system description to any other using a TRAnsform directive. To begin a session, the user obtains immediate guidance using the command >DICtionary. If he wishes to list all of the currently available commands as in Figure 1 he types
1 16
> D I C COM. To use any of these commands it is necessary to know the syntax, and this may be displayed by nesting the DICtionary command, for example: > D I C DIC COM NAME produces the response NAME: ENABLES THE USER TO LABEL THE SYSTEM AND INDICATE SYSTEM TYPE AND FORM SYNTAX: NAME : : =CSYS OR DSYS CSYS : : = CONTINUOUS SYSTEM DSYS : : = DISCRETE SYSTEM : : = STRING OF 3 ALPHANUMERIC CHARACTERS : : = STATE OR TRANSFER OR ROOTS
Operational commands NAM Give the system a name REN Rename the system or change its attributes DEL Delete a system from the directory STA Status of directory CAL Call a system from file STO Store all the data SAV Save pattern data COP Copy across between data sets EXI Exit IV[an-machine communicational commands DEF Define a variable INI Initiate a variable to a given value TIT Title TAP Tape input END End tape input LIS List on visual display unit OUT Output on teletype D IC Dictionary DIS Display MAG Magnify picture DIS MAG Display a magnified version SAV DIS Display a saved pattern (or patterns) HCOP Make a hard copy Machine-machine communicational commands MEA Measurement, to activate line with slave machine ONT Online transmit data ONR Online receive data FOR Format specification
Functional commands SIM Simulate ASS TRA RAN RED EVA DES IDEN DES ALG STR
Assess named property Transform system description Add a random signal to a pattern Reduce a model order Evaluate immediately (desk calculator) Design Proceed to identification
Enter block diagram algebra phase Enter structural procedure
Figure 1. List of current CAIAD commands
computer-aided design
Following this syntax, >NAME CSYS EXAM STATE storage space FILE 2.
createsthe required
Up to six descriptions may be stored as indicated by the STATUS command >STATUS STATUS DIRECTORY No.
Name Domain
Form
1 2 3 4 5 6
BAR QAZ EXA MRL RSA M34
TR TR ST t ST RO ST
CONTINUOUS CONTINUOUS CONTINUOUS CONTINUOUS DISCRETE DISCRETE
PRESENT SYSTEM
The user may read a given system description from disc file by >CALL EXA or store an updated description on file using >STORE The program variables list is displayed as in Figure 2 using the command >DIC VARiables and as far as possible these terms correspond to words in common usage by control engineers. They are assigned values by means of the DEFine command: >DIC DIC COM DEFINE DEFINE: ASSIGNS VALUES TO VARIABLES. THE LINE CONSISTS OF A STRING (FORMING IDENTIFIABLE WORDS) FOLLOWED BY NUMBERS (INTEGERS OR REALS IN FREE FORMAT); EACH STRING IS SEPARATED FROM ANOTHER BY A SPACE OR COMMA. SYNTAX: FOR SINGLE VARIABLE, DEF < V A R I A B L E > VALUE FOR MATRIX, DEF POSITION VALUE : : = ELEMENT OR ROW OR COLUMN However, it is convenient to treat define as an optional command and it is omitted in the following sequence which sets up and stores the given state space triplet: >NIN 3 NOUT 3 ORDER4SPER 0.04 > A M A T ROW 1, -1.268 -0.04528 1.498 951. > A M A T ROW 2, 1.002 -1.957 8.520 1240.0 >AMAT ROW 3, 0.0 0.0 -10.0 0.0 > A M A T ROW 4, 0.0 0.0 0.0 -100.0 >BMAT ROW 1,0.1 0.0 1.0 BMAT ROW2, 5.6700.00.0 >BMAT ROW 3, 1.136 -3.146 0.0 BMAT ROW 4, 1.136 0.0 -0.5 > I N I T CMAT IDEN CMAT ELE >STORE
volume 9 number 2 april 1977
I ntegar variables Scalars NPO NIN NOUT ORDER SOR FPO LPO LAG OUT CHA NDIF NAP NBP
Number of samples Number of inputs Number of outputs Order of state description Simplified model order First point Last point correlation lag Output Channel Order of differencing Number of autoregressive parameters Number of moving average parameters
2-D NORD matrices DORD CNO DNO
Matrix Matrix Matrix Matrix orders
3-D NUM matrices DEN SNUM SDEN ZER POL CNUM CDEN SIR NLI CHEQ LCD
Polynomial numerators Polynomial denominators Simplified model numerators Simplified model denominators Model zeros in complex format Model poles in complex format Simplified model numerators Simplified model denominators Time series Nonlinearities matrix set Characteristic equation Least common denominator of a row
Real variables Scalar SPE 1-D CFR matrices SIC
Sampling period Continued fraction coefficients States initial conditions
2-D AMAT matrices BMAT CMAT DMAT DTIM RM AT QMAT ICM OPTG NGA DGA PRO INT DER SSG GINV IMM POST PRE APA BPA CGA
of of of of
numerator orders denominator orders controller numerator orders controller denominator
State space A matrix State space B matrix State space C matrix State space D matrix Matrix of dead times Symmetric definite weighting matrix Symmetric semidefinite weighting matrix initial conditions for Kalman filter Optimal gain matrix Matrix of numerator gains Matrix of denominator gains Matrix of proportional gains Matrix of integral time constants Matrix of derivative action constants Steady state gain matrix Steady state decoupling compensator Interaction measure matrix Post-multiplier matrix Pre-multiplier matrix A parameters B parameters Channel gain
Figure 2. List of current CAIAD variables
1 17
0.5050
This can be checked by the LIST command:
0.~19
>LIST AMA BMAT CMAT SPER. The algorithms for simulation and multivariable control system design are based on the principle of discrete convolution and its associated block diagram algebra. The system is thus represented by a discrete weighting function matrix for which a sampling period, SPER, and response time, NPOINTS, must be specified. The directive, >SIM EXA, results in the computation and display of this matrix as shown in Figure 3. Other system responses derived from the weighting functions may be displayed, for example
I
0.5008
0
O.50O0
>DIS MAG SYS STEP displays a magnified picture of the superimposed responses for a unit step function applied to one input. The fixed design option is now considered. For practical reasons it is frequently necessary to distinguish between servomechanism and regulator design strategies, and those which are either deterministic or stochastic in terms of their input functions. The DESign directive is described as: >DIC DIC COM DES THIS COMMAND HAS TWO DISTINCT FORMATS: 1. DES ; : : = STATIC OR DYNAMIC OR STATIC DYNAMIC OR PROP OR PROP INTOR PROP DER OR PID OR 3 TERM 2. DES : : = OPTIMAL CONTROL OR KALMAN FILTER : : =
it)
R 8 -0.0048 Set
point I
0~.0022 Set point5
Set point2
Figure 4. Closed loop response to unit step reference inputs after steady state decoupling
Thus>DES 3 TERM ; REG RAND DIST displays the response of a closed-loop system with three-term control subject to a random load disturbance, whereas >DES PID ; CLOS STEP uses the same control action but presents the response to a unit step reference input change. In selecting the control parameters, users may attempt designs by a variety of classical techniques as well as by trial and error. For multivariable problems however, interaction sometimes makes this difficult and two design aids are therefore provided. Firstly, Bristol's relative gain array is listed as a steady-state interaction measure, IMM: 9 > E V A L IMM INTERACTION MEASURE MATRIX -14.22766 .20611 15.02155 15.53043 -.60697 -13.97346 -.35276 1.40085 -.04809 The controlled and manipulated variables should be connected so as to ensure that this matrix has the largest positive elements of each column situated on the principal diagonal. In this case a transformation is required to interchange rows one and two, follwed by interchange of rows two and three. Alternatively, the inverse of the matrix of steady-state gains GINV may be evaluated and used as a matrix compensator:
N 8
/.0049
Q0053
8
~037 Input I
Input2
Input3
Figure 3. Graphical display of weighting function matrix
1 18
>EVAL GINV STEADY STATE COMPENSATOR -1.79445 1.00741 -3.45036 -.67152 .40337 -4.45281 -5.55890 3.14476 -9.61793 >DES STATIC ; CLOS STEP then displays the closed-loop step responses which are decoupled in the steady-state as shown in Figure 4. The responses can subsequently be changed by the addition of dynamic compensating elements
computer-aided design
DESIGN USING A STRUCTURAL PROCEDURE
....
° .........................
1.0113
The second example is a state space description of an industrial chemical reactor given by While: 1o >LIST AMAT BMAT CMAT A MATRIX 1.03600 -.01095 .11775 -.04504 B MATRIX
SPER .00157 .03094 .90238 -.00017 .00006 .82186 .57999 -.00069
.00527 .00302 .00031 .97371
.00000 1.00000 1.00000 .00000 SAMPLING PERIOD = 25
.0152 Prop = 0.05 Int = 350
~J
0.0891
0.0629
.00000 .00000 .00000 .00000
Prop = - 0 . 8 0 2 Int Der
Transforming this despcription to pole-zero form, Set point I
>TRAN TO ROOTS >LIST POLES immediately reveals poles which lie outside the unit disc in the z-domain, showing that the system is open-loop unstable. The design strategy adopted therefore is to insert simple proportional controls in the direct paths and raise the gains using a structural procedure until the system is stablized, as indicated by decaying transient responses. >STR NAME REACTOR 1 STEP PROP ELE 2,2 -0.05 GEN PROP SAY - 6 2 CONVOLVE - 9 - 6 SAY - 8 ADD IDEN SAV - 7 INV - 7 SAV - 7 3 MUL BY -1 ADD IDEN INTEGRATE DIS 4 REMARK LOOP RESPONSE IS I - (I + G D ) * * - I 5 EXECUTE REACTOR >END Starting with controller gains hi = 0.05 and h2 = -0.05 the structure is executed by >EXECUTE REACTOR. At each iteration the closed-loop response is displayed and the pro-
0.9351
"5
-0.0216
O
Prop
=
0.05
1.7276
o~
O.1888
Prop = Set point I
0,5
Set point 2
Figure 5. Closed loop step responses for reactor model with proportional control
volume 9 number 2 april 1977
-0.0007
1.2949
. 0 0 7 5 1 -.06245 13.49030 .00023 .00023 -3.56935 4.20766 .00091
C MATRIX
8
= =
800 70
Set point 2
Figure 6. Integral and derivative action are added to remove offset and improve the speed of response
cedure is interrupted when a stable control configuration is obtained with hi = 0.05 and k2 = -0.5, as in Figure 5. By further use of procedural iteration introducing integral and derivative action, satisfactory closed-loop step responses are obtained as shown in Figure 6. The design would be completed by making tests to ensure that the controller is realizable and that the system has good disturbance rejection properties.
CONCLUSION The interpretive command language described here has made it possible to construct an integrated identification and design package for a control system using terms which are familiar to the control engineer. Unlike previously reported procedures which employ state-space or frequency domain techniques in fixed control system structures, CAIAD allows the user to manipulate structures of his own specification in an unrestructed manner. This algorithmic flexibility corresponds directly to manipulations suggested by the algebraic theory of discrete convolution. Because the results are presented directly in the time domain, the procedure has proved to be particularly useful as an educational aid. 11 In addition it is being used for the study of computer control problems in a major industrial process. Extensions to the many facilities already provided by CAIAD are being carried out. Experimental procedures have been written to investigate the potential of synthesizing control algorithms directly to meet various closed-loop design specifications. Furthermore, several non-linear procedures have been introduced as a preliminary to implementing a powerful algebraic theow of non-linear control system analysis within CAIAD. 12 In conclusion, it is noted that the modular construction of the package allows it to be run on a minicomputer with only 16k core store and disc operating system. A version written in CORAL 66 is now in preparation so that a high degree of machine independence is possible and allows the language to be used on other machines.
119
Al-Thiga, R S A Computer aided identification and design of discrete control systems PhD Thesis, University of Bradford (1975)
REFERENCES 1
Kalman, R E 'ASP - the automatic synthesis program' NASA Report CR-475 (1966)
2
Munro, N and McLeod, R S The computer-aideddesign facility for control systems at the control system centre Report No 300, Control Systems Centre, UMIST
AI-Thiga, R S A and Gough, N E 'Artificial intelligence applied to the discrimination of the order of multivariable linear systems' Int. ]. Control Vol 20 No 6 (1974) pp 961-969
3
Shearer, B R, Daly, K C, Goodwin, G C and Waite, P 'A suite of programs for classical control systems design' lEE Conference Publication No 96 on 'Computer aided control system design' (1973) pp 113-118
Bristol, E H 'On a new measure of interaction for multivariable process control' IEEE Trans, on Automatic Control (1966) pp 133, 134
4
Fallside, F, Patel, R V and Seraji, H 'Design of linear multi-variable systems using interactive graphics' lEE Conference Publication No 96 on 'Computer aided control system design' (1973) pp 101-112
5
Wieslander, J IDPA K user's guide, revision I Report 7605, Department of Automatic Control, Lund Institute of Technology (1976)
6
Makhlouf, M A and Gough, N E 'A computer package for the design of optimum servo and regulator mode digital controllers using time domain matrices' Int. J. Control Vol 14 No 5 (1971) pp 833-851
120
10
While, C 'Control problems associated with an open loop unstable chemical reactor' Measurement and Control Vol 9 (1976) pp 105-109
11
Gough, N E Lecture notes on discrete control systems Report No 305, School of Control Engineering, University of Bradford (1976)
12
Dimirovski, G M Foundations of algebraic operator analysis for MIMO nonlinear control systems Report No R306, School of Control Engineering, University of Bradford (1976)
computar-aided design