Copyright © IFAC Advances in Control Education Massachusetts, USA, 1991
VISDYCON: VISUAL DYNAMICS AND CONTROL W. K. Durfee Department 0/ Mechanical Engineering, Massachusetts Institute a/Technology, Cambridge, MA, USA
Abstract. VISDYCON is a collection of courseware modules for teaching system dynamics and controls. The modules include svsresp for linear dynamic system response, riOClIS for root locus design . and !graph for modelling by the iinear graph method. The software is written in C and makes extensive use of X Windows graphics. The modules are available on MIT's Project Athena and are used by graduate and undergraduate controls students. Keywords. Control system analysis: control system design; educational aids; computer software; courseware. The primary design objective for VISDYCON was to create easy to use. rapid response. interactive graphics modules each of which demonstrates a single concept in control analysis or design. Control systems are a natural candidate for graphical computer tools because the discipline has a long history of graphically based methods for analysis and design. Some examples include step and frequency response plots. Bode plot frequency domain design, Nyquist stability methods. and root locus design. By implementing these methods numerically and wrapping them with an intuitive user interface. the classic textbook pictures can "come alive" for the student.
INTRODUCTION VISDYCON (VISual DYnamics and CONtrol) is a collection of interactive. graphically based courseware modules designed to aid in the teaching of elementary concepts in system dynamics and controls. This paper discusses the need for control systems courseware. presents the design objectives for the VISDYCON modules. highlights key technical details of the software, and presents detailed descriptions for three of the VISDYCON modules. The VISDYCON courseware was designed to fill the gap between hand analysis for control system design and analysis, and complete computer-aided control system design (CACSD) packages such as MATRlXx and MATLAB. Hand analysis is essential for beginning students who are working to develop a basic comprehension of the underlying theory of control systems. Through assignments and self-study. the student uses simple methods to solve well -structured problems. If the assignments require that all computations be performed with nothing more complex than a simple calculator, the details of the underlying theory of control design and analysis are revealed and assimilated by the student. The limitation of hand analysis to anificially small or ideal systems, however, greatly restricts the student who is more comfortable with the basics. Further, the time required for performing hand computations limits the number of control systems the student can analyze which in tum inhibits his or her ability to develop an intuitive feel for how systems behave. It is this intuitive knowledge which is difficult to transmit to students through traditional chalkboard ancl textbook techniques. A good example are non-minimum phase systems. At MIT, we find that few control students have developed a sufficient level of familiarity with systems to realize that the step response for linear systems with zeros in the right half plane has an initial transient in the "wrong" direction.
The current suite of VISDYCON modules includes sysresp where the user places poles and zeros on the s-plane using a mouse and the program computes and displays the resulting step and frequency responses, r!oclIs which draws the root locus plot in response to open-loop pole and zero entry, and !graph which automates the process of modeling systems using the linear graph method. Other modules under development include nvquisr which takes the user through conformal mapping and Nyquist stability theory, and drime which demonstrates fundamental concepts of sampling and discrete-time systems.
IMPLEMENTATION DETAILS VISDYCON modules were written in C and run on workstations using the X Window System. X is a networktransparent windowing and graphics environment which is rapidly becoming a standard for interactive, graphically-based applications software that runs on engineering workstations (lones. 1989). X Window servers have recently been made available for IBM PC and Apple Macintosh personal computers which enable X applications software to run on those platforms as well. The X programming environment provides a rich selection of graphics and window management library calls which can be augmented with X Toolkit libraries that simplify code development. A custom X toolkit was written to facilitate creation of VISDYCON modules (Wall, 1989). The toolkit provides data structures to create buttons, text entry boxes, "tweakers" for parameter changing, and graphs. It also contains routines to easily create and maintain windows and to manage event loop handling.
CACSD packages are required for the analysis and design of medium and large scale control systems , and are therefore usecl universally in industry and are an essential part of the curriculum in many university level controls courses. The typical CACSD package is geared toward the professional control system designer, has powerful, comprehensive and numerically accurate software, and requires an extensive training period before effective use can be achieved. Software package training time, however, is generally not available nor desirable within the tight time constraints of the typical single semester course.
At MIT, VISDYCON is provided on Project Athena, an academic computing system consisting of over 1,000
85
networked DEC and mM engineering workstations (Champine, 1990). All undergraduate and graduate srudents have ready access to Project Athena with workstations in public clusters, department facilities, and in some living groups and faculty offices. Since many courses at MIT make use of Project Athena and since tutorial training on use of the workstation is readily available, instructors need not consume valuable class time assigning accounts or teaching students the mechanics of login or of manipulating the operating system.
time between entering a pole and the display of the new response plots is approximately one second on a DEC VAXstation 3100.
RLOCUS Purpose. The root locus method is a powerful, graphical means for studying the behavior of single-input, single-output feedback control systems. By plotting poles and zeros of the open-loop system, the root locus method determines the locations of the closed-loop system poles as the control gain is varied. The root locus plot provides at a glance estimates of system natural frequency and damping over a wide range of gain values, as well as indicating whether the closed-loop system will be unstable over a range of gain values. The purpose of the rlocus module is to compute and draw the root locus plot given the location of the open-loop poles and zeros. and to do so with minimum response time.
COURSEW ARE MODULES
SYSRESP Purpose. The sysrcsp (SYStem RESPonse) module was designed to teach the equivalence between the many graphic representations of dynamic systems. Three of these representations are the pole-zero plot in the complex s-plane, the time domain step re sponse. and the frequency domain magnirude and phase plot. Sysresp enables the user to explore the relation between these differing system representations by encouraging the visualization of many systems.
Operation. The user is presented with a single, large window with a row of buttons at the bottom (Fig. 2). The user places open-loop poles and zeros on the s-plane using the mou se, and the root locus is computed and plotted. Unlike most commercial CACSD oackages where the loci are never carrIed completely to the zeros. the resulting root loci appear as they would m a textbook with the loci carrying to and tem1matmg at the zeros, or continuing on to the edge of the screen. ThIs results from the unique way rlo cus computes the root paths.
Operation. Sysresp presents a screen with four windows under which is a row of icon buttons. (Fig. 1). With the mouse, the user selects the pole or zero button and places the root at the desired location on the s-plane plot in the lower right window. The normalized step response is then immediately drawn in the upper right window and the magnirude and phase frequency response in the left windows. The arrow button is used to move poles and zeros while the eraser button removes them. The buttons at the lower left are for enabling an interactive help facility, for changing a set of preferences options, for storing systems on disk, and for printing a screendump picture of the windows. The preferences options allow the user to scale the plots, to disable any plot in order to speed up the calculations of others, and to display the impulse and ramp response in place of the frequency plots. If the help button is activated, a help window appears with information which describes each button as it is pressed.
The remaining buttons have the same functions as the corresponding ones in svsresp. The "show me" button activates a rutorial mode which guides the user through the trad1l10nal steps of drawing an approximate hand sketch of the root locus plot using the set of construction rules developed by Evans during the 1950's (Ogata, 1970). This hand sketch method is taught in virtually every introductory controls course but requires practice to master the essential concepts. The rloclIS tutorial mode is de signed to demonstrate the correct steps and solutions for the user. (The "show me" mode is not integrated with the current version of rlocus but rather exists as a separate module. The integration is unde~ay). Algorithms. While most CACSD packages compute the root locus through explicit root solving methods, rlocus uses an integration method where the characteristic equation is propagated along each branch of the locu s. The integration method has several advantages over root solving. First, it is extremely fast, demonstrating order-of-magnitude speed mcreases over the root solvers. Second, unlike the root solvers, the user is not required to specify the range of closedloop gains K over which the loci are computed. Third, the loci are carried completely into the zeros or off the edge of the sc reen. This is not possible for root solving methods since K approaches infinity as the loci approach the zeros. The mtegratlOn method is derived from the literature (Bien, 1986, Pan, 1978) and only a brief overview will be provided here . Complete details can be found in (MacLeod, 1986).
Several additional features are implemented which ease the use of sysresp. When the user places a pole anywhere off the real axis, the complex conjugate pole is immediately drawn. When two poles are pl aced at the same location. a doublepole icon is drawn. Poles placed near the real or imaginary axes are "snapped" to that axis. Algorithms. The underlying algorithms which perfonn the computations required by s.'"sresp are straightforward. The magnirude and phase plots are computed using vector methods where a vector is drawn from each pole and zero to the relevant jw point on the imaginary axis (Ogata, 1970). This method is extremely fast even for high order systems and particularly well suited for s)"sresp where the system description is entered in pole-zero form. Some enhancements to the basic computation were required. For example, with lightly damped systems, one must chose the resonant frequency of the lightly damped pole-pair as a member of the frequency vector for which the response is computed to prevent missing completely the resonant peak in the resulting plot.
The root locus marks the set of closed-loop transfer function poles as the gain varies from zero to infmity. This corresponds to the roots of the characteristic equation 8 (s) +KA(s)=0
Where A(s) and 8(s) are the numerator and denominator polynomials of the open-loop transfer function, and K is the closed-loop gain (Ogata, 1970). Let the characteristic equation be described by the function g(s,K) and let both s and K be parameterized by the independent parameter t so that
To compute the step response , a factored transfer function is formed from the set of pole and zero locations. The factors are multiplied to generate polynomials and the resulting transfer function convened to a state-space control canonical form (Ogata, 1970). The matrix set of state-space equations are then integrated numerically using a founh order Runga-Kutta method to generate the step response time history. The response is normalized by the DC gain of the transfer function before plotting. For a system of four poles and two zeros, the
g[s(t),K(t)] =B[s(t)] + K(r)A[s(t)] =0
The root locus is described by the set of points where g, and therefore Its derivative dg/dt. equal zero. Thus the locus can be descnbed by the differential equation
86
dg/dt+g=O
graph nodes are placed by clicking on the node icon and then clicking in the graph area of the Canvas window. The nodes denote distinct velocity points for mechanical systems or distinct voltage points for electrical systems. Branches are placed by selecting the appropriate element icon from the palette and then clicking on the two nodes which defme the branch endpoints. The system automatically spreads the branches if !Wo or more are added in parallel between common nodes. Errors are corrected by deleting branches or nodes with the eraser icon.
or dg/dt=-g
Using chain rule differentiation, this can be rewritten as (iJg/ds)(ds/dt) + (dg(iJK)(dK/dt) =-g
or equivalently
itS
ds/dt= [-g- (dg/dK)(dK/dtl]/dg/dS
After constructing the graph, the user clicks the "Calculate" button, and Igraph computes and displays the primary, secondary, and state variables, the elemental equations, the constraint equations, and the state equations in symbolic form. The "Show Steps" button enables a tutorial mode where the user is taken step by step through the process of reducing a linear graph and generating system state equations. The buttons along the bottom row of the Palette window allow the user to print the Canvas window, save the graph on disk, enable an interactive help facility, and exit the program. Algorithms. The procedural algorithms used by Lgraph, generate the elemental and constraint equations, and symbolically manipulate the basic equations to derive the system state equations. These algorithms rely extensively on linear algebra techniques and only a brief overview will be presented here. Complete details are in (Ourfee, 1990).
The derivative of K can be specified arbitrarily as dK/dt= I
Now , using the definition of g, the differential equation for s can be written ds/dt= [B(s)+ KA(s)+A(s)]/[B'(s)+KA'(s)]
where B'(s)=dB(s)/ds and A'(S)=dA(s)/ds
This equation can be numerically integrated with respect to t from each of the open-loop poles to produce the set of complex points s which describe the root locus.
The elemental equations are generated from a set of lookup tables which contain basic I-port elements for each of the five energy domains. The compatibility {"node") and continuity ("loop") constraint equations are generated through algebraic manipulations of the incidence matrices. Incidence matrices are a formulation which originates from graph theory , and are a compact expression of the graph interconnections with one row for every branch and one column for every node (Strang, 1986).
To produce integration steps of constant segment length L\s, it is necessary to adjust the integration step size I'1t at each iteration. This insures that the locus computation will progress a fixed distance after each integration step and that the entire locus will be drawn. Other modifications of the basic algorithm must be made produce proper behavior at locus breakpoints and when the locus approaches the open-loop zeros at high gain values.
Lgraph computes the system state equations in symbolic form, which enables the student to study how the elements relate to the equation structure. This contrasts with most other automated system modelling packages which require parameterization of the elements and compute and display the state equations in numeric form only. The state equations are derived through a series of linear algebraic manipulations using the elemental and constraint equations. The algorithm can handle linear graphs with no energy storage elements as well as those with dependent energy storage elements and those which generate derivatives of the inputs.
LGRAPH Purpose. Engineers conunonly use graphical representations of lumped-element physical system models as an aid to understanding a system's structure and to aid in developing mathematical models which describe the behavior of a system. Most are familiar with circuit diagrams which, in conjunction with Kirchhoff's voltage and current laws and network theory, enable an engineer to analyze the behavior of complex , interconnected networks of passive and active components. Several common graphing representallons generalize this concept beyond electrical circuit diagrams, and are not restricted to a single engineering domain. These techniques include bond graphs (Karnopp, 1975), signal-flow graphs (Oazzo, 1981), and linear graphs (Rowell, 1989, Shearer, 1967). With linear graphs, a particular phySical system is represented as a set of connected, generalized single- and dual-port elements, power sources, and transduction elements, whose behavior is described by the time history of power or energy variables. Lgraph is an interactive, graphical software package designed to create, modify , and reduce linear graphs. Lgraph enables the user to place elements from several domains in a connected graph, and then computes and displays elemental equations, constraint (loop and node) equations, and state equations for the dynamic system, all in symbolic form. Operation. After starting Igraph, the user is presented with !Wo windows (Fig. 3). The Canvas window contams a regIOn at the top for constructing the graph, and four regions undemeath where the program output is displayed. The Palette window contains the tools and selection options for entering and manipulating the graph. All user interaction is handled via a single-button mouse. To construct the graph, the user fust selects an energy domain from the row of icons at the top of the Palette window. The choices from left to right are mechanical translational, mechanical rotational, electrical, fluid, and thermal. Next, the
87
ACKNOWLEDGMENTS The VISDYCON project has been developed over several years by a series of MlT undergraduate UROP (Undergraduate Research Opportunities Program) and senior thesis students. Particularly important contributions have been made by Matthew Wall, Douglas MacLeod, Freeland Abbott , Heather Andrus, David Sangster, and Diana Othon. VISDYCON has been supported by MlT's Project Athena and by the MIT Department of Mechanical Engineering.
REFERENCES Bien, Z. and J. Lee. (1986). A note on a computer-aided root-locus method. IEEE Trans. Automat. Cont., AC-3J , 246-247 . Champine, GA, DE Geer and WN Ruh. (September 1990). Project Athena as a Distributed Computer System. Computer, , pp. 40-51.
D·Azzo. JJ and CH H()upis. (1981 ). Linear Control System Analysis and Design. McGraw-Hill. Durfee, WK, MB Wall , D Rowell . and FK Abbott. (1990). Interactive Software for Dynamic System Modeling Using Linear Graphs. Unpublished report. Available from the author. Jones, O. (1989). Introdu ction to the X Window System. PrenticeHall. (1975). System Dynamics: A Kamopp, D and R Rosenberg. Unified Approach. John Wiley & Sons.
MacLeod, DR. (June 1986). Design and Development of an Interactive Software To ol for Plotring Root Locus. Bachelor's thesis, Massachusetts Institute of Technology. Ogata, K. (1970). Modern Control Engineering. Prentice-Hall. Pan, CT and KS Chao. (1978). A computer-aided root locus method. IEEE Trans . Automat. Cont., AC-23, 856-860. Rowell, D. and D. Wormley. (1989). System Dynamics: An Introduction. Course Notes. (1967). Shearer, JL, AT Murphy, and HH Richardson. Introduction to System Dynamics. Addison-Wesley.
Strang, G. (1986). Introduction Wellesley-Cambridge Press.
to Applied Mathematics.
Wall, MB. (June 1989). Interactive Software for Creating and RedUCing Linear Graphs. Bachelor's thesis, Massachusetts Institute of Technology.
88
"'.l.<>«D
~
0
@
b t l GCUI
S-f' l _
i
:
i
I
I !
: I
i
E
I
Ii i I
I I I
,
: 1
i II I? [EJ~g
/Y
t
:
I
I
I
I i
\
'~-;-D~:Q,~ :
Fig. 2. Rlocus screen. The window shows a root locus plot on the complex s- plane. The icon buttons at the bottom are similar in function to those in Fig. I. The "show me" button enables a mode which steps through the root loc us construction rules.
Fig. 1. Sysresp screen. The complex s-plane is in the lower right window and the step response is in the upper right. The left upper and lower windows contain the magnitude and phase frequency response. The row of icon buttons at the bottom right are for placing and erasing poles and zeros in the s-plane. The buttons at the bottom left are for printing , di sk storage, enabling the help facility, changing user preferences, and quitting the application. The screen shows a lightly damped , second order system with two complex conjugate poles.
Domain
vetoclty source
~~
node
force sOU'Ce
[i] []
mass (m)
",.",,,",,,,,~[],pring(kl Primarv Vanab6es vmO vml 11<2 fk3 fb4
9Y"""
secondary Van~ fmO fml vt<2 vtc.J vb4 State Variabtes vmO vml fk2
[RJ rI ' ' ' ' '
(bl
fkJ
Bemental EquaUons
COoslr.lint Equations
~"lnu-fmO
fmll .. - JkZ - fkJ-fb4
~ .. :n,fml
fml .. fkJ.fb4
~ .. kZvta ~ .. kJvk3
vkJ .. vmO - vml
fb4 .. b4 vb4
Vb4 .. vmO - vml
Slate Equations VmO ) . ~vmO ..
:f
:-f vm 1) .. ~vmO -
~vml
~vml
..
-
kfltZ -ktkJ
~tkJ
~.~vmo ~ .. ~vmO
-
~vml
Fig. 3. Lgraph screen. The Canvas window is at the left and contains from top to bottom: an area for constructing the graph, a .ist of critical system variables, the elemental equations. the constraint equations. and the symbolic state equations. The Palette window is at the right at contains a row of icon butons for selecting an energy domain, a set of buttons for selecting graph elements, erase and clear butons, a "Calculate" button for updating the information in the Canvas window, a "Show Steps" button for leading the user through the linear graph process, and a row of buttons at the bottom for printing, disk storage. enabling help, and quitting the application. The screen is displaying a fourth-order, quarter-car suspension system example.
89