Discrete Approximation of Continuous Systems CSE 421 Digital

  • Slides: 11
Download presentation
Discrete Approximation of Continuous Systems CSE 421 Digital Control Lecture 3 1

Discrete Approximation of Continuous Systems CSE 421 Digital Control Lecture 3 1

Introduction • One approach for digital control is to first design a continuous-time controller

Introduction • One approach for digital control is to first design a continuous-time controller H(s) and then find a discrete system H(z) which approximates, using numerical integration, the behavior of H(s). H(z) is then realized on a computer. 2

Example • Given the first-order system • Cross-multiplying and using inverse Laplace transform we

Example • Given the first-order system • Cross-multiplying and using inverse Laplace transform we get • We integrate to obtain u(t), 3

 • In discrete time, we can express this integral in two intervals: [0,

• In discrete time, we can express this integral in two intervals: [0, k. T−T] and [k. T−T, k. T] • This area may be approximated in three ways: • Forward rectangular • Backward rectangular • Trapezoidal 4

Forward & backward rules 5

Forward & backward rules 5

Trapezoidal rule • Comparing the original H(s) = a/(s + a) with the three

Trapezoidal rule • Comparing the original H(s) = a/(s + a) with the three H(z), an approximation for s is obtained. • This may be viewed as a mapping from the s-plane to the z-plane. 6

Comparison of Integration Rules • It is instructive to see where in the z-plane

Comparison of Integration Rules • It is instructive to see where in the z-plane these approximations transform the left-half s-plane (the region of stable poles). • To this end, solve for the inverse mapping, then substitute for s = jω. • The mapping of the left-half s-plane are as shown below. • With forward rectangular rule, there is a possibility that a stable continuous system results in an unstable discrete approximation. • With trapezoidal rule, stable continuous system will result in a stable discrete system and vice versa. 7

Example With the aid of Matlab, find the discrete approximation of the following continuous

Example With the aid of Matlab, find the discrete approximation of the following continuous system. Using trapezoidal rule approximation and a sample period T = 0. 05. numc = [0 10]; % Continuous-time numerator & denominator denc = [1 10]; sysc = tf(numc, denc); % Create continuous LTI system T = 0. 05; % Sampling period sysd = c 2 d(sysc, T, ’tustin’) % Discretize using trapezoidal rule % Rectangular rules are not supported Transfer function: 0. 2 z + 0. 2 -------z - 0. 6 Sampling time: 0. 05 8

Finding transfer function from LTI system • Sometimes you may need to extract the

Finding transfer function from LTI system • Sometimes you may need to extract the numerator and denominator from the LTI description of the system. • Using the result obtained above, here’s how to use tfdata: [numd, dend] = tfdata(sysd, ’v’) numpz = 0. 2 denpz = 1. 0 -0. 6 • NOTE: Don’t forget the ’v’ or you’ll be in for grief! 9

Implementation of Difference Equations in Real Time • It is time to consider how

Implementation of Difference Equations in Real Time • It is time to consider how to construct computer programs that will realize the difference equations we obtain. • Consider the second-order discrete transfer function: • with corresponding difference equation • We assume that there is an interrupt occuring every T seconds. When an interrupt occurs, variable FLAG is set to one. 10

Implementation of Difference Equations in Real Time 10 while (FLAG == 0) wait; 20

Implementation of Difference Equations in Real Time 10 while (FLAG == 0) wait; 20 uk = adc_in(); % Read input u(k). 30 yk = a 1*yk 1 + a 2*yk 2 + b 0*uk + b 1*uk 1 + b 2*uk 2; % compute y(k). 40 dac_out(yk); % Write output y(k) to D/A converter. 50 uk 2 = uk 1; 60 uk 1 = uk; 70 yk 2 = yk 1; 80 yk 1 = yk; 90 Goto 10; % Propagate variables backwards for next sample % Execute continuously. 11