IEEE TRANSACTIONS ON POWER DELIVERY, VOL. 17, NO.
4, OCTOBER 2002 1093
Computer Code for Rational Approximation of
Frequency Dependent Admittance Matrices
Bjørn Gustavsen, Member, IEEE
Abstract—This paper deals with the problem of approximating poles. The authors suggested, in the Closure, to achieve this by
with rational functions a matrix whose frequency dependent el- stacking the matrix columns into a single column, which is then
ements have been obtained from calculations or from measure- subjected to VF.
ments. Based on a previously developed technique (vector fitting),
a set of callable routines have been written in the Matlab language. This paper presents a computer code for achieving this ma-
These routines allow for rational approximation with a common trix fitting capability with focus on admittance matrices. In par-
set of stable poles, automatic selection of initial poles, passivity en- ticular, five routines are described that together form a plat-
forcement, and creation of an equivalent electrical network that form for matrix fitting. The end result is matrices , , , ,
can be imported into an ATP version of EMTP. Usage of sparse and , as used in state equations, as well as a file containing
arithmetic permits the computer code to handle large systems. The
methodology is demonstrated by application to a frequency depen- an equivalent electrical network. The network can be imported
dent network equivalent of a radial distribution network (phase into EMTP-type programs, but only the import into ATP-EMTP
domain), for which the accuracy is validated in both the frequency has been verified. For other versions, some extra work may be
domain and the time domain. The computer code is in the public needed. Application of the software is explained and described
domain and is available from the author. in some detail. The validity of the approach is demonstrated by
Index Terms—Electromagnetic transients, EMTP, frequency de- application to a network equivalent. The routines (in Matlab)
pendence, network synthesization, rational approximation. and a user’s manual can be obtained from the author.
I. INTRODUCTION II. VF
I N PROGRAMS for simulation of electromagnetic transients
(e.g., EMTP), there is sometimes a need for inclusion of net-
work components described by frequency domain responses.
A. Least Squares Rational Approximation
VF [6] takes as input a column and approximates all of
The response can be either a scalar function or a matrix of re- its elements simultaneously using an identical set of poles.
sponses. The preferred approach is to approximate the responses Each element in becomes
with rational functions in order to bring the frequency data into
the time domain and in order to achieve high computational ef-
ficiency for the time domain simulation [1]. Examples of appli-
cations are
(1)
• network equivalent for portion of a large network [2]; where and denote the residues and the poles, respectively.
• high-frequency transformer model based on measured fre- Note that the residues depend on , while the poles do not. The
quency responses [3], [4]; terms and may be specified as zero, if desired. The poles
• transfer of voltages from transformer terminals to internal and residues are real or complex conjugate, whereas and
points in winding [5]; are real.
• transmission line modeling [1]. The approximation (1) as produced by VF is a weighted least
The development of vector fitting (VF) [6], [7] has made it squares approximation for the entire vector , i.e.,
possible to calculate a least squares rational approximation of
a vector of frequency domain responses using a common set
of stable poles. This vector fitting capability has been used for
the fitting of matrix columns in transmission line modeling [8], (2)
[9] and in transformer modeling [4]. The high-quality approx-
imation has also been useful when fitting scalar functions [8], where is a weight function specified by the user.
[10]–[13].
In a Discussion contribution for [4], it was reasoned by Lima
B. Sparse Implementation
et al. that the elements of a matrix should have a common set of
The VF approach has been implemented as a callable func-
tion spavectfit.m in Matlab. This routine fully utilizes the
Manuscript received May 21, 2001; revised February 11, 2002. sparse capabilities of Matlab when solving the large but sparse
The author is with SINTEF Energy Research, N-7465 Trondheim, Norway
(e-mail:
[email protected]). linear problem encountered when calculating the poles
Digital Object Identifier 10.1109/TPWRD.2002.803829 of long vectors.
0885-8977/02$17.00 © 2002 IEEE
1094 IEEE TRANSACTIONS ON POWER DELIVERY, VOL. 17, NO. 4, OCTOBER 2002
III. MATRIX FITTING
A. Least Squares Rational Approximation
A least squares approximation for a matrix is to be cal-
culated in a such way that all elements get identical poles. This
is achieved by stacking the elements of into a single column
, which is fitted by VF. As a result, each element , of
Fig. 1. Companion network.
gets an approximation
The elements of and are either real or come in complex
(3) conjugate pairs. and can be specified as zero.
The structure of the resulting state equations when applying
The stacking is done by a routine mtrxvectfit.m, which the matrix fitter to is shown next. Assuming to be of
calls the fitter spavectfit.m. dimension 2 2 and 3, we get, for matrices , , , ,
and
B. Reduction of Problem Size
When is a symmetric matrix, only the elements of the upper diag (5)
triangle of are fitted. This reduces the length of the vector (6)
to be fitted, thus reducing the computation time needed by
spavectfit.m.
(7)
C. Initial Poles
Reference [6, Sec. III] and its closure describes how to select (8)
the initial poles needed by VF. In mtrxvectfit.m, the user
can choose between linearly spaced complex poles and logarith- (9)
mically spaced real poles or specify the poles directly.
It is noted that the elements in (poles) are repeated as many
D. Weighting times as there are columns in .
Frequency Dependent Weighting: The accuracy of the least
squares approximation can be manipulated by means of a three- V. TIME DOMAIN IMPLEMENTATION
dimensional (3-D) weighting array weight [ in (2)], This is
The situation is now considered that a component described
an n n matrix of frequency-dependent elements which de-
by a frequency dependent admittance matrix is to be included
fines the weighting of the correspoonding elements in Y(s). Each
in a time domain simulation host program (EMTP-type pro-
entry (i,j,k) in weight multiplies a corresponding row in the least-
gram). Voltage now replaces in (4), and current replaces .
squares problem for pole identification and subsequent residue
identification. A. Companion Network
Weighting of Individual Elements: Increased accuracy can
be enforced for individual elements by means of an by array When the source code of the host program is available, it is
elemweight. The elements in are multiplied by the corre- convenient to include the rational approximation in the form of
sponding elements in elemweight, prior to pole identification, a companion network (see Fig. 1).
whereas the unscaled is used for the calculation of ma- If trapezoidal integration is used with a fixed time step, the
trices , , and . following companion network can be formulated which consti-
tutes a conductance matrix in parallel with a vector of current
E. Passivity Enforcement sources.
Passivity for is enforced using the “simplistic approach” If is assumed to be scalar ( 1), the companion network
described in [14], which has been implemented in a routine at time step can be calculated as follows [13]:
passive.m. This enforcement is useful to avoid unstable sim-
ulations.
IV. STATE EQUATIONS
The output from the matrix fitter are the matrices , , , (10)
, and , which define a state equation for of the form
Details on how to calculate the coefficients , , and are given
(4) in [13].
For a matrix , the following pseudo code can be used for
The matrix dimensions are updating the history current source. It follows from the code that
when 1, the number of floating point operations for each
diagonal time step becomes O(2 ).
GUSTAVSEN: COMPUTER CODE FOR RATIONAL APPROXIMATION OF ADMITTANCE MATRICES 1095
for
for
(col)
end
end
for
for
for
end
end
end
B. Electrical Network
When the source code of the host program is not available,
it is convenient to represent the fitting of in the form of an
electrical network which can be read in by the host program.
The network has branches between all nodes and ground and
between all nodes. Each branch is calculated as follows [2]:
Branch between node and ground:
(11)
Branch between node and node :
(12)
This procedure is straightforward when matrix fitting has
been applied: All elements of have the same poles, and
these become the poles for the network branches when calcu-
lated by (11) and (12). The Appendix shows how the rational
functions for the network branches are converted into basic
network elements ( , , ).
The routine netgen.m converts the state equation produced
by the matrix fitter (defined by matrices , , , , and ) into
an electrical network that can be imported directly into ATP-
EMTP.
Fig. 2. Flowchart of matrix fitting.
VI. COMPUTER CODE
This routine is identical to the previous vectfit.m devel-
A modularized computational platform for Matrix Fitting has oped in [6], except that the matrix problem in [6, (A.7)] is now
been developed using the following five routines: solved using sparse arithmetic. This greatly reduces the memory
spavectfit.m requirements and increases the computational efficiency for ma-
mtrxvectfit.m trices of big dimensions. All poles produced by the routine are
passive.m stable. The user can specify , or and , to be zero.
netgen.m mtrxvectfit.m
mainfit.m This routine essentially stacks the columns of into a
Each routine is a fully documented standalone function that single column, and calls spavectfit.m. The symmetry of
can be called from the Matlab environment. For the purpose is taken advantage of by fitting only the upper triangle
of matrix fitting, the routines have been integrated within the of , which leads to a shorter column to be fitted by
routine mainfit.m. Fig. 2 shows the hierarchy of the matrix spavectfit.m.
fitting platform and the most important features. Several other passive.m
capabilities are built in, including plotting of results. This routine enforces passivity by the Simplistic Approach
The following gives a brief description of the respective rou- in [14] at frequency samples provided in the input. These
tines. frequency samples should in general be chosen to cover a wider
spavectfit.m frequency range than the samples used in the fitting because
1096 IEEE TRANSACTIONS ON POWER DELIVERY, VOL. 17, NO. 4, OCTOBER 2002
Fig. 3. Electrical three-phase network (all distances in kilometers).
nonpassivity may occur outside the fitting range. Upon output,
modified matrices , , , are produced if nonpassivity was
detected.
netgen.m
This routine takes as input the rational approximation of Fig. 4. Magnitude functions.
as given by matrices , , , , and calculates an equivalent
network as described in Section V-B and the Appendix. The
equivalent network is written to file (RLC.out) as branch cards
for ATP. Predefined node names are used so that the file can be
imported using the $INCLUDE feature of ATP.
mainfit.m
This routine integrates the above routines into a complete pro-
cedure for Matrix Fitting. It takes as input the frequency do-
main data, does the rational function approximation, enforces
passivity, and generates an electrical network which can be in-
cluded in ATP-EMTP. The user can choose between logarithmi-
cally spaced real starting poles, linearly spaced complex starting
poles, or the poles can be provided by the user.
VII. CALCULATED RESULTS
A. Electrical System
As an example, a 24-kV rural distribution system will be con- Fig. 5. Phase angles.
sidered, as shown in Fig. 3. Each line section consists of a flat
untransposed overhead line without ground wires, whereas each
cable section consists of three single core coaxial cables. Figs. 4–6 show the resulting plots produced by mainfit.m.
Fig. 4 shows the magnitude of the nine elements of and the
magnitude of the complex fitting error, whereas Fig. 5 shows the
B. Network Equivalent
corresponding phase angles. The accuracy of the approximation
A frequency-dependent network equivalent (fdne) is to be is seen to be very good. Fig. 6 shows the three eigenvalues of
calculated in the phase domain for the radial network connected in the range 0 Hz–400 kHz. In this case,
to bus A, as indicated by the dotted line in Fig. 3. An exact all eigenvalues were positive so that no passivity enforcement
Pi-equivalent (frequency dependent) was established in the was needed.
phase domain for each of the line and cable stubs in the range
50 Hz–150 kHz. The total admittance matrix was formed and D. Time Domain Simulation
reduced with respect to bus A, thus giving a 3 by 3 .
Next, we calculate the resulting current flowing into one of
the outer phases of the network equivalent when energizing the
C. Matrix Fitting capacitor bank in Fig. 3 at voltage maximum in this phase.
A rational approximation for was obtained in Matlab An ATP source file was created for the circuit in Fig. 3 with
by making a call to the routine mainfit.m. 80 linearly spaced the network equivalent read in from RLC.out, as produced by
complex poles were used, and all of the elements were weighted mainfit.m. Using ATP, the energization currents were calcu-
with the inverse of the sum of the elements of (absolute lated at the terminals of the network equivalent.
value). This weighting was chosen in order to obtain an approx- In addition, the circuit in Fig. 3 was modeled in EMTDC,
imation with a small relative deviation (see the Closure of [6] where each of the line stubs were modeled explicitly using a
for an explanation). phase domain transmission line model [12], [13].
GUSTAVSEN: COMPUTER CODE FOR RATIONAL APPROXIMATION OF ADMITTANCE MATRICES 1097
Fig. 9. Synthesization by electrical network.
Fig. 6. Eigenvalues of G(s). achieved. As expected, the very highest frequency components
in Fig. 7 are missing in the ATP simulation, as was fitted
up to only 150 kHz.
VIII. CONCLUSIONS
This paper has presented a public domain calculation package
for rational approximation of frequency dependent admittance
matrices. The main features are the following.
• All matrix elements are fitted simultaneously with an iden-
tical set of stable poles using the vector-fitting approach.
Automatic generation of starting poles is available.
• The computational efficiency is high due to the use of
sparse arithmetic during pole identification.
• Frequency-dependent weighting is available for control-
ling the accuracy of the rational approximation.
• Passivity is enforced by the “Simplistic Approach” in [14],
which ensures a stable simulation.
Fig. 7. Energization current.
• The resulting rational approximation is expressed as A, B,
C, D, E matrices as used in state equations, and in the form
of an equivalent electrical network which is written to file
as branch cards for ATP-EMTP.
• User friendliness is achieved by modularization using
callable routines in the Martlab environment. Graphics as
in Figs. 4–6 are automatically produced.
The validity of the produced rational approximation was veri-
fied in Section VII by comparing a time domain simulation with
a network equivalent imported in ATP with the result from a
fully detailed representation in EMTDC.
APPENDIX
A. Calculation of Electrical Network
Each branch in (11) and (12) is given as a rational function
Fig. 8. Energization current (expanded time scale).
(A.1)
Figs. 7 and 8 show the energization current in an outer phase
of the cable at bus A, as calculated by ATP using the frequency- The branch can be represented by an electrical network as shown
dependent network equivalent (fdne), and by EMTDC. The fig- in Fig. 9. and are calculated as
ures show the current in the time range 0–0.1 ms and 0–1 ms,
respectively. It is seen that a very good agreement has been (A.2)
1098 IEEE TRANSACTIONS ON POWER DELIVERY, VOL. 17, NO. 4, OCTOBER 2002
Each real pole gives an -branch [6] B. Gustavsen and A. Semlyen, “Rational approximation of frequency
domain responses by vector fitting,” IEEE Trans. Power Delivery, vol.
14, pp. 1052–1061, July 1999.
(A.3) [7] A. Semlyen and B. Gustavsen, “Vector fitting by pole relocation for the
state equation approximation of nonrational transfer matrices,” Circuits
Each complex conjugate pair Syst. Signal Process., vol. 19, no. 6, pp. 549–566, 2000.
[8] B. Gustavsen and A. Semlyen, “Simulation of transmission line
transients using vector fitting and modal decomposition,” IEEE Trans.
(A.4) Power Delivery, vol. 13, pp. 605–614, Apr. 1998.
[9] , “Combined phase and modal domain calculation of transmission
line transients based on vector fitting,” IEEE Trans. Power Delivery, vol.
gives an RLC-branch 13, pp. 596–604, Apr. 1998.
[10] J. A. Parle, E. Acha, and C. R. Fuerte-Esquivel, “Real-time simulation of
transmission line transients using vector fitting,” in PROC. 13th PSCC,
(A.5) Trondheim, Norway, June 28–July2 1999, pp. 1033–1039.
(A.6) [11] M. J. Manyahi, “Response of transformers to lightning transients and
their transfer between the transformer circuits,” Tekn. Lic. thesis, Upp-
(A.7) sala Univ., Uppsala, Sweden, 2000.
[12] A. Morched, B. Gustavsen, and M. Tartibi, “A universal line model for
(A.8) accurate calculation of electromagnetic transients on overhead lines and
cables,” IEEE Trans. Power Delivery, vol. 14, pp. 1032–1038, July 1999.
[13] B. Gustavsen, G. Irwin, R. Mangelrød, D. Brandt, and K. Kent, “Trans-
mission line models for the simulation of interaction phenomena be-
REFERENCES tween parallel ac and dc overhead lines,” in Proc. Int. Conf. Power Syst.
[1] A. Semlyen and A. Dabuleanu, “Fast and accurate switching transient Transients, Budapest, Hungary, 1999, pp. 61–67.
calculations on transmission lines with ground return using recursive [14] B. Gustavsen and A. Semlyen, “Enforcing passivity for admittance ma-
convolutions,” IEEE Trans. Power App. Syst., vol. PAS-94, pp. 561–571, trices approximated by rational functions,” IEEE Trans. Power Systems,
Mar./Apr. 1975. vol. 16, pp. 97–104, Feb. 2001.
[2] A. S. Morched, J. H. Ottevangers, and L. Marti, “Multi-port frequency
dependent network equivalents for the EMTP,” IEEE Trans. Power De-
livery, vol. 8, pp. 1402–1412, July 1993.
[3] A. Morched, L. Marti, and J. Ottevangers, “A high frequency trans-
former model for the EMTP,” IEEE Trans. Power Delivery, vol. 8, pp.
1615–1626, July 1993. Bjørn Gustavsen (M’93) was born in Norway in 1965. He received the M.Sc.
[4] B. Gustavsen and A. Semlyen, “Application of vector fitting to the state degree in 1989 and the Dr.-Ing. degree in 1993, both from the Norwegian Insti-
equation representation of transformers for simulation of electromag- tute of Technology, Trondheim, Norway.
netic transients,” IEEE Trans. Power Delivery, vol. 13, pp. 834–842, Since 1994, he has been with SINTEF Energy Research (former EFI), Trond-
July 1998. heim. He spent 1996 as a Visiting Researcher at the University of Toronto,
[5] A. S. Morched, L. Marti, R. H. Brierly, and J. G. Lackey, “Analysis of in- Toronto, ON, Canada, and the summer of 1998 at the Manitoba HVDC Research
ternal winding stresses in EHV generator step-up transformer failures,” Centre, Winnipeg, MB, Canada. His interests include simulation of electromag-
IEEE Trans. Power Delivery, vol. 11, pp. 888–894, Apr. 1996. netic transients and modeling of frequency dependent effects.