An Experimental Evaluation of the Delta Operator in Digital Control
by
Brandon L. Eidson
A thesis submitted to the Graduate Faculty of
Auburn University
in partial ful llment of the
requirements for the Degree of
Master of Science
Auburn, Alabama
August 9, 2010
Keywords: Digital Control, Delta Operator, Finite Word-Length
Copyright 2010 by Brandon L. Eidson
Approved by:
John Y. Hung, Chair, Professor of Electrical and Computer Engineering
R. Mark Nelms, Professor and Chair of Electrical and Computer Engineering
Stanley J. Reeves, Professor of Electrical and Computer Engineering
Abstract
Interest in digital control systems has been on the rise over recent decades with the ever
decreasing cost and increasing performance of microprocessors and the academic advance-
ments in control theory. Although there are many bene ts to digital control, there are many
challenges. This study explores one obstacle presented by nite word-length microproces-
sors: the limited range of numbers that can be represented. The goal is to compare its e ects
using two di erent discrete operators|the shift operator and the delta operator.
The experiment is designed in order to accommodate a second challenge in digital con-
trols: most engineers and technicians are far more experienced with continuous controller
design. Therefore, this analysis?s control design takes place in continuous-time. Both shift
and delta-operator-based di erence equations are derived from the continuous transfer func-
tion. The ability of each competing model to perform under nite word-length conditions is
evaluated through mathematical analysis, simulation, and experimentation. These demon-
strations are made using a PID controller to compensate a DC-DC buck converter. It is
concluded that the delta operator representation is less susceptible to the numerical limita-
tions and shows greater performance resemblance to the original continuous compensator.
ii
Acknowledgments
Soli Deo gloria.
iii
Table of Contents
Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
List of Figures . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
1 Topic Introduction and Background . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Digital Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 The Delta Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 The Focus of this Thesis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Overview of the Delta Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1 De nition of Delta Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Higher-Order Representations . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2.1 Second-Order, Causal Delta Operator . . . . . . . . . . . . . . . . . . 7
2.2.2 Third-Order, Causal Delta Operator . . . . . . . . . . . . . . . . . . 8
2.2.3 In General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.3 Stability Region Parallels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3 Mathematical Demonstration of Coe cient Constraints on Discrete Models . . . 12
3.1 General Mathematical Analysis . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1.1 General Transfer Function Conversion to Shift Operator Representation 12
3.1.2 Shift Operator Representation to Delta Operator Representation . . 15
3.2 Discrete Representations of a PID Controller . . . . . . . . . . . . . . . . . . 16
3.2.1 Z-Transforming the PID . . . . . . . . . . . . . . . . . . . . . . . . . 16
3.2.2 The Shift Operator Di erence Equation . . . . . . . . . . . . . . . . 17
3.2.3 The Delta Operator Di erence Equation . . . . . . . . . . . . . . . . 19
iv
4 Experiment Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
4.1 Hardware and System Con guration . . . . . . . . . . . . . . . . . . . . . . 24
4.1.1 The Plant: DC-DC Buck Converter . . . . . . . . . . . . . . . . . . . 24
4.1.2 The Microcontroller: 18F PICTM . . . . . . . . . . . . . . . . . . . . 30
4.2 Software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4.2.1 Practical Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2.2 Addition/Subtraction Subroutines . . . . . . . . . . . . . . . . . . . . 35
4.2.3 Duty-Cycle Calculation: Shift Operator . . . . . . . . . . . . . . . . . 37
4.2.4 Duty Cycle Calculation: Delta Operator . . . . . . . . . . . . . . . . 40
4.2.5 Timing Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
5 System Modeling and Simulation . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.1 Modeling of DC-DC Buck Converters . . . . . . . . . . . . . . . . . . . . . . 45
5.2 Modeling of Analog PID Controllers . . . . . . . . . . . . . . . . . . . . . . . 54
5.3 Modeling of Non-ideal Digital Controllers in Simulink . . . . . . . . . . . . . 55
5.3.1 Shift-Based Digital PID Controller in Simulink . . . . . . . . . . . . . 56
5.3.2 Delta-Based Digital PID Controller in Simulink . . . . . . . . . . . . 57
6 Simulation and Experimental Results . . . . . . . . . . . . . . . . . . . . . . . . 59
6.1 Continuous PID Controller Designs . . . . . . . . . . . . . . . . . . . . . . . 59
6.2 Discrete PID Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
6.2.1 Shift Operator Performance . . . . . . . . . . . . . . . . . . . . . . . 64
6.2.2 Delta Operator Performance . . . . . . . . . . . . . . . . . . . . . . . 69
7 Conclusions and Potential Future Work . . . . . . . . . . . . . . . . . . . . . . . 76
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
v
List of Figures
1.1 Block diagram of generic, continuous control system . . . . . . . . . . . . . . 2
1.2 Block diagram of generic, digital control system . . . . . . . . . . . . . . . . 2
1.3 Some digital control system weaknesses . . . . . . . . . . . . . . . . . . . . . 2
2.1 Stability region of d=dt operator . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.2 Stability region of shift operator . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.3 Stability region of delta operator . . . . . . . . . . . . . . . . . . . . . . . . 11
3.1 Continuous PID coe cients that will not result in truncation using shift op-
erator parameterization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.2 Continuous PID coe cients that will not result in truncation using delta op-
erator parameterization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.3 Comparison of possible continuous PID coe cients without truncation occur-
ring in the shift and delta operators di erence equations, View 1 . . . . . . . 23
3.4 Comparison of possible continuous PID coe cients without truncation occur-
ring in the shift and delta operators di erence equations, View 2 . . . . . . . 23
4.1 Schematic for digitally controlled buck converter . . . . . . . . . . . . . . . . 25
4.2 An ideal buck converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
4.3 Equivalent ideal buck converter with switch closed . . . . . . . . . . . . . . . 26
4.4 Equivalent ideal buck converter with switch open . . . . . . . . . . . . . . . 27
4.5 A simple voltage divider schematic . . . . . . . . . . . . . . . . . . . . . . . 28
4.6 General overview of software algorithm . . . . . . . . . . . . . . . . . . . . . 34
4.7 Subtraction when both numbers are known to be positive . . . . . . . . . . . 36
4.8 Addition of two numbers that could be either positive or negative . . . . . . 37
vi
4.9 Subtraction of two numbers that could be either positive or negative . . . . . 38
4.10 Overview of duty cycle calculation based on the shift operator . . . . . . . . 39
4.11 Overview of duty cycle calculation based on the delta operator . . . . . . . . 41
4.12 The approximate timing diagram for the shift-operator-based controller algo-
rithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.13 The approximate timing diagram for the delta-operator-based controller algo-
rithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
4.14 The approximate timing diagram for the overall system . . . . . . . . . . . . 44
5.1 A typical buck converter with inductor and capacitor ESRs . . . . . . . . . . 46
5.2 Non-ideal buck converter with transistor switch closed . . . . . . . . . . . . . 47
5.3 Non-ideal buck converter with transistor switch open . . . . . . . . . . . . . 47
5.4 State diagram for a buck converter . . . . . . . . . . . . . . . . . . . . . . . 49
5.5 Open-loop buck converter Simulink model . . . . . . . . . . . . . . . . . . . 51
5.6 PWM generator Simulink model . . . . . . . . . . . . . . . . . . . . . . . . . 51
5.7 Simulink simulation of open-loop response with Vref = 2:5V . . . . . . . . . 52
5.8 Pspice schematic of open-loop buck converter . . . . . . . . . . . . . . . . . 52
5.9 Pspice simulation result of open-loop response . . . . . . . . . . . . . . . . . 53
5.10 Experimental versus simulation open-loop response . . . . . . . . . . . . . . 54
5.11 Closed-loop buck converter with continuous-time PID controller . . . . . . . 55
5.12 Closed-loop buck converter with discrete-time PID controller . . . . . . . . . 56
5.13 Simulation model of the shift-operator-based PID di erence equation . . . . 57
5.14 Block diagram of the delta operator . . . . . . . . . . . . . . . . . . . . . . . 57
5.15 Simulation model of the delta-operator-based PID di erence equation . . . . 58
6.1 Initial transient; Continuous PID; KP=50, KI=140000, KD=0.0075 . . . . . 60
6.2 Initial transient; Continuous PID; KP=70, KI=60500, KD=0.0084 . . . . . . 60
6.3 Initial transient; Continuous PID; KP=40, KI=40300, KD=0.0064 . . . . . . 61
vii
6.4 Initial transient; Continuous PID; KP=6, KI=20160, KD=0.0005 . . . . . . 61
6.5 Initial transient; Continuous PID; KP=170, KI=5040, KD=0.0127 . . . . . . 62
6.6 Initial transient; Continuous PID; KP=75, KI=2500, KD=0.0124 . . . . . . 62
6.7 Initial transient; Continuous PID; KP=300, KI=1260, KD=0.04 . . . . . . . 63
6.8 Initial transient; Continuous PID; KP=100, KI=1260, KD=0.03 . . . . . . . 63
6.9 Initial transient; shift operator PID; KP=50, KI=140000, KD=0.0075 . . . . 65
6.10 Initial transient; shift operator PID; KP=70, KI=60500, KD=0.0084 . . . . 65
6.11 Initial transient; shift operator PID; KP=40, KI=40300, KD=0.0064 . . . . 66
6.12 Initial transient; shift operator PID; KP=6, KI=20160, KD=0.0005 . . . . . 66
6.13 Initial transient; shift operator PID; KP=170, KI=5040, KD=0.0127 . . . . 67
6.14 Initial transient; shift operator PID; KP=75, KI=2500, KD=0.0124 . . . . . 67
6.15 Initial transient; shift operator PID; KP=300, KI=1260, KD=0.04 . . . . . . 68
6.16 Initial transient; shift operator PID; KP=100, KI=1260, KD=0.03 . . . . . . 68
6.17 Initial transient; delta operator PID; KP=50, KI=140000, KD=0.0075 . . . 69
6.18 Initial transient; delta operator PID; KP=70, KI=60500, KD=0.0084 . . . . 70
6.19 Initial transient; delta operator PID; KP=40, KI=40300, KD=0.0064 . . . . 70
6.20 Initial transient; delta operator PID; KP=6, KI=20160, KD=0.0005 . . . . . 71
6.21 Initial transient; delta operator PID; KP=170, KI=5040, KD=0.0127 . . . . 71
6.22 Initial transient; delta operator PID; KP=75, KI=2500, KD=0.0124 . . . . . 72
6.23 Initial transient; delta operator PID; KP=300, KI=1260, KD=0.04 . . . . . 72
6.24 Initial transient; delta operator PID; KP=100, KI=1260, KD=0.03 . . . . . 73
6.25 Initial transient; Continuous vs. Delta; KP=50, KI=140000, KD=0.0075 . . 74
6.26 Initial transient; Continuous vs. Delta; KP=70, KI=60500, KD=0.0084 . . . 74
6.27 Initial transient; Continuous vs. Delta; KP=40, KI=40300, KD=0.0064 . . . 75
6.28 Initial transient; Continuous vs. Delta; KP=6, KI=20160, KD=0.0005 . . . 75
viii
List of Tables
5.1 Model parameters for experimental buck converter . . . . . . . . . . . . . . . 50
6.1 Gains and coe cients used in the simulations and experiments for Ts = 49:6 s 64
ix
Chapter 1
Topic Introduction and Background
1.1 Digital Control
Academia?s interest in digital control has been increasing proportionally to the increase
in digital technologies. The combination of ever faster and lower-cost processors secures a
place in future digital control approaches in control system applications. The implementation
of complex algorithms with a single processor rather than a multitude of integrated circuits
is also increasingly attractive. The ease of modi cation and superior imperviousness to aging
add additional credibility to the overall value of digital control systems. However, the world
that engineers desire to control is inherently analog and continuous, so transforming a system
from a continuous, closed-loop control system (Figure 1.1) to a discrete, closed-loop control
system (Figure 1.2) does not come without challenges.
The implementation of the digital control system shown in Figure 1.2 can be described
more speci cally for this thesis by Figure 1.3, which points out some of the main weaknesses
of digital systems. Time delays are caused by the analog-to-digital converter and the com-
putation of the new control signal. An n-bit processor?s resolution is limited to increments
of (x2 x1)=2n, where x1 and x2 are the maximum and minimum values of the range that is
desired to be represented. Also, the processor itself can only work with numbers from 0 to
2n 1. This last limitation is the main focus of this thesis.
The bene ts and trade-o s associated with digital control systems versus analog control
systems are well recorded and documented at the beginning of nearly every paper on the sub-
ject. There is extensive modern research attempting to improve digital control performance
through complex control algorithms [1] [2], advanced digital control theory approaches [3]
1
Figure 1.1: Block diagram of generic, continuous control system
Figure 1.2: Block diagram of generic, digital control system
Figure 1.3: Some digital control system weaknesses
2
[4], reducing e ects of numerical limitations [5], and overcoming analog-to-digital, digital-
to-analog, and computational delays [6].
This research is rightly placed. However, it is not simply overcoming the various math-
ematical and physical challenges that will be necessary for the progress in digital control to
be utilized. Experienced engineers and academics are far more adept at and comfortable
with traditional analog control theory. There are advancements being made, though, that
have potential to reduce performance and pedagogical di culties at the same time.
1.2 The Delta Operator
The incremental di erence operator (or delta operator) has been proposed as an alter-
native to the shift operator when representing discrete functions. A very notable work on
the delta operator (and delta transform) has been produced by Richard Middleton and Gra-
ham Goodwin [7]. Their work thoroughly introduces all the major areas of digital control
theory through the use of the delta operator, proposing that the study of both continuous
and discrete controls can be accomplished simultaneously since there is a narrow distinction
between the two when considering the delta operator for discrete parameterizations. This
thesis introduces some of these basic concepts of the delta operator in Chapter 2, but for a
thorough understanding, Middleton and Goodwin?s textbook should be referenced [7].
Others have explored the potential bene ts of the delta operator over the shift operator,
especially when considering the e ects of nite word-length. Chen, Wu, Istepanian and Chu
have shown that the closed-loop stability margin of delta operator parameterizations are
better than the shift operator approach [8] [9]. Li and Gevers demonstrated that the delta
operator representations of state-variable models are less sensitive to coe cient errors in the
state-space matrices due to nite word-length [10]. Before these, Middleton and Goodwin
argued for the delta operator?s ability to:
1. better represent controller coe cients,
3
2. reduce rounding error, and
3. facilitate more straightforward design by pole assignment [11].
The delta operator signi cantly closes the gap between continuous and discrete control
theory. In addition to potential performance improvement over the z-Transform, the con-
ceptual and mathematical similarities between the -Domain and the s-Domain can make
understanding discrete controls far easier|especially for someone already familiar with ana-
log controls. Some examples of these connections are introduced later in this text, but the
main focus will be on the delta and shift operators? coe cient representation restrictions
presented by nite word-length.
1.3 The Focus of this Thesis
The proposed performance bene t of the delta operator over the shift operator under
nite word-length situations could have many advantages in industry. For instance, con-
sider that most of today?s control engineers and technicians are experienced with continuous
control design. Also, even though the use of oating-point processors is on the rise, many
applications still prefer xed-point implementations due to their reduced cost and power
consumption and increased speed and simplicity. There are similar bene ts associated with
reduced word-length. Combining these realities reveals a bene t in having delta-operator-
based control algorithms.
This is, of course, dependent on the improved e ectiveness of the delta operator?s per-
formance and continuous-like behavior in practice over the shift operator when transforming
from an analog to a digital controller representation. This thesis explores one facet of the
proposed bene ts: the numerical characteristics of the controller coe cients due to nite
word-length. An investigation of the mathematical traits of a shift-operator-based (q-based)
di erence equation and a delta-operator-based ( -based) di erence equation, both having
4
been derived from the same s-Domain transfer function, is conducted. The results are sim-
ulated and tested using an 8-bit programmable interface controller (PICTM) to implement
a proportional, integral, derivative (PID) compensator to control a DC-DC buck converter.
Other digital control weaknesses are minimized and/or held constant so as to explore the
nite word-length characteristics.
Chapter 2 provides an overview of the delta operator. Chapter 3 conducts the mathe-
matical analysis of the shift and delta operators? resultant di erence equations and derives
the corresponding PID di erence equations. Chapter 4 explains the hardware and software
utilized to implement an experiment of the results from Chapter 3. The basic concepts of
the representative plant, a buck converter, are introduced, as well as the appropriateness of
an 18F series PICTM as the microprocessor for this experiment. Chapter 4 concludes with
an explanation of the software algorithms. The system modeling and simulation designs are
discussed in Chapter 5, and the simulation and experimental results are recorded in Chapter
6. Chapter 7 presents the thesis conclusions and provides recommendations for future work.
5
Chapter 2
Overview of the Delta Operator
Because the equivalent continuous-time operator is d=dt, one might suspect that it
would not bear much resemblance to the discrete shift operator, q. This is exactly what has
been observed by academia and industry for decades. However, if a discrete-time operator
equivalent to a derivative is used, an increased correspondence would be expected. This
premise is the historic motivation behind the development of the delta operator.
2.1 De nition of Delta Operator
The incremental di erence operator (or delta operator) is typically de ned as:
= q 1T
s
where Ts is the sampling period and q is the classic forward-shift operator, de ned as:
qxk = xk+1
making
xk = xk+1 xkT
s
where xk is a state at the k-th sample. This expression demonstrates the correlation the delta
operator makes between discrete and continuous time. Notice that the delta operator acts
like an approximation of a derivative as Ts approaches 0 (the sampling rate, fs, approaches
1). So, at an in nite sampling rate, operating on xk would be identical to d=dt operating
on xk!
6
Now, for most practical purposes, it is necessary to write the delta operator in a causal
form. The causal (backward) delta operator is de ned as:
1 = 1 q
1
Ts (2.1.1)
where q 1 is the causal (backward) shift operator:
q 1xk = xk 1
Therefore,
1xk = xk xk 1T
s
(2.1.2)
2.2 Higher-Order Representations
In most applications, higher-order operators are necessary to implement a control sys-
tem.
2.2.1 Second-Order, Causal Delta Operator
The second-order operator is:
2xk = 1( 1xk)
= 1(xk xk 1T
s
)
The second-order delta operator can be viewed as the di erence of di erences, or the ap-
proximation of a second-order derivative as Ts approaches 0, in the following form:
2xk =
xk xk 1
Ts
xk 1 xk 2
Ts
Ts (2.2.1)
7
For implementing in a real-time program, the following form can be derived from observing
equations (2.1.2) and (2.2.1):
2xk =
1xk 1xk 1
Ts (2.2.2)
2.2.2 Third-Order, Causal Delta Operator
Applying a third delta operator will help reveal a pattern for the causal delta operator,
as shown by the following:
3xk = 1( 2xk)
= 1
xk xk 1
Ts
xk 1 xk 2
Ts
Ts
!
The third-order derivative approximation for the delta operator is seen here:
3xk =
xk xk 1
Ts
xk 1 xk 2
Ts
Ts
xk 1 xk 2
Ts
xk 2 xk 3
Ts
Ts
Ts (2.2.3)
If equations (2.1.2), (2.2.2) and (2.2.3) are examined closely, more programmable-friendly
forms can be found, such as:
3xk =
1xk 1xk 1
Ts
1xk 1 1xk 2
Ts
Ts (2.2.4)
or
3xk =
2xk 2xk 1
Ts (2.2.5)
8
2.2.3 In General
From examining equations (2.1.2), (2.2.2), and (2.2.5), a general pattern is observed so
that the following de nition can be made:
nxk =
(n 1)xk (n 1)xk 1
Ts (2.2.6)
where n represents any integer. This result is conceptually consistent as the delta operator is
thought of as a derivative approximation. Higher-order derivatives simply represent changes
in changes (e.g., acceleration being the change in velocity, which is the change in position).
2.3 Stability Region Parallels
One additional illustration will serve to introduce the shared relationship and bene t
the delta operator provides in relation to continuous control systems. The stability regions
of their root locus plots will be examined. These facts are simply recorded; the reader can
investigate [7] for further explanation.
All the poles of the Laplace transform model of stable continuous-time systems lie
strictly in the left-half of the s-plane (Figure 2.1). The eigenvalues of a system matrix in
linear state variable form are found in the same region.
The shift operator?s stability region is signi cantly di erent, consisting of only the unit
circle (Figure 2.2).
When the stability region of the delta operator (Figure 2.3) is observed, an interesting
relationship with the continuous-time diagram is seen. The circle?s origin is shifted to the
point 1=Ts +j0. The radius of the stability region circle is also 1=Ts. As Ts approaches 0,
the stability region of and d=dt become identical!
9
Figure 2.1: Stability region of d=dt operator
Figure 2.2: Stability region of shift operator
10
Figure 2.3: Stability region of delta operator
11
Chapter 3
Mathematical Demonstration of Coe cient Constraints on Discrete Models
In order to implement a digital controller in software, the transfer function must be
written as a causal di erence equation. The rst section of this chapter nds the general
di erence equations from a generic continuous-time transfer function. Although the solutions
are somewhat complex, one can clearly see the numeric bene ts of the delta operator.
In the second section, two di erence equations are obtained for a classic PID controller.
The observed numeric bene ts in general are realized in this speci c example.
3.1 General Mathematical Analysis
3.1.1 General Transfer Function Conversion to Shift Operator Representation
A transfer function, G(s), is de ned as the relation between the input and output of a
general system:
G(s) = Y(s)X(s)
and its general form is:
G(s) = aks
k +ak 1sk 1 +:::+a1s+a0
bjsj +bj 1sj 1 +:::+b1s+b0
In order to discretize the transfer function, most advanced controls engineers would use
the bilinear (or Tustin or Trapezoidal) approximation. In order to reduce the complexity of
the math, Euler?s backward di erence approximation is utilized:
s 1 z
1
Ts
12
where Ts is the sampling period. Making the above substitution yields:
G(z) =
ak
Tks (1 z
1)k + ak 1
Tk 1s (1 z
1)k 1 +:::+ a1
Ts(1 z
1) +a0
bj
Tjs (1 z
1)j + bj 1
Tj 1s (1 z
1)j 1 +:::+ b1
Ts(1 z
1) +b0
and after nding common denominators of the numerator and denominator the result can
be written as:
G(z) =
Tj
s
Tks
ak(1 z 1)k +ak 1Ts(1 z 1)k 1 +:::+a1Tk 1
s (1 z
1) +a0Tk
s
bj(1 z 1)j +bj 1Ts(1 z 1)j 1 +:::+b1Tj 1s (1 z 1) +b0Tjs
Since this thesis?s experiment is controlling a buck converter, it will be helpful to de ne
the discrete transfer function as:
G(z) = D(z)E(z)
where d[n] and e[n] represent the duty cycle and the error signal at time nTs, respectively,
where n = 1;2;3:::. So, the di erence equation can be found by cross multiplying:
D(z)[bj(1 z 1)j +bj 1Ts(1 z 1)j 1 +:::+b1Tj 1s (1 z 1) +b0Tjs] =
E(z)
Tj
s
Tks
[ak(1 z 1)k +ak 1Ts(1 z 1)k 1 +:::+a1Tk 1s (1 z 1) +a0Tks ]
and substituting in the equivalent time-domain components:
d[n][bj(1 q 1)j +bj 1Ts(1 q 1)j 1 +:::+b1Tj 1s (1 q 1) +b0Tjs] =
e[n]
Tj
s
Tks
[ak(1 q 1)k +ak 1Ts(1 q 1)k 1 +:::+a1Tk 1s (1 q 1) +a0Tks ]
(3.1.1)
This can be written more concisely by utilizing the binomial theorem:
(x+y)k =
kX
i=0
k
i
xk iyi
13
where
k
i
= k!i!(k i)!
A general expression emerges such that
(x+y)k + (x+y)k 1 +:::(x+y) + 1 =
kX
m=0
k mX
i=0
k m
i
x(k m) iyi
(3.1.2)
By applying equation (3.1.2) to equation (3.1.1), the di erence equation becomes:
d[n]
jX
m=0
bj mTms
j mX
i=0
j m
i
( q) i
=
e[n]
Tj
s
Tks
kX
m=0
ak mTms
k mX
i=0
k m
i
( q) i
(3.1.3)
The nal, causal di erence equation for d[n] based on the shift operator can be written as:
d[n] =
jX
m=0
bj mTms
1"
d[n]
jX
m=0
bj mTms
j mX
i=1
j m
i
( q) i
+
e[n]
Tj
s
Tks
kX
m=0
ak mTms
k mX
i=0
k m
i
( q) i
# (3.1.4)
Although this result is complex, what is important to understand is not. Observe in
particular the scaling term Tjs=Tks . Unless k = j, every coe cient in the di erence equation
multiplied by every shifted version of e[n] will have a term scaled by some power of Ts. This
same possibility exists for many of the coe cients even if k = j. Because a sampling period
is typically in ranges of 10 5 to 10 6 seconds, the coe cients will vary over many orders of
magnitude.
There are important implications for this scaling characteristic in nite word-length
mircocontrollers. Speci cally, the maximum value a microcontroller can represent is 2 1,
where is the number of bits. For example, an 8-bit microcontroller can only represent
values up to 255. The max value due to this hardware-related constraint has the potential
14
to be orders of magnitude smaller than the values required if the sampling period is in a
range typical for digital control systems.
3.1.2 Shift Operator Representation to Delta Operator Representation
By rearranging equation (2.1.1), one obtains
q 1 = 1 Ts 1
and equation (3.1.1) can be rewritten as:
d[n][bj(Ts 1)j +bj 1Ts(Ts 1)j 1 +:::+b1Tj 1s (Ts 1) +b0Tjs] =
e[n]
Tj
s
Tks
[ak(Ts 1)k +ak 1Ts(Ts 1)k 1 +:::+a1Tk 1s (Ts 1) +a0Tks ]
Therefore,
d[n]
jX
m=0
bmTj ms Tms m = e[n]
Tj
s
Tks
kX
m=0
amTk ms Tms m
Combining the Ts?s and moving them in front of the summations yields:
d[n]Tjs
jX
m=0
bm m = e[n]
Tj
s
Tks
Tks
kX
m=0
am m
This result shows that the sampling periods can be canceled from the equations:
d[n]
jX
m=0
bm m = e[n]
kX
m=0
am m
If b0 6= 0, the nal, causal di erence equation for d[n] based on the delta operator can be
written as:
d[n] = b 10
h
d[n]
jX
m=1
bm m +e[n]
kX
m=0
am m
i
(3.1.5)
15
Because the sampling periods canceled, the scaling issue associated with the coe cients
of the shift-operator-based di erence equations is no longer as severe!
Each delta operator term, though, factors in dividing by the sampling period. So, even
though the coe cients of the delta-operator-based di erence equation are not a ected by
the sampling period in the same way as the shift operator di erence equation, the sampling
period cannot be ignored altogether.
Also, if b0 = 0, some change in the duty cycle will have to be solved for, rather than
the new duty cycle itself, and this will introduce the sampling period into the coe cients.
This will be seen with the PID controller?s di erence equation. However, by using the
delta operator approach, the sampling period will be easily absorbed into the design of the
coe cients as will be demonstrated later.
3.2 Discrete Representations of a PID Controller
To demonstrate the superior numerical aspects of the delta operator, an experiment is
conducted to compare shift operator and delta operator control of a buck converter. A PID
compensator is designed in its analog form, then mathematically represented by two di erent
di erence equations|one shift-operator-based and the other delta-operator-based. In this
section, the two competing di erence equations are derived.
3.2.1 Z-Transforming the PID
The PID controller is one of the most common controllers used in industry process
system applications. A standard academic practice is to use the PID or compare to the PID
when testing new control techniques or aspects; see examples in [12, 13, 14, 15]. The Laplace
Transform form of the classical PID compensator is de ned as:
D(s)
E(s) = KP +sKD +
KI
s (3.2.1)
16
As before, Euler?s backward di erence approximation is utilized to discretize the PID transfer
function:
s 1 z
1
Ts
Therefore,
D(z)
E(z) = KP +
KD(1 z 1)
Ts +
KITs
1 z 1
This simpli es to
D(z)
E(z) =
KPTs(1 z 1) +KD(1 2z 1 +z 2) +KIT2s
Ts(1 z 1)
and
D(z)
E(z) =
(KDTs )z 2 + ( Kp 2KDTs )z 1 + (KP + KDTs +TSKI)
(1 z 1) (3.2.2)
3.2.2 The Shift Operator Di erence Equation
To nd a di erence equation, cross multiply both sides of equation (3.2.2):
D(z)(1 z 1) = E(z)(KDT
s
)z 2 + ( Kp 2KDT
s
)z 1 + (KP + KDT
s
+TSKI)
Then replace z 1 with q 1 as follows:
dn(1 q 1) = en[(KDT
s
)q 2 + ( Kp 2KDT
s
)q 1 + (KP + KDT
s
+TSKI)]
A causal di erence equation is obtained to calculate the change in duty cycle. The resultant
equation for d is:
d = (KDT
s
)enq 2 + ( Kp 2KDT
s
)enq 1 + (KP + KDT
s
+TsKI)en (3.2.3)
17
which is equivalent to:
d = (KDT
s
)en 2 + ( Kp 2KDT
s
)en 1 + (KP + KDT
s
+TsKI)en (3.2.4)
Finally, equation (3.2.4) will be written as:
d = 2en 2 + 1en 1 + 0en (3.2.5)
where
2 = (KDT
s
) (3.2.6)
1 = ( Kp 2KDT
s
) (3.2.7)
0 = (KP + KDT
s
+TsKI) (3.2.8)
Equations (3.2.5) through (3.2.8) are the ones that will be used for programming the shift
operator?s di erence equation algorithm in this experiment. After the continuous coe cients,
KP, KD, and KI, have been determined, the coe cients will be calculated.
Notice, however, that all three of these coe cients are substantially larger than the
continuous coe cients because of the additions and, more importantly, the scaling by 1=Ts
on the KD term. For a -bit microcontroller, if
KD
Ts > 2
1
the coe cients cannot be properly represented without truncation (or over ow), much less
the results of the multiplications! Although truncation historically refers to removing LSBs,
this thesis will use it to refer to removing MSBs (e.g., in an 8-bit microcontroller, the
value 290 will have to be truncated to 255). The plot in Figure 3.1 illustrates the possible
18
Figure 3.1: Continuous PID coe cients that will not result in truncation using shift operator
parameterization
combinations of continuous PID gains that can be selected that will not result in the shift
operator?s di erence equation coe cients being truncated (or over owing).
3.2.3 The Delta Operator Di erence Equation
A di erent representation of the di erence equation presented by equation (3.2.3) can
be obtained by making the following substitutions:
q 1 = 1 Ts 1
19
and
q 2 = 1 2Ts 1 +T2s 2
The result is as follows:
d = (KDT
s
)T2sen 2 + (Kp + 2KDT
s
2KDT
s
)Tsen 1+
(KP 2KDT
s
+TsKI KP + KDT
s
+ KDT
s
)en
which simpli es to
d = (KDTs)en 2 + (KpTs)en 1 + (KITs)en (3.2.9)
As concluded from Section 3.1.2, because there is no constant in the denominator of the
original continuous transfer function (i.e., b0 = 0 in (3.1.5)), the sampling period appeared
in the coe cients of the delta-operator-based di erence equation. However, since it is not
possible to divide by Ts in the microcontroller chosen for the experiment (explained in detail
later), the sampling period will need to be absorbed into the coe cients. If the de nition of
the delta operator is substituted into equation (3.2.9),
d = (KDTs)
en en 1
Ts
en 1 en 2
Ts
Ts + (KpTs)
en en 1
Ts
+ (K
ITs)en
This can be rewritten as
d = D[(en en 1) (en 1 en 2)] +P[en en 1] +Ien (3.2.10)
20
where
D = KDT
s
(3.2.11)
P = KP (3.2.12)
I = TsKI (3.2.13)
Equations (3.2.10) through (3.2.13) are used in the delta-operator-based algorithm. In
this form, the \division" will occur at the same time as the coe cient multiplication. Also,
notice that now only one term contains KD=Ts. This way, if KD is designed so that it must
be truncated after being scaled by 1=Ts, only one coe cient will be thrown o , as opposed
to all three coe cients used in equation (3.2.4). The possible continuous PID coe cients
that can be used without truncation occurring on the delta-operator-based coe cients are
shown in Figure 3.2. These are compared with the shift operator?s limitations in Figures 3.3
and 3.4.
Care must be taken when designing KI because xed-point processors do not handle
decimals. If division is required, it must be by powers of 2. This consideration is described
in detail in the hardware section of the experimental implementation chapter.
For now, it is important to note that the continuous PID compensator gains, KD,
KP, and KI, are designed so that conveniently-programmable and untruncated di erence
equation coe cients are much easier and less limited with the delta-operator-based di erence
equations.
21
Figure 3.2: Continuous PID coe cients that will not result in truncation using delta operator
parameterization
22
Figure 3.3: Comparison of possible continuous PID coe cients without truncation occurring
in the shift and delta operators di erence equations, View 1
Figure 3.4: Comparison of possible continuous PID coe cients without truncation occurring
in the shift and delta operators di erence equations, View 2
23
Chapter 4
Experiment Implementation
In order to test the results from the mathematical demonstration, an experiment is
designed and implemented to compare the performance of a shift-operator-based controller
with a delta-operator-based controller. Both are implemented based on a continuously-
designed PID controller. Most of the schematics and simulation diagrams (Chapter 5) include
the capabilities of performing step-changes in load. These are not performed in this thesis;
only the initial transients will be observed.
4.1 Hardware and System Con guration
A DC-DC buck converter is provided to serve as a plant process, and an 18F1220 PICTM
microcontroller is selected as the equipment to create the compensated, closed-loop system.
The buck converter and controller are con gured as shown in Figure 4.1. The performance
characteristics are described in the following subsections.
4.1.1 The Plant: DC-DC Buck Converter
DC-DC converters are electronic devices used to regulate one DC voltage to another.
Buck converters are DC-DC converters speci cally designed to step down an input voltage
and are common control problems. A helpful way to introduce these devices is to derive
their ideal gain and e ciency. A typical schematic of an ideal buck converter is illustrated
in Figure 4.2.
Although buck converters can operate in a discontinuous conduction mode, this thesis
analysis and experiment will be limited to operation in continuous conduction mode only
(i.e., the inductor current is assumed to always be > 0). Therefore, for this thesis?s purposes,
24
Figure 4.1: Schematic for digitally controlled buck converter
Figure 4.2: An ideal buck converter
25
Figure 4.3: Equivalent ideal buck converter with switch closed
the buck converter will be operating in only two states: switch closed (\ON") and switch
opened (\OFF"). The signal q is a pulse-width modulated (PWM) signal that varies the
power transistor between saturation mode (switch closed or \ON") and cuto mode (switch
open or \OFF"). The switching period of q is denoted by TSW, and the ratio of its \ON"
time verses its switching period is de ned as the duty cycle, D:
D = TONT
SW
(4.1.1)
Notice that 0 D 1.
When the power transistor is conducting, 0 t TON, the buck converter is modeled
by Figure 4.3. In this case, the transistor acts as a closed switch (a short circuit), and the
diode is blocking, acting as an open circuit. When the power transistor enters cuto mode,
TON