EMTP Simul
EMTP Simul
ik 1 + 1 e
tR/L
vk
(5.2)
Although the exponential form of the difference equation can be deduced from the difference equation developed by the numerical integrator substitution method, this approach is unsuitable for most transfer functions or electrical circuits, due to the difculty in identifying the form of the exponential that has been truncated. The root-matching technique provides a rigorous method. Numerical integrator substitution provides a mapping from continuous to discrete time, or equivalently from the s to the z-domain. The integration rule used will inuence the mapping and hence the error. Table 5.1 shows the characteristics of forward rectangular, backward rectangular (implicit or backward Euler) and trapezoidal integrators, including the mapping of poles in the left-hand half s -plane into the z-plane. If the continuous system is stable (has all its poles in the left-hand half s -plane) then under forward Euler the poles in the z-plane can lie outside the unit circle and hence an unstable discrete system can result. Both backward Euler and the trapezoidal rule give stable discrete systems, however stability gives no indication of the accuracy of the representation. The use of the trapezoidal integrator is equivalent to the bilinear transform (or Tustin method) for transforming from a continuous to a discrete system, the former being the time representation of the latter. To illustrate this point the bilinear transform will be next derived from the trapezoidal rule. In the s -plane the expression for integration is: 1 Y (s) = X(s) s In discrete time the trapezoidal rule is expressed as: yn = yn1 + t (xn + xn1 ) 2 (5.4) (5.3)
Transforming equation 5.4 to the z-plane gives: Y (z) = z1 Y (z) + t (X(z) + X(z)z1 ) 2 (5.5)
Equating the two integration expressions (i.e. equations 5.3 and 5.6) gives the well known bilinear transform equation: s 2 (1 z1 ) t (1 + z1 ) (5.7)
Table 5.1
Backward rectangular (implicit/backward Euler)
u
u
Integrator characteristics
Trapezoidal
Name
Waveform
yk = yk 1 +
yk = yk 1 +
yk = yk 1 + y k =
t (fk + fk 1 ) 2
Differentiator
Approximation to s
yk y y k = k +1 t z1 s t
j Backward rectangular 1 j
yk yk 1 t z1 s tz
2 (yk yk 1 ) y k 1 t 2 (z 1) s t (z + 1)
Trapezoidal rule j 1
Forward rectangular
s to z-plane
1 1 1
102 Power systems electromagnetic transients simulation Hence the trapezoidal rule and the bilinear transform give the same mapping between the s and z-planes and are therefore identical. Equation 5.7 can also be derived from an approximation of an exponential. The actual relationship between s and z is: z = es Hence Expressing tion gives: es t
t
(5.8)
t
z1 = es
(5.9)
es es
t/2 t/2
(1 s t/2) (1 + s t/2)
(5.10)
2 (1 z1 ) t (1 + z1 )
(5.11)
which is identical to equation 5.7. Hence the trapezoidal rule (and many other integration rules for that matter) can be considered as a truncated series approximation of the exact relationship between s and z.
5.3
Digital simulation requires the use of the z-domain, either in the form of a transfer function or as an equivalent difference equation. In the transfer function approach: H (z) = a0 + a1 z1 + a2 z2 + + am zm Y (z) = 1 2 m U (z) 1 + b 1 z + b 2 z + + bm z (5.12)
Equation 5.13 can be implemented directly and without any approximation as a Norton equivalent. Rearranging equation 5.13 gives: Y (z) = a0 + a1 z1 + a2 z2 + + am zm U (z) b1 z1 + b2 z2 + + bm zm Y (z) (5.14)
The root-matching method 103 The corresponding difference equation is: y(k t) = (a0 u + a1 u1 + a2 u2 + + am um ) (b1 y1 + b2 y2 + + bm ym ) (5.15)
The rst term on the right side of equation 5.15 is the instantaneous term between input and output, while the other terms are history terms. Hence the conductance is a0 and the history term is: a1 u1 + a2 u2 + + am um b1 y1 + b2 y2 + + bm ym (5.16)
Whereas in the s -domain stability is ensured if poles are in the left-hand half-plane, the equivalent criterion in the z-plane is that the poles must reside inside the unit circle. In the transformation from the s to z-plane, as required by digital simulation, the poles and zeros must be transformed correctly and this is the purpose of the rootmatching technique. In other words, to ensure that a difference equation is suitable to simulate a continuous process the poles, zeros and nal value of the difference equation should match those of the actual system. If these conditions are met the difference equations are intrinsically stable, provided the actual system is stable, regardless of the step size. The difference equations generated by this method involve exponential functions, as the transform equation z1 = es t is used rather than some approximation to it. When integrator substitution is used to derive a difference equation, the poles and zeros usually are not inspected, and these can therefore be poorly positioned or there can even be extra poles and zeros. Because the poles and zeros of the difference equation do not match well those of the continuous system, there are situations when the difference equation is a poor representation of the continuous system. The steps followed in the application of the root-matching technique are: 1. Determine the transfer function in the s -plane, H (s) and the position of its poles and zeros. 2. Write the transfer function H (s) in the z-plane using the mapping z = es t , thus ensuring the poles and zeros are in the correct place. Also add a constant to allow adjustment of the nal value. 3. Use the nal value theorem to compute the nal value of H (s) for a unit step input. 4. Determine the nal value of H (z) for unit step input and adjust the constant to be the correct value. 5. Add extra zeros depending on the assumed input variation between solution points. 6. Write the resulting z-domain equation in the form of a difference equation. The nal value of H (s) must not be zero to allow the nal value matching constant in H (z) to be determined. When that happens the nal value is matched for a different input. For example some systems respond to the derivative of the input and in such cases the nal value for a unit ramp input is used. Appendix E (sections E.1 and E.2) illustrate the use of the above procedure with a single order lag function and a rst order differential pole, respectively. Table 5.2
104 Power systems electromagnetic transients simulation Table 5.2 Exponential form of difference equation
Expression for Norton R = 1/k IHistory = e t/ It t k = G (1 e t/ ) R = 1/k IHistory = k e t/ Vt t G k= (1 e t/ ) R = 1/k IHistory = e t/ It t k Vt t k= G (1 e t/ ) t
Transfer function
G H (s) = 1 + s
H (s) = G (1 + s )
H (s) =
Gs 1 + s
H (s) =
G (1 + s1 ) (1 + s2 )
H (s) =
2 G n 2 s 2 + 2 n s + n
H (s) =
2 G sn 2 2 s + 2 n s + n
k=
G (1 e t p1 ) (1 e t p2 ) t G (1 A + B) = t A B Vt t + It 2 t k k
R=k
2) G (s 2 + 2 n + n sn
IHistory = It t k=
H (s) =
G (1 e t p1 ) (1 e t p2 ) t G (1 A + B) = t
The root-matching method 105 gives expressions of the exponential form of difference equation for various s -domain transfer functions. In Table 5.2, A and B are as follows: If two real roots ( > 1): 2 2 A = 2e n t e tn 1 + e tn 1 B = e2 n If two repeated roots ( = 1): A = 2en B = e2n If complex roots ( < 1): A = 2e n B = e2 n
t t t t t
cos n t 1 2
By using the input form shown in Figure 5.13(a) on page 113, the homogeneous solution of the difference equation matches the homogeneous solution of the differential equation exactly. It also generates a solution of the differential equations response that is exact for the step function and a good approximation for an arbitrary forcing function.
5.4
The exponential form of the difference equation can be viewed as a Norton equivalent in just the same way as the difference equation developed by Dommels method, the only difference being the formula used for the derivation of the terms. Figure 5.1 illustrates this by showing the Norton equivalents of a series RL branch developed using Dommels method and the exponential form respectively. Until recently it has not been appreciated that the exponential form of the difference equation can be applied to the main electrical components as well as control equations, in time domain simulation. Both can be formed into Norton equivalents, entered in the conductance matrix and solved simultaneously with no time step delay in the implementation. To remove all the numerical oscillations when the time step is large compared to the time constant, the difference equations developed by root-matching techniques must be implemented for all series and parallel RL, RC , LC and RLC combinations. The network solution of Dommels method is: [G]v(t) = i(t) + IHistory (5.17)
m IHistory= e tR / L i (t t)
Figure 5.1
Structurally the root-matching algorithm is the same as Dommels, the only difference being in the formula used for the derivation of the conductance and past history terms. Moreover, although the root-matching technique can also be applied to single L or C elements, there is no need for that, as in such cases the response is no longer of an exponential form. Hence Dommels algorithm is still used for converting individual L and C elements to a Norton equivalent. This allows difference equations, hence Norton equivalents, based on root-matching methods to be used in existing electromagnetic transient programs easily, yet giving unparalleled improvement in accuracy, particularly for large time steps. In the new algorithm, IHistory includes the history terms of both Dommels and the root-matching method. Similarly the conductance matrix, which contains the conductance terms of the Norton equivalents, includes some terms from Dommels technique and others of the exponential form developed from the root-matching technique. The main characteristics of the exponential form that permit an efcient implementation are: The exponential term is calculated and stored prior to entering the time step loop. During the time step loop only two multiplications and one addition are required to calculate the IHistory term. It is thus more efcient than NIS using the trapezoidal rule. Fewer previous time step variables are required. Only the previous time step current is needed for an RL circuit, while Dommels method requires both current and voltage at the previous time-step. Three simple test cases are used to illustrate the algorithms capability [3]. The rst case shown in Figure 5.2 relates to the switching of a series RL branch. Using a t = time step ( being the time constant of the circuit), Figure 5.3 shows the current response derived from Dommels method, the exponential method and
R = 1.0
Vdc = 100 V
L = 0.05 mH
Figure 5.2
100.0
60.0
40.0
20.0
0.0 0.0008
0.0011
0.0017
0.002
Figure 5.3
continuous analysis (theoretical result). At this time step, Dommels method does not show numerical oscillations, but introduces considerable error. The results shown in Figure 5.4 correspond to a time step of t = 5 ( = 50 s). Dommels method now exhibits numerical oscillations due to truncation errors, whereas the exponential form gives the correct answer at each solution point. Increasing the time step to
Current (amps)
0.001375
0.003125
0.004
Figure 5.4
120.0 100.0 80.0 60.0 40.0 20.0 0.0 0 0.001 0.002 Time (s) 0.003 0.004
Current (amps)
Figure 5.5
t = 10 results in much greater numerical oscillation for Dommels method, while the exponential form continues to give the exact answer (Figure 5.5). The second test circuit, shown in Figure 5.6, consists of a RLC circuit with a resonant frequency of 10 kHz, excited by a 5 kHz current source. Figures 5.7 and 5.8
=10 kHz
L = 0.2533 mH C = 1 F
Figure 5.6
60 50 40 Voltage (volts) 30 20 10 0 0.0001
0.0007
0.001
Figure 5.7
Comparison between exponential form and Dommels method to a 5 kHz excitation for resonance test system. t = 25 s
show the voltage response using 25 s and 10 s time steps, respectively. Considerable deviation from the expected sinusoidal waveform is evident for Dommels method. Figure 5.9 shows the comparison when the excitation contains a 10 kHz component of 1 A peak for a time-step of 10 s. At that frequency the inductance and capacitance cancel out and the exponential form gives the correct response, i.e. a 2 V peak-to-peak 10 kHz sinusoid on top of the d.c. component (shown in Figure 5.10), whereas Dommels method oscillates. The inductor current leads the capacitor voltage by 90 degrees. Therefore, when initialising the current to zero the capacitor voltage should be at its maximum negative value. If the capacitor voltage is also initialised to zero a d.c. component of voltage (|V | = I /C ) is effectively added, which is equivalent to an additional charge on the capacitor to change its voltage from maximum negative to zero. A third test circuit is used to demonstrate the numerical problem of current chopping in inductive circuits. A common example is the modelling of power electronic
56
Voltage (volts)
42
28
14
0 0.0001
0.0007
0.001
Figure 5.8
Comparison between exponential form and Dommels method to a 5 kHz excitation for resonance test system. t = 10 s
Exponential form 35
Dommels method
25 Voltage (volts)
15
5 0.0001
0.0007
0.001
Figure 5.9
Comparison between exponential form and Dommels method to 10 kHz excitation for resonance test system
16 Voltage (volts)
15.6
15.2
14.8
14.4 0.0001
0.0007
0.001
Figure 5.10
Response of resonance test system to 10 kHz excitation, blow-up of exponential forms response
Figure 5.11
devices such as diodes and thyristors. Although the changes of state are constrained to occur at multiples of the step length, the current falls to zero between these points [4]; thus the change occurs at the time point immediately after and hence effectively turning the device off with a slight negative current. To demonstrate this effect Figure 5.11 uses a simple system where an a.c. voltage source supplies power to an RL load via a diode. Figure 5.12(a) shows the load voltage for the exponential form and Dommels method using a time-step of 500 s. This clearly shows the superiority of the exponential form of difference equation. The numerical oscillation at switch-off depends on how close to a time point the current drops to zero, and hence the size of negative current at the switching point. The negative current at switching is clearly evident in the load current waveform shown in Figure 5.12(b).
Voltage (volts)
0.04
0.05
0.08
0.09
0.1
(b)
160
Exponential form
Dommels method
120
Current (amps)
80
40
40 0.03
0.04
0.05
0.08
0.09
0.1
Figure 5.12
These three test circuits clearly demonstrate the accuracy and stability of the exponential form of the difference equation regardless of the time step.
5.5
In the root-matching technique used to derive the exponential form of a difference equation the poles and zeros of the s -domain function are matched in the z-domain
Figure 5.13
H (s) =
G 1+s
H (s) =
1+ sL R
Figure 5.14
function. Extra zeros are added based on the assumed discretisation on the input, which is continuous [5]. Figure 5.13 shows some of the possible discretisations and these result in a family of exponential forms of the difference equation. The root-matching technique is equally applicable to equations representing control or electrical systems [6]. For each of the discretisation types, with reference to the rst order lag function shown in Figure 5.14, the use of the root-matching technique expressed as a rational function in z1 produces the following exponential form difference equations. Input type (a): b/a(1 ea t ) y(z) = u(z) (1 z1 ea t ) b/a(1 ea t )z1 y(z) = u(z) (1 z1 ea t ) b/(2a)(1 ea t )(1 + z1 ) y(z) = u(z) (1 z1 ea t )