modeling and analysis of digital control systems

68
DIGITAL CONTROL (EEEE 789) DIGITAL CONTROL (EEEE 789) Dr. AbdullaIsmail Professor of Electrical Engineering [email protected]

Upload: ronald-george

Post on 02-Nov-2015

11 views

Category:

Documents


0 download

DESCRIPTION

Modeling and Analysis of Digital Control Systems

TRANSCRIPT

  • DIGITAL CONTROL (EEEE 789)Dr. AbdullaIsmailProfessor of Electrical [email protected]

  • Introduction to Digital ControlDiscrete Time Systems & Difference EquationsThe Z-transformImpulse Response and Step response of Discrete-Time SystemsModeling Digital Control SystemsFrequency Response of Discrete-Time SystemsSteady-State Error Computation for Digital Control SystemsStability of Digital Control SystemsDigital Control System DesignState-Space Analysis of Discrete-Time SystemsCourse Outline (Topics):Digital Control

    Digital Control

  • Digital Control*Modeling Digital Control SystemsAs in the case of analog control, mathematical models are needed for the analysis and design of digital control systems. A common configuration for digital control systems is shown in Figure 1. The configuration includes a digital-to-analog converter (DAC), an analog subsystem, and an analog-to-digital converter (ADC). The DAC converts numbers calculated by a microprocessor or computer into analog electrical signals that can be amplified and used to control an analog plant. The analog subsystem includes the plant as well as the amplifiers and actuators necessary to drive it. Figure 1

    Digital Control

  • Digital Control*Modeling Digital Control SystemsThe output of the plant is periodically measured and converted to a number that can be fed back to the computer using an ADC. Here, we develop models for the various components of this digital control configuration.Many other configurations that include the same components can be similarly analyzed. We begin by developing models for the ADC and DAC, then for the combination of DAC, analog subsystem, and ADC.

    Digital Control

  • Digital Control*Modeling Digital Control SystemsADC ModelThe ADC can be modeled as an ideal sampler with sampling period T as shown in Figure 2.DAC ModelThe input-output relationship of the DAC is given bywhere {u(k)} is the input sequence.This equation describes a zero-order hold (ZOH), shown in Figure 3..Figure 3(1)

    Digital Control

  • Digital Control*ADCModeling Digital Control SystemsDAC

    Digital Control

  • Digital Control*Modeling Digital Control SystemsOther functions may also be used to construct an analog signal from a sequence of numbers. For example, a first-order hold constructs analog signals in terms of straight lines, whereas a second-order hold constructs them in terms of parabolas.In practice, the DAC requires a short but nonzero interval to yield an output; its output is not exactly equal in magnitude to its input and may vary slightly over a sampling period. But the model given in (1) is sufficiently accurate for most engineering applications. The zero-order hold is the most commonly used DAC model and is adopted in most digital control texts.

    Digital Control

  • Digital Control*Modeling Digital Control SystemsTransfer Function of the ZOHTo obtain the transfer function of the ZOH, we replace the number or discrete impulse shown in Figure 3 below by an impulse (t). The transfer function can then be obtained by Laplace transformation of the impulse response. As shown in the figure, the impulse response is a unit pulse of width T. A pulse can be represented as a positive step at time zero followed by a negative step at time T, i.e. u(kT) u(kT+T)

    Digital Control

  • Digital Control*Modeling Digital Control SystemsFigure. (a) Input signal to an ideal sampler. (b) Output signal of an ideal sampler. (c) Output signal of a zero-order-hold (ZOH) device.Transfer Function of the ZOH

    Digital Control

  • Digital Control*Modeling Digital Control SystemsUsing the Laplace transform of a unit step and the time delay theorem for Laplace transforms,Transfer Function of the ZOHThus, the transfer function of the ZOH isNext, we consider the frequency response of the ZOH:

    Digital Control

  • Digital Control*Modeling Digital Control SystemsTransfer Function of the ZOHWe rewrite the frequency response in the formWe now have

    Digital Control

  • Digital Control*Modeling Digital Control SystemsTransfer Function of the ZOHThe angle of frequency response of the ZOH hold is seen to decrease linearly with frequency, whereas the magnitude is proportional to the sinc function. As shown in Figure 4, the magnitude is oscillatory with its peak magnitude equal to the sampling period and occurring at the zero frequency.Figure 4

    Digital Control

  • Digital Control*Modeling Digital Control SystemsEffect of the Sampler on the Transfer Function of a CascadeAssuming that interconnection does not change the mathematical models of the subsystems, the Laplace transform of the output of the system of Figure 5 is given byIn a discrete-time system including several analog subsystems in cascade and several samplers, the location of the sampler plays an important role in determining the overall transfer function.

    Digital Control

  • Digital Control*Modeling Digital Control SystemsEffect of the Sampler on the Transfer Function of a CascadeThus, the equivalent impulse response for the cascade is given by the convolution of the cascaded impulse responses.

    Digital Control

  • Digital Control*Modeling Digital Control SystemsEffect of the Sampler on the Transfer Function of a CascadeThe same conclusion can be reached by inverse-transforming the product of the s-domain transfer functions. The time domain expression shows more clearly that cascading results in a new form for the impulse response. The output of the system is sampled to obtainFor a linear time invariant (LTI) system with impulse-sampled input, the output is given by

    Digital Control

  • Digital Control*Modeling Digital Control SystemsEffect of the Sampler on the Transfer Function of a CascadeChanging the order of summation and integration givesSampling the output yields the convolution summationThis is the equivalent to the following z-transform

    Digital Control

  • Digital Control*Modeling Digital Control SystemsEffect of the Sampler on the Transfer Function of a CascadeExample 1Find the equivalent sampled impulse response sequence and the equivalent z-transfer function for the cascade of the two analog systems with sampled input1. If the systems are directly connected.2. If the systems are separated by a sampler.Solution1. In the absence of samplers between the systems, the overall transfer function is

    Digital Control

  • Digital Control*Modeling Digital Control SystemsEffect of the Sampler on the Transfer Function of a CascadeExample 1 .. SolutionThe impulse response of the cascade isand the sampled impulse response isThus, the z-domain transfer function is2. If the analog systems are separated by a sampler, then each has a z-domain transfer function and the transfer functions are given by

    Digital Control

  • Digital Control*Modeling Digital Control SystemsEffect of the Sampler on the Transfer Function of a CascadeExample 1 .. Solution

    Digital Control

  • Digital Control*Modeling Digital Control SystemsDAC, Analog Subsystem, and ADC Combination Transfer FunctionThe cascade of a DAC, analog subsystem, and ADC, shown is shown in Figure below.Because both the input and the output of the cascade are sampled, it is possible to obtain its z-domain transfer function in terms of the transfer functions of the individual subsystems as follows

    Digital Control

  • Digital Control*Modeling Digital Control SystemsDAC, Analog Subsystem, and ADC Combination Transfer FunctionUsing the DAC model given before, and assuming that the transfer function of the analog subsystem is G(s), the transfer function of the DAC and analog subsystem cascade isThe corresponding impulse response is

    Digital Control

  • Digital Control*Modeling Digital Control SystemsDAC, Analog Subsystem, and ADC Combination Transfer FunctionThis impulse response is the analog system step response minus a second step response delayed by one sampling period. This response is shown in Figure shown below for a second-order underdamped analog subsystem. Figure: Impulse response of a DAC and analog subsystem. (a) Response of an analog system to stepinputs. (b) Response of an analog system to a unit pulse input.

    Digital Control

  • Digital Control*Modeling Digital Control SystemsDAC, Analog Subsystem, and ADC Combination Transfer FunctionThis analog response is sampled to give the sampled impulse responseBy z-transforming, we obtain the z-transfer function of the DAC (zero-order hold), analog subsystem, and ADC (ideal sampler) cascadeThe equation can be rewritten more concisely as

    Digital Control

  • Digital Control*Modeling Digital Control SystemsDAC, Analog Subsystem, and ADC Combination Transfer FunctionExample 2Find GZAS(z) for the cruise control system for the vehicle shown in Figure 1, where u is the input force, v is the velocity of the car, and b is the viscous friction coefficient.SolutionWe first draw a schematic to represent the cruise control system as shown in Figure right. Using Newtons law, we obtain the following model:

    Digital Control

  • Digital Control*Modeling Digital Control SystemsExample 2 .. Solutionwhich corresponds to the following transfer function:We rewrite the transfer function in the form

    Digital Control

  • Digital Control*Modeling Digital Control SystemsDAC, Analog Subsystem, and ADC Combination Transfer FunctionThe corresponding partial fraction expansion isExample 2 .. Solutionwherethe desired z-domain transfer function isUsing and the z-transform table, We simplify to obtain the transfer function

    Digital Control

  • Digital Control*Modeling Digital Control SystemsDAC, Analog Subsystem, and ADC Combination Transfer FunctionExample 3Find GZAS(z) for the series R-L circuit shown in Figure with the inductor voltage as output.Using the voltage divider rule givesSolutionHence, using,we obtain

    Digital Control

  • Digital Control*The Closed-Loop Transfer FunctionModeling Digital Control SystemsThe closed-loop digital control system is given block diagram of Figure 1. The block diagram includes a comparator, a digital controller with transfer function C(z), and the ADC-analog subsystem-DAC transfer function GZAS(z). The controller and comparator are actually computer programs and replace the computer block in Figure 2. Figure 2Figure 1

    Digital Control

  • Digital Control*The Closed-Loop Transfer FunctionModeling Digital Control SystemsThe block diagram is identical to those commonly encountered in s-domain analysis of analog systems with the variable s replaced by z. Hence, the closed-loop transfer function for the system is given byand the closed-loop characteristic equation isThe roots of the equation are the closed-loop system poles, which can be selected for desired time response specifications as in s-domain design.

    Digital Control

  • Digital Control*The Closed-Loop Transfer FunctionModeling Digital Control SystemsExample 4Find the Laplace transform of the analog and sampled output for the block diagram of Figure below.The analog variable x(t) has the Laplace transformSolutionwhich involves three multiplications in the s-domain. In the time domain, x(t) is obtained after three convolutions.

    Digital Control

  • Digital Control*The Closed-Loop Transfer FunctionModeling Digital Control SystemsExample 4 .. SolutionFrom the block diagramSubstituting in the X(s) expression, after sampling, then givesThus, the impulse-sampled variable x*(t) has the Laplace transformThese terms are obtained by inverse Laplace transforming, impulse sampling, and then Laplace transforming the impulse-sampled waveform.

    Digital Control

  • Digital Control*The Closed-Loop Transfer FunctionModeling Digital Control SystemsExample 4 .. SolutionNext, we solve for X*(s):and then E(s)With some experience, the last two expressions can be obtained from the block diagram directly.The combined terms are clearly the ones not separated by samplers in the block diagram.

    Digital Control

  • Digital Control*The Closed-Loop Transfer FunctionModeling Digital Control SystemsExample 4 .. SolutionFrom the block diagram the Laplace transform of the output is Y(s) = G(s)D(s)E(s). Substituting for E(s) givesThus, the sampled output isWith the transformation z = est, we can rewrite the sampled output as

    Digital Control

  • Digital Control*Disturbances in a Digital SystemModeling Digital Control SystemsDisturbances are uncontrolled variables that have undesirable effects on the system response response. They can be deterministic, such as load torque in a position control system, or stochastic, such as sensor or actuator noise. However, almost all disturbances are analog and are inputs to the analog subsystem in a digital control loop.

    Digital Control

  • Digital Control*Disturbances in a Digital SystemModeling Digital Control SystemsConsider the system with disturbance input shown in Figure belowThe Laplace transform of the impulse-sampled output isSolving for Y*(s), we obtain(1)

    Digital Control

  • Digital Control*Disturbances in a Digital SystemModeling Digital Control SystemsThe denominator involves the transfer function for the zero-order hold, analog subsystem, and sampler. We can therefore rewrite (1) using the notation of asor in terms of z as

    Digital Control

  • Digital Control*Disturbances in a Digital SystemModeling Digital Control SystemsExampleConsider the block diagram shown below with the transfer functionsFind the steady-state response of the system to an impulse disturbance of amplitude A.

    Digital Control

  • Digital Control*Disturbances in a Digital SystemModeling Digital Control SystemsExample.. SolutionWe first evaluateThe z-transform of the corresponding impulse response sequence is

    Digital Control

  • Digital Control*Disturbances in a Digital SystemModeling Digital Control SystemsExample.. SolutionUsingwe obtain the transfer functionFromwe obtain the sampled outputTo obtain the steady-state response, we use the final value theorem

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsHere, we consider the unity feedback block diagram shown in Figure 1in the next slide subject to standard inputs and determine the associated tracking error in each case. The standard inputs considered are the sampled step, the sampled ramp, and the sampled parabolic. As with analog systems, an error constant is associated with each input, and a type number can be defined for any system from which the nature of the error constant can be inferred. All results are obtained by direct application of the final value theorem.E(z) = R(z) Y(z)

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsFrom Figure 2, the tracking error is given byFigure 1where L(z) denotes the loop gain of the system.Applying the final value theorem yields the steady-state error

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsThe limit exists if all (z 1) terms in the denominator cancel. This depends on the reference input as well as on the loop gain.To examine the effect of the loop gain on the limit, rewrite it in the formwhere N(z) and D(z) are numerator and denominator polynomials, respectively, with no unity roots. The following definition plays an important role in determining the steady-state error of unity feedback systems.

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsThe loop gain of has n poles at unity and is therefore type n. These poles play the same role as poles at the origin for an s-domain transfer function in determining the steady-state response of the system. Note that s-domain poles at zero play the same role as z-domain poles at e0 or 1.

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsSubstituting from in the error expression of e() to giveNext, we examine the effect of the reference input on the steady-state error.

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsSampled Step InputThe z-transform of a sampled unit step input isSubstituting in gives the steady-state errorThe steady-state error can also be written aswhere Kp is the position error constant given byTherefore, the steady-state error for a sampled unit step input is

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsSampled Ramp InputThe z-transform of a sampled unit ramp input isSubstituting in gives the steady-state errorwhere Kv is the velocity error constant.The velocity error constant is thus given by

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsSampled Ramp InputThe corresponding steady state error isFrom the above expression for e(), the velocity error constant Kv is zero for type 0 systems, finite for type 1 systems and infinite for type 2 or higher systems.

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsSampled Parabolic InputSimilarly, it can be shown that for a sampled parabolic input, an acceleration error constant given bycan be defined, and the associated steady-state error is

    Digital Control

  • Digital Control*Summary of the error constants and the steady-state errorModeling Digital Control Systemsdue to a Step inputdue to a Ramp inputdue to a Parabolic or Exponential input

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsExample 1Find the steady-state position error for the digital position control system with unity feedback and with the transfer functionsSolutionThe loop gain of the system is given byThe system is type 1.

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsExample 1 .. SolutionTherefore, it has zero steady-state error for a sampled step input and a finite steady-state error for a sampled ramp input given byClearly, the steady-state error is reduced by increasing the controller gain and is also affected by the choice of controller pole and zero.

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsExample 2Find the steady-state error for the analog systemSolutionThe transfer function of the system can be written asThus, the position error constant for analog control is K/a, and the steady-state error is

    Digital Control

  • Digital Control*Steady-State Error and Error ConstantsModeling Digital Control SystemsExample 2 .. SolutionFor digital control, it can be shown that for sampling period T, the DAC-plant-ADC z-transfer function isThus, the position error constant for digital control isand the associated steady-state error is the same as that of the analog system with proportional control. In general, it can be shown that the steady-state error for the same control strategy is identical for digital or analog implementation.

    Digital Control

  • Digital Control*MATLAB CommandsModeling Digital Control SystemsThe transfer function for the ADC, analog subsystem, and DAC combination can be easily obtained using the MATLAB. Assume that the sampling period is 0.1 s and that the transfer function of the analog subsystem is G. The MATLAB command to obtain a digital transfer function from an analog transfer function iswhere num is a vector containing the numerator coefficients of the analog transfer function in descending order, and den is a similarly defined vector of denominator coefficients.

    Digital Control

  • Digital Control*MATLAB CommandsModeling Digital Control SystemsFor example, the numerator polynomial (2s2 + 4s + 3) is entered asThe term method specifies the method used to obtain the digital transfer function. For a system with a zero-order hold and sampler (DAC and ADC), we useFor a first-order hold, we use

    Digital Control

  • Digital Control*Modeling Digital Control SystemsBACKUP SLIDES

    Digital Control

  • Digital Control*The Sampling TheoremSampling is necessary for the processing of analog data using digital elements. Successful digital data processing requires that the samples reflect the nature of the analog signal and that analog signals be recoverable, at least in theory, from a sequence of samples. Figure 1 shows two distinct waveforms with identical samples. Obviously, faster sampling of the two waveforms would produce distinguishable sequences. Thus, it is obvious that sufficiently fast sampling is a prerequisite for successful digital data processing. The sampling theorem gives a lower bound on the sampling rate necessary for a given band-limited signal (i.e., a signal with a known finite bandwidth).

    Digital Control

  • Digital Control*The Sampling Theorem

    Digital Control

  • Digital Control*The Sampling Theorem

    Digital Control

  • Digital Control*The Sampling Theorem

    Digital Control

  • Digital Control*The Sampling Theorem

    Digital Control

  • Digital Control*The Sampling Theoremwith F denoting the Fourier transform, can be reconstructed from the discrete-time waveformThe spectrum of the continuous-time waveform can be recovered using an ideal low-pass filter of bandwidth b in the range

    Digital Control

  • Digital Control*The Sampling TheoremSelection of the Sampling FrequencyIn practice, finite bandwidth is an idealization associated with infinite-duration signals, whereas finite duration implies infinite bandwidth. To show this, assume that a given signal is to be band limited. Band limiting is equivalent to multiplication by a pulse in the frequency domain. By the convolution theorem, multiplication in the frequency domain is equivalent to convolution of the inverse Fourier transforms. Hence, the inverse transform of the band-limited function is the convolution of the original time function with the sinc function, a function of infinite duration. We conclude that a band-limited function is of infinite duration.In practice, the sampling rate chosen is often larger than the lower bound specified in the sampling theorem. A rule of thumb is to choose s asThe choice of the constant k depends on the application.

    Digital Control

  • *MATLAB Filesc2dConvert model from continuous to discrete timeSyntaxsysd = c2d(sys,Ts)sysd = c2d(sys,Ts,method)sysd = c2d(sys,Ts,opts)[sysd,G] = c2d(sys,Ts,method)[sysd,G] = c2d(sys,Ts,opts)

    Description

    sysd = c2d(sys,Ts) discretizes the continuous-time dynamic system model sys using zero-order hold on the inputs and a sample time of Ts seconds.

    sysd = c2d(sys,Ts,method) discretizes sys using the specified discretization method method.

    sysd = c2d(sys,Ts,opts) discretizes sys using the option set opts, specified using the c2dOptions command.

    [sysd,G] = c2d(sys,Ts,method) returns a matrix, G that maps the continuous initial conditions x0 and u0 of the state-space model sys to the discrete-time initial state vector x [0]. method is optional. To specify additional discretization options, use [sysd,G] = c2d(sys,Ts,opts).Sys is Continuous-time dynamic system model Ts is Sampling TimeSysd is Discrete-time dynamic system model

  • Digital Control*MATLAB FilesExample Discretize the continuous-time transfer function:

    with input delay Td = 0.35 second. To discretize this system using the triangle (first-order hold) approximation with sample time Ts = 0.1 second, type

    H = tf([1 -1], [1 4 5], 'inputdelay', 0.35); Hd = c2d(H, 0.1, 'foh'); % discretize with FOH method and % 0.1 second sample time

    Transfer function:

    0.0115 z^3 + 0.0456 z^2 - 0.0562 z - 0.009104--------------------------------------------- z^6 - 1.629 z^5 + 0.6703 z^4

    Sampling time: 0.1

    Digital Control

  • Digital Control*The next command compares the continuous and discretized step responses.step(H,'-',Hd,'--')

    MATLAB FilesExample

    Digital Control

  • Digital Control*d2c Converts discrete-time dynamic system to continuous time. SYSC = d2c(SYSD,METHOD) computes a continuous-time model SYSC that approximates the discrete-time model SYSD. The string METHOD selects the conversion method among the following: 'zoh' Zero-order hold on the inputs 'foh' Linear interpolation of inputs 'tustin' Bilinear (Tustin) approximation 'matched' Matched pole-zero method (for SISO systems only)The default is 'zoh' when METHOD is omitted.MATLAB Files

    Digital Control

  • Digital Control*Consider the discrete-time model with transfer function

    and sample time Ts = 0.1 s. You can derive a continuous-time zero-order-hold equivalent model by typingHc = d2c(H)

    Discretizing the resulting model Hc with the default zero-order hold method and sampling time Ts = 0.1s returns the original discrete model H(z):c2d(Hc,0.1)

    To use the Tustin approximation instead of zero-order hold, typeHc = d2c(H,'tustin')

    As with zero-order hold, the inverse discretization operationc2d(Hc,0.1,'tustin')gives back the original H(z).MATLAB FilesExample

    Digital Control