14th PSCC, Sevilla, 24-28 June 2002 Session 32, Paper 4, Page 1 A Circuit Approach for the Computer Modelling of Control Transfer Functions Benedito Donizeti Bonatto∗ and Hermann W. Dommel Department of Electrical and Computer Engineering The University of British Columbia Vancouver, BC, Canada * Receiving a scholarship from CAPES - Brasilia/Brazil – E-mail: benedito.bonatto@ieee.org Abstract - This paper presents a technique which uses circuit components, such as resistances, capacitances, and ideal operational amplifiers, for the computer modelling of control transfer functions. This approach can be used by any EMTP-type electromagnetic transients program or by similar simulation programs, independently of the method used for the time-domain integration, because of its generality and flexibility. For an efficient digital computer implementation, it is assumed that resistances and capacitances can be assigned negative values. Ideal operational amplifiers could be solved with the modified nodal analysis (MNA) method, which would result in an unsymmetric nodal conductance matrix. The compensation method with an iterative NewtonRaphson algorithm is used here, because nonlinear effects can then be easily handled as well. With this compensation method, a simultaneous solution of the control and electric power system equations is obtained at every time step of the digital computer simulation. Keywords - digital computer simulation, Electromagnetic Transients Program, control systems, transfer functions, ideal operational amplifier. 1 Introduction T HIS paper presents a “circuit implementation” for the simultaneous solution of the electric network and control system equations in EMTP-based programs [1]. With this novel approach for EMTP-based programs, elements of the control circuit which already exist in the EMTP, such as resistances and capacitances, are solved by the EMTP proper, while elements missing inside the EMTP, such as ideal operational amplifiers and current and voltage dependent sources, are solved in the subroutine CONNEC with the compensation method. This circuit approach is an alternative to the mathematical representation adopted by Araújo [2], [3], [4]. The compensation method is used for ideal operational amplifiers, for current and voltage dependent sources, for limiters, as well as for intrinsic FORTRAN functions and some special control devices. Because some of these elements are nonlinear, an iterative Newton-Raphson procedure is used for the solution. Among the added elements, the dependent sources are the most important ones for control system modelling. 2 Current and Voltage Dependent Sources in EMTP-based Programs Dependent sources expand the capabilities of EMTPbased programs considerably for modelling many electric and electronic circuits and devices. With a voltagecontrolled voltage source, for example, it becomes easy to simulate operational amplifiers. These can then be used to set up control circuits with analog-computer blockdiagrams. As long as the equations of the dependent sources are linear, they could be added directly to the network equations used in EMTP-based programs with the modified nodal analysis [5], [6], but the matrix would then become unsymmetric and a linear equation solver for unsymmetric matrices would have to be used. Another alternative is based on the compensation method, which has long been used in EMTP-based programs for solving the equations of nonlinear elements with the Newton-Raphson iterative algorithm [7]. If the nonlinear elements are not too numerous, this approach confines the iterations to a relatively small system of equations, compared to the nodal equations for the entire system. This approach is used here for solving the equations of dependent sources, as a special case of nonlinear elements. Without limiters, the equations are linear, but with an unsymmetric matrix. Nonlinear effects arise with the inclusion of saturation or limits in the dependent sources. The fundamental equations for the implementation of current and voltage dependent sources in EMTP-based programs are given in [8]. 2.1 Compensation Method When there are M nonlinear elements in a circuit, the following system of equations (1) and (2), allows the simultaneous solution of the nonlinear equations with the rest of the linear network [9] which is then represented by its M-phase Thévenin equivalent circuit, as illustrated in Fig. 1: − [vOP EN ] + [rT HEV ] · [i] + [v] = 0 (1) where [vOP EN ], [v], and [i] are the open-circuit branch voltages, the final branch voltages, and branch currents of the M nonlinear branches, and where [rT HEV ] is an M ·M symmetric matrix supplied from the main program to subroutine CONNEC. Equations (2) are the branch equations of the nonlinear elements: vk = fk ([v] , [i] , t, etc....) k = 1, ...M (2) 14th PSCC, Sevilla, 24-28 June 2002 [ vOPEN ] Session 32, Paper 4, Page 2 [ rTHEV ] [i] [ v] i1 i2 i3 i4 ... vOPEN _ 1 iM vOPEN _M RM ... vM vs(M) ... v4 R4 v3 vs(4) R3 v2 vs(3) R2 v1 vs(2) R1 vs(1) Figure 1: M-phase Thévenin equivalent circuit. If the branch equations in (2) are linear, as in the case of dependent sources, they can be represented in the form of a voltage source behind an impedance, or in the form of a current source in parallel with an impedance. It is assumed here that the branch impedances are not coupled, and that they are resistive (Rk ). For other types of impedances, the representation would have to be modified. After the two systems of equations (1) and (2) have been solved in subroutine CONNEC, the currents [i] are returned to the main program, which adds the effect of the M nonlinear branches to the previously calculated opencircuit solution for all nodes with unknown voltages [7], [vN ] = [vN −OP EN ] − [rN ·M ] · [i] (3) where: [vN ] is a column vector with the final solution for the N unknown node voltages; [vN −OP EN ] is a column vector with the previously calculated open circuit solution for the N unknown node voltages; [rN ·M ] is a rectangular matrix with N rows and M columns (N = number of nodes with unknown voltages and M = number of branches solved with the compensation method); [i] is a column vector with the M compensating branch currents. The use of the compensation method is based on the following two assumptions: • A Thévenin equivalent circuit can be calculated where the dependent source is to be connected, and also where the controlling current or controlling voltage is to be measured. In cases where this calculation fails, the connection of large resistances in parallel usually makes a Thévenin equivalent circuit possible. • Proper precautions are taken to handle extremely large numbers and zero values. The following models are derived in [8]: CurrentControlled Voltage Source (CCVS), Current-Controlled Current Source (CCCS), Voltage-Controlled Voltage Source (VCVS) and Voltage-Controlled Current Source (VCCS). In all cases, the equations from the Thévenin equivalent circuit are the same, namely, for the controlling branch j −vOP ENj + rj1 i1 + · · · · · · + rjj ij + rjk ik + · · · + rjM iM + vj = 0 (4) and for the dependent source branch k −vOP ENk + rk1 i1 + · · · · · · + rkj ij + rkk ik + · · · + rkM iM + vk = 0 (5) where vOP EN and v are the open-circuit and final branch voltages in the two branches, and where r are the elements of the matrix [rT HEV ]. 2.2 Voltage-Controlled Voltage Source (VCVS) The necessary equations for the implementation of a voltage-controlled voltage source are (4) and (5), as well as: vj = Rin ij (6) vk = Avj + Rout ik = ARin ij + Rout ik (7) where A is the gain over the controlling or measured voltage, applied as a dependent voltage source in branch k. 14th PSCC, Sevilla, 24-28 June 2002 Session 32, Paper 4, Page 3 Eliminating the voltages vj , vk from the four equations (4) to (7) results in the following two equations, in a form suitable for large values of Rin and A: vOP EN r i1 + · · · − Rin j + Rj1 in (8) r rjj +Rin r ik + · · · + RjM iM = 0 ij + Rjk ···+ Rin in in v k1 i1 + −vOPENj + OPAENk + rj1 − rA ··· r out ik + · · · · · · + rjj − Akj ij + rjk − rkk +R A = 0 i · · · + rjM − rkM M A (9) transfer functions by using the impedance approach [10]. With the ideal operational amplifier, a “virtual ground” potential appears at the inverting input terminal, since the non-inverting input terminal is grounded. Moreover, no current flows into the input terminals. Therefore, the same current flowing through the complex impedance Z1 (s) has to flow through the complex impedance Z2 (s), resulting in Ei (s) = Z1 (s)I(s) and Eo (s) = −Z2 (s)I(s). The transfer function for this generalized inverter circuit is given by equation (12). I( s ) Z1(s) If A → ∞, Rin → ∞, and Rout → 0 in equations (8) and (9), then equations (10) and (11) are obtained for the “ideal operational amplifier”. Note that the use of equation (11) only makes sense if there are feedback paths modelled in the network part, which create the “rjk ” coupling resistance, and produce the correct current ik . Note also that equation (11) implies that vj = 0 according to equation (4). ij = 0 Eo ( s ) Ei ( s ) Figure 2: Generalization of inverter amplifier circuit. Eo (s) Ei (s) = −Z2 (s) Z1 (s) . (12) (10) 4 −vOP ENj + rj1 i1 + ... ... + rjj ij + rjk ik + ... + rjM iM = 0 Z2(s) I( s ) 3 Ideal Operational Amplifiers (11) The commercially available operational amplifier is in reality an integrated-circuit chip with many transistors and resistors. The voltage placed across its two input terminals (the non-inverting terminal (+) and the inverting terminal(−)), is amplified and appears at the output terminals, one of which is grounded (this grounding is usually omitted in the symbol). Since the gain of the operational amplifier is very high, it is necessary to have an external feedback circuit to make it stable. In the ideal operational amplifier, no current would flow into the input terminals (Rin = ∞ as in an open circuit), the output voltage would not be affected by the load connected to the output terminal (Rout = 0), and the gain would be infinite (A = ∞ so that the voltage at the non-inverting input terminal would be equal to the voltage at the inverting input terminal). For the analysis, the two input terminals of the ideal operational amplifier constitute “at the same time” [6]: Control Transfer Functions in EMTP-based Programs A transfer function, as in Fig. 3, is defined in the frequency domain (Laplace transformation of a continuous time system) by equation (13), which represents the output signal X(s) as a function of the input signal U (s) for a particular linear time-invariant system. U(s) H(s) X(s) Figure 3: Transfer function. H(s) = k bm sm +bm−1 sm−1 +···+b1 s1 +b0 an sn +an−1 sn−1 +···+a1 s1 +a0 (13) with n ≥ m and an = 0. It is possible to reorganize the terms of equation (13) as follows: an sn + an−1 sn−1 + · · · + a1 s1 + a0 X(s) = • “an open circuit” (equation (10)), and • “a virtual short-circuit” (equation (11)). k bm sm + bm−1 sm−1 + · · · + b1 s1 + b0 U (s) Unless otherwise indicated, all operational amplifiers are assumed to be ideal in this paper. There are many types of operational amplifier circuits. The two basic ones are the inverting amplifier and the noninverting amplifier circuit. An adder is a special case of the inverting amplifier. An ideal integrator uses an ideal operational amplifier, a resistor and a capacitor. Fig. 2 presents a generalization of the inverting amplifier circuit, which is very useful for obtaining Laplace (14) 1+ an−1 −1 an s k + ··· + bm m−n an s ···+ + a1 1−n an s + a0 −n an s bm−1 m−1−n an s b1 1−n an s + b0 −n an s X(s) = + ··· U (s) (15) 14th PSCC, Sevilla, 24-28 June 2002 X(s) = k ··· + − an−1 −1 an s Session 32, Paper 4, Page 4 bm m−n an s + bm−1 m−1−n an s b1 1−n an s + b0 −n an s + ··· + a1 1−n an s + + ··· U (s) (16) a0 −n an s X(s) For m = n, this results in: −1 + ··· X(s) = k abnn + bn−1 an s ··· + − an−1 −1 an s b1 1−n an s + ··· + + b0 −n an s a1 1−n an s + U (s) (17) a0 −n an s X(s) or X(s) = k abnn U (s) +s −1 k bn−1 an U (s) − an−1 an X(s) · · · + s1−n k abn1 U (s) − +s−n k ab0n U (s) − X(s) = s−1 k ab01 U (s) − + ··· a1 an X(s) (18) a0 an X(s) which can be re-arranged, e.g. for n = 3, as X(s) = k ab33 U (s) +s−1 +s−1 k ab23 U (s) − a2 a3 X(s) k ab13 U (s) − a1 a3 X(s) +s−1 k ab03 U (s) − justment) technique is applied [12], [13]. This method allows an arbitrary design of transfer functions and special control devices by the users of EMTP-based programs. A simplification can be made in a computer transfer function implementation, in contrast to a physical circuit implementation, in order to reduce the number of operational amplifiers needed: resistances and capacitances can assume negative values. Proper precautions should be taken, though, whenever the diagonal element of the conductance matrix associated to a node becomes equal to zero. The connection of large resistances to that node can easily solve this problem. In this transfer function implementation, as long as the system eigenvalues (or poles of the transfer function) remain on the left hand side of the complex plane, the system is stable. Such a possible computer implementation of the transfer function blockdiagram of Fig. 4 is presented in Fig. 5. Assume, for example, that a first-order transfer function H(s) = 10/(0.01s+1) is to be implemented with the proposed technique. Equation (19) becomes in this case, with n = 1: (19) a0 a3 X(s) If m < n then bn = bn−1 = ... = bm+1 = 0. A transfer function block-diagram realization of equation (19) is presented in Fig. 4, which, according to [11], is called the observer form. The practical realization of such a transfer function block-diagram can be accomplished with the use of circuit components, such as operational amplifiers, resistors and capacitors. In practice, an analog signal processing scheme is usually designed as the first step for a digital signal processing derivation. The derivation of an analog circuit model for the transfer function implementation in EMTP-based programs takes advantage of all circuit elements already implemented. In this way, the equations for the digital model of a transfer function are automatically constructed inside the EMTP, which uses the trapezoidal integration rule, or the backward Euler rule whenever the CDA (critical damping ad- a0 a1 X(s) (20) where, for illustration purposes, kb0 = 10, a0 = 1, and a1 = 0.01 seconds. From the observer form block-diagram for equation (20) it is easy to derive its respective computer implementation with one ideal operational amplifier, two resistors and one capacitor. The realization of this first-order transfer function can also be done with a physically-based realistic first-order lag circuit which requires two inverting amplifier circuits, instead of just one required in the more economic computer implementation. There may be cases where the realistic implementation is needed, which the proposed method can handle as well without any restrictions. There is no time delay between the electric network and the control equations; the solution of both systems of equations is simultaneous. The modified nodal analysis method [5] could also be used for the solution of operational amplifiers and other “linear branch equations” as presented in [6], but the network and control system equation matrix would become unsymmetric, and zero diagonal elements may appear, which requires pivoting techniques. As the number of added branch equations increases, the dimension of the matrix becomes larger, and possibly less sparse. With the compensation method, the size of the matrix [rT HEV ] increases as well as the number of control equations increases. To keep this increase to a minimum, one could separate the control variables into those attached to power network nodes (“external” nodes) and those attached to nodes inside the control system (“internal” nodes). This approach has not yet been implemented, and time comparisons between the compensation and modified nodal analysis methods, as well as with TACS, cannot be made yet. 14th PSCC, Sevilla, 24-28 June 2002 Session 32, Paper 4, Page 5 U(s) ... kb0 ___ an + kb1 ___ an 1 ___ s - + - kbn ___ an + 1 ___ s + a0 ___ an kbn-1 ___ an ... 1 ___ s + - a1 ___ an + X(s) + an-1 ___ an ... Figure 4: Observer form block-diagram of transfer function in equation (19). u(t) ... an ___ M Ω kb0 -1µ F an ___ M Ω kb1 -1µ F 1M Ω an _ ___ MΩ a0 an ___ MΩ kbn-1 an ___ MΩ kbn -1µ F 1M Ω ... 1M Ω -1M Ω x(t) 1M Ω an _ ___M Ω a1 an _ ___ MΩ an-1 ... Figure 5: Possible computer implementation of the transfer function block-diagram in Fig. 4. 5 Limiters for First Order Transfer Functions There are two types of limiters associated with firstorder transfer functions: windup (also referred to as static limiter) and non-windup (dynamic limiter) [14], [9]. ”Non-windup limiters should only be used with first-order transfer functions. For second and higher-order transfer functions it is no longer clear which variables should be limited. ... Even for the first-order transfer function, the meaning of the limiting function is confused if it has any zeros” [9]. Reference [14] presents an appropriate model for a proportional-integral (PI) controller (which can be represented as a transfer function with one zero) with a non-windup limiter. In a lead-lag control function block, for example, the way in which a non-windup limiter can be realized is not unique; the interpretation of the limiting action should therefore be based on the electronic implementation of the physical device [15]. The main difference between windup and non-windup limiters is the way in which the limited variable comes off its limit. To illustrate that, the first-order transfer function presented earlier is assumed to have a windup limiter as in Fig. 6, and a non-windup limiter as in Fig. 7. The time domain simulation of the output x(t) for both cases, for a pulse input excitation u(t) of 1V, is presented in Fig. 8. + 5 slope=1 U(s) 10 __________ X(s) 0.01 s + 1 Figure 6: First-order transfer function with windup (static) limiter. + 5 slope=1 U(s) 10 __________ X(s) 0.01 s + 1 Figure 7: First-order transfer function with non-windup (dynamic) limiter. 14th PSCC, Sevilla, 24-28 June 2002 Session 32, Paper 4, Page 6 10 x(t) without limiter 9 8 Voltage ( V ) 7 6 5 x(t) with windup limiter (static) 4 x(t) with non−windup limiter (dynamic) 3 2 1 u(t) 0 0 5 10 15 20 25 30 35 40 45 50 Time ( ms ) Figure 8: Transient response of a first-order transfer function with windup and non-windup limiter. Note that the output variable x(t) reaches its limit at the same time for both cases, but x(t) backs off the limit first for the non-windup (dynamic) limiter. The reason is that for the windup limiter the output variable is just clipped at the limit, whereas in the non-windup limiter the differential equation is actually modified [14], [9]. The implemented solution for limiters uses the methodology proposed in [1], in which a simultaneous system solution is first found without considering any of the limits. Then, each limit violation is verified in the sequence of the input data given by the user. If a particular limit has been reached, all previous indications of limit violations are cleared, and a solution is found for this particular limiter and all of its consequences on the other limiters. This cause-consequence iterative process has been found to be a very “robust method” in all cases tested, and has given the correct solution for all limiters, independent of the ordering of the input data given by the user. The solution for limiters is still simultaneous without time delays. The maximum (xmax ) and minimum (xmin ) limiting values are part of the input data. For example, in the case of the first order transfer function with a non-windup limiter illustrated in Fig. 7, with a computer model as presented before, it is possible to represent the non-windup hard limiting action with a simple change in the equations for the ideal operational amplifier, such that equations (10) and (11) are replaced by equations (21) and (22), respectively: −vOP ENj + rj1 i1 + ... ... + rjj ij + rjk ik + ... + rjM iM = 0 (21) −vOP ENk + rk1 i1 + ... ... + rkj ij + rkk ik + ... + rkM iM + vklimit = 0 (22) where vklimit = xmax , or vklimit = xmin . By using these equations it becomes easy to observe the limits accurately. In practice, in a realistic first order lag circuit with two inverting amplifiers, the clamping action is done with the use of Zener diodes connected in parallel with the capacitor in the feedback loop of the first operational amplifier for a non-windup (dynamic) limiter, or with Zener diodes connected in parallel with the resistor in the feedback loop of the second operational amplifier for a windup (static) limiter. Another example is the simple limiter control block. In this case, one could use the equations for an “ideal voltage-controlled voltage source” including the limiting values in the output voltage, as follows: ij = 0 (23) −vOP ENk + rk1 i1 + ... ... + rkj ij + rkk ik + ... + rkM iM + vklimit = 0 (24) where vklimit = xmax , or vklimit = xmin . The limiters presented in the previous section assume fixed values (hard limits) for the maximum and minimum of the output variable. It may be useful to allow soft limits as well, as recommended in [9]. With soft limits, the slopes in the limited region are nonzero. Hard limits are then just a special case of soft limits when the slopes are set to zero. The equations for soft limits are: x(t) = Ku(t), if xmin < Ku(t) < xmax , xmin + Kmin [u(t) − umin ], if Ku(t) ≤ xmin , xmax + Kmax [u(t) − umax ], if Ku(t) ≥ xmax . (25) 14th PSCC, Sevilla, 24-28 June 2002 6 Conclusions This paper offers new models for the digital computer simulation of control transfer functions for implementation in EMTP-based programs or in similar programs. A “circuit approach” is used for the simultaneous solution of control and power systems equations [1], as an alternative to the approach of A. E. A. Araújo [4] developed in 1993. The main differences and important advantages are summarized as follows: • With the addition of ideal operational amplifiers, transfer functions can be implemented with the circuit approach, where the circuit elements R, L, C are solved by the main code of the EMTP. If integration methods are changed in the EMTP, for example from trapezoidal rule to backward Euler as done in some versions at instants of discontinuities, no extra coding is needed. Operational amplifiers are not affected by integration rule changes. Moreover, if ideal operational amplifiers are implemented in the steady-state solution, the frequency response of linear control systems could easily be calculated by just using the frequency scan option. • A “multi-terminal voltage-controlled voltage source concept” implemented with the compensation method and the Newton-Raphson iterative algorithm is “general and flexible”, thus providing an easy EMTP-based modelling of any linear or nonlinear control device. This is very useful for the dynamic analysis of novel power electronic controllers, such as distributed FACTS and Custom Power Controllers in transmission and distribution power systems. 7 Acknowledgements The authors gratefully acknowledge the financial support from CAPES (Fundação Coordenação de Aperfeiçoamento de Pessoal de Nı́vel Superior Brasilia/Brazil) and NSERC (Natural Sciences Engineering Research Council of Canada). The authors also acknowledge the help of Mr. Jesús Calviño-Fraga for indicating in 1998 the need for modeling operational amplifiers in EMTP-type programs, and for validating some of the simulation results with laboratory experiments. REFERENCES [1] B. D. Bonatto, EMTP Modelling of Control and Power Electronic Devices, Ph.D. thesis, The University of British Columbia, Vancouver, British Columbia, Canada, October 2001. Session 32, Paper 4, Page 7 neous Solution and Backtracking Technique,” in Joint International Power Conference (IEEE-NTUA) - Athens Power Tech., IEEE/PES, Ed., AthensGreece, September 5-8 1993. [4] A. E. A. Araujo, H. W. Dommel, and J. R. Martı́, “Simultaneous Solution of Power and Control-Systems Equations,” IEEE Transactions on Power Systems, vol. 8, no. 4, pp. 1483–1489, November 1993. [5] Chung-Wen Ho, A. E. Ruehli, and P. A. Brennan, “The Modified Nodal Approach to Network Analysis,” IEEE Transactions on Circuit and Systems, vol. CAS-22, pp. 504–1975, 1975. [6] J. Vlach and K. Singhal, Computer Methods for Circuit Analysis and Design, Van Nostrand Reinhold Company Inc., New York, USA, 1983. [7] H. W. Dommel, “Nonlinear and Time-Varying Elements in Digital Simulation of Electromagnetic Transients,” IEEE Transactions on Power Apparatus and Systems, vol. PAS-90, pp. 2561–2567, Nov./Dec. 1971. [8] Benedito Donizeti Bonatto and Hermann Wilhelm Dommel, “Current and Voltage Dependent Sources in EMTP-based Programs,” in IPST’2001 International Conference on Power Systems Transients, Federal University of Rio de Janeiro, Ed., Rio de Janeiro - Brazil, June 24-28 2001, vol. I, pp. 299–304. Can be downloaded as a pdf file from http://www.ipst.org. [9] H. W. Dommel, EMTP Theory Book, Second Edition, Microtran Power System Analysis Corporation, Vancouver, British Columbia, Canada, May 1992. Latest update: April 1996. [10] Katsuhiko Ogata, Modern Control Engineering, International Edition, 3rd Ed., Prentice-Hall International, Inc., 1997. [11] D. E. Scott, An Introduction to Circuit Analysis - A Systems Approach, McGraw-Hill, Inc., New York, USA, 1987. [12] J. R. Martı́ and J. Lin, “Supression of Numerical Oscillations in the EMTP,” 88 SM 732-0 IEEE/PES 1988 Summer Meeting, July 1988. [13] J. Lin and J. R. Martı́, “Implementation of the CDA Procedure in the EMTP,” IEEE Transactions on Power Systems, vol. 5, no. 2, pp. 394–402, May 1990. [2] A.E.A. Araújo, Numerical Instabilities in Power System Transient Simulation, Ph.D. thesis, The University of British Columbia, Vancouver, British Columbia, Canada, June 1993. [14] R. H. Lasseter, EMTP Workbook IV, Electric Power Research Institute, Palo Alto, California, USA, June 1989. [3] A. E. A. Araujo, H. W. Dommel, and J. R. Martı́, “Converter Simulations with the EMTP: Simulta- [15] P. Kundur, Power System Stability and Control, McGraw-Hill, Inc., 1994.