Copyright © IFAC 12th Triennial World Congress, Sydney, Australia, 1993
RECENT APPLICATIONS OF SYMBOLIC COMPUTATION IN CONTROL SYSTEM DESIGN D.W.C. Ho*, J. Lam**, S.K. Tin*** and c.Y. Hant *Department of Mathematics, City Polytechnic of Hong Kong, Hong Kong **IJepartment ofMec/lllflical Engineering, University of Hong Kong, HOIlf!, Kong ***Division of Applied Mathematics, Brown University, Providence, RI IJ2912, USA tIJepartment of Electrical Engineering, University of Hong Kong, HOflf!, Kong
Abstract In this paper we describe several recent applications of symbolic computation to control system design based on :rvlACSYMA. These include routines to calculate the transfer function of a control system in block diagram representation and to compute and simplify state space realizations of multivariable control systems. The programs provide a quick way to formulate design problem and automate the calculation in the initial stage of a control system design process. An example on the application of these routines in the setting up of generalized plant state space realization for use in Hoo/Hz optimial control is provided.
Key words. Symbolic Computation, Computer-aided Control System Design.
1. Introduction
2. Transfer Function Calculation In this section, we shall assume given a timeinvariant linear system represented by a block diagram. To make things concrete, let us consider the following "Twoparameter Compensation Scheme":
Recent years have seen a growing interest in the
application of symbolic computation to control theory. In the process of computation, symbolic variables are carried along. Since computations are done in an exact manner, there is no possibility of cumulative error due to rounding off. This advantage is emphasized in Gonzalez & Munro (1990, 1991), Tin et al. (1991). On the other hand, by doing computations symbolically, we get formulae involving the parameters which we would like to vary. This is helpful in the design of control systems (Umeno et al., 1989, Phelps & Krener, 1988). Applications of symbolic packages to manipulate and simplify polynomial and rational matrices can be found in Saito et al. (1989) using REDUCE and in Makela et ai, (1988) using MACSYMA. There are also softwares that are built on top of standard symbolic packages with specific applications. CAD package written on MATHEMATICA developed by Kitamoto & Saeki (1992) can be used to provide common control system analysis in an effective way. Meanwhile CONDENS, developed by Akhrif and Blankenship (1990) using MACSYMA, is designed to perform analysis and synthesis for nonlinear control systems. For a survey of symbolic computation applied to teaching and research, see (Fitt, 1990).
Figure 1
Here r, y are the (Laplace-transformed) input and output. respectively, and for the moment, wc assume transfer functions are SISO. The conventional method for finding the transfer function from r to y involves the so· called " Block Diagram Reduction", in which the number of blocks ill the diagram is sllccessively reduced by moving branching points and sllmming points, interchanging summing points, and then reducing internal feedback loops (Ogata, 1970). To the summing point and the input-output relationship of each plant, we have:
Perhaps a more primitive reason for favouring the use of symbolic packages is that very often we are interested in the formulae themselves. The prototype calculations are the ones which carry many variables, are tedious but involve no "thinking". It is certainly of interest to automate these calculations, and if need requires it, subsequent substitution of the variables by numeric values. In fact, it is our goal in this paper to illustrate the power of symbolic computation in this regard. For this purpose we shall consider the problem of calculating the transfer function of a time-invariant linear system from its block diagram representation. Then we shall discuss the symbolic computation and simplification on state-space realizations. Elementary as it seems, the problem illustrates quite well the capability of symbolic computation and its potential application in control system design in general. Certain difficulties involving symbolic computation are also highlighted,
Ut -
U2
= e
(2.1)
lLl
=
(2.2)
Clr
y = Pe lL2
= C2 y
(2.3) (2.4)
With MACSYMA at our disposal, tbe system of linear equations (2,1) - (2.4) can be solved efficiently by the function LINSDLVE, so that if wc type in LINSOLVE( [Ul-U2=E. Ul=Cl*R. Y=P*E, U2=C2*Y] , [y • E. Ul ,U2] ) ;
MACSYMA will respond
At the moment, there are several systems on symbolic computation: MACSYMA, MATHEMATICA, MAPLE, ... - to name a few. A general comparison and evaluation amongst them can be found in Simon (1990). In the present paper we shall illustrate the methodology by MACSYMA, although we do not hesitate to emphasize that our methods are general and therefore not dependent on the particular system one utilizes in the implementation.
Cl P R
Cl R
Cl C2 P R
[y = --------, E = ---------, Ul = Cl R, U2 = ----------) C2 P + 1 C2 P + 1 C2 P + 1
The first entry in the results list of MACSYMA then shows that the transfer function of the system is y r
567
CIP C2 P + 1
If it happens that the transler tunctlOns are m lact gIven Dy
C _
p=_l_ s + l'
Using back substitution, the following results are obtained for the relationship between the output vector [y, uJt and the input vector [a, b, c, Jt
1
1 - s2
+ s + l'
then the MACSYMA function EV effects the substitution:
[
G.(I-K.F.G)-l.K
I+G.(I-K.F.G)-l.K.F
(I-K.F.G)-l.K
(I-K.F.G)-l.K.F
G. (I-K.F .G)-l .K.,] (I-K.F.G)-l.K.F
EV(Cl.P/(C2.P+1) ,P=l/(S+1) ,Cl=1/(S-2+S+1) ,C2=1/(2.S+3));
Besides NC.5YCAL wruch actually solves the system of equations, a routine MAT.EV is developed which performs substitution if the symbols are to be replaced by concrete matrices(possibly with variables). More technical details can be found in Han et al (1990).
giving the answer
2s 4
2s + 3 + 7s 3 + l1s2 + 9s + 4
3. State Space Realization in split-second. In case where the transfer functions concerned are MIMO, the same calculation goes through as before if we understand now that multiplications are that c,{ matrices. In ~IACSYMA there is no built-in function to solve a system of equations when the multiplication is matrix multiplication. However it does have a "." (dot) operator which performs matrix multiplication, i.e. if A and B are matrices of appropriate dimensions, _4 . B gives the matrix product. To carry out these operations, we have developed for the dot operator a routine analogous to LINSOLVE wruch solves systems involving non-commutative elements.
In the state space domain, many design techniques are based upon matrix manipulation and large amount of algebraic formulation. During the design process, it is often required to build systems from subsystems and realize the overall system in the state space form. This can be easily automated by MACSYMA. Suppose the dynamics of a system P is described by a set of first-order differential equations written in terms of state variables in vector x( t) such that
The main program NC_SYCAL developed performs two functions:
x(t) = A(t)x(t) + B(t)u(t) yet) = C(t)x(t) + D(t)u(t)
1. Solving the system by Gaussian elimination for noncommutative elements.
where u(t), y(t) are input and output vectors respectively; A(t), B(t), C(t), D(t) are generally real time-varying matrices of appropriate dimensions. The above system can be conveniently denoted by a Jtate .. pace quadruple
2. Providing an interactive environment for replacing an expression by an equivalent identity. This is an option for users to simplify the symbolic expressions or give an alternative form according to the following three identities:
G(aI + KG)-l = (aI + GK)-IG, (aI + (bI
+ GK)-lr l
=
(I
+ a(bI + GK))-l (bI + GK),
1+ (aI - G)-IG = a(aI - G)-I where a, b are scalars and G, K are matrices. Technically we make use of MACSYMA's ability of matching expressions. One of the main steps is to check if a given subexpression is of the form (s + AJj-l, where s is a scalar symbol, AI is arbitrary. For example we have a multivariable control system with given inputs a, b, c and unknown outputs u, y treated as vectors.
3.1 System Configuration Routines
Given a system in block diagram representation, one can think of it as a combination of elementary configurations If using the basic operations we described earlier. furthermore a state space form is chosen for each primitive block, then one can re-build the system in state space form sucessively.
b
a
+
+
An overall system can often be thought of as an interconnection of a number of individual subsystems, mostly built from addition, multiplication, feedback and augmentation connections. The state space quadruple of the overall system is a combination of the state space quadruples of the subsystems.
y
In MACSYMA, the built-in command ADDeOL/ ADDR.OW can be used to append the column/row of a given ma.trix onto another matrix respectively and also the entries in the columns and rows are symbolic objects. A series of operations are constructed based on these commands. The following table summarizes the programs developed for performing the operations involved in the construction of the overall realization from those of subsystems.
Figure 2
The set of simultaneous equations in augmented matrix form is
To perform matrix Gaussian elimination, the row element is multiplied by the inverse of the diagonal element. However, the (1,1) element such as -KF may not be invertible. This leads to the general question: Which elements do we want to invert? In general situations, we take inverses of the form
(I + Mdv[2)-1 where Ml and M2 are symbolic objects which may themselves be composed of a series of symbolic objects. Hence in this example, we are searcrung for I - K.F.G in the augmented matrix, which can be inverted in general.
I-
~~F.G
K.a
Operation
SS.ADD SS_SUB SS..MULT SS..NEG SS_INV SS_TRAN SS.FB ROW.AUG COL.AUG DIA.AUG
Addition Subtraction Multiplication Negation Inversion Transpose Feedback Row Augment Column Augment Diagonal Augment
Table 1. Programs of State Space Operations Note. that SS.F~ feedback command has various options of bUlldmg up umty feedforward, unity feedback and general feedback operations.
In the above example, we interchange the rows and carry out the Gaussian Elimination, we obtain
[~
Program
+ K.;.c + K.F.b] 568
3.2 Simplification
program consecutively to work on to a given state space quadruple until no more simplification is possible. Thus, it provides users with a direct way to solve the simplification problem without distinguishing each state space realization pattern.
After obtaining a realization of a given interconnection of state space subsystems using the above operations, very often the overall state space dimension may be reducible . We would like to obtain a "generically" minimal realization. In fact , unless we substitute the symbols by numerical constant matrices, it is impossible to guarantee a truly minimal realization. However, we can always work towards a realization which is minimal in the generic case (i.e. when the symbols are replaced by "generic" matrices). A set of programs is developed as shown in the following table .
A given quadruple may consist of complicated and mixed patterns. In case we cannot use pattern matching to reduce a state space dimension of a given quadruple, we need to carry out row/column operations manually. Its success relies on users' ingenuity and experience. Using this approach, a program called RED.1HX is developed and it runs in an interactive manner. The program will first switch to system matrix form and users are required to issue commands instructing the program to carry out the row / column operations. Finally, the program returns a simplified state space quadruple. More detailed description can be found in Ho et al (1992).
Operation
Program REDJ.DD REDJ.UG RED_INV RED_CON RED _OBV
Addition/Subtraction Column/Row Augment Inversion Uncontrollable Mode Unobservable Mode
Reduction Reduction Reduction Reduction Reduction
3.3 Example on Generalized Plant Realization In this section, the use of symbolic state space realization for a generalized plant used in H 00/ H2 optimization control system design is described. A program AUGMENT is developed to handle all the symbolic state space realization operations. AUGMENT employs the basic routines in section 3.1 and makes the generalized plant realization available to users who may not have an extensive knowledge of symbolic manipulation software.
Table 2. Programs of State Space Dimension Reduction As an example, if p=
[_A_o_P'___A_P_'__r-_±_BB_P_;,__ c Pl
cpz
Dp
The generalized plant of a mixed sensitivity problem is given by (Doyle et al., 1989)
then
P (s ) =
and if
[;:: ;:;] [~' .....
~.
······i···
-W,G W2 G
-G
(3.1)
1
where Pij(S) is a subsystem, G is a given system and W , and W2 are dynamic weightings. To realize P( s) in state space form, each subsystem of Pij(S) requires the multiplication and augmentation of the quadruples
then
and When a realization P is given by
G=
[~G] ~
where i = 1,2. The realization in state space form for P( s) serves to illustrate the powerfulness of symbolic packages when used in analysis. The execution of AUGMENT can be separated into three stages. The first stage is the input. The second stage is realization and the last stage is simplification. We shall explain the execution of AUGMENT in detail with the use of P(s) in (3.1 ).
±u
We execute AUGMENT by typing
the uncontrollable mode reduction routine gives
AUGMENT() ; in MACSYMA and it prompts for the information of the generalized plant. Please enter all variable names in list form [Wl, W2 ,G] ; Please enter plant Pll [Wl,O];
All these simplifications are achieved by the pattern matching capabilities in MACSYMA. The basic schemes used in Tables 2 are equivalent to strict system equivalent row/column operations. The main ideas of these row/column operations are to form de coupled states with uncontrollable and/or unobservable properties and that the corresponding states can be eliminated from the system.
Please enter plant P12 [-Wl.G,W2.G] ; Please enter plant P21 [1];
1 denote3 the identity matrix
in MACSYMA
Although the programs uses standard MACSYMA built-in commands, the intelligent searching and checking in A p , Bp and Gp are demanding in programming in order to keep the new quadruple strict system equivalent to the old one. The actual MACSYMA implementation of these programs involves the usual programming technique of checking whether our matrices have certain forms using the built-in logical operators such as the conditional operators IF ... THEN .. . ELSE. For ease to use, we have developed a main driver program called DIM..RED. The program simply calls all the programs in Table 2 and repeatedly drives each
Please enter plant P22 [-G] ; Do you want to use the default (A,B,C,D) matrix setting? yes; In the last question of the above program, the user can choose the default set ting which is G = [ A_G B_G
[ [ C_G D_G
569
1
1 1
On the other hand, he may assign his own qlladnJpl" matrices to the variables Wl, W2 and G which may contain constants or variable elements.
Th" CPU t.ime taken for t.his program to give the aboyc a.nswcr is 78.1 sec. runnin g 011 VAX 8800. Notice that. this AUGMENT program is developed based on the specific problem involved in generalized plant realization. For other user specific problem it is easy for the user to build up its OWll routines based on section 3.1. It is certain that the userilltcrface illput section of the above algorithm requires some kllowledge of MACSYMA or any symbolic package used.
After the input stage, the following procedures will be carried out in AUGMENT to calculate the realiZiLtion of plant P. (1) Replace "." SS-.MULT and in command carry out the
and "-" signs in the user input with SSJlEG. This is done by using a builtSUBST. (Note that the SUBST will only substitution but not execute SS-.MULT or
4. Conclusion We have presented some applications of symbolic computation to the calculation of transfer functions and t.heir realizations in state space from. Symbolic computation is ext.remely useful for engineers to automate the hand calculations. The programs faci litate the formulation at the iIlit.ial stage of the control system design, and thus form an important integral part of the design process. Due to the enormous potential of application of symbolic computation in a control system design process, future researches should be aimed at combining symbolic softwares with powerful numerical packages.
SSJlEG. )
PII
(2) Realize sub-plant
[t~l] ,
=
[~~\?],
P I2 =
P21 = [1] and Pn = [-G]. This is done by first executing the SS...MULT and SSJlEG with a built-in evaluation command EV and then using COL~UG to form the sub-plants. Hence
References Akhrif O. and Blankenship C.L., (1990), Computer Algorithms for Nonlinear Control, in: Advanced Computing Concepts and Techniques in Control Engineering, Nato ASI Series, Edited by M.J. Denham and A.J. Laub.
[-WI.G] W2.G
Doyle J.C., Glover K, Khargonekar P. and Francis E., (1989), St.ate space solution to standard H2 and Hoo control problems, IEEE TRANS. on Automatic Control, AC-34, pp.831 -847.
-BWl·DG
BG BW2.Do
BG
Fitt, A. (1990), Symbolic algebra system in teaching and research, Scientific Software Systems, edited by J. Mason and M. Cox, Chapman & Hall. Gonzalcz L. and Mumo N. (1990), New algorithm for minimal balanced realization of transfer function matrix, 1nt. J. Control, vol. 50, no. 4, pp. 923-929. Gonzalcz L.A. and Munro N. (1991), A note on the closedform determination of the I!;ramians of a stable time-invariant time system, Int 1. Control, vol. 53, no. 6, 1483-1489. Han C.Y., Lam J., Tin S.K. and Ho D. (990), Transfer flmct.ion calculation using Macsyma, GP H K Research Report, AM-91·01.
(3) Use DIM...RED to simplify the sub-plants state space quadnJples. Hence
P
II
=
BWl
[~I]
Ho D., Tin S.K., Lam J. and Han C.Y., (1992), Symbolic Approach to st.ate Space Realization, CP H K Research Report MA·f) 2·01.
[ Aw CWl
DWl
0
P 12 =
Kitamoto T. and Saeki M., (1992), CAD Package for Control System on Mathematica, IEEE International Conference on System Engineering, Kobe.
[-WIG W2.G ] AWl
BG
AG AWJ
BW1,CG
CWl
Makcla T. and Pohjolainen S., (1988), On the symbolic computation in simulation of distributed parameter systems, 4th IFAC symposium on computer aided design in control systems, Beijing.
-BWl·Do
-BWl'CO
BW'J.DG
-DW1.C G
Ogata K., (1970), Modern Control Engineering, PrenticeHall,86-93.
-DW1·DG CWJ
DW2. C G
DWJ.DG
and P21 = [1], Pn = [-G] remain unchanged. (4) Use the simplified sub-plants to form the realization of plant P. This is done by first using COL~UG to form the column augmentation of Ql =
Q2
=
[;~~] ,
and then use
augmentation of Ql and Q2
[;~:]
ROW~UG to form the (ie. P = [Q1 Q2].)
Phdps A.R. and Krener A.J. (1988), Computation of Observer No rmal Form Using MACSYMA, in: Analysis and Cont.rol of Non linear Systems, I3yrnes C.l., Martin C.F. ans Sacks R.E.(eds), Elsevier Science Publishers B.V., NorthHolland, 1988, pp. 475-482.
and
Saito 0., Kanno M., Abe, K, (1988), Symbolic manipulation CAD of Control engineering by using REDUCE, Int J. Control, vol 48 , No 2, pp. 781-790.
row
Simon, B., (1990), Four Computer Mathematical Environ -ment.s, Notices, American Mathematical Society, 37, 7, pp.I-8.
(5) Use DIM...RED to simplify P. In fact the intermediate results after (2), (3) and (4) are transparent to the user and finally the program ret urns the state space quadruple P( s) A= [ A_Ill 0 -B_II1.C_G [ 0 A_1I2 B_1I2.C_G [ 0 A_G
Tin S.K., Lam J. and Ho. D. (1991), Comments on 'New algorit.hm for minimal balanced realizat ion of transfer fWl ct ion matrix,' Int. J. Control, Vol 53, No. 5, pp.12551259.
B=
1 1 1
[ B_1I1 -B_1I1.0_G
[
0
[
0
B_1I2.0_G B_G
1 1 1
Umeno T., Yamasb.ita S., Saito 0., Abe K. (1989), Symbolic Computation Application for the Design of Linear Multivariable Control systems, J. Symbolic Computation, no. 8, pp. 581-588.
0=
C= [ C_lIl
[
0
[
0
0 C_1I2
-0_111. C_G 0_1I2.C_G - C_G
1 1 1
[ o_111 -0_1I1.0_G
[
0
[
1
0_1I2.0_G -O_G
1 1 1.
570