COP' ri!!;ht © I F.-\( : \Ltll- \I ac hine S,·"ellls.
SYSTDI DESIG;\i
Oull!. Finlallcl. IlJ HH
THE MANIPULATION OF GRAPHICAL AND SYMBOLIC MODELS OF DYNAMIC SYSTEMS H. A. Barker, M. Chen, P. W. Grant, C. P. Jobling, D. A. Simon and P. Townsend DeparllllflllJ of EIr,ctrim/ alld E/nlnJllir t:lIgilll'l'I"wg ([ lid .\1 alitl'llllllif".l IIl1d C/JII/pllll'!" Srifll("(" [ 'lIil'l'nill Col/egl' Sll'flll.II' ([, Sillg/I'I/JII P!II-k, SlI'(///.II'1I S.·I] 8PP , [ 'f.:
Abstract. The developmc nt of an integrated Computer Aided Control System Design environment for use with a grarLic$ workstation j , described. Thi~ paper concennates on the man-machine interaction aspec:ts of th~ environment and the facilities for the input anli manipulation of dynamic sy,stcm descriptions in grarhicai form wiLl symbolic mathematical data. The graphical editors for the input of dynamil: system topology, in block diagram or signal flow graph form, and the layout algorithms necessary for the fully automatic generation of these representations are described in detail. The facilities for the input and editing of the mathematical data, in standard mathematical form, and the algorithms for the manipulation of both this and the topological data of a system, using the logic programming language Prolog, are also described. Keywords. Computer-aided design, control system analysis, computer graphics, manmachine systems, symbolic computation, automatic diagram layouL and others, 1987a) which allows the designer of a control system to communicate with the computer in a natural and efficient manner. It exploits the power of modem graphics workstations, with highspeed, high-resolution, bit-mapped raster-scan graphical outputs and ergonomic inputs, in this case the mouse, to provide an interface which is both simple to learn and easy to use. The design is based on the tenet that easy manipulation of both graphical and symbolic data is of fundamental importance for man-machine interaction in CACSD, this paper describes the way in which the software of the pre-processor has been engineered to achieve this aim .
INTRODUCTION As in many engineering disciplines, the computer has a great deal to offer the designer of dynamic systems but its full potential is far from realised. For Computer Aided Control System Design (CACSD) for example, many software packages are available but in them the medium for man-machine interaction is rudimentary, normally being textual in the form of either a question-and-answer dialogue (Munro, 1972) or a command driven interpreter (Maciejowski, 1984). These are primitive forms of interaction when compared with what is available to, say, the designer of electronic systems through computer-aided design (Walker and McGregor, 1986).
THE GRAPHICAL INTERFACE As far as possible the structured design of the graphical interface is based on mouse-driven interaction through a hierarchical set of menus, with keyboard input limited to text such as file names or block identifiers. An important feature of the interface is the strict control which has been placed on the layout of the display, with particular elements such as error and prompt windows and help and quit buttons always appearing at the same screen location. Consistent use of the three mouse buttons ensures that the user quickly learns to associate certain actions with particular mouse buttons. Other techniques which enhance the ergonomic appeal of the interface include the use of lit/unlit buttons and high-lighting to indicate valid options together with the use of colour which, apart from its aesthetic attraction, adds to the clarity of the interface in that certain colours are always associated with particular picture elements. For ex.ample, a help window will
It is perhaps surprising that in a field such as control
engineering the majority of the effort in CACSD has been concentrated on the development of sophisticated numerical tools for the analysis, simulation and design of complex dynamic systems to the exclusion of sensible man-machine interfaces, because the way in which most engineers in this field communicate their ideas to one another is essentially pictorial. Their most common forms of communication are either graphical, through block diagrams and signal flow graphs, or symbolic, through mathematical equations, or both . Consequently there has been a distinct lack of enthusiasm for using the powerful CACSD packages which have been developed because of their deficiencies in user-friendliness. To overcome these problems, a graphical preprocessor for CACSD has been developed (Barker
:lO l
H . :l. . H
always be one colour and an error message window another quite different colour. One aim of the interface is to reduce to a minimum the need to refer to user manuals, with on-line help facilities in the form of scrolled text windows available at all stages of operation of the software. The overall design of the interface is aimed at reducing familiarisation time for the user, increasing the designer's productivity and reducing the chances of design errors by using a natural form of data representation. The principal components of the graphical interface are two screen editors which may be used to construct block diagrams or signal flow graphs . Features of the block diagram editor include facilities for positioning blocks and their inter-connections on a work area of the screen using the mouse. A typical screen layout is shown in Fig. 1. Above the work area are indicator displays giving status information. To the right is an icon-driven library access facility for locating particular block types for inclusion in the diagram. Below the work area are option buttons, the form of which changes as different operations are invoked. The input of block diagrams is automatically controlled in a number of ways, which include limitations on the geometry of connections and checks on the consistency of interconnections. The block diagram editor includes a sub-editor for adding new block icons to the block library .
CES
I
Pro mpt / Error WindOw
I
xl«:t . . ,
...
c," ·:X
W
:" []'d . L
,'::.....
\ .. )J.
.nu . . ' 1> (tn ();ilj "
L\:
Fig. 1. A typical screen layout The other editor is used for constructing signal flow graphs, and its form is very similar to the block diagram editor except that the basic building components of a network are nodes and arcs rather than blocks and connections. A detailed description of the graphical editors has been given elsewhere (Barker and others, 1987b)
INPUT, DISPLAY AND EDITING OF MATHEMA TICAL EXPRESSIONS A block in a block diagram, or branch in a signal flow graph, represents the mathematical relationship between two signals, the transmittance, which must
be defined before detailed analysis can take place. Current methods for the entry of mathematical expressions into CACSD packages do not rencct the usual manner in which human beings attempt to convey mathematical meaning to each other. The accepted way of representing a mathematicai expression on paper is in a two-dimensional pictorial fashion; for example G{s) =
s{s+2) {s+ 1)(S+3)2
The positions in space of the individual characters, as well as their relative sizes, help to convey meaning . Certain multiplication operations are understood as being implicit in this representation. Existing CACSD packages do not accept input in this form and instead one must convert the mathematics into some linear form with a formal syntax such as G{s) = (s'(s+2))/((s+1ns+3)1\2))
with all the possibilities for error that such conversions invite. In even less friendly CACSD packages, one might additionally have to multiply out the numerator and denominator by hand to obtain the various coefficients before attempting to enter the expression into the computer. The graphical interface described here includes an interactive module for the display and editing of mathematical expressions in a natural format, using a mouse for editing. This input module can be called from either of the editors referred to above, or may be entered from the top level menu . The user can either enter all mathematical definitions for a particular control system individually, or through a library of pre-defined transmittances. Mathematical expressions are entered using the keyboard, with control keys for activating various levels of subscription and superscription as well as for the input of such standard functions as sine, cosine and exponent. Editing facilities, including insertion, deletion, replacement and a clipboard function are all mouse driven and each amendment to the text is followed by automatic reformatting . At all stages of input and editing the text appears on the screen in standard mathematical notation. A syntax checker based on LEX (Lesk and Schmidt, 1979) and Y ACC (John son, 1978) validates input expressions and attempts to highlight any apparent errors. Current facilities are limited to the input of rational polynomials, and is presently being extended to allow the definition of a wide range of mathematical functions, including, for example, state-space matrices and differential equations.
T he \I a nipul a tio n o f G ra phical a nd S,"moo li c "I od e ls of DYlla mi c SYS te m s
GRAPHICAL AND SYMBOLIC MANIPULA TION OF SYSTEMS The editors described in the previous sections represent the foundations for the system manipulation requirements of a pre-processor for dynamic systems analysis. Tools are being developed which enable the user to initiate manipulations of systems based not only on the pictorial view of the system but also on the semantics. This will enable the user interactively (or in some cases, automatically) to structure the design problem to suit a particular design methodology . The support of this aspect of the human computer interface requires the following features :The support of tools which operate on the symbolic and topological description of the system to enable various structural changes to be made without affecting the semantics of the system The support of tools for the automatic redisplay of the pictorial representation following the application of such changes. In this section these two aspects of the interface design are briefly discussed. Structural Manipulation There are four basic classes of tools required to support this activity. These are: System transformation Direct manipulation of diagram elements Graph reduction Creation of sub-graphs. System Transformation. The transformation between a block diagram and a signal flow graph is a desirable manipulation facility for the graphical description of a linear system . Since any system can be equally well represented by either a block diagram or a signal flow graph, a set of transformation rules may be established according to the duality between the information contained in these two system descriptions. These rules may be readily expressed in logic programming languages such as Prolog. One is then able to scan every component in a block diagram and construct the corresponding components of the signal flow graph and vice versa. Direct manipulation of diagram elements. Direct manipulation allows the user to change the topology of the graph using well known rules of which two examples are illustrated in Fig. 2. The user defines the action required and the objects to be affected and the system applies the rules to change the topology of the graph and modify its components without changing the semantic meaning of the graph.
--'h4s~ Removal of Feedback Loops
~
~
I 1.1 B
A
A
j +~
~
B
~
~
Move a Take-off Point
Fig. 2. Block & signal manipulation rules Graph reduction. Graph reduction is a procedure used to obtain relationships between specific signals in the system . To reduce a graph the user specifies a set of n signals which are to be taken as inputs (sources) and a set of m signals to be taken as outputs (sinks). The result is a new graph whose n inputs and m outputs are those of interest and whose mxn branches contain the symbolic relationships between the signals (Munro, 1977; Salehi, 1981; Jobling and Grant, 1986 ). The parts of the original graph which do not contribute anything to the new relationships are removed during the reduction process. The relationships produced by this method are those which could actually be measured in the original system by exciting the selected inputs with suitable signals and observing the selected output signals. Reduction is a destructive process which eliminates most of the topology of the system, and it would normally only be applied to a copy of the original graph unless used to simplify parts of a graph as described in the next section. Creation of sub-graphs. A subgraph is created by grouping together a specific set of components and defining where the graph is to be severed from the original graph. The connections at which the graph is severed become the input and output ports of the macro or supcrblock element which replaces the subgraph in the original graph. There are two approaches to subgraph creation. The first is to simply create a new graph, which is a copy of the original subgraph, and to relate its input and output connections to the input and output ports of the macro element which represents the subgraph,
H ..-\ . Ba rker
:\ (1-1
as in Fig. 3(a). This approach is useful to simplify the user's view of a complex graph and can be used to create an hierarchical view of the system. The underlying system topology is unchanged although the graphical output from the system may change to tidy up the user's view . The second approach is to reduce the subgraph between the input and output connections thereby creating a new graph which is simpler than the original but maintains the mathematical inputoutput relationships of the original subgraph. This approach is illustrated in Fig. 3(b).
- - - - - - - - - - -- - - .
R
Sub System a)
Sub-System
r-+ r-~
J
G 1 1 + H1 G 1 G 2
G 1G 2 1+ H1G1G2
"I.
derived need to be available for browsing and further manipulation by either simulation or analysis tools. This requires that a great deal of cooperation between the symbolic and graphical tools must be available in the interface.
R
Fig 4 The relocation or a subgraph output
,
~
f' f
U
b)
Fig. 3. The creation of a subgraph For both approaches one can specify that only certain signals which cross the boundary of the subgraph should be taken as subgraph inputs or outputs . This necessitates the utilization of signal manipulation rules to move the unwanted signals to either the actual output (in the case of unwanted output signals) or to the actual input (in the case of unwanted input signals). A typical example is shown in Fig. 4 . Pictorial Manipulation The importance of symbolic and graphical feedback to the user in all manipulations described above is apparent, since the user needs to be aware of the effect of any manipulation of the model's structure and the interrelations of its signals. Following any manipulation request the graph should be redisplaycd as aesthetically as possible and the relationships
Given the topology of a signal !low graph or a block diagram, a user could construct the pictorial layout by using the editors described earlier. Alternatively, one would expect that the system would also be capable of automatically producing a pictorial layout from the topological information . An automatic redisplay tool which achieves this goal has been developed in CES (Barker and others, 1987c). The functional modules of this tool for signal flow graph layouts is depicted by the !low diagram given in Fig. 5. The input data includes only the topology of the signal !low graph; a list of nodes and a list of branches describing the connections between nodes. From this, the database construction module captures the structural properties of the graph . Properties taken into consideration include node reachability, distance between nodes, cycles and other properties of the graph and its equivalent graph (Henly and Williams, 1973). The initial node-layout generation module constructs several layouts and then selects the best one by reference to a metric which gives each layout a score based on certain criteria. Further adjustment is applied to the node layout to produce the final optimised version using a branch-layout algorithm including generation and optimisation processes. All modules are written in Prolog in order to deal efficiently with the nondeterministic nature of the layout algorithm. The basic rules which determine the quality of a layout differ from that of the highly developed systems for integrated circuit layout or circuit board layout. The latter emphasise the use of physical resources such as minimisation of the layout area and optimisation of the circuit speed performance, while the former require more aesthetic considerations for placing the elements neatly to produce layouts which are clear and conform to the
The :'\[anipulatio ll of Graphical a nd Svmbolic \[ odel s of Dnlamic S\stems
generally accepted conventions for drawing signal flow graphs. Topological data
Database construction
Initial node layout generation
Optimisation of node Layout in n-space
Conversion from n-space to u-space
Signal flow graph layout
Fig. 5. The functional modules of the layout algorithm There is no unique, well defined set of rules for signal flow graph layout although most control engineers would agree on the main desirable features, which would include, for example: Particular orientation of components of a signal flow graph Even distribution of nodes and branches in the layout area Considerations of graph planarity including minimisation of branch crossings Compactness of graph within the layout area There will be other factors although none will by itself determine an aesthetically pleasing layout of a signal flow graph. Some requirements may conflict and a priority scheme has to be adopted to resolve conflicts. In addition to the work on signal flow graphs, software is also under development for the automatic layout of block diagrams which require a somewhat more complicated set of heuristics. CONCLUSIONS Certain facilities offered by a graphical CACSD environment have been discussed . The graphical editors allow the efficient definition of a system's topology and the mathematical text editor the entry of mathematical data, such as transfer functions, in symbolic form. The use of symbolic mathematical analysis enables the user to work with familiar concepts and reflects the more qualitative approach used in pen-and-paper analysis . Numerical substitution of variables need only occur at the last stages of the design and implementation process.
With appropriate interface software, data may then be used by other file-based analysis or simulation packages, their detailed requirements remaining transparent to the user . Thus, a system may be completely defined without recourse to abstract concepts, such as simulation languages and numerical analysis tcchniques and without detailed knowledge of the particular CACSD tool employed. REFERENCES Barker, H.A, M. Chen, P.W. Grant, c.P. Jobling and P. Townsend (I987a) . The development of an intelligent man-machine interface for computer aided design, simulation and implementation of control systems. Proc . 10th IFAC Congress on Automatic Control, vol.7, pp. 255-260. Barker, H.A, M. Chen, etc (1987b) . A human-computer interface for control systems design . Proc . of the British Computer Society Conference on People and Computers - HumanComputer Interaction. Barker, H.A., M. Chen, C.P. Jobling and P. Townsend (1987c). Interactive graphics for the computer-aided design of dynamic systems. IEEE Control Systems Society Magazine, vol. 7, no. 3, pp. 19-25. Henly, EJ. and R.A. Williams (1973) . Graph theory in modern engineering. Academic Press, New York. Jobling, C.P. and P.W. Grant (1986) . Using Prolog for signal flow graph reduction. Proc. of the Conference on Man, Machine and Cybernetics Atlanta, Georgia, USA (IEEE Systems, Man and Cybernetics Society) , pp. 1270-1274. Johnson, S.C. (1978) . YACe: Yet another compiler compiler. Bell Laboratories, Murray Hill, New Jersey. Lesk, M.E. and E. Schmidt (1979). LEX - A lexical analyzer generator. UNIX programmers manual, vol. 2B. Seventh Edition. AT&T Bell Labora tories. Munro, N. (1972). Conversational mode CAD of control systems using display terminals. IEEE Conference Publication No .86 : Computer-Aided Design . pp. 418-431. Munro, N. (1977). Composite system studies using the connection matrix. International Journal of Control, vol. 26, pp. 831-839. Maciejowski, J.M. (1984). The Cambridge linear analysis and design programs - CLAD? Proc. 0/ the Conference on Computer-Aided COn/rol System Design (Inst. Measurement and Control), pp.I-6. Salehi, S.V. (1981). Signal flow graph reduction of sampled data systems. International Journal a/Control, vol. 34, pp. 71-94. Walker, M .G. and J.L. McGregor (1986) . Computer-aided engineering for analog circuit design. Computer (IEEE Computer society) , vol. 19, no. 4, pp. 100-108.