3783 IEEE Transactions on Power Apparatus and Systems, Vol. PAS-102, No. 12, December 1983 TESTING OF TRAPEZOIDAL INTEGRATION WITH DAMPING FOR THE SOLUTION OF POWER TRANSIENT PROBLEMS Juan J. Sanchez Robert H. Lasseter Fernando L. Alvarado The University of Wisconsin The University of Wisconsin The University of Wisconsin ABSTRACT I1. COMPARISON OF EMSTING METHODS A variation of trapezoidal integration (called trapezoidal integration with damping) for the solution of dynamic equations is described and tested. This method has several advantages over ordinary trapezoidal integration for the simulation of transients in power systems. The method is compared to ordinary trapezoidal integration, backward Euler and Gear 2nd order. The comparison is based upon local truncation error and upon performance of each method as a differentiator. The method is tested using a transmission line model response to a voltage step function, and the response of a HYDC converter with its controllers. Trapezoidal integration with damping is free from numerical problems, even when used as a differentiator; it provides a ready means for obtaining the "average behavior" of a simulator; it is fully compatible with trapezoidal; and it is very accurate. I. INTRODUCTION Three methods are compared in this section. All three are simple and stable for stiff systems. In addition to trapezoidal integration, backward Euler and Gear 2nd order are considered. Gear 2nd order appears to be a very good method which may be an alternative to trapezoidal integration. Assume that the equation of interest has the form: y (1) =f(Y,t) Let At, be the time step of a numerical solution. To simplify the notation, let tn = nAt, y/n = y(tn) and fn= f(y,, t.). All n-umerical methods enable the calculation of y1n- based upon y,.. In addition, multi-step methods also use values of f and y at times prior to tn. a. Trapesoidal Integration Good numerical methods are central to the efficient numerical simulation of power systems. Trapezoidal integration appears to have become the dominant method for the simulation of power systems. It is used widely in the solution of electromagnetic transient problems [1] and stability problems [2]. Comparative studies have proven its superiority [3]. The main features of trapezoidal integration are its simplicity, numerical stability for "stiff" systems (those with widely differing eigenvalues), and its self-starting nature. On the other hand, trapezoidal integration suffers from numerical oscillations when used as a differentiator. As a result of this problem, it cannot be used without a careful regard for the system or circuit in which it is being employed. A way of improving its behavior by the addition of "damping" has been suggested in the specialized EMTP literature [4-5]. This paper elaborates on this approach and presents results of extensive testing of the method. The formula for trapezoidal integration is given by: 1/n-l 1n Yn+=~Yn At +2Hfni-i + fn) (2) Numerical methods can also be used for differentiation. In order to use a method for differentiation, let f((Yn, tn) = Zn- The objective of differentiation is to find Zn+i given xn, yn. If xn is replaced in (2) and solved for Zn±l, the following formula results: Zn+l = -Xn + 2 (Y.+1- 1Yn) (3) The behavior of trapezoidal integration for differentiation leaves a lot to be desired. Figure l(a) illustrates a discrete step function of amplitude At. If this signal is applied to a trapezoidal differentiator, the result is: A paper recommended and approved 83 SM 364-7 by the IEEE Power System Engineering Committee of the IEEE Power Engineering Society for presentation at the IEEE/PES 1983 Summer Meeting, Los Angeles, California, July 17-22, 1983. Manuscript submitted February 1, 1983; made available for printing May 2, 1983. Xn (-l)n(-2) for n>1 The resulting oscillating waveform is illustrated in figure lb. This waveform bears little resemblance to the time derivative of a unit step, which is an impulse function. 0018-9510/83/1200-3783$01.00 © 1983 IEEE 3784 w 0.Oc a. Yn+1 Y=Yn + A&tfn+ aT - The formula for pure differentiation using backward Euler is: a.Discrete_st Discrete step of amplitude At. - - 4aIi*o00 ':r. 00 (4) 8.I'000 1 Zn+1 lYn,+l - Yin) (5) When equation (5) is applied to the discrete step of amplitude At, the result is: {i if nt = 1 n otherwise This is illustrated in figure 1(c), which is a better approximation to an impulse than l(b). c. Gear Second Order Of the numerous numerical methods in existence, the authors have concluded that one of the most serious contenders to trapezoidal integration is Gear 2nd order method, (it shall be referred to simply as Gear in the remainder of this paper). The equation that describes Gear is: b. Trapezoidal differentiation. 1.00 J 5> .00 4.00 8.00 YIn+i *c. Backward Euler. 2.00 w -j >: 0.00 1.001 A T/ = 4 1 2 -Yln - -Yln-1 + -jAtfn+i (8) When Gear is used as a pure differentiator, the following equation results: zn+l OESTEP 8.00 1 -I .00 _ =n (7) 1.5 if n 1 -.5 if n 2 0 if n > 2 This result is illustrated in figure l(d). The result is good an approximation to an impulse function as figure l(c), but considerably better than l(b). not The formula for numerical integration using Backward Euler is given by: 2Yn-1) if the discrete step of amplitude At is applied to the Gear differentiator, the following is the resultant discretetime sequence: d Gear nd order. Figure 1: Performance of nuimerical integration methods as differentiators. b. Backward Euler -(2Yn + = as d. Error analysis 3785 ized time step. The time step is normalized as a fraction of the time constant T in the equation: 0 0. 0.2 TIME STEP AtiT Figure 2t Normalized percent error in a single time step versus normalized time step size for three numerical integration methods. Performance as a differentiator is not the only (or even the main) criteria in the selection of a numerical integration method. The accuracy of the numerical integration is also an important measure. A number of measures of accuracy are possible. This paper utilizes a measure based upon the local error truncation. The usual definition of local truncation error for a given numerical method is given by [6J: ez&et ET = Yn+i method Yn+i (8) assuming that the value of y, and all previous values of y are known precisely. This paper uses a slightly different definition of local truncation: method exact CT = xact Yn+1 (10) The use of (8) instead of (9) affects the results for Gear's method somewhat, since Gear is a multistep method, but the basic curve relationships remain the same: trapezoidal is most accurate, backward Euler is least accurate. Engineering considerations allow the definition of a "useful range" in these curves. It is clear that any frequency whose period or time constant approaches the sampling time step At (that is, when At/T approaches 1.0) will not be modelled accurately. As a practical engineering measure, only those signals which are sampled at least 5 times over one time constant (.2 on the normalized horizontal axis in figure 2) should be of primary interest. This sampling time step is indicated as a vertical line in Figures 2 and 5. uJ 0.1 'NORMALIZED 1 TY (9) where Y. is assumed to be exact but computed from Yn-i, etc, using the same formula used to go from yn, to Yn+1 This represents a more realistic measure of the total error accumulation in a single time step. Using this measure of error, figure 2 illustrates the performance of all three numerical methods on a log-log scale. The vertical axis in all these plots gives the normalized total truncation error over a single time step, in percent. The horizontal axis gives the size of the normal- Similarly, errors in excess of 1% or so in a single time step would render a method virtually unuseable. The 1% error line is indicated as a horizontal line in the plots. It is, therefore, of interest to compare the methods mainly in the lower left hand corner rectangular area, in particular, the point at which the intersect either the 1% error line or the maximum practical time step line. Based on these observations, trapezoidal integration appears to be the best method from error analysis considerations, followed by Gear and backward Euler. m. TRAPEZOIDAL WITH DAMPING It is of some interest to note that all integration formulas have a network interpretation. It has been shown that the time domain solution of a network can be viewed at each time step as the analysis of a purely resistive network with known nodal injections. The model of every network component using any numerical method can be done by replacing it with a network of parallel RL branches, as illustrated in Figure 5. The values of J and R (or C) may vary from time step to time step, depending on the numerical method selected, but the form of the model remains the same. For example, the use of a numerical integration formula to replace an inductor of value L results J R Figure 3: Discrete Model for Arbitrary Network Component, all numerical methods. 3786 2.( w -J < I.0c -o1.00o -2.00k a. a 0.15 NORMALIZED TIME STEP At/T 2.00 Figure 52: Percent Error over a Single Time Step verNormalized Time Step for Trapezoidal Integration with Damping. sus 2.0 Figure 4: Numerical Oscillation upoIn Differentiation of Step of Amplitude At Using Trapezoidal Integration with Damping. b. a - in the inductor being replaced by a pure conductance in parallel with a known current source which depends only on "past values". The numerical method chosen dictates the values of the current source J and the conductance G. Table I summarizes the values of G and J for the three methods described 'in the last section as well as for the method to be presented in this section. In order to eliminate the problem of steady numerical oscillations upon differentiation the following integration equation has been indirectly introduced in [4,5]: net effect of this alteration to trapezoidal integration is to add some dissipation to an otherwise lossless inductor. It may be noted that a 0 results in ordinary trapezoi1 results in Backward Euler. dal integration, while a The advantages of trapezoidal with damping become apparent only when attempting to use the formula for differentiation. The differentiation formula using (11) is: nl ) (1 (1±a ) 1. 2 nAt (1 +a) .+ Y) (12) Plots of this formula when used to differentiate the discrete step of amplitude At are shown in figure 4 for two values of a. The numerical oscillations are no longer 0) at the expense of sustained (unless, of course, an increase in the local truncation error, as illustrated in figure 5. However, as figure 5 illustrates, the error in the useful range of the method is not significantly greater than that of trapezoidal integration for small values of a. Larger values of result in greater damping and increasing error. Notice that the dc error tends to zero in all a a Yn+t = Yn + 2 [(1 + a)fn+l +(1 - a)fnj (11) This formula can be called "trapezoidal with damping" because of its physical interpretation. It can be shown that the use of (11) to model an ideal inductor is equivalent to using ordinary trapezoidal integration in an inductor with a shunt conductance GC (aAt)/(2L). The cases. IV. NUMERICAL EXAMPLES In order to illustrate the application of trapezoidal with damping, two numerical examples are presented in this section. The main purpose of these examples is to 3787 V, (l) V. tt - l.OY 0.0 V R,- Rij- 0. In L, Li . 0.4 H R- IO. On L- 1.0 H C. 2X1O-5 F a. Actual model of the line using 7r equivalents. a. aL = acC = 0 b. Discretized model of the line. Figure 6: Diagram for the Transmission Line Example. show the performance of the method for different values of a and different time steps in "practical" power system component models. a. Testing of the Method on Line Equations In this subsection, trapezoidal integration with damping is applied to the simulation of a transmission line. The transmission line itself is represented by two r sections. The sending and receiving ends are connected to RL branches and the exciting voltage is a unit step voltage. The circuit diagram is shown in Figure B(a). In order to carry out the simulation, the circuit is represented by its discrete equivalent, shown in Figure 6(b). The nodal equations for the circuit of Figure 6(b) can then be solved at every time step for the nodal voltages. Figures 7 and 8 compare the voltage vi (t) calculated numerically with the exact solution. When the time step is sufficiently small, 5 X 10-5 seconds, a very accurate solution can be obtained by letting the parameter a be zero, i.e. by using trapezoidal integration, as shown in Figure 7(a). Damping can be introduced in the numerical solution by increasing the value of a. Notice that the values of a used in the integration formula for the inductors can be different from the value of a used for the capacitors. Thus, undesirable oscillations due to either (or both) element can be damped out by increasing the corresponding a. Figure 7(b) illustrates the behavior of damped trapezoidal with aL and ac equal to one, which is equivalent to the application of the Backward Euler algorithm. Figure 7(b) shows a certain amount of damping in the numerical solution. The damping can be further increased by increasing the value of ac as shown in Figure 7(c). In this case, the algorithm yields what can be considered the average behavior of the voltage by eliminating the oscillations of the response. b. aL= aC = 1. 4- 3 i.:2 0. E IN _ 3U. 23 C. aL = 0.15 aC = 1000. Figure 7: Comparison of voltages at node 1 for At = 5 X 10-5 seconds. 3788 R2 a Rl 25Q& c R2 L Exac t L i 5S v 0.2 H {235 kV o ct <tF t atf 0 Es 210.9kV a. Diagram of the Overall System. a. aOL = aC 0. b. Block Diagram of the Control Sub-System. Figure 9: Diagram of the DC Network and its Controller. a more meaningful solution. Exact b. Testing of Algorithm on a Controller Model This sub-section presents the results of the simulation of a simple dc network and its controller (as illustrated in Figure 9). The simulation is carried out using trapezoidal integration without damping (aL = ac = 0) and trapezoidal with damping (aL = aC = 0.15). The dc network co8nsists of a simple RL transmission line, a voltage source (1.35E cos y) at the sending end, and a dc voltage source (V) at the receiving end. The symbol Xy is used in this paper to denote the firing angle of the controller, to distinguish it from the damping factor a. The dc voltage source V is assumed to be 235 KV for a time 0 < t < tF. At time tF a fault is applied at the receiving by setting V to zero. b. aL aC 1I Figure 8: Comparison of voltages at node 5 X 10-2 seconds. = = 1 for At Figure 8 shows the results obtained when the simulation is carried out using a large time step of integration (5 X 10-2 seconds). Figure 8(a) is obtained with aL and equal to zero. It can be seen that the oscillations present in the simulation render the solution meaningless. Figures 8(b) is calculated with aL and aC< equal to 1.0 (Backward Euler). Notice that the 'average' behavior of the voltage is once again obtained. The undesirable oscillations present in Figure 8(a) have been eliminated giving cEO The controller accepts a current order (Iarder) and computes the difference between this current and the current in the line (Id,o). The sum of the error ([de - Iorder) and its derivative are integrated. The firing angle y is proportional to the output of the integrator. The simulation algorithm extrapolates I'& linearly to estimate the line current at time t. The controller equations are then solved with Iorder and Idc as inputs to yield y. Following this, the network equations are solved and the new value of Id, at time t is then used to estimate Idr at time t + At. A time delay is introduced by not updating (iterating) the value of the current Id, at each time step. 3789 0 Idc 1o i. 00 tl.00 0. 02 0'.04 0. 06 0. 08 0.10 5 a. Ordinary Trapezoidal Integration, time step of 5 X 1o-5 0.02 O.04 O. 08 O.06 .1 . S a. Ordinary Trapezoidal Integration, time step of 5 X lo-5 seconds. 1dc bJ. oo 0O.00 0.20 0.140 0.60 0.80 1.00 0.20 0.40 O. 60 0;.80 1. 0 S S b. Ordinary Trapezoidal Integration, time step of 1 X 10-3 seconds. Notice severe sustained nuimerical oscillations. b. Ordinary Trapezoidal Integration, time step of 1 X 10-3 seconds. Notice severe sustained numerical oscillations. 0 CD C. 2CD 0 CL OD Idc r 0 CD C.LE) 'Y i1 O 0 C.=V °1 0 I! C.(Ii _ CD -D ! ].'> ,,.49 ,5 ^ :< s CD C) 00.00 I,^: 0.20 0.40 0.50 0.80 1.00 S c. Trapezoidal with Damping, time step of 1 X 10-3 seconds, a = .15. Notice rapid decay of numerical os- cillations. Figure 10: Comparison of firing angle 'y using trapezoidal integration with and without damping. c. Trapezoidal with Damping, time step of 1 X 10`3 seconds, a = .15. Notice rapid decay of numerical oscillations. Figure 11: Comparison of dc current Idc using trapezoidal integration with and without damping. 3790 As a result of this delay, attempts to increase At bring about oscillations due to the presence of a spurious pole introduced by the time delay. Figures 10 and 11 contaiIn typical results for I& and 'y. In general, if the time step of the integration is small both ordinary trapezoidal and trapezoidal with damping give identical results. When the time step is made large, a = 0.15 gives better results than trapezoidal integration (a = 0). The undesirable oscillations present in the trapezoidal simulation are eliminated after a short time, and the accuracy of the solution is excellent. The results obtained in the simulation of the transmission line and the simple controller suggest the possibility of allowing a user to adjust the damping coefficient parameter a. This would provide the user with a method for eliminating oscillations in those cases where large time steps are desirable, such as in mid-term stability studies, without the need to use a different model to carry out the mid-term simulation. V. CONCLUSIONS Trapezoidal integration with damping can be recommended as a compatible substitute to ordinary trapezoidal integration for all power system time domain simulation applications. By setting a equal to zero, the method becomes identical to ordinary trapezoidal integration. However, a > 0 results in a better behavior as a differentiator, at the expense of accuracy. For values of a' < 1, the accuracy over the useful time step sizes of the method is very good when compared to other numerical integration methods. Values of a > 1 can be used to attain empirical deliberate damping of physical oscillations. The net effect of high values of a is to reduce the order of a model without changing its form. A secondary conclusion of this work is that Gear 2nd order should be seriously considered in power system applications whenever compatibility with existing trapezoidal integration algorithms is not a requirement. VI. REFERENCES [1] H. W. Dommel and W. S. Meyer, Digital Computer Solution of Electromagnetic Transients in Single and Multi-phase Networks, IEEE Transactions on Power Apparatus and Systems, Vol PAS-88, pp. 388-399, April 1969. [2] H. W. Dommel and N. Sato, Fast Transient Stability Solutions, IEEE Transactions on Power Apparatus and Systems, Vol. PAS-91, pp. 1643-1650, July/August 1972. [3] EPRI Report EL-484, Power System Dynamic Analysis, Project 670-1, Final Report, July 1977. [4] V. Brandjwan, Damping of Numerical Noise in the EMTP Solutions, EMTP Newsletter. [5] F. L. Alvarado, Eliminating Numerical Oscillations in Trapezoidal Integration, EMTP Newsletter. [6] L. 0. Chua and P. Lin, Computer Aided Analysis of Electronic Circuits, Prentice-Hall, 1975. Table I: Physical interpretation of numerical integration for pure inductor Method J C Trapezoidal in + (At/2L)vn At/2L Backward Euler in At/L Gear 2nd Order 'in - lin- 2At/3L Trap. w/Damp. in + (1 - t)(At/2L)vn (1 + a)At/2L