+ All Categories
Home > Documents > Symbolic algebra tools for control teaching

Symbolic algebra tools for control teaching

Date post: 20-Sep-2016
Category:
Upload: n
View: 215 times
Download: 1 times
Share this document with a friend
6
CIAL FEATURE SYMBOLIC COMPUTATION Svmbolic aluebra tools -* for controI reaching his article describes various interactive computing facilities implemented in the symbolic algebra computing environment T known as Madhematica,' which have been used in the teaching of control topics to final-year undergraduates and MSc students, in the Department of Electrical Engineering & Electronics at UMIST. The first facility developed, known as the Linear Models Puchage, provides the transformations needed to manipulate the various well established linear system models from one form to another, so that analysis tools and algorithms requiring a particular model format can subsequently be applied. The second facility developed, known as the Linear Analysis Package, provides a range of well- established linear system analysis tools. Both these packages are front-ended by a user inter- face, which introduces the user to the features provided and demonstrates each of the facilities available in terms of preloaded system data. The user can then modify this data or enter new system data and activate any of the transformations or analysis tools. The students to date have found these facilities both easy to use and instructive in enabling them to obtain a better feel for the various well established control system tools in a short time, when manipulating more realistic data. A third newer package, called Optim, which introduces Symbolic algebra languages off er an exciting opportunity for the development of online teaching aids which are closer to textbook format. Some of the facilities developed to support the teaching of control engineering concepts, using Mathematics, are introduced. The type of user-interface facilities that can be created and the ease with which control manipulations can be carried out are presented. by Nei1 Munro well-established function minimisation tools, has also recently been developed. This package provides simple graphical output, showing the cost function surface for functions of two variables, and the progress of the search vector from the initial guess towards the desired function minimum. Various other similar teaching packages- addressing pole assignment, optimal control (LQR), and Nyquist array design tools-are also being implemented. In addition, two further new toolboxes providing the Nyquist array design method and pole assignment algorithms for systems with models subject to structured parameter uncertainty are currently being developed. Why symbolic algebra? Accuracy is a major problem in various computing tasks which arise in scientific and engineering studies. While most modern numerical subroutine libraries on linear algebra, which are widely used in control system CAD, are generally good at producing results with no large errors, there are many occasions where large errors, or failures, can occur due to the numerical sensitivity of the data concerned. Symbolic algebra languages, such as Matlzematical and Maple? all handle fractional numerical forms with infinite precision. Thus, working with symbols, where necessary, and rational numbers, cancellation and simplification of sub-expressions are COMPUTING & CONTROL ENGINEERING JOURNAL APRIL 1997
Transcript

CIAL FEATURE SYMBOLIC COMPUTATION

Svmbolic aluebra tools - * for controI reaching

his article describes various interactive computing facilities implemented in the symbolic algebra computing environment T known as Madhematica,' which have been

used in the teaching of control topics to final-year undergraduates and MSc students, in the Department of Electrical Engineering & Electronics at UMIST. The first facility developed, known as the Linear Models Puchage, provides the transformations needed to manipulate the various well established linear system models from one form to another, so that analysis tools and algorithms requiring a particular model format can subsequently be applied. The second facility developed, known as the Linear Analysis Package, provides a range of well- established linear system analysis tools.

Both these packages are front-ended by a user inter- face, which introduces the user to the features provided and demonstrates each of the facilities available in terms of preloaded system data. The user can then modify this data or enter new system data and activate any of the transformations or analysis tools. The students to date have found these facilities both easy to use and instructive in enabling them to obtain a better feel for the various well established control system tools in a short time, when manipulating more realistic data.

A third newer package, called Optim, which introduces

Symbolic algebra languages off er an exciting opportunity for the development of online teaching aids which are closer to textbook format. Some of the facilities developed to support the teaching of control engineering concepts, using Mathematics, are introduced. The type of user-interface facilities that can be created and the ease with which control manipulations can be carried out are presented.

by Nei1 Munro

well-established function minimisation tools, has also recently been developed. This package provides simple graphical output, showing the cost function surface for functions of two variables, and the progress of the search vector from the initial guess towards the desired function minimum. Various other similar teaching packages- addressing pole assignment, optimal control (LQR), and Nyquist array design tools-are also being implemented. In addition, two further new toolboxes providing the Nyquist array design method and pole assignment algorithms for systems with models subject to structured parameter uncertainty are currently being developed.

Why symbolic algebra? Accuracy is a major problem in various computing

tasks which arise in scientific and engineering studies. While most modern numerical subroutine libraries on linear algebra, which are widely used in control system CAD, are generally good at producing results with no large errors, there are many occasions where large errors, or failures, can occur due to the numerical sensitivity of the data concerned. Symbolic algebra languages, such as Matlzematical and Maple? all handle fractional numerical forms with infinite precision. Thus, working with symbols, where necessary, and rational numbers, cancellation and simplification of sub-expressions are

COMPUTING & CONTROL ENGINEERING JOURNAL APRIL 1997

more readily performed, giving enhanced accuracy, performance and code simplification. This now allows many of the more compact results, which have emerged from algebraic systems and rely on the accurate manipulation of polynomial functions, to be implemented.

There are also many occasions, in the implementation of algorithms, where numerical approximations are used because the numerical tools available cannot directly handle even simple differential and integral equations. These latter functions can not only be handled exactly in symbolic form, but also in many cases need only be done once for a whole class of systems. Such situations can arise in the modelling, analysis, design or optimisation aspects of control systems.

Many of the inbuilt Mathematica functions use natural names for the operations concerned, all starting with an uppercase letter; e.g. the command Eigenvalues [A] will return a list of the eigenvalues of the matrix A. Equally, to calculate the

rf2ps E rf2tf

gf2ps e gf2tf

Fig. 1 Transformations menu

- .

transfer-function matrix model G(s), corresponding to a given state-space model, using the relationship

the code required, in its simplest form, is

g = C.Inverse[s IdentityMatrix[n]-A].B+D

where the '.' means matrix multiplication is used. Similarly, the code required to determine the integral

fxzsin[x]dx

can be entered exactly as shown. In fact, using Mathematica V3.0, the user can select any expression which has been entered, and then by clicking on the desired mathematical operation, in the various differen- tial, integral, trigonometric, and algebraic function palettes provided, the necessary inline code is auto- matically wrapped around the selection-e.g. the /" u d o as shown above-which can then be evaluated.

User interfaces Symbolic algebra environments allow the presentation

of control techniques in a form closer to textbook format. Using the user-created palettes available in the notebook features in Mathematka V3.0, various types of user-interfaces can readily be created. Fig. 1 shows an example of a palette, where the linear systems transformations menu is shown. Clicking on the button 'Menu' produces the script shown in Fig. 2, reminding the user of the functions executed by the mnemonic commands shown, and clicking on any of the function buttons allows interactive execution of the required manipulation. These notebooks allow a mixture of textual, numerical and graphical output, thus enabling the description of the theory and use of the facilities concerned, intermixed with online demonstrations of the tools provided, followed by the interactive use of the tools by the user.

When operating in tutorial mode, where the users (students) have recently been taught some particular control technique, the opportunity to consolidate under-

standing by being able to explore many more complex examples (which would be tedious or impossible to do by hand calculation) rapidly online is readily provided. Fig. 3 gives a simple example of Ziuch an interface, where a window is opened presenting the problem background, and showing initial results obtained with a set of default values for the physical parameters concerned. By activating the 'changedata' button, shown at the end of

Menu

the transformations available in this facility are:

state-space to transfer-function (matrix) state space to polynomial system matrix transfer-function (matrix) to state-space transfer-function matrix to left matrix-fraction transfer-function matrix to right matrix-fraction system-matrix to state-space form system-matrix to transfer-function form system-matrix to TU, V, Wform left-fraction to system-matrix in polynomial form left-fraction to transfer function (matrix) right-fraction to system-matrix in polynomial form right-fraction to transfer function (matrix) T U YWto system-matrix form TU, V, Wto transfer-function (matrix)

ss2tf .ss2ps .if2ss .if2lf .rf2n' .ps2ss :ps2tf .ps2gf :If2ps :If2tf :rf2ps :rf2tf 9f*PS yf2t f

Fig. 2 Model transformations mnemonics

COMPUTING & CONTROL ENGINEERING JOURNAL APRIL 1997

T2.1 In Example 1 , a spring-mass system was considered and a state-space model. described by the matrices A, B, and C was determined, where

The corresponding transfer-function, relating the output y = x p (the position of mass m2) to the input U (the force applied to mass m,), was determined using the relationship g(s) = C(sl-A)-'B

r l as '(') s 4m,m2 + r, r2 + s* (m, r, + m, (r, + r2))

I For [r,+l, r242, m,+2, m,+3), the matrices A and B become

0 0 1 0

-0.5 0.5 0 0

0,3333 -1. 0 0

This Amatrix haseigenvalues{~]={1.111,-1.111, 0~5211,-0.5211}

These eigenvalues, or poles of the system, indicate that the displacement of m2 will behave in an oscillatory manner, consisting of a low-frequency oscillation superimposed on a higher-frequency oscillation, in response to the applied input

The corresponding transfer function relating y(s) to U@), for these

parameter values, becomes g (s) = 2. + 9.s' + 6.s4

The resulting time response over 200 s, for a unit-step input, is

Y current parameters

-0.25 -1 I time I

Fig. 3 Tutorial interface

this initial output, a separate data entry window is opened and the user is then free to modify the system data and observe the changes in the model characteristics being considered and the resulting time-domain Each package implemented consists of a set of self-

behaviour of the system.

Pac

COMPUTING & CONTROL ENGINEERING JOURNAL APRIL 1997

contained modules, which provide the algorithms concerned. Any temporary variables needed to carry out a particular calculation are kept local to the module. A typical module consists of a function header, a ‘usage’ section, which provides simple online help using the ‘?’ function in Muthemutica, a set of calls to data consistency checking routines, to ensure that the data passed in the function arguments is compatible with the requested operation, the code for the calculations, and a ‘return’ statement to provide the required results as output. A typical package (see Fig. 4) consists of a set of instructions to load the necessary modules, a menu of available facilities and their associated mnemonic command names (see Fig. l), and the online demonstration facilities to assist the user.

Linear Systems Models package This package provides a set of transformation facilities

which allow the user to enter data defining a linear system model in one of six model formats, as follows:

1 State-space representations:

x = A x + B u y = C x +Du

2 Transfer-function matrix:

3 Matrix-fraction forms:

y(s) = DL+) NL(s) u(s) As) = NR(s) OR-’ 4s)

left-fraction right-fraction

4 Rosenbrock‘s system matrix:

P(s) = [ -c ,,I state-space form

where

This data can then be transformed to any other of these formats by using the appropriate command; e.g. to transform a state-space model to transfer-function matrix form, the command is

g = ss2tf[a,b,c,dl

where the default variable is ‘s’. The various formats of the command structures

SYMBOLIC COMPUTA

Fig. 4 Package structure

available can readily be obtained, at any time, by invoking the Mathematica usage facility; e.g. ?ss2tfwill produce a full explanation of how to use this command, as shown below:

?ss2tf This procedure constructs the transfer-function (matrix) g(var), in the variable var, corresponding to the state- space model held in the matrices [a,b,c,dl by entering g = ssZtf[a,b,c,d,var], or g = ss2tf[a,b,c,uar], or in the default variable s by entering g = [a,b,c,a, or g = [a,b,c].

Likewise, a demonstration facility can be called up, at any

Demonstration facilities: The use of the McMillan form procedu a preloaded transfer-function matrix, C will be demonstrated by entering the c shown in bold below

9

{{L! l + S 3 + s -L},{L, l + S l + S L}}

McMillan[g]

Converting the given matrix to the form where d(s) = (1 + s) (3 + s )

Determinmg the Smith form of the matrcx

c Fig. 5 Demonstration facilities

COMPUTING & CONTROL ENGINEERING JOURNAL APRIL 1997

time, by entering the word ‘demo’, or clicking on the ‘demo’ button, followed by entry of the mnemonic for the facility concerned. This provides full illustrative examples of the operation of each transformation, showing the model data to be transformed and the resulting model representation (see Fig. 5).

The minimal realisation algorithm used in this package is extremely simple and fast. When it was first developed,j it was criticised because it uses a Gaussian elimination technique which depends on the value to be considered as zero; e.g. IO-’”, when testing for non-zero pivots. However, zero is exactly defined in symbolic languages, and since the necessary arithmetic can be done using exact rational numbers, this problem is eliminated. Conversion to rational- number form is obtained by using the command Rationalize[0.97] + 9?400.

Analysis tools The Livzear Analysis Package provides various well

established control system analysis tools, namely, the Kalman tests for controllability and observability, Rosenbrock’s decoupling zeros facilities to generate the Smith form of a given polynomial matrix and the McMillan form of a given transfer-function matrix, and a facility to generate Bristol’s Relative Gain Array (RGA).

Whilst the Kalman tests are very useful, the numerical realisation of these tests is very ill-conditioned and the result obtained is binary; i.e. the system concerned is, or is not, controllable or observable. Rosenbrock‘s decoupling zeros tests, which can equally be applied to system models in state-space form or in the more general form (characterised by Rosenbrock’s system matrix in polynomial form) are much more informative. They not only give the desired result, but also tell the user which modes of the system are uncontrollable or unobservable, if any. Symbolic algebra facilities now enable these tests, which involve operations on polynomial matrices, to be reliably implemented, and simply consist of determining the rank of a polynomial matrix at specific values of the variable concerned e.g. the system [ T(s),U(s)] will have no input-decoupling zeros (i.e. will be completely controllable) if the matrix [T(s),U(s)] has full rank at Is’ equal to the roots of 1T(s) I = 0. A similar test can be applied to the matrix [sl-A,B] at ‘s’ equal to the eigenvalues of A.

It is interesting to note here that none of the symbolic languages provides an explicit ‘rank-test’ command. It is therefore necessary in Mathewzatica to invoke the RowReduce[a command to convert the matrix 2 into the form [ty::] * * * 2-

0 0 . . . . *

and the rank is then determined by the number of non- vanishing Is on the leading diagonal. There are other ways of determining the rank of a matrix. However, this approach has been found to be reliable when Zcontains a mixture of symbols and (real or complex) numbers.

When a balanced minimal realisation6 of a given state-space, or transfer-function, model is required, it is necessary to determine the controllability and observability Gramians, W, and WO, respectively, where -

W, =

WO =

8’ BB’ e*’‘ dt

& I t c“C kt dt 0 m

n

These are also used in model-order reduction techniques, such as Glover’s optimal Hankel norm approachP Using numerically based approaches, W, and WO are essentially determined by solving the two simultaneous matrix Lyapunov equations, namely

AP+ PA’ + BB’ = 0 AT&+QA+CTC=O

where P and Q are symmetric and positive definite, and W, = P and WO = &. However, the integral form of the Gramian can be solved directly using the Muthelnaticu command

Integrate [X, {t,O,Infinityl]

where X = Y.Transpose[ yl and Y = MatrixExp[At].B

for the controllability Gramian.

Optimisation tools Another facility recently developed, using

Mathewzatica, is a collection of well established function minimisation, or maximisation, tools8 implemented in the Optiwz package. This provides Newton’s method, the steepest descent method, the conjugate gradient method, the Fletcher-Powell algorithm, and Rosenbrock’s method, which are all well suited to functions with a unique minimum or maximum. An advantage of using a symbolic language with these tools is that the various gradient vectors and matrices of second partial derivatives required need only be calculated once in symbolic form.

Optiln allows the user to select a minimisation algorithm and decide how many iterations are to be executed before inspecting the progress achieved. The user can then switch to another algorithm to improve the speed of convergence, or continue. For example, when applying Rosenbrock’s method to his banana-shaped valley function

f(x) = lOO(x2-x,”~ + (l-x1)2

COMPUTING & CONTROL ENGINEERING JOURNAL APRIL 1997

SYMBOLIC COMPUTA

1.5

1

0.5

0

-0.5

-1

limits: -1 3 5 x, 5 1 5 -1 5 s x2 < 1 3

The function plot of 1OO(x2-x12)~+ (1 -xiy

limits: -1.5 5 x, 5 1.5 -1.5 < x2 5 1.5

good progress is made until the search vector approaches the minimum, when progress slows down. It is advan- tageous, at this point, to switch to Newton’s method, which often then achieves the minimum in one or two steps. The graphical output obtained when applying the Fletcher-Powell algorithm to Rosenbrock’s banana- shaped valley function is shown in Fig. 6. The minimum x = (1,l) was achieved in 21 iterations from an initial guess of x = (-1.2,l).

Concluding remarks Some of the possible advantages of using a modern

symbolic algebra computing environment in developing teaching aids for control engineering topics have been introduced. However, it is not possible in such a brief article to cover all the exciting potential offered by such facilities. Mathevnatica can readily be linked to other control CAD tools, such as Matlab,9 thus harnessing the combined power of these tools. Also, other control system facilities addressing the analysis and design of linear and nonlinear systems, including adaptive control system design, have been developed elsewhere.’O

Fig. 6 The graphics of contours, approximation trace and function surface with initial guess (-1.2,l) using the Fletcher-Powell algorithm

References 1 WOLFRAM, S.: ‘The Mathematzca book‘ (1996,3rd Edn.) 2 MAPLE V: Waterloo Maple Inc., Waterloo, Canada 3 ROSENBROCK, H. H.: ‘Computer aided control system design’

(Academic Press, 1974) 4 PATEL, R. I?, and MUNRO, N.: ‘Multivariable system theory and

design’ (Pergamon Press, 1982) 5 MUNKO, N., and McLEOD, R. S.: ‘Minimal realisation of transfer-

function matrices using the system matrix’, Pruc. IEE, 1971, 118, (9), pp.1298-1301

6 MOORE, B. C.: ‘Principal component analysis in linear systems: controllability, observability and model reduction’, IEEE Trans.,

7 ZHOU, K., DOYLE, J. C., and GLOVER, K.: ‘Robust and optimal control’ (Prentice-Hall, 1995)

8 ATHENS, M., DERTOUSOS, M. L., SPANN, R. N., and MASON, S. J.: ‘Systems, networks, and computation: multivariable methods (McGraw-Hill, 1974)

1981, AC-26, (1)

9 Matlah, The Mathworks, Natick, USA 10 KWATNY, H., and BLANKENSHIP, G.: ‘TSi controls: a Muthematica

package for control systems analysis’, Techno~Sciences, Inc., 1001 Derekwood Lane, Suite 204, Lanham, MD 20706, USA

0 IEE: 1997

Prof. Munro is Professor of Applied Control Engineering and Head of Control Systems Centre, Department of Electrical Engineering & Electronics, UMIST, PO Box 88, Manchester M60 lQD, UK. He is an IEE Fellow.

COMPUTING & CONTROL ENGINEERING JOURNAL APRIL 1997


Recommended