Digital Control of an Unstable Plant W. K. N. Anakwa Department of Electrical Engineering Concordia University T. Srinivasan and B. J. Thomas Department of Electrical Engineering The Pennsylvania State University ABSTRACT: An unstable third-order system is controlledigitally by poleassignment technique and observer theory. The unstable plant is simulated on an EA 680 analog computer, and a DEC-0 minicomputer is used to implement the controller. The minimum sampling rate required for stable operation is determined. ntroduction The advent of minicomputers and microcomputers has generated a desire to implement analog controllers designed by modem control techniques by computerbased digital controllers. The performance of the computer-based digital controller will depend on the bandwidth of the plant to be controlled, the wordlength, the speed of the computer, conversion times of the analog to digital and digital to analog converters, the control algorithm, and the programming language. n [, pole allocation and observer theory were used to design an analog outputfeedback controller for an unstable plant with transfer function Us) (s + ) (s + 2) G(s) = - = U(s) (s - ) (s2 + 2s + 2) () so that the system closed-loop poles were placed at s = -2 and s = - rjl. n state variable representation, the plant wasdescribedbythecontrollableandobservable normal form equation i(t) = Fx(t) + gu(t) y(t) = h'x(r) (2) where F, g, and h' were n X n, n X, and X n matrices respectively with numerical values, 0 o-j 0 F = 0 0, g= [2 h' = ( 0,O). The state vector -, -0 and the state variables were xl(t) = y(r), xz(t) = j(t) - u(t), and -x3([) = B(t) - L(t) - 3u(r). f the state variables were accessible, the control law would be u(r) = r(t) - k'x(t) wherek' = (k, k, k3) = (.0.0 0.5) and r(t) is the external reference input. An observer was designed to estimate the controllaw u(t) = r(t) - k'x(t), sinceonly the output ~(t) was available for feedback to the controller. The observer equations were ;(r) = Au(t) + by([) + du(t) where w(t) = c'u(r) + ey(t) (3) - e = -5 and u(t) = r(t) - k'x(t) = r(t) + w(t). A block diagram of the plant and observer/ controller is shown in Fig.. Laplace transformation of Eq. (3) gave W(s) = (c'(s - A)-'b + e)y(s) + (~'(sl - A)-ld)U(s) (4) The block diagram of Fig. 2 shows the plant and observerkontroller in Laplace transform variable. The closed-loop transfer function of Fig. 2 is -_ Us) - (s + ) (s + 2) (5) R(s) (s + 2) (sz + 2s + 2) n the next section, a minicomputer implementation of the digital controller is considered. Minicomputer mplementation of Digital Controller The differential Eq. (3) of the observer is discretized and solved on a DEC-0 minicomputer using y(n) and U(R) as inputs to the computer. Figure 3 shows an analog computer diagram of the plant with the minicomputer in the feedback loop. There are many techniques for discretizing continuous-time differential equations [2]. However, in order to obtain a tractable mathematical relation between the sampling Received March 8, 983; revised May, 984. Accepted in revised form by Technical Associate Editor, G. H.' Hostetter. Fig.. Block diagram of plant and observerkontroller.
~~ ~ Fig. 2. Block diagram of plant and observedcontroller in Laplace transform. interval and the closed-loop eigenvalues, the simple first-order Euler approximation is used for discretization. Let At = A be the sampling interval, r = n be the sampling instant, and r + Ar = n + be the next sampling instant; then, the discretized form of Eq. (3) becomes u(n + ) = ( + AA)v(n) + by(n)a + du(n)a w(n) = c'u(n) + ey(n) (6) The implementation of Eq. (6) isgivenby the following steps: (i) Given v(n) and y(n), convert w(n) to w(r) and obtain u(r), as in Fig. 3. (ii) Sample u(r) and y(r), and generate u(n) and p(n). (iii) Use y(n) and u(n) to compute v(n + ); replace u(n) by u(n + ). (iv) Compute w(n + ) = c'u(n + ) + ey(n) and return to step (ii). Hardware, Simulation, and Computer Programming The plant transfer function of E!.q. () was simulated on an EA 680 analog computer, which has a dynamic range of 2 0 V, and the observer equations in Eq. (6) were programmed in Fortran on a DEC-0 minicomputer [3]. The EA 680 analog computer andthedec-ominicomputerwere interfaced with A/D and D/A converters as shown in Fig. 3. The A/D and D/A components that were supplied with the EA 680 analog computer are bipolarwith 20 V rangeanda resolution of 3 bits excluding the sign bit. The conversion times of the A/D and D/A are approximately 50 ps each. The computer programs written in Fortran initialize the analog computer, set the oper- PLANT ating modes and timers, interface the analog computer with the minicomputer, and solve the observer equations. The flowchart of the hybrid program is shown in Fig. 4, and the flowchart of the digital controller subroutine is shown in Fig. 5. The computer programs are given in the Appendix. A sampling interval A = 660 ps was selected after estimating compilation, execution, and data conversion times. n Fig. 6, curve (a) shows the response of the plant without the controller when y(0) = V, r(t) = OV. Curve (b) shows the response of the system to a step input r(r) = 5 V with the digital controller in the feedback loop. The output).(?) is stable with a final value of 2.5 V in steady state as expected. The signal w(t) is also shown as curve (c) in the figure. t seems a little erratic in the beginning because of the inertia of the recorder pen but settles down almost immediately. The system is also able to follow a ramp, but the figure has been omitted because of lack of space. Whenthesamplinginterval is too long, the delay, which can be considered as a transportation lag, causes excessive phase shift that leads to instability. When a sampling START d NTALZE THE HYBRD COMPUTER SET HFOS CONTROL PARAMETERS AND NTALZE M E CONTROLLER STATE VARABLES 6 ENTER SAMPLNG NTERVAL + SET PATCH PANEL TO C MODE AND THEN TO OP - SAMPLE BOTH THE NPUT AND THE OUTPUT OF THE SYSTEM USNG A/D CONVERTERS &-,. L,G+- DEC- 0 MNCOMPUTER CALL CONTROLLERS SUBROUTNE RENTALZE THE CONTROLLER STATE VARABLES V AND V, 4 FEEDBACK CONTROLLER OUTPUT USNG DAC 6 STOP Fig. 3. Analog computer diagram of plant and DEC-0 minicomputer. Fig. 4. Flowchart of hybrid program. 0 control systems
START READ DATA FOR NVARANT A,B,C,D MATRCES TME CALCULATE THE CONTROLLER STATE VARABLES CALCULATE THE CONTROLLER OUTPUT 2v - RETURN dt) 3v - Fig. 5. Flowchart of digital controller subroutine. OV +b 5 0 5 20 25 X) t,secs interval greater than 700 ps is used, the system is unstable. The instability can be verified from the following analysis. Consider the system Fig. 6. Response of system to r(t) = 5V. Curve (a) y(t) without digital controller. Curve (b) y(t) with controller. Curve (c) w(t). i(t) = Fx(t) + gu(t) y(t) = h'x(t) 6(f) = A?&) + by(t) + du(t) w(t) = c'v(t) + ey(t) u(t) = i-(f) + w(t) (7) - 5A A 0 -.5A -3OA A -P 0 -A 0 2A 0 0 + 9A -lla 0 0 4A - 6A Equation (7) can be rewritten as *=[ F + geh' bh' + deh' rl = [:] A + dc' The discretized version of Eq. (8) may be approximated by e(n + ) = ( + AA) t(n) + q Ar(n) (9) For stability, the eigenvalues of + M must lie within the unit circle. When A = 700 x s, the eigenvalues of ( + AA) are approximately A, = 0.99650, A2 = 0.99720, A3 = 0.99860, = 0.99930 zk j 0.0007. These values confirm the instability behavior when the sampling interval exceeds 700 ps. Conclusion The paper has demonstrated the design and implementation of a stabilization controller by a DEC-0 minicomputer. The sampling interval, which is very critical for stable operation, can be determined from the time required for analog to digital conversion, digital to analog conversion, and computation time for the observer equations. Even though the system was successfully controlled, the use of the DEC-0 minicomputer is very expensive for such a low-order system. As an alternative, a microcomputer implementation is now under investigation. The results will be reported in a later article. Acknowledgment The authors would like to thank Professor W. S. Adams for the use of the hybrid computer facility of The Pennsylvania State University for this research. august 984
Appendix Hybrid Program for Controlling an Unstable Plant REAL RY(2), W, V(2), V2(2) NTEGER Y(2), U(400), 0(400),, FREE. DONE, T EXTERNAL CRBC *****NTALZED HYBRD COMPUTER***** CALL PARAM ( NMSG, PASS ) CALL HNT (ERR) F (ERR, EQ. 0) GO TO 2 CALL SLEEP (5) GO TO *****SET HFOS CONTROL PARAMETERS***** CALL 2 PARAM ( MSG. NPASS, GMODE, DBUG, CALL STCO ( NSEC ) *****NTALZE THE CONTROLLER STATE VARABLES***** Vl() = 0.0 V2() = 0.0 TYPE FORMAT ( OENTER SAMPLNG NTERVAL = $) FORMAT 222 ACCEPT 222.T () CHEK ) *****SET PATCH PANEL TO C MODE AND THEN TO OP MODE***** CALL S AM0 (&C ) CALL SLEEP ( ) CALL SLMO ( RUN ) CALL SAMO ( OP ) w = 0.0 CALL LTDA (0, W) *****SAMPLE BOTH THE NPUT AND THE OUTPUT OF THE SYSTEM USNG A/D CONVERTERS***** 3 CALL DTM (T, ERR, CRBC, 0,,, Y) CALL NTEND ( CONT ) CALL NTPRM ( COE ) CALL STNT FREE = CALL DTMSTA (.FALSE., STAT, FREE, DONE) *****CONVERT THE SAMPLED NPUT AND OUTPUT VARABLES FROM THE MU TO RMU***** RY() = O.OOOl*Y(l) RY(2) = 0.000*Y(2) *****CALL CONTROLLER SUBROUTNE***** CALL EXEQ (V, V2, RY, W, T) *****RENTALZE THE CONTROLLED STATE VARABLES***** Vl() = Vl(2) V2() = V2(2) *****LMT THE FEEDBACK VARABLE TO + OR -.O RMU***** F (W.GT..0) W =.0 F (W.LT. -.0) W = -.0 *****FEEDBACK USNG A D/A CONVERTER***** CALL LTDA (0, W) *****CONTNUE SAMPLNG***** GO TO 3 STOP END 2 control systems magazine
Controller Subroutine SUBROUTNE EXEQ (Vl, V2, RY. W, T) REAL RY(2), W, A(2.2), B(2), CT(2), D(2), E, V(2), V2(2), DET NTEGER T *****ELEMENTS OF THE TME NVARANT A, B. C, D MATRCES***** A(, ) = 0.0 A(,2) = -20.0 A(2, ) =.0 A(2,2) = -9.0 B(l) = -58.0 B(2) = -52.0 CT() = -0.5 CT(2) = -0.5 D(l) = -8.0 D(2) = 6.0 E = -5.0 *****SAMPLNG NTERVAL***** DET = 0.00000*T *****CALCULATE STATE VARABLES***** Vl(2) = (.0 + A(, l)*det)*vl(l) + A(,2)*DET*V2( + D(l)*RY(l)*DET V2(2) = A(2, )*DET*V(l) + (.0 + A(2,2)*DET)*V2( + D(2)*RY(l)*DET *****CALCULATE CONTROLLER/OBSERVER OUTPUT***** W = CT(l)*V() + CT(2)*V2() + E*RY(2) RETURN END ) + B(l)*RY(2)*DET ) + B(2)*RY(2)*DET References [] Winfred K. N. Anakwa, Stabilization of an Unstable Plant by Pole Allocation, Observer Theory. and Active Networks, EEE Trans. on nd. Electron. CoAtr. mtrum., vol. EC-28. no. 3, pp. 220-224, August 98. [2] Paul Katz, Digiral Control L sitzg Microprocessors. Englewood Cliffs, N. J.: Prentice-Hall nternational, 98. [3] ntroduction to Hybrid Computation, EE 475 Manual, Hybrid Computer Laboratory, The Pennsylvania State University, University Park, Pennsylvania. g Winfred K. N. Anakna 5 was born in Ghana, i.~ : = West Africa. He re- := ceived the B.Sc., M.Sc.. and Ph.D. de- = grees in engineering, specializing in control systems theory, from Brown University, %3 Providence, R.., in 967. 969, and 972. respectively. During the year 972 to 973, he worked on problems of nonlinear filtering as an Assistant Professor of Research in the Division of Applied Mathematics at Brown University. From august 984 973 to 977. he was a Lecturer in the Electrical Engineering Department of the University of Science and Technology in Ghana. He was an nternational Atomic Energy Agency Fellow in nuclear engineering at the Pennsylvania State University from 977 to 979 and a visiting Assistant Professor of electrical engineering at the Pennsylvania State University from 979 to 982. He is now a Research Associate in the Department of Electrical Engineering at Concordia University in Montreal, Canada. His current research interests are design and implementation of microcomputerbased control systems and hybrid computer simulation of multivariable control systems. Dr. Anakwa is a member of EEE Control Systems Society, the EEE ndustrial Electronics Society, and Sigma Xi. Thyagarajan Srinivasan was born in Coimbatore. ndia. on October 5: 948. He received the B. E. and the M.Sc. degrees in electrical engineering from the University of Madras in 969 and 972, respectively; he received the M.S. degree in electrical engineering from the Oklahoma State University in 979. From 97 to 978. he served as an Associate Lecturer in the Department of Electrical Engineering at the Coimbatore nstitute of Technology in Coimbatore. ndia. Since 980, he has been nith the Department of Electrical Engineering at The Pennsylvania State University as a teaching and research assistant. His areas of interest are digital signal processing. digital filters. and control systems. Bertram J. Thomas was born in Kingston, Jamaica, West ndies, on March 22, 950. He received a B.Sc. degree in physics and an h..sc. degree in electrical engineering. both from the University of the West ndies, in 973 and 977, respectively. While at the Jamaica Public Service Company, Kingston. Jamaica, during 977 and 978, he norked in power systems planning. n 978. he immigrated to the United States and \%orked with the Devtec Corporation in New York, designing electrical power distribution systems for aircrafts. Since September 979, he joined the faculty of the Electrical Engineering Department at The Pennsylvania State University where he has been attending graduate school while working as an instructor of electrical engineering..- d