pb wittenmark etal final

93
IFAC PROFESSIONAL BRIEF Computer Control: An Overview Björn Wittenmark http://www.control.lth.se/~bjorn Karl Johan Åström http://www.control.lth.se/~kja Karl-Erik Årzén http://www.control.lth.se/~karlerik Department of Automatic Control Lund Institute of Technology Lund, Sweden Abstract Computer control is entering all facets of life from home electronics to produc- tion of different products and material. Many of the computers are embedded and thus “hidden” for the user. In many situations it is not necessary to know anything about computer control or real-time systems to implement a simple controller. There are, however, many situations where the result will be much better when the sampled-data aspects of the system are taken into consideration when the controller is designed. Also, it is very important that the real-time as- pects are regarded. The real-time system influences the timing in the computer and can thus minimize latency and delays in the feedback controller. The paper introduces different aspects of computer-controlled systems from simple approximation of continuous time controllers to design aspects of optimal sampled-data controllers. We also point out some of the pitfalls of computer control and discusses the practical aspects as well as the implementation issues of computer control. 1

Upload: enver-espinal-santos

Post on 24-Nov-2015

23 views

Category:

Documents


3 download

TRANSCRIPT

  • IFAC PROFESSIONAL BRIEFComputer Control: An Overview

    Bjrn Wittenmark http://www.control.lth.se/~bjornKarl Johan strm http://www.control.lth.se/~kjaKarl-Erik rzn http://www.control.lth.se/~karlerikDepartment of Automatic ControlLund Institute of TechnologyLund, Sweden

    Abstract

    Computer control is entering all facets of life from home electronics to produc-tion of different products and material. Many of the computers are embeddedand thus hidden for the user. In many situations it is not necessary to knowanything about computer control or real-time systems to implement a simplecontroller. There are, however, many situations where the result will be muchbetter when the sampled-data aspects of the system are taken into considerationwhen the controller is designed. Also, it is very important that the real-time as-pects are regarded. The real-time system influences the timing in the computerand can thus minimize latency and delays in the feedback controller.

    The paper introduces different aspects of computer-controlled systems fromsimple approximation of continuous time controllers to design aspects of optimalsampled-data controllers. We also point out some of the pitfalls of computercontrol and discusses the practical aspects as well as the implementation issuesof computer control.

    1

  • Contents

    Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

    Computer-controlled Systems . . . . . . . . . . . . . . . . . . . . . . 4The Sampling Process . . . . . . . . . . . . . . . . . . . . . . . . . . 5Time Dependence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5Aliasing and New Frequencies . . . . . . . . . . . . . . . . . . . . . 6Approximation of Continuous-time Controllers . . . . . . . . . . . . 6Is There a Need for Special Design Methods? . . . . . . . . . . . . . 8Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    2. Sampling and Reconstruction . . . . . . . . . . . . . . . . . . . 11Shannons Sampling Theorem . . . . . . . . . . . . . . . . . . . . . . 11Aliasing and Antialiasing Filters . . . . . . . . . . . . . . . . . . . . 12Zero-order Hold DZOHE . . . . . . . . . . . . . . . . . . . . . . . . . . 13First-order Hold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    3. Mathematical Models . . . . . . . . . . . . . . . . . . . . . . . . . 15Zero-order Hold Sampling of a Continuous-time System . . . . . . 15First-order Hold Sampling . . . . . . . . . . . . . . . . . . . . . . . . 16Solution of the System Equation . . . . . . . . . . . . . . . . . . . . 17Operator Calculus and Input-output Descriptions . . . . . . . . . . 18Z-transform . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19The Pulse-transfer Function . . . . . . . . . . . . . . . . . . . . . . . 20Zero-order Hold Sampling . . . . . . . . . . . . . . . . . . . . . . . . 21First-Order-Hold Sampling . . . . . . . . . . . . . . . . . . . . . . . 23Shift-operator Calculus and Z-transforms . . . . . . . . . . . . . . . 24Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24

    4. Frequency Response . . . . . . . . . . . . . . . . . . . . . . . . . . 25Propagation of Sinusoidal Signals . . . . . . . . . . . . . . . . . . . 25Lifting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27Practical Consequences . . . . . . . . . . . . . . . . . . . . . . . . . 28Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29

    5. Control Design and Specifications . . . . . . . . . . . . . . . . . 30The Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Admissible Controls . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Design Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31Criteria and Specifications . . . . . . . . . . . . . . . . . . . . . . . . 32Robustness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32Attenuation of Load Disturbances . . . . . . . . . . . . . . . . . . . 32Injection of Measurement Noise . . . . . . . . . . . . . . . . . . . . 32Command Signals Following . . . . . . . . . . . . . . . . . . . . . . 33Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33

    6. Approximation of Analog Controllers . . . . . . . . . . . . . . 34State Model of the Controller . . . . . . . . . . . . . . . . . . . . . . 34Transfer Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35Frequency Prewarping . . . . . . . . . . . . . . . . . . . . . . . . . . 36Step Invariance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37Ramp Invariance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38Comparison of Approximations . . . . . . . . . . . . . . . . . . . . . 38Selection of Sampling Interval and Antialiasing Filters . . . . . . . 39Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40

    2

  • 7. Feedforward Design . . . . . . . . . . . . . . . . . . . . . . . . . . 41Reduction of Measurable Disturbances by Feedforward . . . . . . . 42System Inverses . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42Using Feedforward to Improve Response to Command Signals . . 43Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

    8. PID Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45Modification of Linear Response . . . . . . . . . . . . . . . . . . . . 45Discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46Incremental Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . 46Integrator Windup . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47Operational Aspects . . . . . . . . . . . . . . . . . . . . . . . . . . . 48Computer Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Tuning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49

    9. Pole-placement Design . . . . . . . . . . . . . . . . . . . . . . . . 52The Diophantine Equation . . . . . . . . . . . . . . . . . . . . . . . . 54Causality Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . 54Summary of the Pole-placement Design Procedure . . . . . . . . . 54Introduction of Integrators . . . . . . . . . . . . . . . . . . . . . . . 56Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57

    10. Optimization Based Design . . . . . . . . . . . . . . . . . . . . . 59Linear Quadratic DLQE Design . . . . . . . . . . . . . . . . . . . . . 59How to Find the Weighting Matrices? . . . . . . . . . . . . . . . . . 60Kalman Filters and LQG Control . . . . . . . . . . . . . . . . . . . . 61H[ Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64

    11. Practical Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65Controller Implementation and Computational Delay . . . . . . . . 65Controller Representation and Numerical Roundoff . . . . . . . . . 66A-D and D-A Quantization . . . . . . . . . . . . . . . . . . . . . . . 69Sampling Period Selection . . . . . . . . . . . . . . . . . . . . . . . . 69Saturations and Windup . . . . . . . . . . . . . . . . . . . . . . . . . 70Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72

    12. Real-time Implementation . . . . . . . . . . . . . . . . . . . . . . 73Real-time Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73Implementation Techniques . . . . . . . . . . . . . . . . . . . . . . . 74Concurrent Programming . . . . . . . . . . . . . . . . . . . . . . . . 75Synchronization and Communication . . . . . . . . . . . . . . . . . 75Periodic Controller Tasks . . . . . . . . . . . . . . . . . . . . . . . . 76Scheduling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81

    13. Controller Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . 83Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

    14. Research Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90Notes and References . . . . . . . . . . . . . . . . . . . . . . . . . . . 91

    Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93

    3

  • 1. Introduction

    Computers are today essential for implementing controllers in many differentsituations. The computers are often used in embedded systems. An embeddedsystem is a built-in computer/microprocessor that is a part of a larger system.Many of these computers implement control functions of different physical pro-cesses, for example, vehicles, home electronics, cellular telephones, and stand-alone controllers. The computers are often hidden for the end-user, but it isessential that the whole system is designed in an effective way.

    Using computers has many advantages. Many problems with analog imple-mentation can be avoided by using a computer, for instance, there are no prob-lems with the accuracy or drift of the components. The computations are per-formed identically day after day. It is also possible to make much more compli-cated computations, such as iterations and solution of system of equations, usinga computer. All nonlinear, and also many linear operations, using analog tech-nique are subject to errors, while they are much more accurately made using acomputer. Logic for alarms, start-up, and shut-down is easy to include in a com-puter. Finally, it is possible to construct good graphical user interfaces. However,sometimes the full advantages of the computers are not utilized. One situationis when the computer is only used to approximately implement an analog con-troller. The full potential of a computer-controlled system is only obtained whenalso the design process is regarded from a sampled-data point of view. The the-ory presented in this paper is essentially for linear deterministic systems. Evenif the control algorithms give the same result for identical input data the per-formance of the closed-loop system crucially depends on the timing given by thereal-time operating system. This paper gives a brief review of some of the toolsthat are important for understanding, analyzing, designing, and implementingsampled-data control systems.

    Computer-controlled SystemsA schematic diagram of a computer-controlled system is shown in Figure 1. Thesystem consists of

    Process

    Sampler together with Analog-to-Digital DA-DE converter Digital-to-Analog DD-AE converter with a hold circuit Computer with a clock, software for real-time applications, and control

    algorithms

    Communication network

    The process is a continuous-time physical system to be controlled. The inputand the output of the process are continuous-time signals. The A-D converter isconverting the analog output signal of the process into a finite precision digitalnumber depending on how many bits or levels that are used in the conversion.The conversion is also quantized in time determined by the clock. This is calledthe sampling process. The control algorithm thus receives data that are quan-tized both in time and in level. The control algorithm consists of a computerprogram that transforms the measurements into a desired control signal. Thecontrol signal is transfered to the D-A converter, which with finite precision con-verts the number in the computer into a continuous-time signal. This impliesthat the D-A converter contains both a conversion unit and a hold unit that

    4

  • ukuk

    ky

    ky

    Communication network

    Computer

    Process

    y(t). . . . .u(t)

    t

    .

    andDA

    Hold

    Sampler

    ADand

    y(t)u(t)

    . . . .t

    . . . . .. . .

    t

    t

    Figure 1 Schematic diagram of a computer-controlled system.

    translates a number into a physical variable that is applied to the process. Thecommunication between the process, or more accurately the A-D and D-A con-verters, and the computer is done over a communication link or network. All theactivities in the computer-controlled system are controlled by the clock with therequirement that all the computations have to be performed within a given time.In a distributed system there are several clocks that have to be synchronized.The total system is thus a real-time system with hard time constraints.

    The system in Figure 1 contains a continuous-time part and a sampled-datapart. It is this mixture of different classes of signals that causes some of the prob-lems and confusion when discussing computer-controlled systems. The problemis even more pronounced when using decentralized control where the controlsystem is shared between several computers. Many of the problems are avoidedif only considering the sampled-data part of the system. It is, however, impor-tant to understand where the difficulties arise and how to avoid some of theseproblems.

    The Sampling ProcessThe times when the measured physical variables are converted into digital formare called the sampling instants. The time between two sampling instants is thesampling period and is denoted h. Periodic sampling is normally used, implyingthat the sampling period is constant, i.e. the output is measured and the controlsignal is applied each hth time unit. The sampling frequency is s 2pi/h.In larger plants it may also be necessary to have control loops with differentsampling periods, giving rise to multi-rate sampling or multi-rate systems.

    Time DependenceThe mixture of continuous-time and discrete-time signals makes the sampled-data systems time dependent. This can be understood from Figure 1. Assumethat there is a disturbance added at the output of the process. Time invarianceimplies that a shift of the input signal to the system should result in a similarshift in the response of the system. Since the A-D conversion is governed by aclock the system will react differently when the disturbance is shifted in time.The system will, however, remain time independent provided that all changes

    5

  • 0 5 101

    0

    1

    Time

    Figure 2 Two signals with different frequencies, 0.1 Hz DdashedE and 0.9 Hz DfullE, havethe same values at all sampling instants DdotsE when h 1.

    in the system, inputs and disturbances, are synchronized with the samplinginstants.

    Aliasing and New FrequenciesThe A-D and D-A converters are the interface between the continuous-time re-ality and the digital world inside the computer. A natural question to ask is: Dowe loose any information by sampling a continuous-time signal?

    EXAMPLE 1ALIASINGConsider the two sinusoidal signals sinDD1.8t 1Epi E and sin 0.2pi t shown in Fig-ure 2. The sampling of these signals with the sampling period h 1 is shownwith the dots in the figure. From the sampled values there is thus no possibil-ity to distinguish between the two signals. It is not possible to determine if thesampled values are obtained from a low frequency signal or a high frequency sig-nal. This implies that the continuous-time signal cannot be recovered from thesampled-data signal, i.e. information is lost through the sampling procedure.

    The sampling procedure does not only introduce loss of information but may alsointroduce new frequencies. The new frequencies are due to interference betweenthe sampled continuous-time signal and the sampling frequency s 2pi/h. Theinterference can introduce fading or beating in the sampled-data signal.

    Approximation of Continuous-time ControllersOne way to design a sampled-data control system is to make a continuous-time design and then make a discrete-time approximation of this controller. Thecomputer-controlled system should now behave as the continuous-time systemprovided the sampling period is sufficiently small. An example is used to illus-trate this procedure.

    EXAMPLE 2DISK-DRIVE POSITIONING SYSTEMA disk-drive positioning system will be used throughout the paper to illustratedifferent concepts. A schematic diagram is shown in Figure 3. Neglecting reso-

    u yuc

    Controller Amplifier Arm

    Figure 3 A system for controlling the position of the arm of a disk drive.

    6

  • 0 5 100

    1

    Ou

    tpu

    t

    0 5 100.5

    0

    0.5

    Inpu

    t

    Time (0t)

    Figure 4 The step response when simulating the disk arm servo with the analog con-troller D2E Ddashed/redE and sampled-data controller D3E Dsolid/blueE. The design param-eter is 0 1 and the sampling period is h 0.3.

    nances the dynamics relating the position y of the arm to the voltage u of thedrive amplifier is approximately described by a double integrator process

    GDsE kJs2

    D1E

    where k is the gain in the amplifier and J is the moment of inertia of the arm.The purpose of the control system is to control the position of the arm so thatthe head follows a given track and that it can be rapidly moved to a differenttrack. Let uc be the command signal and denote Laplace transforms with capitalletters. A simple continuous-time servo controller can be described by

    UDsE bKa

    UcDsE K s bs a YDsE D2E

    This controller is a two-degrees-of-freedom controller. Choosing the controllerparameters as

    a 20b 0/2

    K 2J20

    kgives a closed system with the characteristic polynomial

    PDsE Ds2 0s 20EDs0E s3 20s2 2 20s 30

    where the parameter 0 is used to determine the speed of the closed-loop sys-tem. The step response when controlling the process with the continuous-timecontroller D2E is shown as the dashed line in Figure 4. The control law given byD2E can be written as

    UDsE bKa

    UcDsE KYDsE K a bs a YDsE K

    ba

    UcDsE YDsE X DsE

    7

  • or in the time-domain as

    uDtE K

    ba

    ucDtE yDtE xDtE

    dxDtEdt

    axDtE Da bEyDtE

    The first of these equations can be implemented directly on a computer. To findan algorithm for the second equation the derivative dx/dt at time kh is approx-imated with a forward difference. This gives

    xDkh hE xDkhEh

    axDkhE Da bEyDkhE

    The following approximation of the continuous algorithm D2E is then obtained:

    uDkhE K

    ba

    ucDkhE yDkhE xDkhE

    xDkh hE xDkhE hDa bEyDkhE axDkhE

    D3Ewhere yDkhE is the sampled output, uDkhE is the signal sent to the D-A converter,and xDkhE is the internal state of the controller. This difference equation is up-dated at each sampling instant. Since the approximation of the derivative by adifference is good if the interval h is small, we can expect the behavior of thecomputer-controlled system to be close to the continuous-time system. Figure 4shows the arm position and the control signal for the system when 0 1 andh 0.3. Notice that the control signal for the computer-controlled system is con-stant between the sampling instants due to the hold circuit in the D-A converter.Also notice that the difference between the outputs of the two simulations is verysmall. The difference in the outputs is negligible if h is less than 0.1/0.

    The computer-controlled system has slightly higher overshoot and the settlingtime is a little longer. The difference between the systems decreases when thesampling period decreases. When the sampling period increases the computer-controlled system will, however, deteriorate and the closed-loop system becomesunstable for long sampling periods.

    The example shows that it is straightforward to obtain an algorithm for com-puter control simply by writing the continuous-time control law as a differentialequation and approximating the derivatives by differences. The example alsoindicates that the procedure seems to work well if the sampling period is suffi-ciently small. The overshoot and the settling time are, however, a little largerfor the computer-controlled system, i.e. there is a deterioration due to the ap-proximation.

    Is There a Need for Special Design Methods?The approximation of a continuous-time controller discussed above shows that itis possible to derive a discrete-time controller based on continuous-time design.There are many different approximations methods that can be used. Normally,they are crucially dependent on choosing fairly short sampling periods. The ap-proximation methods are possible to use also for nonlinear continuous-time con-trollers. Deriving a sampled-data description of the process makes it possible toutilize the full potential of a sampled-data systems and to derive other classes

    8

  • 0 5 100

    1

    Pos

    itio

    n

    0 5 10

    0

    0.5

    Vel

    ocit

    y

    0 5 100.5

    0

    0.5

    Inpu

    t

    Time (0t)

    Figure 5 The step response when simulating the disk arm servo using the analog con-troller D3E Ddashed/redE and the deadbeat controller Dsolid/blueE. The sampling period ish 1.4.

    of controllers that are not possible to use in continuous-time. The sampled-datatheory is also needed to explain the inter-sample and periodic behavior of thesampled-data systems. Notice that the theory for sampled-data systems is de-rived mainly for linear systems.

    EXAMPLE 3DEADBEAT CONTROLConsider the disk drive in the previous example. Using a sampling interval ofh 1.4 with 0 1 gives an unstable closed-loop system if the controller D3E isused. However, designing a discrete-time controller with the same structure asD3E gives the performance shown in Figure 5 when h 1.4. The controller canbe written as

    uDkhE t0ucDkhE t1ucDkh hE s0 yDkhE s1 yDkh hE r1uDkh hE

    where the coefficients now are chosen such that the output of the system willreach the reference value after two samples. This is called a deadbeat controllerand it has not a continuous-time counterpart. The design parameter of the dead-beat controller is the sampling period h, which here is chosen such that the max-imum control signal is the same when the continuous-time and the sampled-datacontrollers are used.

    SummaryThe examples in this chapter clearly show that there are some important issuesthat are specific for sampled-data systems.

    Sampling makes the system time-varying.

    9

  • Information may be lost through sampling.

    Sampled controller have behaviors that are not achievable with continuous-time controllers.

    This requires an understanding of the interplay between the continuous-time sig-nals and the discrete-time signals. The rest of the paper gives a brief overview ofsome of the tools that are important for the analysis, design, and implementationof sampled-data control system.

    10

  • 2. Sampling and Reconstruction

    A sampler is a device, driven by the clock in the system, that is converting acontinuous-time signal into a sequence of numbers. Normally, the sampler iscombined into the A-D converter, which also quantizes the sequence of numbersinto a finite, although it may be a high, precision number that is then stored inthe computer. Typically the A-D converter has 816 bits resolution giving 28216 levels of quantization. This is normally a much higher resolution than theprecision of the physical sensor. The input to the process is reconstructed fromthe sequence of numbers from the computer using a D-A converter combinedwith a hold circuit that is determining the input to the process until a newnumber is delivered from the computer. The hold circuit can be of different kinds.Most common is the zero-order-hold, which holds the input constant over thesampling period. Another type of hold device that will be discussed is the first-order-hold, where the input is computed from current and previous outputs fromthe computer using a first order polynomial in time.

    Shannons Sampling TheoremIt is clear that if the signal to be sampled is not changing very fast and if thesampling is done sufficiently often very little should be lost in the sampling proce-dure. This intuition was formalized by Claude E. Shannon in 1949 in his famoussampling theorem. Shannon proved that if the signal contains no frequenciesabove 0 then the continuous-time signal can be uniquely reconstructed from aperiodically sampled sequence provided the sampling frequency is higher than20.

    In Figure 2 the sinusoidal signals has the frequencies 0.1 Hz and 0.9 Hz,respectively, while the sampling frequency is 1 Hz. From Shannons samplingtheorem it follows that the slow 0.1 Hz signal can be uniquely reconstructedfrom its sampled values. To be able to reconstruct the 0.9 Hz signal the samplingfrequency must be higher than 1.8 Hz.

    The Shannon reconstruction of the continuous-time signal from the sampledvalues is characterized by the filter

    hDtE sinD st/2E st/2

    The impulse response of this filter is given in Figure 6. The frequency N s/2 plays an important role and is called the Nyquist frequency. The filter forthe Shannon reconstruction is not causal, which makes it impossible to use inpractice and simpler and less accurate reconstructions, such as the zero-orderhold, are therefore used.

    10 0 10

    0

    1

    Time

    h(t

    )

    Figure 6 The impulse response of the Shannon reconstruction when h 1.

    11

  • Aliasing and Antialiasing FiltersThe phenomenon shown in Figure 2 that a high frequency signal will be inter-preted as a low frequency signal when sampled is called aliasing or frequencyfolding. The fundamental alias for a frequency 1 is given by

    hD1 NE mod D sE N h D4E

    Equation D4E implies that the signal 1 has an alias in the interval F0 NE andthat the signal above the Nyquist frequency cannot be reconstructed after thesampling. Equation D4E gives that 0.9 Hz has the alias frequency 0.1 Hz whenthe sampling frequency is 1 Hz as could be seen in Figure 2.

    The implication of the aliasing is that we need to remove all frequenciesabove the Nyquist frequency before sampling the signal. The simplest way ofdoing this is to use an analog filter. This type of filters are called antialiasingfilters. The bandwidth of the filter must be such that the attenuation above theNyquist frequency is sufficiently high. Bessel filters of orders 26 are in practicesufficient to eliminate most of the influence of higher frequencies. A second orderBessel filter with bandwidth B has the transfer function

    2

    Ds/ BE2 2 Ds/ BE 2with 1.27 and 0.87. Other filters such as Butterworth or ITAE can alsobe used. The Bessel filters has the property that they can be well approximatedby a time delay. This is an advantage in the design of the controller since thedynamics of the antialiasing filter normally has to be included in the design ofthe sampled-data controller.

    EXAMPLE 4PREFILTERINGThe influence of a prefilter is shown in Figure 7. An analog signal consisting of asquare-wave and a superimposed sinusoidal disturbance with frequency 0.9 Hzis shown in DaE. In DcE the signal in DaE is sampled using a sampling frequencyof 1 Hz. This gives rise to an alias frequency of 0.1 that is seen in the sampledsignal. The result of filtering the signal in DaE using a sixth-order Bessel filter

    0 10 20 30

    1

    0

    1(a)

    0 10 20 30

    1

    0

    1(b)

    0 10 20 30

    1

    0

    1

    Time

    (c)

    0 10 20 30

    1

    0

    1

    Time

    (d)

    Figure 7 DaE Signal plus sinusoidal disturbance. DbE The signal filtered through a sixth-order Bessel-filter. DcE Sampling of the signal in DaE. DdE Sampling of the signal in DbE.

    12

  • with a bandwidth of 0.25 Hz is shown in DbE and the sampling of this signal isgiven in DdE. The disturbance signal is eliminated in DbE, but the filter also hasan influence on the useful signal, i.e. the square-wave is transformed into asmoother signal, which is sampled.

    Zero-order Hold (ZOH)The simplest and the most common way to make a reconstruction of a sampled-data signal is to let the output of the hold circuit be constant until the nextsampled value is obtained. This is called zero-order hold, since the continuoustime signal is a zeroth order polynomial between the sampling points. The re-constructed signal f DtE is given by

    f DtE f DkhE kh t kh h

    Standard D-A converters are usually constructed such that the output is constantuntil a new conversion is ordered. The zero-order hold circuit can easily also beused for non-periodic sampling.

    First-order HoldThe hold circuit can be made more sophisticated by allowing the continuous-timesignal to be a higher-order polynomial between the sampling points. A drawbackof the zero-order hold is that the output of the hold circuit is discontinuous.The discontinuities can excite poorly damped mechanical modes of the physicalprocess and also cause wear in the actuators of the system. One way to make theoutput continuous is to use a first-order hold. The signal between the samplingpoints is now a linear interpolation. The reconstructed signal can be expressedas

    f DtE f DkhE t khh

    D f Dkh hE f DkhEE kh t kh hNotice that this is not a causal reconstruction since f Dkh hE must be availableat time kh. The value f Dkh hE can be replaced by a prediction, which easilycan be done in a feedback loop.

    0 5 101

    0

    1

    Zer

    o or

    der

    hol

    d

    0 5 101

    0

    1

    Fir

    st o

    rder

    hol

    d

    Time

    Figure 8 Sampling and reconstruction Dsolid/blueE of a sinusoidal signal Ddashed/redEusing a zero-order hold and first-order hold for the sampling period h 1. The samplingtimes are indicated by dots.

    13

  • Figure 8 gives a comparison of reconstruction of a sampled sinusoidal signalwhen using zero-order hold and first-order hold circuits. The figure shows clearlythe advantage of using first-order hold when the input signal is smooth.

    Summary Information can be lost through sampling if the signal contains frequencies

    higher than the Nyquist frequency.

    Sampling creates new frequencies DaliasesE. Aliasing or frequency folding makes it necessary to filter the signals before

    they are sampled.

    The dynamics of the antialiasing filters must be considered when designingthe sampled-data controller. The dynamics can be neglected if the samplingperiod is sufficiently short.

    A standard D-A converter can be described as a zero-order hold. There arespecial converters that give first-order hold. They give a smoother controlsignal.

    14

  • 3. Mathematical Models

    The problem of having a mixture of continuous-time and discrete-time signals canbe avoided by observing the sampled-data system only at the sampling points tk.This implies that the process is looked upon from the view of the computer, i.e. byconsidering the sampled or discrete-time sequences uDtkE and yDtkE. This resultsin a simple description of the sampled-data system, which is sometimes called thestroboscopic model. It should, however, be emphasized that the physical processis still a continuous-time system and that we are not getting any informationabout what is happening between the sampling points. By using the stroboscopicmodel it is straightforward to derive a system description of the sampled-datasystem either as a state-space system or as an input-output system.

    For simplicity, we assume that periodic sampling is used, i.e. that the sam-pling instances are tk kh, and that a zero-order hold is used at the input ofthe process.

    Zero-order Hold Sampling of a Continuous-time SystemAssume that the physical process is described by the time-invariant state-spacesystem

    dxdt AxDtE BuDtE

    yDtE CxDtE DuDtED5E

    The system has n states, r inputs, and p outputs. Assume that at time kh thestate xDkhE is available and that the constant input is applied to the system overthe time kh t kh h. On this interval the state is described by

    xDtE eADtkhExDkhE Z t

    kheADts

    PEBuDsPE dsP

    eADtkhExDkhE Z t

    kheADts

    PEdsP BuDkhE

    eADtkhExDkhE Z tkh

    0eAs ds BuDkhE

    Dt, khExDkhE Dt, khEuDkhE

    D6E

    The second equality follows since uDtE is constant over the sampling interval. No-tice that D6E give the change of the state over the sampling period. By consideringthe situation at the next sampling instance we get

    xDkh hE xDkhE uDkhEyDkhE CxDkhE DuDkhE D7E

    where Dkh h, khE eAh

    Dkh h, khE Z h

    0eAs dsB

    D8E

    At the sampling times the system is described by a linear time-invariant dif-ference equation. The simplification is obtained without any approximations byregarding the system only at the sampling points and by assuming that the in-put is piece-wise constant and is changed synchronized with the sampling of the

    15

  • signals. The model D7E is called a zero-order hold DZOHE sampling of the systemD5E. Since the output yDkhE in most cases is measured before the control signaluDkhE is applied to the system it then follows that D 0. The zero-order holdsampling can also be done for processes containing time-delays.

    It follows from D8E that and satisfy the equation

    ddt

    DtE DtE0 I

    DtE DtE

    0 I

    A B

    0 0

    where I is a unit matrix of the same dimension as the number of inputs. Tosample the system we have to calculate a matrix exponentialDhE DhE

    0 I

    exp

    A B

    0 0

    h

    The matrix exponential is defined as a series expansion, but there are commandsin scientific computational programs such as Matlab that directly calculates thesampling of a continuous-time system when using different hold devices.

    EXAMPLE 5SAMPLING THE DISK DRIVE SYSTEMThe disk drive system D1E can be written in the state-space form

    dxdt

    0 1

    0 0

    x k

    J

    0

    1

    u

    y F 1 0 G x

    This gives

    eAh I Ah A2h2/2

    1 0

    0 1

    0 h

    0 0

    1 h

    0 1

    Z h0

    eAs B ds kJ

    Z h0

    s

    1

    ds k

    J

    h2/2

    h

    First-order Hold SamplingA difference equation for the state at the sampling instants can be obtained whenthe control signal has a specified form over the sampling interval. To illustratethis we will give formulas equivalent to D7E when the input signal is piecewiseaffine instead of piecewise constant.

    Consider a continuous-time system described by D5E. Assume that the inputsignal is linear between the sampling instants. Integration of D5E over one sam-pling period gives

    xDkh hE eAhxDkhE

    Z khh

    kheADkhhs

    PEBhuDkhE s

    P khh

    uDkh hE uDkhE

    idsP

    16

  • HencexDkh hE xDkhE uDkhE 1

    h1

    uDkh hE uDkhE

    xDkhE 1h

    1uDkh hE

    1h

    1

    uDkhEyDkhE CxDkhE DuDkhE

    D9E

    where eAh

    Z h

    0eAs ds B

    1 Z h

    0eAsDh sE ds B

    D10E

    The matrices , and 1 are also given by

    8: 19; 8: I 0 09; exp0@8>>>>>>:

    A B 0

    0 0 I

    0 0 0

    9>>>>>>; h1A

    The discrete system given by D9E is not a standard state-model. Replacing thecoordinates in D9E by x 1uDkh hE/h, we obtain the standard model

    Dkh hE xDkhE

    1hD IE1

    uDkhE

    yDkhE C DkhE DD 1h

    C1EuDkhED11E

    Notice that the sampled-data system has a direct term even if D 0. First-orderhold sampling is particularly useful when approximating continuous transferfunctions by sampled systems, because a piecewise affine curve is a good ap-proximation to a continuous function, see Figure 8.

    Solution of the System EquationAssume that the input sequence uDk0E, uDk0 1E, . . . and the initial conditionxDk0E are given. The solution to the system equation D7E is then obtained throughiterations

    xDk0 1E xDk0E uDk0ExDk0 2E xDk0 1E uDk0 1E

    2xDk0E uDk0E uDk0 1E...

    xDkE kk0xDk0E kk01uDk0E uDk 1E

    kk0xDk0E k1Xjk0

    k j1uD jE

    D12E

    The solution consists of two parts, one depending on the initial condition xDk0Eand the other is a weighted sum of the inputs over the interval Fk0, k 1G.The solution shows that the eigenvalues of play an important role for thedevelopment of the states. The influence of the initial condition will decay if the

    17

  • magnitude of all the eigenvalues of are strictly less than unity, i.e. that theyare inside the unit circle. This is thus the condition for stability of the discretetime system D7E. The eigenvalues are obtained from the characteristic equation

    detD I E 0

    Operator Calculus and Input-output DescriptionsThe discrete-time system D7E is given in state-space form. To derive the input-output description of the system we will use the forward shift operator q definedin the following way

    qf DkE f Dk 1EFor convenience the sampling period is chosen as the time unit. The argument ofa signal is thus not real time but instead the number of sampling intervals. Wecall this the sampling-time convention. The q should be interpreted as an opera-tor acting on time-functions in the same way as the differential operator is usedfor continuous-time signals. In shift-operator calculus, all signals are consideredas doubly infinite sequences M f DkE : k 1, 0, 1, . . .N. Multiplying a time-sequence by q implies that the sequence is shifted one step ahead. Multiplyingwith qn implies a shift of n steps forward. In the same way multiplying with qn

    means a backward shift of n steps. The operator q1 is called the backward shiftoperator.

    To simplify the notation it is assumed that the system is a SISO system, i.e.that it has one input and one output. Using the forward shift operator in D7Egives

    xDk 1E qxDkE xDkE uDkEyDkE CxDkE DuDkE

    Solving for xDkE in the first equation and using that in the second equation givesan elimination of the state variables

    yDkE CxDkE DuDkE CDqI E1 BuDkE DuDkE

    CDqI E1 B DuDkE HDqEuDkE BDqEADqEuDkE

    D13E

    HDqE is the pulse-transfer operator of the system D7E and describes how the inputand output are related. The polynomials ADqE and BDqE are defined as

    ADqE qn a1qn1 anBDqE b0qnb b1qnb1 bnb

    with deg A n and deg B nb n, where n is the number of states in thesystem. The solution to ADqE 0 gives the poles and BDqE 0 the zeros of thesystem. From D13E it follows that

    ADqE detDqI E

    which is the characteristic polynomial of the matrix . Stability of the systemthen requires that all the poles should be strictly inside the unit circle.

    The system D13E can be written as

    ADqEyDkE BDqEuDkE

    18

  • orDqn a1qn1 anEyDkE Db0qnb bnbEuDkE

    which should be interpreted as

    yDk nE a1 yDk n 1E an yDkE b0uDk nbE bnbuDkE

    where n nb. The input-output relation is thus a higher order difference equa-tion.

    EXAMPLE 6DISK ARM DRIVEConsider the sampled-data description of the disk arm drive from Example 5with h 1 and k/J 1. From D13E

    HDqE F 1 0 G

    q 1 10 q 1

    1 0.51

    0.5Dq 1EDq 1E2

    0.5Dq1 q2E1 2q1 q2 D14E

    The system has two poles in 1 and one zero in 1.

    Z-transformThe Laplace transform is important in the input-output analysis of continuous-time systems. The z-transform was introduced to play a similar role for sampled-data systems and is a convenient tool to handle linear difference equations withor without initial values.

    Consider the discrete-time signal M f DkhE : k 0, 1, . . .N. The z-transform off DkhE is defined as

    ZM f DkhEN FDzE [X

    k0f DkhEzk

    where z is a complex variable. The inverse transform is given by

    f DkhE 12pi i

    IFDzEzk1 dz

    where the contour of integration encloses all singularities of FDzE. Some prop-erties of the z-transform are collected in Table 1. The z-transform maps semi-infinite time sequences into a function of the complex variable z. It should beremarked that this is a difference with respect to the shift operator which actson infinite time sequences.

    EXAMPLE 7Z-TRANSFORM OF A RAMPConsider a ramp signal defined by yDkhE kh for k 0, which has the Laplacetransform YDsE 1/s2, then

    YDzE 0 hz1 2hz2 hDz1 2z2 E hzDz 1E2

    19

  • Table 1 Some properties of the z-transform.

    1. Definition

    FDzE [X

    k0f DkhEzk

    2. Inversionf DkhE 1

    2pi i

    IFDzEzk1 dz

    3. LinearityZMaf nN aZ f Zn

    4. Time shiftZMqn f N zn FZMqn f N znDF F1E where F1DzE

    Pn1j0 f D jhEz j

    5. Initial-value theoremf D0E lim

    z0[ FDzE

    6. Final-value theoremIf D1 z1EFDzE does not have any poles on or outside the unit circle, thenlimk0[

    f DkhE limz01D1 z1EFDzE.

    7. Convolution

    ZM f nN Z(

    kXn0

    f DnEnDk nE) DZ f EDZnE

    The Pulse-transfer FunctionConsider the system in Figure 9, where there is a zero-order sample-and-hold atthe input of the system and a sampler at the output of the process. We now wouldlike to derive the relation between the z-transforms of the sequences MuDkhEN andMyDkhEN. This will be the pulse-transfer function HDzE of the sampled-data sys-tem, which will correspond to the continuous-time transfer function. The pulse-transfer function is defined through

    YDzE HDzEUDzE D15E

    where YDzE and UDzE are the z-transforms of the sequences yDkhE and uDkhE,respectively. The description D15E has the advantage that it separates the trans-form of the output into one part that depends on the input signal, UDzE, and onepart that characterizes the system, HDzE. Table 2 gives the pulse-transfer func-tion HDzE for some continuous-time transfer functions GDsE in Figure 9. Notice

    Zero-order hold

    u t( )u kh( ){ } y t( ) y kh( ){ }G s( )

    H z( )

    Figure 9 Sampling a continuous-time system.

    20

  • that the table does not give the z-transforms of the time functions correspondingto the Laplace transforms GDsE, but that also the zero-order hold is included inthe system.

    The z-transform can be used to solve difference equations. Consider D7E forh 1 and take the z-transform of both sides, then

    [Xk0

    zkxDk 1E z [X

    k0zkxDkE xD0E

    !

    [Xk0

    zkxDkE [X

    k0zkuDkE

    Hencez

    X DzE xD0E X DzE UDzE

    X DzE DzI E1

    zxD0E UDzE

    andYDzE CDzI E1 zxD0E

    CDzI E1 D

    UDzE

    The solution depends on the initial state and the input signal from time k 0,compare D12E. The pulse-transfer function is thus given by

    HDzE CDzI E1 D

    which is the same as D13E with q replaced by z. The time sequence yDkE can nowbe obtained using the inverse transform.

    EXAMPLE 8PULSE-TRANSFER FUNCTION OF THE DISK ARM DRIVEThe disk arm drive with k/J 1 is a double integrator, i.e. GDsE 1/s2. FromTable 2 it follows that the zero-order hold sampling of this system gives thepulse-transfer function

    HDzE h2Dz 1E

    2Dz 1E2which is the same as the pulse-transfer operator in D14E, but with q replacedby z. Notice that this differs from the z-transform of the ramp 1/s2 derived inExample 7. The z-transform tables should thus be used with care if we want tofind the pulse-transfer function/operator.

    Zero-order Hold SamplingThe pulse-transfer function HDzE for zero-order-hold sampling can be determineddirectly from the continuous-time transfer function GDsE using the formula

    HzohDzE z 1

    z1

    2pi i

    Z i[ i[

    esh

    z eshGDsE

    sds

    Xssi

    1z esh Res

    esh 1

    s

    GDsE

    D16E

    where si are the poles of GDsE and Res denotes the residue. The second equalityrequires that the transfer function GDsE goes to zero at least as fast as hsh1 fora large s and has distinct poles, none of which are at the origin. If GDsE hasmultiple poles or a pole in the origin, the equation must be modified to takemultiple poles into consideration.

    21

  • Table 2 Zero-order hold sampling of a continuous-time system with transfer functionGDsE. The table gives the pulse-transfer function HDzE that is the zero-order-hold equiva-lent of the continuous-time system.

    GDsE HDzE b1zn1 b2zn2 bn

    zn a1 zn1 an

    1s

    hz 1

    1s2

    h2Dz 1E2Dz 1E2

    esh z1

    as a

    1 expDahEz expDahE

    asDs aE

    b1 1a Dah 1 eahE b2 1a D1 e

    ah aheahE

    a1 D1 eahE a2 eah

    a2

    Ds aE2b1 1 eahD1 ahE b2 eahDeah ah 1Ea1 2eah a2 e2ah

    sDs aE2

    Dz 1EheahDz eahE2

    abDs aEDs bEa b

    b1 bD1 eahE aD1 ebhE

    b a

    b2 aD1 ebhEeah bD1 eahEebh

    b aa1 Deah ebhEa2 eDabEh

    20s2 2 0s 20

    b1 1

    0

    0q

    1 2 1

    b2 2 0

    e 0h

    a1 2 cos D hEa2 2 sinD hE

    22

  • First-Order-Hold SamplingThe pulse-transfer function for first-order-hold sampling of a system with a trans-fer function GDsE can also be obtained by a direct calculation. Let u be the inputof the system and let y denote the output. The piecewise affine input u canbe generated as the output vDtE of an integrator whose input is the piecewiseconstant signal, i.e.

    dvDtEdt

    uDkh hE uDkhEh

    D17EBecause the signal at the right hand side of D17E is constant over the samplingintervals, the results of zero-order hold sampling can be applied and we find thatthe z-transform of the output is given by

    YDzE Szoh

    GDsEs

    V DzE D18E

    where Szoh denotes the map of transfer functions to pulse-transfer functionsthrough zero-order-hold sampling. Combining D17E and D18E we get

    YDzE Szoh

    GDsEs

    z 1

    hUDzE

    We have thus obtained the input-output relation for sampling with a first-order-hold that can be expressed as follows.

    Sfoh(GDsE z 1

    hSzoh

    GDsE

    s

    D19E

    By using D16E it follows that the pulse-transfer function obtained by first-order-hold sampling of a continuous system with the transfer function GDsE can beexpressed by

    Hf ohDzE Dz 1E2

    zh1

    2pi i

    Z i[ i[

    esh

    z eshGDsE

    s2ds

    The pulse-transfer function for first-order-hold sampling can also be determinedby state space methods by sampling the system and taking z-transform. Applyingthis to the representations D9E and D11E we get the pulse-transfer function

    HDzE D CDzI E1

    zh

    1 1h 1

    D 1h

    C1 CDzI E1

    1hD IE1

    where the matrices , and 1 are given by D10E.EXAMPLE 9FIRST-ORDER-HOLD SAMPLING OF A DOUBLE INTEGRATORA double integrator has the transfer function GDsE 1/s2. Zero-order-hold sam-pling of 1/s3 gives

    h3

    6z2 4z 1Dz 1E3

    It then follows from D19E that the first-order-hold sampling of the double inte-grator is

    HDzE h2

    6z2 4z 1Dz 1E2

    Notice that the orders of the numerator and denominator polynomials are thesame. This reflects the predictive nature of the first-order-hold.

    23

  • Shift-operator Calculus and Z-transformsIn the presentation we have distinguished between the operator q and the com-plex variable z. The pulse-transfer operator HDqE is the same as the pulse-transfer function HDzE with z replaced by q. With this similarity it would betempting to use the same notation for both the shift operator and z-transformvariable. This is used in many text-books. This is a bad practice because it isimportant not to confuse operators with complex variables.

    Summary Sampled systems are time-varying systems because of the sampling mech-

    anism.

    Simple system descriptions are obtained by observing the system at thesampling instants. This leads to a time-invariant sampled-data system ifthe the continuous-time system is time-invariant.

    Operator and transform theory can be used to define input-output descrip-tions.

    The system is stable if the system matrix has all eigenvalues inside theunit circle or equivalently that all roots of ADzE are inside the unit circle.

    24

  • 4. Frequency Response

    Many powerful methods for analysis and design of control systems are based onfrequency response. The key idea is to use the fact that a linear time-invariantsystem can be completely characterized by its steady-state response to sinusoidalsignals. Frequency response is particularly useful for discussions of robustness.The frequency response of a discrete-time system is given by HDei hE, whereHDzE is the pulse-transfer function of the system. The frequency response of asampled system is unfortunately much more complicated. The reason is that asampled system is a linear periodic system. Such a system is infinite dimensionaleven if the continuous system is finite dimensional. We will first investigate thepropagation of sinusoidal signals through a sampled system and we will thenbriefly discuss the frequency response of a sampled system.

    Propagation of Sinusoidal SignalsConsider the system in Figure 10 consisting of an A-D converter, the computer,a D-A converter, and the process. It is assumed that the D-A converter holds thesignal constant over the sampling interval. It is also assumed that the calcula-tions performed by the computer can be expressed by the pulse-transfer functionHDzE and that the process is described by the transfer function GDsE.

    The actions of the A-D converter can be represented by a sample and holdmechanism. In continuous time this can be represented by a modulation by animpulse train followed by the filter

    GhDsE 1s

    (1 esh D20E

    The impulse response of GhDsE is a pulse of unit amplitude and length h. Mod-ulation can be represented by

    vDtE vDtEmDtE D21E

    where the modulation function m is given by

    mDtE [X

    k[ Dt khE 1

    h

    1 2

    [Xk1

    cos k st

    The operation D21E followed by the transfer function D20E is a mathematical modelof sampling and a zero-order hold. If a sinusoid

    vDtE sinD t E Im (exp iD t E

    Process

    Clock

    AD DAyuv

    Algorithm

    H( z) G (s)

    Figure 10 Open-loop computer-controlled system.

    25

  • 2s 2 s

    s s

    2s + s + 2s +

    2s s 2s

    s

    s +

    rad/s

    Figure 11 Frequency content of the sampled input signal v when v sinD t E.

    is applied to the system then the modulated signal is

    vDtE vDtEmDtE 1h

    hsinD t E 2

    [Xk1

    cosDk stE sinD t Ei

    1h

    hsinD t E

    [Xk1

    sinDDk s Et E sinDDk s Et E

    iThe signal v has a component with the frequency of the input signal. Thiscomponent is multiplied by 1/h because the steady-state gain of a sampler is1/h. The signal also has components corresponding to the sidebands k s .The frequency content of the output v of the sampler is shown in Figure 11.The modulation thus creates several frequencies even if a single sinusoid is ap-plied. The propagation of the sinusoids can then be described by standard linearmethods. The transmission of the fundamental component may be described bythe transfer function

    KDi E

    8>:1h

    HDei hEGhDi EGDi E k N2h

    HDei hEGhDi EGDi EeiDpi /2E sin k N

    where N is the Nyquist frequency. When is not a multiple of the Nyquistfrequency, the signal transmission of the fundamental component can be char-acterized by a transfer function that is a product of four terms: the gain 1/h ofthe sampler, the transfer function GhDsE of the hold circuit, the pulse-transferfunction HDexpDshEE of the algorithm in the computer, and the transfer func-tion GDsE of the process. Notice, however, that there are other frequencies inthe output of the system because of the sampling. At the Nyquist frequency thefundamental component and the lowest sideband coincide. Close to the Nyquistfrequency there will be interference between the fundamental and the side band.We illustrate what happens with an example.

    EXAMPLE 10FREQUENCY RESPONSE OF A SAMPLED-DATA SYSTEMConsider a system composed of a sampler and a zero-order hold, given by D20E,followed by a linear system, with the transfer function

    GDsE 1s 1

    The sampling period is h 0.05 s. The Nyquist frequency is pi/0.05 62.8rad/s. If a sine wave of frequency is applied, the output signal is the sumof the outputs of the sine wave and all its aliases. This is illustrated in Figure12, which shows the steady-state outputs for three different frequencies. For

    26

  • 0 2 41

    0

    1

    Sam

    pled

    inpu

    t(a)

    0 2 41

    0

    1

    Ou

    tpu

    t

    0 2 41

    0

    1S

    ampl

    ed in

    put(b)

    0 2 4

    0.02

    0

    0.02

    Ou

    tpu

    t0 2 4

    1

    0

    1

    Time

    Sam

    pled

    inpu

    t(c)

    0 2 41

    0

    1

    TimeO

    utp

    ut

    Figure 12 Steady-state responses to sinusoids with different frequencies for a zero-orderhold followed by a first-order system with a unit time constant. The sampling period is0.05 s. The frequencies are 5 rad/s in DaE, 60 rad/s in DbE, and 130 rad/s in DcE.

    frequencies smaller than the Nyquist frequency DaE, the contribution from thefundamental frequency dominates. At frequencies close to the Nyquist frequencyDbE, there is a substantial interaction with the first alias, s . Typical beatsare thus obtained. At the Nyquist frequency, the signal and its first alias have thesame frequency and magnitude. The resulting signal then depends on the phaseshift between the signals. For frequencies higher than the Nyquist frequency DcE,the contribution from the alias in the frequency range D0, NE dominates.The example clearly shows how important it is to filter a signal before the sam-pling, so that the signal transmission above the Nyquist frequency is negligible.If proper antialiasing filters are used the contributions of the aliases will besmall. Notice, however, that it is often a problem around the Nyquist frequency.This can to some extent be alleviated by designing the control algorithm so thatHD1E 0, which implies that the signal transmission of the controller at theNyquist frequency is zero.

    LiftingThe notion of lifting is an elegant way to deal with periodically sampled systems.The idea is to represent a finite-dimensional sampled system as a time-invariantinfinite-dimensional discrete-time system. In this way it is possible to define anotion of frequency response properly. It is also possible to give a nice descriptionof inter-sample behavior.

    Consider a system described by D5E. Assume that the system is sampled witha period h, and that the input signal and the states are in L2. We introduce thediscrete-time signal uk " L2D0, hE defined by

    ukD E uDkh E 0 h

    27

  • and the signals xk and yk, which are defined analogously. It follows from D5E that

    xk1D E D ExkDhE Z

    0 D sEBukDsE ds

    ykD E CxkD ED22E

    where

    D E eA D E eA B

    This system is a time-invariant discrete-time system. Equation D22E gives a com-plete description of the inter-sample behavior because the function ykD E, whichis defined for 0 h, is the output in the interval kh t kh h. The de-scription thus includes the phenomenon of aliasing. Notice, however, that uk, xk,and yk are elements of function spaces. Because the system is linear and time-invariant, the frequency response can be defined as HDei hE, where H is thetransfer function of the infinite-dimensional system D22E. The transfer functionH is, however, not a simple mathematical object. It can be computed numeri-cally by a finite-dimensional approximation of the state. This can, for example,be obtained through the discrete-time system obtained by dividing the samplinginterval h into N equal parts. A complete treatment requires functional analysisand is outside the scope of this paper.

    Another way to deal with frequency response of sampled-data systems isto realize that the output generated by a sinusoid with frequency 0 containsthe frequencies k s 0. The system can then be properly characterizedby an infinite matrix that represents the transmission of all sinusoids and thefrequency response can be defined as the norm of that matrix.

    Practical ConsequencesThe fact that sampled systems are time-varying means practically that somecare must be exercised when interpreting frequency responses of sampled-datasystems. The key difficulty is that injection of a sinusoid will result in an out-put which is the sum of several sinusoids. There is a correct frequency responseobtained by lifting but this is unfortunately quite complicated. The approximatefrequency response obtained by neglecting all frequencies except the injected fre-quency is simple and straightforward to compute. It may, however, give mislead-ing results particularly if there are resonances close to the Nyquist frequency.The maximum sensitivity of the approximate frequency response may be smallerthan the true frequency response resulting in wrong estimates of the robustnessof the closed-loop system. With an ideal antialiasing filter the signal componentswith frequencies different from 0 will not be present and the difficulty disap-pears. Ideal antialiasing filters cannot be implemented practically. There willnot be much difficulties with plants with good attenuation of high frequencies ifthe sampling period and the antialiasing filter are chosen properly. There may,however, be severe problems if there are resonant modes close to the Nyquistfrequency. In such cases it is necessary to choose sampling rates and antialias-ing filters very carefully. An additional safeguard is to make control designs sothat the pulse transfer function of the controller has zero gain at the Nyquistfrequency, i.e. HD1E 0. In questionable cases it is advisable to use the theoryof lifting to compute the proper frequency responses.

    28

  • Summary Sampled systems are time-varying systems because of the sampling mech-

    anism.

    New frequencies are introduced through the sampling.

    The frequency response of a sampled-data system requires careful inter-pretation, especially for frequencies close to the Nyquist frequency.

    29

  • 5. Control Design and Specifications

    Control system design is a very rich problem area because there are so manyfactors that have to be considered, for example:

    Attenuation of load disturbances

    Reduction of the effect of measurement noise

    Command signal following

    Variations and uncertainties in process behavior

    Design of discrete-time systems is very similar to design of continuous-time sys-tem. In this chapter we will summarize some relevant facts. A block diagramof a generic control system is shown in Figure 13. The system is influencedby three external signals: the command signal uc and the disturbances v ande. The command signal is used to make the system behave in a specified way.The signal v represents load disturbances that drive the process away from itsdesired behavior. The signal e represents measurement noise that corrupts theinformation about the process obtained from the sensors. Process disturbancescan enter the system in many different ways. It is convenient to consider themas if they enter the system in the same way as the control signal; in this waythey will excite all modes of the system. For linear systems it follows from theprinciple of superposition that inputs entering the system in different ways canbe represented by equivalent systems at the process input. Measurement noiseis injected into the process by feedback. Load disturbances typically have lowfrequencies and measurement noise has high frequencies.

    Control problems can broadly speaking be classified into regulation problemsand servo problems. Model uncertainty is essential for both problems. The majorissue in regulation is to compromise between reduction of load disturbances andinjection of measurement noise. The key issue in the servo problem is to makethe output respond to command signals in the desired way.

    The key ingredients of a design problem are

    Purpose of the system

    Process model

    Model of disturbances

    Model variations and uncertainties

    Admissible control strategies

    Design parameters

    yu

    z

    - 1

    HpHcHff

    ev

    uc

    Figure 13 Block diagram of a typical control system.

    30

  • It is difficult to find design methods that consider all aspects of a design problem.Most design methods focus on one or two aspects of the problem and the control-system designer then has to check that the other requirements are also satisfied.To do this it is necessary to consider the signal transmission from command sig-nals, load disturbances, and measurement noise to process variables, measuredsignals, and control signals, see Figure 13. There are today many computer toolsavailable for design of continuous-time as well as sampled-data controllers. Soft-ware packages, such as Matlab, have many commands and toolboxes aimed atanalysis and design of control systems. In the following chapters we will give anoverview of several methods for design of sampled-data controllers. It turns outthat all methods result in systems having very similar structure. Before goinginto the details of the design methods we will give an overview of the structureof a controller.

    The ProcessIt is assumed that the process to be controlled can be described by the model

    dxdt Ax Bu D23E

    where u represents the control variables, x represents the state vector, and Aand B are constant matrices. Further, only the single-inputsingle-output casewill be discussed. Because computer control is considered, the control signalswill be constant over sampling periods of constant length. Sampling the systemin D23E gives the discrete-time system

    xDkh hE xDkhE uDkhE

    where the matrices and are given by D8E. To simplify we use the sampling-time convention and write the system as

    xDk 1E xDkE uDkE

    Admissible ControlsIt is important to specify the information available for generating the controlsignal. A simple situation is when all state variables are measured without error.The general linear controller is then a linear feedback from all states, i.e.

    uDkE LxDkE D24E

    This feedback is called state feedback. It is important conceptually but is rarelyused in practice because of the cost or difficulty of measuring all the states.A more common situation is that the control signal is a function of measuredoutput signals, past control signals, and past and present reference signals.

    Design ParametersAll design problems are compromises. It is often practical to have a few param-eters that make the compromise explicit. These parameters are called designparameters. The design parameters make it possible to fine tune the design online. Typical design parameters relate to trade-offs between attenuation of loaddisturbances and injection of measurement noise for regulation problems or re-sponse speed and model uncertainty for servo problems.

    31

  • Criteria and SpecificationsThe closed loop system in Figure 13 has three inputs uc, v and e and threeoutputs z, y and u. It can be shown that the system is completely characterizedby six transfer functions.

    Hze T HpHc1 HpHc Hue Hc

    1 Hp Hc Hzuc HpHc Hf f1 Hp Hc

    Hzv Hp

    1 HpHc Hye S 1

    1 Hp Hc Huuc Hc Hf f

    1 Hp Hc

    D25E

    Specifications on the closed loop system are thus naturally expressed in terms ofthese transfer functions. Notice that it is necessary to give specifications on allsix transfer functions. The specifications can be given in the time or frequencydomain.

    RobustnessRobustness to process variations are well captured by the sensitivity functionand the complementary sensitivity function, i.e.

    SDzE 11 HpDzEHcDzE and TDzE

    HpDzEHcDzE1 HpDzEHcDzE

    Typical criteria are the maximum values

    Ms maxhSDei hEh and Mt max

    hTDei hEh D26E

    where the values of Ms and Mt typically should be in the range of 1.2 to 2.0.The smaller values give more robust closed loop systems. In critical situationsthe values should be replaced by the exact frequency responses, see Chapter 4.

    Attenuation of Load DisturbancesThe pulse-transfer function from load disturbance to process output is

    HzvDzE HpDzE1 HpDzEHcDzE

    Since load disturbances typically have low frequencies, the low frequency be-havior is most important. Since the loop transfer function is also large at lowfrequencies we have approximately

    HzvDzE HpDzE1 HpDzEHcDzE 1

    HcDzE

    The low frequency gain of the controller is thus a good measure of load distur-bance attenuation. Other measures are the the maximum value or some someweighted integral of hHzvDei hEh. See Chapter 10.

    Injection of Measurement NoiseThe pulse-transfer function from measurement noise to controller output is

    HueDzE HcDzE1 HpDzEHcDzE SDzEHcDzE

    32

  • Processu y

    u c uff

    ufb

    Hff

    - Hfb

    Figure 14 Block diagram of a feedback system with a two-degree-of-freedom structure.

    Since measurement noise typically has high frequencies, the high frequency be-havior is most important. For high frequencies we have approximately

    HueDzE HcDzE1 HpDzEHcDzE Ms HcDzE

    The high frequency gain of the controller is thus a good measure of measurementnoise attenuation. Other measures are some weighted integral of hHueDei hEh orthe maximum of this quantity for high frequencies.

    Command Signals FollowingThe response to command signals can be decoupled from the response to distur-bances by using a controller having two degrees of freedom. This is illustratedin Figure 14. The reason that this controller is said to have two degrees of free-dom is that the signal transmission from output y to control u is different fromthe signal transmission from command signal uc to control u. This configurationhas the advantage that the servo and regulation problems are separated. Thefeedback controller Hf b is designed to obtain a closed-loop system that is in-sensitive to process disturbances, measurement noise, and process uncertainties.The feedforward compensator Hf f is then designed to obtain the desired servoproperties.

    Summary The design can be separated into regulation and servo problems.

    The regulator problem is solved using feedback.

    The servo problem can mainly be solved using feedforward.

    The sensitivity S and complementary sensitivity T functions are importantmeasures of the robustness of the closed loop system.

    Good software packages are available for design of control systems.

    33

  • 6. Approximation of Analog Controllers

    There are situations when a continuous-time controller is already available. Atypical case is when an analog system is replaced by a computer controlled sys-tem. It is then natural to convert the continuous-time controller to a discrete-time controller directly. In all other situations it is more convenient to make thedesign directly in the sampled-data domain.

    A straightforward approach to approximate an analog controller is to use ashort sampling interval and to make some discrete-time approximations of thecontinuous-time controller, compare Example 2. The problem is illustrated inFigure 15. The continuous-time controller is a dynamical system which can begiven in terms of a state model or a transfer function. It is desired to find analgorithm for a computer so that the digital system approximates the continuous-time system. The algorithm can be given in terms of a difference equation or apulse-transfer function. This problem is interesting for implementation of bothanalog controllers and digital filters. The approximation may be done in manydifferent ways. Digital implementation includes a data reconstruction, whichalso can be made in different waysfor example, zero- or first-order hold.

    State Model of the ControllerA controller is a dynamical system. We will first consider the case when thecontroller is specified as a state model. To simplify the notation assume that thecontroller GDsE in Figure 15 is represented as a generic dynamic system

    dxdt Ax Bu

    y Cx DuD27E

    where x is the controller state, which consists of the observer state and additionalstates that are introduced to generate feedforward signals and integral action.

    A simple way of converting the differential equation to a difference equationis to approximate the derivative of the state by a difference. There are two simplechoices, a forward difference, also called Eulerss method

    dxDtEdt

    pxDtE xDt hE xDtEh

    q 1h

    xDtE D28E

    or a backward difference.

    dxDtEdt

    pxDtE xDtE xDt hEh

    q 1qh

    xDtE D29E

    Algorithm

    Clock

    u kh( ){ } y kh( ){ } H(z) G (s)

    y(t)u(t)A-D D-A

    Figure 15 Approximating a continuous-time transfer function, GDsE, using a computer.

    34

  • where p is the differential operator. Using these approximations we find thatD27E can be approximated by

    xDt hE DI hAExDtE hBDtEuDtE CxDtE DuDtE

    when forward differences are used and

    xDt hE DI hAE1DxDtE BuDt hEEuDtE CxDtE DuDtE

    when backward differences are used. A nice feature of these approximations isthat there is a close correspondence between the continuous and discrete versionsof the controllers. The scheme works very well if the sampling frequency issufficiently high compared with the frequency content of the control signal.

    More elaborate schemes are to compute the zero-order hold or the first-order-hold equivalences. The first-order-hold is probably the most natural approxima-tion because the continuous analysis assumes that the signals are continuous.A sophisticated scheme is to assume that the measured signal is piecewise lin-ear and that the control signal is piecewise constant. It is a straight forwardextension to derive the appropriate formulas in these cases.

    Transfer FunctionsWhen the controller is specified as a transfer function it is natural to look formethods that will transform a continuous transfer function GDsE to a pulse-transfer function HDzE so that the systems in Figure 15 are close to each other. Atransfer function represents a differential equation. The approximations given byD28E and D29E imply that the differential operator p is replaced by some differenceapproximation. In the transform variables, this corresponds to replacing s byDz 1E/h or Dz 1E/zh. The variables z and s are related as z expDshE. Thedifference approximations correspond to the series expansions

    z esh 1 sh DForward difference or Eulers methodEz esh 1

    1 sh DBackward differenceE

    Another approximation, which corresponds to the trapezoidal method for nu-merical integration, is

    z esh 1 sh/21 sh/2 DTrapezoidal methodE D30E

    In digital-control context, the approximation in D30E is often called Tustins ap-proximation, or the bilinear transformation. Using the approximation methodsabove, the pulse-transfer function HDzE is obtained simply by replacing the ar-gument s in GDsE by sP, i.e. HDzE GDsPE where

    sP z 1h

    DForward difference or Eulers methodE D31E

    sP z 1zh

    DBackward differenceE D32E

    sP 2h

    z 1z 1 DTustins approximationE D33E

    35

  • Forward differences Backward differences Tustin

    Figure 16 Mapping of the stability region in the s-plane on the z-plane for the trans-formations D31E, D32E, and D33E.

    The methods are very easy to apply even for hand calculations. Figure 16shows how the stability region Re s 0 in the s-plane is mapped on the z-planefor the mappings D31E, D32E, and D33E.

    With the forward-difference approximation it is possible that a stable conti-nuous-time system is mapped into an unstable discrete-time system. When thebackward approximation is used, a stable continuous-time system will alwaysgive a stable discrete-time system. There are, however, also unstable continuous-time systems that are transformed into stable discrete-time systems. Tustins ap-proximation has the advantage that the left half-s-plane is transformed into theunit disc. Stable continuous-time systems are therefore transformed into stablediscrete-time systems, and unstable continuous-time systems are transformedinto unstable discrete-time systems.

    Frequency PrewarpingOne problem with the approximations discussed above is that the frequency scaleis distorted. For instance, if it is desired to design band-pass or notch filters, thedigital filters obtained by the approximations may not give the correct frequen-cies for the band-pass or the notches. This effect is called frequency warping.Consider an approximation obtained by Tustins approximation. The transmis-sion of sinusoids for the digital filter is given by

    HDei hE 1i h

    D1 ei hEG

    2h

    ei h 1ei h 1

    The first two factors are due to the sample-and-hold. The argument of G is

    2h

    ei h 1ei h 1

    2h

    ei h/2 ei h/2ei h/2 ei h/2

    2ih

    tan

    h2

    The frequency scale is thus distorted. Assume, for example, that the continuous-time system blocks signals at the frequency P. Because of the frequency distor-tion, the sampled system will instead block signal transmission at the frequency , where

    P 2h

    tan

    h2

    That is,

    2h

    tan1

    Ph2

    P

    1 D

    PhE212

    D34E

    This expression gives the distortion of the frequency scale Dsee Figure 17E. It

    36

  • Approximation

    s z

    i

    i

    e i

    e i

    Figure 17 Frequency distortion DwarpingE obtained with approximation.

    follows from D34E that there is no frequency distortion at 0 and that thedistortion is small if h is small. It is easy to introduce a transformation thateliminates the scale distortion at a specific frequency 1 by modifying Tustinstransformation from D33E to the transformation

    sP 1tanD1h/2E

    z 1z 1 DTustin with prewarpingE D35E

    From D35E, it follows thatH(ei 1h

    GDi1Ethat is, the continuous-time filter and its approximation have the same value atthe frequency 1. There is, however, still a distortion at other frequencies.

    EXAMPLE 11FREQUENCY PREWARPINGAssume that the integrator

    GDsE 1s

    should be implemented as a digital filter. Using the transformation of D33E with-out prewarping gives

    HT DzE 1

    2h

    z 1z 1

    h2

    z 1z 1

    Prewarping gives

    HPDzE tan D1h/2E

    1

    z 1z 1

    The frequency function of HP is

    HPDei hE tan D1h/2E

    1

    ei h 1ei h 1

    tan D1h/2E1

    1i tan D h/2E

    thus GDi E and HP(ei h

    are equal for 1.

    Step InvarianceAnother way to approximate is to use the idea of sampling a continuous-timesystem. In this way it is possible to obtain approximations that give correctvalues at the sampling instants for special classes of input signals. For example,

    37

  • if the input signal is constant over the sampling intervals D16E gives a pulse-transfer function HDzE that corresponds to a transfer function GDsE that givescorrect values of the output when the input signal is a piecewise constant signalthat changes at the sampling instants. This approximation is therefore calledstep invariance.

    Ramp InvarianceThe notion of step invariance is ideally suited to describe a system where theinput signal is generated by a computer, because the input signal is then constantover the sampling period. The approximation is, however, not so good whendealing with input signals that are continuous. In this case it is much better touse an approximation where the input signal is assumed to vary linearly betweenthe sampling instants. The approximation obtained is called ramp invariancebecause it gives the values of the output at the sampling instants exactly forramp signals and it is identical to first-order-hold sampling.

    Comparison of ApproximationsThe step-invariant method is not suitable for approximation of continuous-timetransfer functions. The reason is that the approximation of the phase curve is un-necessarily poor. Both Tustins method and the ramp-invariant method give bet-ter approximations. Tustins method is a little simpler than the ramp-invariantmethod. The ramp-invariant method does give correct sampled poles. This isnot the case for Tustins method. This difference is particularly important whenimplementing notch filters where Tustins method gives a frequency distortion.Another drawback with Tustins method is that very fast poles of the continuous-time system transform into sampled poles close to z 1, which will give riseto ringing in the digital filter. The different approximations are illustrated by anexample.

    EXAMPLE 12SAMPLED APPROXIMATIONS OF TRANSFER FUNCTIONConsider a continuous-time system with the transfer function

    GDsE Ds 1E2Ds2 2s 400E

    Ds 5E2Ds2 2s 100EDs2 3s 2500E

    Let HDzE be the pulse-transfer function representing the algorithm in Figure 15.The transmission properties of the digital filter in Figure 15 depend on thenature of the D-A converter. If it is assumed that the converter keeps the outputconstant between the sampling periods, the transmission properties of the filterare described by

    GDsE 1shD1 eshEHDeshE

    where the pulse-transfer function H depends on the approximation used. Fig-ure 18 shows Bode diagrams of H for the different digital filters obtained bystep equivalence, ramp equivalence, and Tustins method. The sampling periodis 0.03 s in all cases. This implies that the Nyquist frequency is 105 rad/s. Allmethods except Tustins give a good approximation of the amplitude curve. Thefrequency distortion by Tustins method is noticeable at the notch at 20 rad/sand very clear at the resonance at 50 rad/s.

    The step-equivalence method gives a small error in the gain but a significanterror in the phase. The phase error corresponds approximately to a time delayof half a sampling interval. The approximation based on ramp equivalence gives

    38

  • 100

    101

    102

    105

    104

    103

    102

    Mag

    nit

    ude

    100

    101

    102

    200

    0

    Frequency, rad/s

    Ph

    ase

    Figure 18 Bode diagrams of a continuous-time transfer function GDsE and different sam-pled approximations HDeshE, continuous-time transfer function Dsolid/blueE, ramp invari-ance Ddashed-dotted/redE, step invariance Ddashed/greenE, and Tustins approximationDdotted/blackE.

    very small errors in gain and phase. The phase curve for Tustins approximationalso deviates because of the frequency warping. Ramp equivalence gives the bestapproximation of both amplitude and phase.

    Selection of Sampling Interval and Antialiasing FiltersChoice of sampling rates and antialiasing filters are important issues in designof digital control. It is also necessary to augment process dynamics with thedynamics of the antialiasing filter. The choice of sampling period depends onmany factors. One way to determine the sampling period is to use continuous-time arguments. The sampled system can be approximated by the hold circuit,followed by the continuous-time system. For small sampling periods, the transferfunction of the hold circuit can be approximated as

    1 eshsh

    1 1 sh DshE2/2

    sh 1 sh

    2

    The first two terms correspond to the Taylor series expansion of expDsh/2E.That is, for small h, the hold can be approximated by a time delay of half asampling interval. The antialiasing filter will also decrease the phase margin.Consider a second order filter with transfer function

    Gf DsE 2f

    s2 2 f f s 2f

    39

  • The gain of the filter at the Nyquist frequency N is approximately

    nN

    f N

    2Hence f NTnN . The phase lag of the filter is approximately

    arg Gf Di E 2 f

    f 2 f

    NTnN

    2 f hpiTnN

    Summarizing we find that the hold circuit and the antialiasing filter decreasethe phase margin with

    0.5 2 fpiTnN

    ch

    Assuming that the phase margin can be decreased by 5 to 15 and introducingthe values f 0.707 and nN 0.1 the following rule of thumb is obtained.

    h c 0.05 to 0.14 D36E

    where c is the crossover frequency Din radians per secondE of the continuous-time system. This rule gives a Nyquist frequency that is about 23 to 70 timeshigher than the crossover frequency.

    SummaryDifferent ways of translating a continuous-time controller to a digital controllerhave been presented. These methods make it possible to use continuous-time de-sign and simply translate the results to a pulse-transfer function that can be im-plemented in a computer. This approach is particularly useful when continuous-time designs are available.

    Forward, backward differences, and Tustinss method are the simplest.

    Tustins method distort the frequency scale of the filter.

    Ramp invariance gives very good results and is only moderately more com-plicated than Tustins method. With computer tools like Matlab there is noreason to use any other method.

    The sampling period should be short to have good approximations ch 0.05 0.14.

    Antialiasing filters are important in all cases.

    40

  • 7. Feedforward Design

    Before treating design methods in detail we will discuss the structure of thecontrollers. Figure 14 is an input-output representation which only gives anoverview of the system. Additional insight can be obtained by considering thestate space representation in Figure 19 which gives more details. The controlleris represented by three blocks: a generator for feedforward signals, an observerand a state feedback L. The feedforward generator has the command signal asthe input and it generates the desired behavior of the states xm of the systemand the feedforward signal uf f . The feedforward signal uf f produces an inputto the process that will generate the desired response to the command signal.The feedforward generator can be implemented as a dynamical system

    xmDk 1E mxmDkE mucDkEuf f DkE CmxmDkE DmucDkE

    The block called observer also has two inputs, the process input u and output y,and it generates an estimate of the state of the process. The observer is also adynamical system

    xDk 1E xDkE uDkE KDyDkE CxDkEE D37E

    The estimated state x is compared with the ideal state from the feedforwardgenerator creating the feedback signal

    uf bDkE L

    xmDkE xDkE

    The feedback signal LDxm xE is zero if the error e xm x is zero. If there is adifference between x and xm, the feedback will generate corrective actions. Thefeedback term can be viewed as a generalization of error feedback in ordinarycontrol systems, because the error represents deviations of all state variablesand not just the output errors. The control signal is the sum of the feedback andthe feedforward signals, i.e.

    uDkE uf b uf f L

    xmDkE xDkE uf f

    Many design methods result in the controller structure represented by Figure 19.There are also several refinements. It is, for example, possible to include modelsof the disturbances acting on the system.

    xm

    u

    u

    ff

    x Observer

    L Process

    u fb y

    u c Model andFeedforward Generator

    ^

    Figure 19 A two-degree-of-freedom controller based on state feedback and an observer.

    41

  • Hf b

    Hf f

    Hp1 Hp2

    1

    uc u

    d

    y

    Figure 20 Block diagram of a system where measured disturbance d is reduced by acombination of feedback and feedforward.

    Reduction of Measurable Disturbances by FeedforwardFeedforward is a complement to feedback which can be used both to reduce theeffect of measurable disturbances and to improve the response to command sig-nals as is illustrated in Figure 20. Assuming that the disturbance d is piecewiseconstant over the sampling intervals and sampling the system we find that thepulse-transfer function from load disturbance to process output is

    YDzEDDzE

    Hp2DzE(1 Hp1 DzEHf f DzE

    1 Hf bDzEHpDzE

    Hp2DzE(1 Hp1DzEHf f DzE

    SDzE

    This equation shows that the effects of the disturbances can be reduced in twoways: by making 1 Hp1 DzEHf f DzE DfeedforwardE small or by making the sen-sitivity function SDzE small DfeedbackE. To totally eliminate the disturbances byfeedforward the feedforward transfer function should be chosen as

    Hf f DzE H1p1 DzE D38E

    which means that the process dynamics should be inverted.

    System InversesEquation D38E shows that design of feedforward is essentially a problem of in-verting a system. It is particularly simple to invert a system if it is given as apulse-transfer function. Consider a system given by the pulse-transfer function

    HDzE BDzEADzE

    The inverse is then

    H1DzE ADzEBDzE

    There are, however, some problems because the inverse is not causal if the degreeof the polynomial ADzE is greater than the degree of BDzE. Further, the inverse isunstable if the polynomial BDzE has zeros outside the unit circle. For feedforwarddesign it must be required that the feedforward transfer function is stable andcausal. It is therefore often necessary to replace the exact inverse of the transfer

    42

  • uc

    Hm

    Hu

    Hc Hp

    1

    uf f

    ym uf b y

    Figure 21 Another representation of the system with two-degrees-of-freedom in Fig-ure 19.

    function H1p1 DzE with an approximate inverse Hp1DzE. If the disturbance d hasknow properties it is possible to compute optimal inverses.

    The following procedure gives an inverse that is optimal under certain con-ditions. Write the transfer function HDzE as

    HDzE BDzEBDzE

    ADzE

    where the polynomial BDzE has all its zeros inside the unit disc and BDzE hasall its zeros outside the unit disc. An approximate inverse is then given by

    HDzE ADzEzdeg Adeg B BDzEBDzE

    whereBDzE zdeg BBDz1E

    Using Feedforward to Improve Response to Command SignalsFeedforward can also be used to improve the response to command signals.This has already been discussed in connection with two-degrees-of-freedom con-trollers, see Figure 19. An alternative representation of this figure is given inFigure 21. In this figure Hm represents the desired response of the output to thecommand signal uc, and Hu is the transfer function that generates the feedfor-ward signal. From Figure 21

    yDkE HpDHu Hc HmE1 Hp Hc ucDkE HmucDkE

    This gives the following relation

    Hm Hp Hu

    which implies thatHu H1p Hm

    The pulse-transfer function Hm must clearly be chosen to be causal and stable.A pulse-transfer function Hu that is also causal and stable can be obtained bychoosing Hm to have the same pole excess and the same zeros outside the unitcircle as Hp.

    43

  • Summary Feedforward is efficient for reducing measurable disturbances.

    Feedforward is used to shape the response from the reference signal.

    Feedforward requires inversion of the open loop system and the inverseoften requires approximations to be causal and stable.

    44

  • 8. PID Control

    The PID controller is unquestionably the most common controller, therefore itis appropriate to give it special attention. The textbook version of the PID-controller can be described by the equation

    uDtE K

    eDtE 1Ti

    Z teDsE ds Td

    deDtEdt

    D39E

    where the error e is the difference between the command signal uc Dthe set pointEand the process output y Dthe measured variableE. K is the gain or proportionalgain, Ti the integration time or reset time, and Td the derivative time of the con-troller. The PID-controller was originally implemented using analog technologythat went through several development stages, that is, pneumatic valves, re-lays and motors, transistors, and integrated circuits. In this development muchknow-how was accumulated that was embedded into the analog design. Todayvirtually all PID-controllers are implemented digitally. Early digital implemen-tations were often a pure translation of D39E, which left out many of the extrafeatures that were incorporated in the analog design. In this chapter we willdiscuss the digital PID-controller in some