Sunteți pe pagina 1din 9

IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 56, NO.

4, APRIL 2009 1273


Implementation of Resonant Controllers and Filters
in Fixed-Point Arithmetic
Lennart Harnefors, Senior Member, IEEE
AbstractResonant controllers and lters are useful in voltage-
source-converter control systems. Although the trend is toward
implementation in oating-point arithmetic, xed-point arith-
metic is still of interest, but requires much greater care in the al-
gorithm design. This paper covers some important issues, namely,
choice of structure, design formulas, scaling, sensitivity, quantiza-
tion-noise amplication, and suppression of overow limit cycles.
The results presented should be particularly helpful as design
guidelines to practical engineers in a situation where one often
resorts to trial and error.
Index TermsConverter control, lters, xed-point arithmetic,
resonators.
I. INTRODUCTION
R
ESONATORS, in this paper, short for controllers and
lters that have poles in the Laplace s plane close to
s = j
r
, where
r
is the angular resonant frequency, were
proposed for control of voltage-source converters (VSCs) more
than two decades ago [1]. Lately, they have gained renewed
attention with the proliferation of grid-connected VSCs [2].
One objective for utilizing resonators is to avoid transforma-
tion of signals to the synchronous dq frame. This is achieved by
instead transforming synchronous-frame controllers and lters
to the stationary frame [3]. Since a dq transformation
of a continuous-time dynamic system corresponds to substi-
tuting in the transfer function s s j
1
, where
1
is the
angular fundamental (synchronous) frequency [4], it is apparent
that a dq-frame integrator is transformed to an -frame res-
onator with angular resonant frequency
1
. Resonators were,
therefore, called generalized ac integrators in [2]. However,
also in control systems that operate in the dq frame, resonators
are useful for regulation of the negative-sequence component
and lower order harmonics [5][9].
The trend in VSC control is clearly toward increasing usage
of oating-point digital signal processors (DSPs). Nevertheless,
xed-point DSPs [as well as xed-point eld-programmable
gate arrays (FPGAs) and application-specic integrated circuits
(ASICs)] are cheaper and draw less power per arithmetic oper-
ation [10]. Therefore, it is anticipated that implementation of
VSC control systems in xed-point arithmetic will not, at least
in the near future, become obsolete.
Many important aspects of resonator implementation were
covered in [3]. Primarily, it was pointed out that, for sampling
rates much higher than the resonant frequency, the poles of a
Manuscript received April 16, 2008; revised October 1, 2008. First published
October 31, 2008; current version published April 1, 2009.
The author is with ABB Power Systems/HVDC, 771 80 Ludvika, Sweden
(e-mail: lennart.harnefors@se.abb.com).
Digital Object Identier 10.1109/TIE.2008.2008341
discretized resonator cluster near z = 1 in the z plane, result-
ing in poor numerical properties for the standard direct-form
structure based on the z
1
(one-sample delay) operator.
1
In
[11], direct-form structures based on the inverse of the delta
operator = (z 1)/, where is a design parameter, were
shown to have much better numerical properties. Among the
variants considered in [11], the direct form II transposed
(DFIIt) structure was found to have superior properties regard-
ing quantization noise. For this reason, the DFIIt structure was
adopted in [2], and can arguably be regarded as the currently
preferred structure for resonator implementation. Therefore, it
will be considered in this paper; performance comparisons to
other candidate structures are left to future research.
In this paper, some additional properties of the DFIIt struc-
ture are explored. The outline and contributions of this paper
are as follows.
1) In Section II, explicit design formulas that convert the
coefcients of a prototype s-domain resonator transfer
function to a z-domain equivalent are derived. These are
more general and simpler than those given in [2], and are
useful also for oating-point implementation.
2) With xed-point arithmetic, it is important to scale the
nodes in a digital system such that overow events occur
very rarely. This is addressed in Section III, where also
sensitivities of zero and pole angles with respect to coef-
cient quantization are analyzed.
3) In [11], it was pointed out that the numerical integrators
formed by
1
should be implemented with double or
enhanced precision (i.e., a longer word length than the
normal single precision). In Section IV, we explicitly
show that the underlying reason is that otherwise, very
high amplication of quantization noise often will result.
Explicit formulas for the output quantization-noise vari-
ance are derived.
4) If an overow event occurs, sustained large-amplitude
oscillationsso-called overow limit cyclesmay begin
[12]. In Section V, a proof of absence of such, that holds
under reasonable assumptions, is presented.
5) An example where the derived formulas are applied and
theoretical results veried is presented in Section VI.
It is assumed that all xed-point numbers are represented in
twos complement form, with only the sign bit to the left of the
binary point. That is, the number range is [1, 1[, or 1.000. . .0
to 0.111. . .1 in binary numbers. Normalization of signals to a
1
To conform with previous publications [3], [11], the terms operator and
transform variable will be used synonymously in this paper, even though the
two are not mathematically equal (but related).
0278-0046/$25.00 2009 IEEE
1274 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 56, NO. 4, APRIL 2009
Fig. 1. (a) DFIIt implementation of resonator. (b) Implementation of
1
with
single precision. (c) Implementation of
1
with double precision.
per-unit base is thus useful, but further scaling must be made of
a signal that is known to exceed 1 per unit.
Since DSP implementation is considered, signals as well
as coefcients are assumed to be represented with a word
length of (B + 1) bits including the sign bit. (In an FPGA or
ASIC implementation, different word lengths may be used.)
Consequently, double [i.e., word length (2B + 1)] rather than
enhanced [i.e., word length longer than (B + 1) but shorter than
(2B + 1)] precision is logical to use [11]. Finally, T will be
used to denote the sampling period and f
s
= 1/T the sampling
frequency.
II. STRUCTURE AND DESIGN FORMULAS
A. DFIIt Structure and Linear Model
The resonator considered in this paper is implemented using
the DFIIt structure shown in Fig. 1(a) (see also [11]). The input
and output signals are, respectively, u(n) and y(n), where n
is the discrete time variable (corresponding to the time instant
t = nT), whereas
1,2
and
0,1,2
are the coefcients in the
recursive and transversal signal paths, respectively. The delta
operator is, following [11], dened as
=
z 1

(1)
where 1 is a design parameter that is chosen as a power
of two in order to give a simple bit-shift implementation [11].
Parameter kalso chosen as a power of two (so coefcient
k/ too becomes a bit shift)is introduced to allow scal-
ing. The numerical integrators
1
can be implemented either
with single [Fig. 1(b)] or double [Fig. 1(c)] precision. The
implementations differ in the location and type of quantizer;
these are indicated by the boxes marked Q
B
and Q
2B

for quantization to single and double precision, respectively.


The boxes marked O indicate an overow characteristic [12].
Coefcient is placed at the output of the numerical integrator,
whereas in [11] it was placed at the input. Our choice will be
proven benecial. Finally, s
0,1,2
are summation nodes, and x
1,2
are state variables.
Although quantization and overow are both nonlinear man-
ifestations, the former can be modeled as additive noise [13],
[14], whereas the latter in a well-designed system should occur
very seldom [12]. This permits a linear state-space model with
x = [x
1
, x
2
]
T
as
x(n + 1) =Ax(n) +Bu(n) (2)
y(n) =Cx(n) +Du(n) (3)
where
A =
_
1
1

2
1
_
B =
_

2
_
C =[ k 0 ]
D =k
0
/. (4)
The transfer function from u to y is given by
H(z) =
_
C(zI A)
1
B +D

z=+1
=
k

2
+
1
+
2

2
+
1
+
2
. (5)
B. Algorithm
Taking into account quantizers and overow characteristics,
the algorithm of the DFIIt-structure resonator with double-
precision implementation of
1
can be expressed as
w(n) =Q
B
[O
0
u(n) +Q
2B
[x
1
(n)]] (6)
y(n) =(k/)w(n) (7)
x
1
(n + 1) =O
1
u(n)
1
w(n) +x
1
(n)
+Q
2B
[x
2
(n)] (8)
x
2
(n + 1) =O
2
u(n)
2
w(n) +x
2
(n) . (9)
For single-precision implementation of
1
, the Q
2B
[] quanti-
zations vanish, while Q
B
[] quantization is added in (8) and (9).
Both types of quantization are assumed to be made by rounding
[13], [14]. Quantization is not needed at the output, (7), since
k/ is normally a power-of-two coefcient larger than or equal
to one, as will be seen in the next section.
C. Design Formulas
1) Continuous-Time Prototype Resonators: Resonators are
generally designed as continuous-time systems (prototypes), to
be discretized for digital implementation, normally on a DSP.
HARNEFORS: IMPLEMENTATION OF RESONANT CONTROLLERS AND FILTERS 1275
They appear in several variants that differ in the selection of the
numerator polynomial, i.e., the zeros. We shall limit the scope
to the two most prevalent categories.
In the rst category, we nd resonant controllers [2], [9],
which are in the form
H(s) = K
r
s(sT
r
+ 1)
s
2
+
c
s +
2
r
,
r
= 2f
r
(10)
where K
r
is the controller gain and f
r
is the resonant frequency
(in hertz). When T
r
= 0, which is chosen in many [2]but
not all [9]cases, H(s) is, in effect, a bandpass lter whose
passband is centered at
r
. The 3-dB bandwidth is
c
. (To get
H(j
r
) = 1 for T
r
= 0, K
r
=
c
should be chosen.)
In an ideal resonator, i.e., an exact generalized ac integra-
tor,
c
= 0. This is not recommendable, however, since (10)
would become marginally stable with poles at s = j
r
. For
practical purposes, 0 <
c

r
should be chosen;
c
= 5
15 rad/s was suggested in [2]. The poles of (10) are located at
s
c
/2 j
r
, giving a time constant 2/
c
= 0.13
0.40 s for the transient-response exponential decay.
In the second category, we nd notch lters [3], which are in
the form
H(s) =
s
2
+
2
r
s
2
+
c
s +
2
r
(11)
where the notch frequency equals the resonant frequency.
Notch lters let signal components of all frequencies pass with
negligible attenuation and phase shift, except those within a
stopband (whose bandwidth is
c
) about
r
.
2) Tustin Discretization: The main objectives for discretiza-
tion of the continuous-time prototype are that a stable system
is obtained and that the resonant frequency is unchanged.
The latter objective is important, as a shift of the resonant
frequency inevitably would result in degraded performance.
The objectives are most easily achieved by the (prewarped)
Tustin discretization method (bilinear transformation) [2], in
which the substitution
s K
T
z 1
z + 1
= K
T

+ 2/
(12)
is made in the transfer function of the prototype. The entire
left half of the s plane is mapped onto the unit disk in the z
plane, giving a stable discretized system. However, a frequency
warping results, which is seen by setting z = e
jT
in the right-
hand side of in (12), giving jK
T
tan(T/2), whereas the
frequency response of the left-hand side is j. Only for = 0
and a second frequency, selectable by K
T
, is there an exact
match between the frequency responses (below the Nyquist
frequency). To make the second frequency equal to
r
, K
T
must be selected as [2]
K
T
=

r
tan

r
T
2
. (13)
Substituting (12) with K
T
given by (13) in (10) and (11), and
solving for the coefcients of (5) yields, after simplication,
design formulas (15)(17), where
r =
1
1 +

c
2
r
sin
r
T
1

c
T
2
. (14)
The approximation in (14) does not give a signicant error as
long as 0 <
c

r
, and the sampling rate is fairly high, i.e.,
T is small. Typically, 0.99 < r <1.
1) For discretization of the resonant controller (10)

0
=
K
r
T
r
r
2k
_
1 + cos
r
T +
sin
r
T

r
T
r
_

K
r
T
r

1
=
K
r
r
k
sin
r
T

K
r
T
k

2
= 0. (15)
In the approximations, r 1 and a small T are assumed.
These approximations are valid, since the zeros of (10)
are located on the real axis, and therefore are not suscep-
tible to frequency warping.
2) For discretization of the notch lter (11)

0
=
r
k

1
=
2r
k
(1 cos
r
T)
2
=

1

. (16)
3) For discretization of (10) as well as (11)

1
=
2

(1 r cos
r
T)
2
=
2r

2
(1 cos
r
T). (17)
These formulas generalize those given in [2], while they are
also simpler. Note that, with the approximations they contain
no divide operations, as and k are selected as powers of two.
The formulas are simple enough to allowonline gain scheduling
if a varying resonant frequency is desired in order to track
variations in the fundamental frequency.
Note also that and k must be chosen such that
0,1,2
and

1,2
all become smaller than one.
Remark 1: The simpler forward-difference method [15], i.e.,
s (/T), is not useful in this case, because the region
for poles in the s plane which yields a stable discretization is
within a circle with radius 1/T, centered at s = 1/T (see the
-plane illustration in [3, Fig. 3]). Therefore, poles close
to the imaginary axis often result in an unstable discretized
system. Moreover, the frequency response would get warped.
Remark 2: A useful alternative for discretization might be to
explicitly map poles and zeros using the exact relation z = e
sT
[15]. However, more complicated design formulas would result,
with little or no expected performance improvement.
Remark 3: Note that the right-hand side of (12) with (13) and
z = e
sT
approaches s as T 0, i.e., an exact discretization is
obtained for an innitely high sampling rate.
III. SCALING AND SENSITIVITY
A. Scaling to Prevent Overow
Since the adder in each
1
implementation [Fig. 1(b)
and (c)] is in series with preceding adder in the main structure
[Fig. 1(a)], a common summation node is formed. (This is not
the case for the variant proposed in [11], where coefcient
1276 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 56, NO. 4, APRIL 2009
was placed at the input of
1
.) Consequently, the DFIIt
structure has three summation nodes: s
0,1,2
. The structure must
be scaled such that overow events at these nodes occur very
seldom, if ever, as otherwise large errors are introduced and the
resonator ceases to work as intended. Scaling with one degree
of freedom is permitted by the coefcient k/ at the output of
the structure.
Scaling is often done based on the L
2
norm[10]. This implies
that a summation node s
i
is scaled such that the L
2
norm of the
transfer function H
ui
(z) from the input to the node does not
exceed 1, i.e., |H
ui
(z)|
2
1, where
|H
ui
(z)|
2
2
=
1
2

[H
ui
(e
j
)[
2
d. (18)
L
2
scaling is suitable when the input signal has a wideband
spectrum, e.g., in communications. In power systems and power
electronics, assuming that any switching harmonics have been
ltered off, the fundamental component plus a couple of odd-
order harmonics dominate. Therefore, we shall instead apply
scaling based on the L

norm [10], in which nodes s


0,1,2
are
scaled such that max

[H
u0,u1,u2
(e
j
)[ 1.
1) Resonant Controller (15): H
u0,u1,u2
(z) all have a dis-
tinct peak at =
r
. Moreover, it is easily veried that
[H
u1
(e
j
r
T
)[
K
r
_
1 + (
r
T
r
)
2
k
c
(19)
is generally larger than [H
u0,u2
(e
j
r
T
)[. Therefore, L

scaling
with (15) implies selecting the power-of-two coefcient k large
enough to prevent (19) from exceeding one.
For a bandpass lter with H(e
j
r
T
) = 1, i.e., K
r
=
c
and
T
r
= 0, (19) simplies to [H
u1
(e
j
r
T
)[ 1/k. In this case,
k = 1 gives L

scaling.
2) Notch Filter (16): [H
u1,u2
(e
jT
)[ both have a distinct
peak at =
r
, where
[H
u1
(e
j
r
T
)[
1
k
(20)
is generally larger than [H
u2
(e
j
r
T
)[. Consequently, k = 1
gives L

scaling of nodes s
1,2
. [H
u0
(e
jT
)[ /k except
about the notch. Hence, k gives L

scaling of node s
0
,
which is already fullled by k = 1, since 1.
3) Relaxed L

Scaling: Since H
u1,u2
(z) have a peak at
=
r
, a component at =
r
in u(n), e.g., A
r
sin(
r
nT +),
A
r
< 1, will be observed as the dominant oscillation in the state
variables. Consequently, any overow event is usually due to
this component. If A
r
is known, k as given by the above L

scaling can be reduced by A


r
without signicantly increasing
the risk for overow (although in the notch-lter case, k
must hold). A relaxed L

scaling is obtained.
B. Sensitivity to Coefcient Quantization
After design formulas (14)(17) have been applied, coef-
cients
1,2
and
0,1,2
must be quantized to (B + 1) bits
including the sign bit. This should be done by rounding, giv-
Fig. 2. Result of coefcient quantization: the zero is shifted off its ideal
location z = e
j
n
,
n
=
r
T.
ing a maximum coefcient-quantization error of half the least
signicant bit, i.e., c = 2
(B+1)
. This error affects the transfer
function (5) by shifting poles and zeros off their ideal locations,
as shownwith much exaggerationin Fig. 2.
1) Sensitivity of Notch Frequency: For a notch lter, the
locations of the zeros are critical for good performance, as these
determine the notch frequency and (together with the poles) the
depth of the notch; ideally, H(e
j
r
T
) = 0.
The zeros of (5) are given by
=
1
/(2
0
) j
_

2
/
0

2
1
/(2
0
)
2
z =1
1
/(2
0
)
j
_

2
/
0

2
1
/(2
0
)
2
. The angles of the zeros relative the
positive real axis are
n
, where

n
= arctan , =

_

2
/
0

2
1
/(2
0
)
2
1
1
/(2
0
)
. (21)
For ideal coefcients (16),
n
=
r
T (see Fig. 2).
Let us nd an approximate expression for the notch-
frequency error that results from the maximum coefcient
error c. The maximum angle error

n
(again, see Fig. 2) that
may result from c can be approximated as

n

1
1 +
2
_

_
c (22)
where the partial derivatives are the respective sensitivities to
the coefcients. The corresponding angular notch-frequency
error is, in turn, obtained as
n
=

n
/T. The dominant sen-
sitivity is that with respect to
2
; this can be deduced as
2
is
the -free coefcient in the numerator of (5), whereas
2
r
is the
s-free coefcient in the numerator of (11). The latter determines
the notch frequency of the continuous-time prototype. With the
use of (16), we obtain

n
=
n
T
1
1 +
2

c =
k
2r tan
r
T
c. (23)
Approximating tan
r
T
r
T and r 1, while letting
c = 2
(B+1)
, yields
n
(kf
2
s
/
r
)2
(B+2)
or

f
n
=

n
2

kf
2
s

2
f
r
2
(B+4)
. (24)
To get a sufciently small

f
n
, it may be necessary to se-
lect < 1. Suppose, for example, that the purpose of the
notch lter is to eliminate a fundamental component of f
r
=
50 Hz. Let us also assume that the lter is implemented on a
16-bit DSP (including the sign bit, i.e., B = 15) with a fairly
HARNEFORS: IMPLEMENTATION OF RESONANT CONTROLLERS AND FILTERS 1277
high sampling rate of f
s
= 10 kHz, and that k = 1. Then,
(24) yields

f
r
0.39, 0.19, 0.097 Hz for = 1, 1/2, 1/4,
respectively. Hence, even with a standard 16-bit DSP, good
accuracy can be obtained without making unreasonably
small. Verication of (24) is made in Section VI.
2) Sensitivity of Resonant Frequency: A similar analysis for
the denominator polynomial of (5) with respect to the pole
angle gives the following expression for the resonant-frequency
error:

f
r


2
f
2
s

2
f
r
2
(B+4)
. (25)
Even better accuracy than for the notch frequency can be
obtained, as (25) is proportional to
2
rather than .
IV. QUANTIZATION-NOISE ANALYSIS
A. Theory
Quantization is a nonlinear operation which is difcult to
model deterministically. This is worked around by modeling the
quantization error e(n) = Q[w(n)] w(n) of a signal w(n)
as a white-noise process uncorrelated with w(n) [13], [14].
If quantization is done by rounding to B bits excluding the
sign bit, e(n) is of zero mean with variance
2
e
= 2
2B
/12.
The resulting noise variance at the output can be calculated
as
2
y
= |H
iy
(z)|
2
2

2
e
, i.e., the quantization-noise variance is
scaled by the square of the L
2
normcf., (18)of the transfer
function H
iy
(z) from quantization node i to the output. More-
over, the roundoff noise introduced at a certain node is assumed
uncorrelated with that introduced at any other node. Therefore,
superposition holds for the noise sources, i.e., the total output
noise variance can be calculated as

2
y
=
N
q

i=1
|H
iy
(z)|
2
2

2
ei
(26)
where N
q
is the number of quantization nodes and where the
individual noise variances
2
ei
may be different depending on
the number of bits to which quantization is made.
B. Noise Sources and Noise-Gain Expressions
As shown in Fig. 1(a), there is a quantizer immediately after
node s
0
. A noise source with variance 2
2B
/12 thus enters
there. Other noise sources add depending on which one of the
two implementation variants of
1
that is chosen.
1) Single precision [Fig. 1(b)]: To form the signal at node
s
1
, four terms are added together as
s
1
(n) =
1
u(n)
1
w(n) +x
1
(n) + x
2
(n). (27)
This signal is of double precision, i.e., of word length
(2B + 1), since the rst two terms result from multi-
plication by a (B + 1)-bit coefcient. As described in
[3], (27) can in many DSPs be computed using multiply-
and-accumulate instructions, with a double-precision
accumulator. The signal is thereafter quantized to
(B + 1) bits. The signal at node s
2
is computed likewise.
This introduces noise sources also at nodes s
1,2
, both with
variance 2
2B
/12.
2) Double precision [Fig. 1(c)]: In this case, the signal is not
quantized after nodes s
1,2
, which necessitates implemen-
tation of the delay elements z
1
with double-precision
memory. If < 1, quantization to double precision must
be made after the coefcient, giving noise sources with
variance 2
4B
/12 at nodes s
0,1
.
The total noise variance at the output can be found by calculat-
ing the transfer functions from nodes s
0,1,2
to y, followed by
their L
2
norms. The latter is best made by applying the residue
theorem for complex line integrals [16]
_

f(z) dz = 2j
N
p

i=1
Res
z=p
i
f(z) (28)
where p
i
, i = 1, 2, . . . , N
p
, are the poles of the complex func-
tion f(z) that lie within the closed contour . Let be the unit
circle traversed counterclockwise; then, with the substitution
z = e
j
dz = jz d, we obtain
|H(z)|
2
2
=
1
2

H(e
j
)H(e
j
) d
=
2

i=1
Res
z=p
i
z
1
H(z)H(z
1
) (29)
where p
1,2
are the poles of (5), i.e., p
1,2
= r cos
r
T
j

2r 1 r
2
cos
2

r
T for (17). Evaluating (29) for H(z)
H
0y,1y,2y
(z), assuming small T and
c
, it is found that
|H
0y
(z)|
2
2

k
2

2
r
2
c

2
f
s
|H
1y
(z)|
2
2

k
2
f
s
2
c
|H
2y
(z)|
2
2

k
2

2
f
3
s
2
2
r

c
. (30)
Being inversely proportional to f
s
, |H
0y
(z)|
2
2
is normally
small, whereas |H
2y
(z)|
2
2
tends to be very large. For

r
= 314 rad/s,
c
=10 rad/s, f
s
=10 kHz, k=1, and =1,
|H
0y
(z)|
2
2
0.5, |H
1y
(z)|
2
2
500, and |H
2y
(z)|
2
2

500 000 are obtained. A noise gain as high as the latter would
waste many bits of numerical accuracy. This is why single-
precision implementation of
1
was rejected in [11] and some
of the references cited therein.
All three noise gains |H
0y,1y,2y
(z)|
2
2
decrease if k can be
made smaller, which is one reason for considering relaxed
L

scaling, cf., Section III-A. Moreover, |H


2y
(z)|
2
2
can be
decreased by making smaller. For example, letting k = 1/2
and = 1/8 yields |H
0y
(z)|
2
2
8.0, |H
1y
(z)|
2
2
120, and
|H
2y
(z)|
2
2
2000. However, as |H
2y
(z)|
2
2
is still quite high,
the main benet of the DFIIt structure, i.e., low total noise gain,
is lost if single-precision implementation is used.
As previously mentioned, double-precision implementation
of
1
introduces noise sources of variance 2
4B
/12 at nodes
s
0,1
. This variance is a factor 2
2B
smaller than for quantiza-
tion to single precision, effectively reducing the noise gains
|H
0y,1y
(z)|
2
2
by a factor 2
30
10
9
for B = 15, rendering
1278 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 56, NO. 4, APRIL 2009
Fig. 3. Overow characteristics. (a) Wrapping (twos complement).
(b) Saturation.
them negligible. The sole critical noise gain is |H
0y
(z)|
2
2
for
quantization to single precision, which can be made very low,
making DFIIt the preferred structure in [11].
Remark 4: Note that all noise gains in (30) are inversely
proportional to
c
. The ideal resonator with
c
= 0 is therefore
not implementable in xed-point arithmetic.
Remark 5: Resonant controllers, and often also notch lters,
are parts of closed-loop systems. Taking this into account would
give noise gains different from those of (30), the difference
mainly depending on the bandwidth of the closed loop. This
does not change the main conclusion, i.e., that single-precision
implementation of
1
should be avoided.
V. SUPPRESSION OF OVERFLOW LIMIT CYCLES
In twos complement representation, when an addition over-
ows, i.e., results in a number that exceeds the range [1, 1[,
it wraps around, giving an erroneous sum, as shown in
Fig. 3(a). Even worse is that, following an overow event, the
state variables may start to oscillate with high amplitude in a
so-called overow limit cycle [12]. This completely ruins the
performance of the system.
The error resulting from an overow event can be reduced
by modifying the overow characteristic. The most common
modication is the saturation characteristic [see Fig. 3(b)]. In
this, the output of the adder is replaced by the largest posi-
tive numberto be approximated as one, which is reasonable
except for very short word lengthsif the inputs add up to a
number greater than 1. If they add up to a number smaller than
1, the adder output is instead set to 1. Applied to each state
variable, the saturation characteristic can be expressed as
Sx
1,2
=
_
1, x
1,2
> 1
x
1,2
, 1 x
1,2
1
1, x
1,2
< 1.
(31)
That is, O = S in (8) and (9). Introduction of saturation
reduces, but does not eliminate, the risk for overow limit
cycles. Strict mathematical proof of the absence of overow
limit cycles is desirable, but complicated or impossible if a gen-
eral input signal u(n) is considered [17]. Assuming u(n) = 0
makes proof accessible. Even though this is an unrealistic
assumption, it is known from experience that instabilities occur
rarely if stability can be proven for the zero-input case. Instabil-
ities tend to occur only for periodic input signals that frequently
drive the system into saturation [18]. Such are unlikely if the
system is properly scaled.
Letting u(n) = 0 [which implies that overow never occurs
at node s
0
, i.e., O in (6) is inactive], neglecting quantization,
and letting O = S, (6), (8) and (9) can be expressed in
state-space form as
x(n + 1) = S Ax(n) (32)
where A is given by (4) and, with a slight abuse of notations,
S here denotes a vectorial function whose two elements
are given by (31). Stability of (32) can be analyzed using
Lyapunovs direct method [19]. To this end, the so-called
associated linear system (ALS) to (32) is considered, which is
x(n + 1) = Ax(n). (33)
A Lyapunov function candidate (LFC) is now chosen as the
quadratic form
V [x(n)] = x
T
(n)Px(n). (34)
The LFC is a Lyapunov function for (33)implying that the
ALS is stableif and only if V [x(n)] > 0, x(n) ,= 0, and
V [x(n)] =V [x(n + 1)] V [x(n)] =V [Ax(n)] V [x(n)] =
x
T
(n)[A
T
PAP]x(n)=x
T
(n)Qx(n)0, i.e., if matrices
P and Q = P A
T
PA are positive denite (P > 0) and
positive semidenite (Q 0), respectively [19].
Although Lyapunov functions for stable, linear systems al-
ways exist, nding an analytically parametrized matrix P is,
in general, a difcult task. A certain class of structures, wave
digital lters, has the unique property that a diagonal P exists
for any lter order [20]. Unfortunately, for (33), a diagonal
P for which (34) is a Lyapunov function cannot generally be
found. Instead, we consider an LFC with
P =
_
1 p
0
p
0
p
2
_
(35)
where p
0
= /2 and p
2
=
2
/[2(1 cos
r
T)]. P > 0
when its eigenvalues are positive. We have det(I P) =

2
(1 +p
2
) +p
2
p
2
0
, so P > 0 when 1 +p
2
> 0 and
p
2
p
2
0
=
2
(1+ cos
r
T)/[4(1 cos
r
T)] > 0, which hold
since 0 <
r
T < (this because the resonant frequency must
be placed above zero frequency but below the Nyquist fre-
quency). Furthermore, for (17),
Q = P A
T
PA =
_
2r(1 r)(1 + cos
r
T) 0
0 0
_
(36)
where Q 0, since r < 1. Therefore, (34) is a Lyapunov
function for the ALS. It is a Lyapunov function also for (32)
if P is such that
V [Sx] = S
T
xPSx x
T
Px = V [x] (37)
since then
V [x(n)] =V [x(n + 1)] V [x(n)]
=V [SAx(n)] V [x(n)]
V [Ax(n)] V [x(n)]
= x
T
(n)Qx(n) 0. (38)
HARNEFORS: IMPLEMENTATION OF RESONANT CONTROLLERS AND FILTERS 1279
Fig. 4. Moduli of frequency functions for (solid) H
u0
(z), (dashed) H
u1
(z), and (dasheddotted) H
u2
(z) (the latter two coincide).
Fig. 5. Moduli of frequency functions for H(z) about the notch for (solid) = 1/2, (dashed) = 1/4, and (dasheddotted) = 1/8.
Liu and Michel showed in [19] that an N N positive denite
matrix P = (p
ij
) satises (37) if and only if
p
ii

N

j=1,j,=i
[p
ij
[, i = 1, . . . , N (39)
thereby allowing proof of the following theorem.
Theorem: Algorithm (6)(9) is asymptotically stable for
parameter selection (17) if u(n) = 0, Q
B
[] and Q
2B
[] are
neglected, O = S, and 1 cos
r
T 2.
Proof: Applying (39) to (35) yields 1 p
0
2 and
p
2
p
0
1 cos
r
T. (40)
Consequently, (34) is a Lyapunov function for (32) under
the given assumptions, so (32) is stable. Asymptotic stability
follows from [19, Th. 2.2].
Remark 6: Equation (40) should virtually always hold, as for
high sampling rates cos
r
T is close to one. Moreover, 2
is implied by the design choice 1.
VI. EXAMPLE
A. Design
Let us design a notch lter for suppression in the dq frame
of a 50-Hz negative-sequence component, whose amplitude
is known to be smaller than 0.4. Since it is translated by dq
transformation to a 100-Hz negative-sequence component [9],
f
r
= 100 Hz is selected. We also assume that f
s
= 10 kHz,
B = 15, and let
c
= 15 rad/s.
1) Scaling: Since A
r
< 0.4, k = 1/2 may be selected
without risking overow, giving a relaxed L

scaling, cf.,
Section III-A. Moduli for H
u0,u1,u2
(z) with k = 1/2 and
= 1/8 (see below) are shown in Fig. 4.
2) Sensitivity: Next step is to determine , which has a
direct impact on the sensitivity to coefcient quantization,
cf., (24). For = 1, (16) shows that
0
> 1, whereas
1/16 will give
2
> 1. This leaves three values to consider:
= 1/2, 1/4, 1/8. For these values, (24) predicts that

f
n

0.048, 0.024, 0.012 Hz, respectively. However, evaluation of
the frequency function for H(z) shows that, in this particular
case, all three choices give virtually identical responses, with

f
n
0.01 Hz (see Fig. 5). Equation (24) gives an overestimate
of

f
n
in all three cases. Consequently, any of the three values
of may be picked.
3) Noise Gains: Clearly, for single-precision implementa-
tion of
1
, = 1/8 should be chosen, as then |H
2y
(z)|
2
2
is
minimized. The coefcients are
0
=0.249817,
1
=0.007874,

2
= 0.063110,
1
= 0.043549, and
2
= 0.252380. Equa-
tion (30) gives |H
0y
(z)|
2
2
21, |H
1y
(z)|
2
2
83, |H
2y
(z)|
2
2

330, and a total noise gain of 430. Because |H
2y
(z)|
2
2
is
inversely proportional to
2
r

c
, larger
r
and
c
than in the
example of Section IV gives a much lower total noise gain.
Single-precision implementation of
1
may in this case be
feasible, but again, the main benet of the DFIIt structure, i.e.,
low total noise gain, is lost.
For double-precision implementation of
1
, it is, on the
other hand, benecial to choose = 1/2, as this mini-
mizes |H
0y
(z)|
2
2
(i.e., the sole critical noise gain), giving
|H
0y
(z)|
2
2
= 1.3 (whereas |H
0y
(z)|
2
2
21 for = 1/8). In
this case, the coefcients are
0
= 0.999237,
1
= 0.007874,

2
= 0.015778,
1
= 0.010895, and
2
= 0.015778.
4) Suppression of Overow Limit Cycles: Since 1/8
1/2 whereas 1 cos
r
T = 0.0020 , (40) holds. The
quantization step is 2
15
3 10
5
, allowing quantization
effects to be neglected. Thus, the assumptions of the theorem
in Section V hold if u(n) = 0 and the saturation overow
characteristic is used.
1280 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS, VOL. 56, NO. 4, APRIL 2009
Fig. 6. Simulation results for single-precision implementation of
1
. (a) Output signal. (b) State variables.
Fig. 7. (Solid) Near-steady-state xed-point output signals with (dashed) ideal output signal overlayed. (a) Single-precision implementation of
1
with
= 1/8. (b) Double-precision implementation of
1
with = 1/2.
B. Evaluation
As digital dynamic systems can be exactly simulated (with
loss only of the real-time aspect), we evaluate performance
using MATLAB. A clear benet as compared to experiments
on a DSP is that an ideal implementation (i.e., oating-point
arithmetic with a 32-bit word length) easily can be run in
parallel, for comparison. The algorithms are implemented in an
m le using for loops.
The input signal is chosen at u(n) = 0.7 + 0.2 sin
r
nT for
0 nT < 0.7 s. To force overow events, u(n) = sin
r
nT is
selected for 0.7 nT < 0.8 s, while u(n) = 0 for nT 0.8 s.
Simulation results are shown in Fig. 6. It is seen that the
resonant-frequency component decays with the theoretical time
constant 2/
c
= 0.13 s. Moreover, no overow instabilities
occur, even though u(n) ,= 0.
In Fig. 7, output signals for single- and double-precision
implementations of
1
with the ideal output signal overlayed
are shown for the time interval [0.6, 0.7] s. Steady state has al-
most been reached. For single-precision implementation of
1
,
there is a discernable difference between the ideal and xed-
point outputs, but not for double-precision implementation. The
amplitude is approximately 0.002, agreeing with Fig. 5, which
shows that the gain at =
r
is 0.01.
The variance
2
y
of the output quantization noise can be
measured by taking the squared difference between the ideal
and xed-point outputs averaged over N samples. N = 7000 is
HARNEFORS: IMPLEMENTATION OF RESONANT CONTROLLERS AND FILTERS 1281
selected, i.e., the computation is stopped when the input signal
is modied to give overow. For single-precision implementa-
tion of
1
with = 1/8, this yields a measured total noise
gain of 420, agreeing well with the theoretical 430. For double-
precision implementation of
1
with = 1/2 and = 1/8,
we obtain 2.7 and 26, respectively, versus the theoretical 1.3
and 21. The stochastic quantization-noise model thus gives
reasonably good accuracy, at least in absolute terms.
VII. CONCLUSION
In this paper, explicit design formulas by which the discrete-
time resonator coefcients
1,2
and
0,1,2
can be obtained from
a continuous-time prototype resonator were derived. Recom-
mendations for selection of the power-of-two coefcients
and k were also given, with the objectives of preventing over-
ow as well as giving good accuracy of the notch and resonant
frequencies and a low total quantization-noise gain. In order
to make the latter very low, double-precision implementation
of the numerical integrators
1
is required. Implementation
on a standard 16-bit DSP is quite feasible. For the saturation
overow characteristic, the algorithm was shown to be free of
overow limit cycles under reasonable assumptions.
REFERENCES
[1] T. M. Rowan and R. J. Kerkman, A new synchronous current regulator
and an analysis of current-regulated PWM inverters, IEEE Trans. Ind.
Appl., vol. IA-22, no. 4, pp. 678690, Jul./Aug. 1986.
[2] R. Teodorescu, F. Blaabjerg, M. Liserre, and P. C. Loh, Proportional-
resonant controllers and lters for grid-connected voltage-source
converters, Proc. Inst. Elect. Eng.Electr. Power Appl., vol. 153, no. 5,
pp. 750762, Sep. 2006.
[3] M. J. Newman and D. G. Holmes, Delta operator digital lters for high
performance inverter applications, IEEE Trans. Power Electron., vol. 18,
no. 1, pp. 447454, Jan. 2003.
[4] L. Harnefors, Modeling of three-phase dynamic systems using complex
transfer functions and transfer matrices, IEEE Trans. Ind. Electron.,
vol. 54, no. 4, pp. 22392248, Aug. 2007.
[5] R. Teodorescu, F. Blaabjerg, and M. Liserre, Multiple harmonics control
of three-phase grid converter systems with the use of PI-RES current
controller in a rotating frame, IEEE Trans. Power Electron., vol. 21,
no. 3, pp. 836841, May 2006.
[6] I. Etxeberria-Otadui, A. Lpez de Heredia, H. Gaztaaga, S. Bacha, and
M. R. Reyero, A single synchronous frame hybrid (SSFH) multifre-
quency controller for power active lters, IEEE Trans. Ind. Electron.,
vol. 53, no. 5, pp. 16401648, Oct. 2006.
[7] I. Etxeberria-Otadui, U. Viscarret, M. Caballero, A. Rufer, and S. Bacha,
New optimized PWM VSC control structures and strategies under un-
balanced voltage transients, IEEE Trans. Ind. Electron., vol. 54, no. 5,
pp. 29022914, Oct. 2007.
[8] L. Asiminoaei, E. Aeloiza, P. N. Enjeti, and F. Blaabjerg, Shunt active-
power-lter topology based on parallel interleaved inverters, IEEE Trans.
Ind. Electron., vol. 55, no. 3, pp. 11751189, Mar. 2008.
[9] L. Harnefors, L. Zhang, and M. Bongiorno, Frequency-domain passivity-
based current controller design, IET Power Electron., vol. 1, no. 4,
pp. 455465, Dec. 2008.
[10] L. Wanhammar, DSP Integrated Circuits. New York: Academic, 1999.
[11] J. Kauraniemi, T. I. Laakso, I. Hartimo, and S. J. Ovaska, Delta opera-
tor realizations of direct-form IIR lters, IEEE Trans. Circuits Syst. II,
Analog Digit. Signal Process., vol. 45, no. 1, pp. 4152, Jan. 1998.
[12] P. M. Ebert, J. E. Mazo, and M. G. Taylor, Overowoscillations in digital
lters, Bell Syst. Tech. J., vol. 48, pp. 29993020, Nov. 1969.
[13] L. B. Jackson, On the interaction of roundoff noise and dynamic range
in digital lters, Bell Syst. Tech. J., vol. 49, pp. 159184, Feb. 1970.
[14] L. B. Jackson, Roundoff-noise analysis for xed-point digital lters
realized in cascade or parallel form, IEEE Trans. Audio Electroacoust.,
vol. AU-18, no. 2, pp. 107122, Jun. 1970.
[15] R. H. Middleton and C. G. Goodwin, Digital Control and Estimation:
A Unied Approach. Englewood Cliffs, NJ: Prentice-Hall, 1990.
[16] J. W. Brown and R. W. Churchill, Complex Variables and Applications,
6th ed. New York: McGraw-Hill, 1996.
[17] T. A. C. M. Claasen, W. F. G. Mecklenbruker, and J. B. H. Peek, On
the stability of the forced response of digital lters with overow non-
linearities, IEEE Trans. Circuits Syst., vol. CAS-22, no. 8, pp. 692696,
Aug. 1975.
[18] T. Claasen and L. O. G. Kristiansson, Necessary and sufcient conditions
for the absence of overow phenomena in a second-order recursive digital
lter, IEEE Trans. Acoust., Speech, Signal Process., vol. ASSP-23, no. 6,
pp. 509515, Dec. 1975.
[19] D. Liu and A. N. Michel, Asymptotic stability of discrete-time sys-
tems with saturation nonlinearities with applications to digital lters,
IEEE Trans. Circuits Syst. I, Reg. Papers, vol. 39, no. 10, pp. 798807,
Oct. 1992.
[20] A. Fettweis and K. Meerktter, Suppression of parasitic oscillations in
wave digital lters, IEEE Trans. Circuits Syst., vol. CAS-22, no. 3,
pp. 239246, Mar. 1975.
Lennart Harnefors (S93M97SM07) was born
in Eskilstuna, Sweden, in 1968. He received the
M.Sc., Licentiate, and Ph.D. degrees in electrical
engineering from the Royal Institute of Technol-
ogy, Stockholm, Sweden, in 1993, 1995, and 1997,
respectively, and the Docent (D.Sc.) degree in in-
dustrial automation from Lund University, Lund,
Sweden, in 2000.
From 1994 to 2005, he was with Mlardalen Uni-
versity, Vsters, Sweden, where he, in 2001, was
appointed as a Professor of electrical engineering.
From 2001 to 2006, he was also a part-time Visiting Professor of electrical
drives with Chalmers University of Technology, Gteborg, Sweden. He is
currently with ABB Power Systems/HVDC, Ludvika, Sweden. His research
interests include applied signal processing and control, in particular, control of
power electronic systems and ac drives.
Dr. Harnefors is an Associate Editor of the IEEE TRANSACTIONS ON
INDUSTRIAL ELECTRONICS and the International Journal of Power Electron-
ics. He was the recipient of the 2000 ABB Gunnar Engstrm Energy Award
and the 2002 IEEE TRANSACTIONS ON INDUSTRIAL ELECTRONICS Best
Paper Award.

S-ar putea să vă placă și