You are on page 1of 4

MASON Frequency-Response Programfor Continuous and Discrete Control Systems

lee C. Boger
ABSTRACT:MASONis a frequencyresponse computer program useful in the design and analysis of linear control systems. Complex signal flow graphs involving either Laplace- or z-transform transmittances are reduced via a computational algorithm based on Mason's Gain Formula. Continuous-time systemsareevaluated with s = jw. and discrete-time systems use z = exp(sT). The transmittances may include polynomial expressions,transport lags, or actualgain/ phase data from experimental testing. The input structure is user-oriented, providing for simple transfer-function representation between nodes. Frequency response, resonant peak, resonant frequency. and gain and phase margins are calculated where appropriate, and form the program output. desired frequency. This requires all transfer functions to be represented in the s domain and forces some transfer functions. such as a transport lag. to be represented with a Pade or appropriatenumericalapproximation. This method encounters problems when the complexity of the system being analyzed starts to approach the arithmetic limitations of the computer. The system polynomials with s terms to the 50th or 60th power may cause an overflow condition when evaluated at high frequencies. These higher frequencies may also cause inaccuracies with a Pade or other numerical approximations. MASON avoids both problems by representing each transfer function as one complex number for each desired frequency and then multiplying the transfer functions according to a technique known as Mason's GainFormula [2], [3]. Theexactrepresentation can be given for transport lags, EXP( - T * S ) . Other standard arithmetic functions allowed are SIN, COS, LOG,, and SQRT. Although this methodavoidsthe higher-order computations for a 'cry complex system. the computation time may rise dramatically if the complex system has many nontouching loops. because Mason's Gain Formula requires that all combinations of nontouching loops be calculated. Representing each transfer function as a complex number offers two additional advantages. The first advantage occurs with system modeling when a transfer function (such as an actuator, sensor, or other hardware) is not easily defined. If the poles/zeros are hard to pinpoint or when a second-order approximation is not good enough, the actual frequency response of a system component can be input as atable of gaidphase response versus frequency. Linear interpolation and linear extrapolation are used to evaluate frequencies not found in the table definition. This capability allows practically any function to be defined as a transfer function. The secondadvantageallowstransfer functions to be defined in the z domain. With the system defined as ;-transforms, complex numbersare evaluated by substituting z = exp(T*S). Data input are designed to facilitate use, and changes can be made quite easily. Because of the software architecture used by MASON. transfer functions are defined directly from the signal flow graph as arith0272-1708/86:0403-0016 $01.00 0 1986 IEEE

meticFORTRANstatements.Gainand phase margins are calculated for open-loop frequency-responseanalysis.For closedloop analysis, resonant peak and resonant frequency are calculated to ,indicate system stability. Multivariable systems can also be analyzed by definingthestates XI,X2, . . . ,X.%. and the corresponding coefficients as a signal flow, graph.

Theory
Mason's Gain Formula allows the controls engineer to determine the frequency response of a complicated linear, multiloop system. First, the control system is defined as ablock diagram (Fig. 1). then as a signal flow graph (Fig. 2). From this graph. all forward paths are defined. A fonvard path is a path starting from the input node and ending at the output node with no node being encountered more than once. In Fig. 2, there is one forward path through nodes 1-2-3-4-5-6. The gain of each forward path consists of multiplying all the transfer functions between the nodes of that path. All loops are also defined. A loopis a path starting from a node and ending at the same node with no node being encountered more than once. In Fig. 2, there is one loop consisting of nodes 2-3-4-5-6-2. Thereis also a gain associated with each loop. Using this information, the general expression for Mason's Gain Formula is
G =
K

Introduction
The programMASON is primarily intended for the analysis and design of control systems. It was written to address specific needs and limitations of complex control systems involving both continuous and discrete transfer functions.Alltransferfunctions must be defined using the Laplace variable s = jw,the complex variable z , or a table of gain/phase characteristics versus frequency. It is recommended that MASON not be used for analyzing mixed mode systems containing s and z transfer functions because of the great care that must be taken to ensure accurate analysis of sampled data systems as described in Franklin and Powell's book Digital Control of Dynamic Systems [ 11. MASON was not designed to consider where samplers are located or how to handle mixed mode systems.Thatresponsibilitylies with the user, MASON specifically addresses some problemsandweaknessesfoundinother softwareprogramswhen associated with Iarge or compIex control systems. Experiencehasshownthatsomefrequency-response programs first calculate an overall system transfer function defined by a numerator and denominator polynomial of s, then evaluate that transfer function at each

(G, A,j/l

Lee C. Bogeris a ProjectEngineer in the Advanced Control Systems Group at Allison Gas Turbines Division.GeneralMotors Corporation, hdianapolis, IN 46206.
16

where A = 1 - E L l + E L 2 - E L , + . . . + (- l)"cL,. The symbols are defined as follows: L , is the gain of each closed loop in the graph. Lz is the product of the loop gains of any two nontouching closed loops (loops are considered nontouching if they have no node in common). L , is the product of the loop gains of ariy m nontouching loops. G K is the gain of the Kth forward path. A K is the value of A for that part of the graph not touching the Kth forward path (value of A remaining when the path producing G, is removed). The theory is explained with some practical examples in [4]. Using this formula by handis cumbersome when the signal flow graph has multiple forward paths and loops.
I E E E Control Systems Magazine
~ ~~ ~~

Compensa A t ico tn uP alta on rt


r

Therefore,
'
L

-II

z D(sI
c

ICs1

=- G t s I .

H * ( s ) = (1

- e-") lrT :: e

H*(s) =

KT(1 - e-') (e" - I ) ( l - e-'"'')

Fig. 1. Example of a typical controlsystem.

Substituting,
C*(S) --

DCsI

1.0

R *( 4

KT(1 - e - T )
(e" - 1)(1

+ KT(1

- e-')

-1.0

1
D ( z ) = KTz/(z - 1) and Powellrepresent KT

Fig. 2. Define nodes.

For small T, the transfer function can be approximated by using the first three terms of the seriesexpansion for eachexponential term. Substituting this approximation and expanding the equation yields, C*b) K(l - 0.5T) - R * ( s ) sZ + s + K(l - 0.5T)
As would be expected, when the sampling time T approaches zero, the transfer function approachesthecontinuous-timefrequency response. Using Fig. 3, MASONwould evaluate this example as follows:

MASONdetermines all forward paths, loops, and nontouching loops. To evaluate Mason's Gain Formula, each transfer function is assigned a complex number for each desiredfrequency.TheLaplacevariable s = j w is evaluated as a complex number (0.0, w), where 0.0 represents the real part and w represents the imaginary part. Similarly, the complex variable z = exp(s*T) is evaluated as [cos(w*T), sin(w*T)]. The gains for each fonvard path and loop are then calculated using complex arithmetic. A complexnumber for the entiresystemis computed usingthesegains and Mason's Gain Formula. At each desired frequency, MASON converts the complex number for the system into usable information such as magnitude (dB) and phase (degrees). Thesamplingapprohimationusedin MASON calculates a complex number for the transfer functions by substituting exp(sT) wherever there is the complex variable z, then evaluating it at each desired frequency. Franklin and Powell used hpulse modulation to analyzediscrete transfer functions embedded in a continuous world [ 11. They showed that not every sampled data system has a closed-loop transfer function, depending on where the samplers are located within the system. h4ASON calcu!ates the closedloop frequency response regardless of where the samplers are located. This can produce erroneous results, as illustrated with the example shown ia Fig. 3. By using impulse modulation, the system transfer'function is calculatedasfollows: from Franklin and Powell, the A/D converter is modeled as an impulse modulator. The following models apply where D(z) evaluated at z = exp(sT) yields D *(s):
April 7986

(Note:Franklin as KO)

I(s) = (1 - e-")/s
G(s) = l/(s

+ 1)

Using impulses, the system can be written as follows, where H * = (1 - e-"')D *(G/s)*

R(s)

C(s) - -

D(z)I(s)G(s)
1

+ D(z)Z(s)G(s)
= KTz/

c* = H * R * / ( l + H * )
Evaluating, D(z)
=

Substituting z = erTf oD r (z) (z - 1) andsimplifying yields

KTz/(z - 1)
- 1)

as KT(err - 1) -) R(s) (e" - 1) ( s 2 + s) + KT(&' - 1)

D * ( s ) = KTe"/(e"'

KT
s2+s +KT

s(s

+ 1)
s + l
1

As can be seen by this answer, the transfer function does not approach the continuoustime frequency response as the sampling time T approaches zero. This example illustrates the need to carefully apply the rules for block diagram analysis of sampled data systems described by Franklin and Powell. Otherwise, the results

order

Computer

Zero

Fig. 3. Example from Franklin and Powell's book [ 11.


1 7

obtained from Masons Gain Formula may be erroneous. MASON accurately handles systemsdefinedcompletely with Laplace transforms or completely with z-transforms. Analyzing sampling processes embedded in a continuous-time system requires careful consideration of the time-varying effects before a proven, continuous-time, analysis tool can be used.

Compensation Actuator Plant

- K*D[sI

=~

I[s]

GPlSI-

CCS)

Sensor

U
1.0 1 .o

Typical Application
The main program and required subroutines are written in FORTRAN. In a typical problem, the user wants to analyze a system such as the one shown in Fig. 4. Nodes are assigned, and the system is defined by each transfer function. Input data include frequency range, input node, output node, and sampling period (in seconds) to be used if the system is defined in the z domain; the system transfer functions are shown below: T(1,2) T(2,3)
= =

-1.0 -

H(sI

Fig. 4. Typical application. examine all forward paths, loops, and nontouching loops if this information is required.

Example
Using the system shown in Fig. 4, a simple example would be as follows: input node = 1 frequency range: T(1,2)
=

1.0

K * D(s)

T(3,4) = I(s) T(4,j) = G p ( s ) T ( 5 , 6 ) = 1.0 T(5,7) = H ( s ) T(7,2) = - 1 .o END Each of these transfer functions would be executable FORTRAN statements. Comment cards are allowed along with any legal FORTRAN variable. With this as the input, the execution of MASON will yield a closed-loop frequency response. Each frequency would be listed withthecorrespondingoutput: real part, imaginary part, magnitude (unitless and dB), and phase (degrees). Resonant peak and resonant frequency are calculated to indicate systemstability. If theresponsewas unsatisfactory, the user may change K, D(s) or update the models [(SI, Gp(s), or H(s) to ensure that all dynamicelements are included. This procedure is repeated until a selected closed-loop response is achieved. If an open-loop response is desired, then simply remove or comment-outthe transfer function T(7,2) and change the output node from 6 to7. In this case, gain and phase margins are used to check system stability. Inpractice,MASONhassuccessfully evaluated systems that include continuoustime or discrete-time elements. Many of these systems had multiple loops and forward paths. An option exists that allows the user to
18

Limitations
There are several double precision subroutines that were provided by the IBM 370 host computer system on which the system was tested.These are listed in the users manual along with a functional description of each so that equivalent subroutines may be substituted if the user operating system does not have all the subroutines. Because MASON utilizes storage of large Complex * 16 arrays, the size of these arrays limits the system that can be analyzed. Implementing MASON on a given operating system may require special Job Control Language or other additional effort by the user because of MASONS program structure.

output node = 6 1.O to 100 rad/sec 100 steps

1.0

T(2,3) = 1.0 * (0.30

*S + *S*S +

l.O)/(S + 1.0)
T(3,4) = 1.0/(0.001147 0.0479 T(4,5)

* S + 1.0) = 20.0/[S * (0.02 * S + 1.0) * (0.05 * S t 1.0)]


*

T(5,6) = 1.0 T(5,7) T(7,2)


=

1.0/(0.010

*s +

1.0)

= -1

.o

Availability
A users manual, which contains a description. source code, and an example, is available from National Technical Information Service, U . S . Department of Commerce, 5285PortRoyal Road,Springfield, VA 22161. When ordering, refer to the following documents: PB83 - 192195, Mag tape and documentation Report No. NTIS/DF-83/007, DDAD1EDR-11187. PB83-192187. Users Manual for MASON Report No. NTIS1DF83/007a, DDAD1EDR-11187. TheFORTRANprogramshavebeen compiledusing IBMs FORTRAN IV H Extended Compiler. Execution has been performed on IBM% 37013033, using OSlVS operating system.

END The open-loop frequency response yields: gain margin = 7.18 dB phase margin = 28.79 degrees @ 1.008 Hz In this example, MASON was used to determine the continuous-time frequency response. Whether developing a new control design or investigating problems with current designs. MASON is an effective tool for analyzing linear control systems.

Acknowledgments
This pro,gam was designed and written at Allison Gas Turbine Division, General MotorsCorporation,Indianapolis,Indiana. Contributions and assistance were made by Tom Zizzi of the Advanced Development
/ E Control Systems Magazine

. .

Group and John McGrew of the Controls Department, both from Allison.

Theory and Application, Reading,MA: Addison-Wesley, pp. 51-56, 1978.

References
[I] G. F. Franklin and J. D. Powell, Digital Control of DyzamicSystems, Reading, MA: Addison-Wesley, pp. 85-92, 1980. [2] S. J. Mason, Feedback Theory: Some Prop erties of Signal Flow Graphs, Proc. I R E , vol. 41, p. 1144, 1953. [3] S. J. Mason,FeedbackTheory:Further Properties of Signal Flow Graphs, Proc. IRE, vol. 44, p. 920, 1956. [4] S. M.Shinners, ModernControl System

Lee C. Boger is a Project Engineer in the Advanced Control Systems Group at Allison Gas Turbine Division, General Motors Corporation, Indianapolis, Indiana.In1980,he graduatedMagnaCum Laude with a B.M.E. degree from General Motors Institute, Fltnt, Michigan. Also in 1980, Mr. Boger WRS awardedaGeneral

Motors Fellowship to attend Stanford University where he completed his M.S.E.E. degree in 1981. Since then, he has been actively involved in the analysis and design of digital control systems for bothmilitary and commercialapplicationsinvolving gas turbine engines. In 1985, Mr. Boger receivedhisProfessionalEngineeringLicense from the state of Indiana. He is a Member of the IEEE and is a member of the IEEE Control Systems Society, National Society of Professional Engineers, and Tau Beta Pi Engineering Honor Society.

Conference Calendar
OptimizationDays1986, Apr. 30-May 2, 1986. Montreal, Canada. Contact: Alain Haurie,Director of GERAD,Ecoledes H.E.C., 5255 avenue Decelles, Montreal, Quebec, H3T 1V6, Canada, phone: (514) 340-6042. Fourth IFAC Symposium on Control of Distributed Parameter Systems, June 30-July 3, 1986, University of California, Los Angeles, California. Contact: G. Rodriguez, Jet Propulsion Laboratory, Mail Station 198-326, 4800 Oak Grove Drive, Pasadena, CA 91109, USA, phone: (818) 354-4057. 2nd IFAC Workshop on Adaptive SystemsinControlandSignalProcessing, July 1-3, 1986, Lund, Sweden. Contact: K. J. Astrom, Dept. of Automatic Control, Lund Institute of Technology, Box 118, S-221 00 Lund, Sweden. Japan-USA Symposiumon Flexible Automation, July 14-16, 1986, Osaka, Japan. Contact: Prof. M. Tomizuka, Dept. of Mechanical Engineering, University of California, Berkeley, CA94720, USA! phone: (415) 642-0870. 1986 Summer Computer Simulation Conference, July 28-30, 1986, MGM Grand Hotel,Reno,Nevada.Contact:The Society forComputerSimulation, P.O. Box 17900, San Diego, CA 92117, phone: (619) 277-3888. MidwestSymposiumonCircuitsand Systems, Aug. 11-12, 1986, Cornhusker Hotel,Lincoln,Nebraska.Contact: Dr. Mohammed Ismail, Dept. of Electrical Engineering, University of Nebraska-Lincoln, 194W Nebraska Hall,Lincoln, NE 6858805 11, phone: (402) 472-5141. SIAM Conference on Linear Algebra in Signals,Systems, and Control, Aug. 12-14, 1986, Boston, Massachusetts. Contact: SIAM, LASSC Conference, 117 South 17th St.,Suite1400,Philadelphia, PA 19103-5052, phone: (215) 564-2929.

1986 IEEE International Symposium on Circuits and Systems, May 5-7, 1986, LeBaron Hotel, San Jose, California. Program Chairman: Prof. W. K. Chen,Dept. of ElectricalEngineeringandComputer Science, University of Illinois, Box 4348, Chicago,IL60680,USA,phone:(312) 996-2462.

IFAC Aquaculture 86-Automation n Aquaculture, Aug. and Data Processingi 18-21, 1986>Trondheim, Norway. Contact: Prof. J. G . Balchen, Division of Engineering Cybernetics,TheNorwegianInstitute of Technology, University of Trondheim, 7034 Trondheim-NTH, Norway. 4th IFACDFORS Symposium onLargeScale Systems: Theory and Applications, Aug. 26-29, 1986, Zurich, Switzerland. Contact: Prof. M. Mansour, IFAC/IFORS Symposium,ETH-Zentrum,CH-8092 Zurich, Switzerland, phone: (01) 256-5335 or (01) 256-2828. First European Workshop on Fault Diagnostics,Reliability, andRelated Knowledge-BasedApproaches, Aug. 31Sept. 3, 1986, Island of Rhodes,Greece. Send abstracts by April 15, 1986, to Prof. Spyros Tzafestas, Control and Automation Group,ComputerEngineeringDivision, NationalTechnicalUniversity, Zografou, Athens 157 73, Greece. 2nd IFAC Workshop on Modeling and Controlof ElectricPower Plants, Sept. 16-18, 1986, Drexel University, Philadelphia,Pennsylvania.Contact: Dr. H. G. Kwatny, Dept. of Mechanical Engineering and Mechanics, Drexel University, Philadelphia, PA 19104. IFAC InternationalSymposiumon Simulation of Control Systems, Sept. 22-26,1986, Vienna, Austria. Contact: Prof.
Continued on p. 26
19

IMACSSymposiumonModelingand Simulation for Control of Lumpedand Distributed Parameter Systems,June 3-6, 1986, Lille, France. Contact: IMACS-86 Symposium, 1.D.N.-B.P. 48, E 59651 V.N. DASCQ, France.

1986 American Control Conference June 18-20,1986 Seattle, Washington General Chairman: Dr. Edwin B. Stear The Washington Technology Center 376 Loew Hall, FH-10 The University of Washington Seattle, WA 98195 Phone: (206) 545-1920

April 1986

You might also like