Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Control: An Overview Wittenmark, Åström, Årzén Computer controlled Systems The sampling process Approximation of continuous time controllers Aliasing.

Similar presentations


Presentation on theme: "Computer Control: An Overview Wittenmark, Åström, Årzén Computer controlled Systems The sampling process Approximation of continuous time controllers Aliasing."— Presentation transcript:

1 Computer Control: An Overview Wittenmark, Åström, Årzén Computer controlled Systems The sampling process Approximation of continuous time controllers Aliasing and new Frequencies: Anti-aliasing filters PID Control: Discretization, integrator windup Real time implementation

2 Computer controlled systems Quantization in time and magnitude

3 The sampling process  Periodic sampling  Sampling instants: times when the measured physical variables are converted into digital form  Sampling period: time between two sampling instants (denoted by h or T)

4 Sampling and Reconstruction  Sampler: A device that converts a continuous time signal into a sequence of numbers, e.g., A/D converter  A/D: 8-16 bits  2^8 to 2^16 levels of quantization, normally higher than the precision of physical sensor  Reconstructor: Converts numbers from the computer to analog signals  D/A converter combined with a hold circuit (Zero Order Hold)

5 Discretization of continuous controllers k J Disk drive system controller design: Analysis done on board

6 Sampling continuous signals

7 Aliasing and new frequencies  Can information be lost by sampling a continuous time signal?  sin(2  0.9t) & sin(2  0.1t)  Are sampled values obtained from a low frequency signal or a high frequency signal?  It may be possible that some continuous signal CANNOT be recovered from the sampled signal  May have loss of information

8  If a signal contains no frequencies above  0, then the continuous time signal can be uniquely reconstructed from a periodically sampled sequence provided the sampling frequency is higher than 2  0 (Nyquist rate) Shannon’s Sampling Theorem (1949) Can recover 0.1 Hz but not 0.9 Hz

9  Can recover 0.1 Hz but not 0.9 Hz  What should be the sampling frequency for recovering the 0.9 Hz sinusoidal? Sampling Theory- Example

10 Aliasing & Anti-aliasing Filters  Aliasing (or frequency folding): High frequency signal interpreted as a low frequency signal when sampled at lower than the Nyquist rate (the 0.9=1-0.1 Hz signal) w1 -w1 ws ws-w1ws+w1 ……

11 … anti-aliasing filters  To prevent aliasing:  Remove all frequencies above the Nyquist frequency before sampling the signal.  Antialiasing filter (low pass analog filter)  High attenuation at and above Nyquist frequency  Bessel/Butterworth filters (order 2-6):

12 Example: Pre-filtering  Square wave + 0.9 Hz sine disturbance Sampled at 1 Hz (alias freq 0.1 Hz) Filtered by a 0.25Hz LPF. Sampled values

13 Summary  Information can be lost through sampling if the signal contains frequencies higher than the Nyquist frequency.  Sampling creates new frequencies (aliases).

14 … summary  Aliasing makes it necessary to filter the signals before they are sampled.  Effect of the anti-aliasing filters must be considered when designing controllers.  The dynamics can be neglected if the sampling period is sufficiently short.

15 Computer control (Wittenmark, Astrom, Arzen) z PID Control: Discretization, saturation and windup zOther practical issues

16 PID Control zMost common controller:  e: error, K: gain, Ti: integration time, Td: derivative time z System error as K & 1/Ti, stability improves as Td, increasing 1/Ti reduces stability zOriginally implemented using analog technology

17 PID Control & Discretization zModifications to PID: zDerivative term: zDerivative not acting on the command signal N: gain at high freq: 3-20

18 Discretization of PID Controller zProportional part needs no approximation: zIntegral part:  can be approximated as

19 .. Discretization of PID: P+I+D zDerivative part: D(t)  use backward differences for approximation:

20 Integrator windup zActuators can become saturated due to large inputs zExamples of saturated actuators: - throttle position in an automobile - amplifier output voltage - aircraft control surfaces

21 A taste of the practical world zIf error is large, Integral Control can saturate the actuator. PID error  Integrator output can become large (windup) with no effect on the output (due to saturation). System y reference + - u uc

22 … integrator windup zIntegrator output winds up until the sign of e(t) changes and the integration turns the other way around  Solution: Reset integrator when actuator is saturated Using anti-windup Without anti windup y uc Desired output

23 PID implementation Signals double uc; // set point double y; // measured variable double v; // control output double u; //limited control output States double I = 0; //Integral part double D = 0; //Derivative part double yold=0; //delayed measured variable Parameters double Kp, Ki, Kd; double Ts; //Sampling time double ul, uh; //output limits

24 PID class o PID Signals signals; States states; Parameters par; double calculateOutput(uc, y); void updateState(double u); Calculate, Perform integrator anti-windup

25 Main program main( ) { double uc, y, u; PID pid = new PID( ); // Can pass parameters here long time = getCurrentTimeMillis( ); // Get current time while (true) { y = readY( ); uc = readUc( ); u = pid.calculateOutput(uc,y); writeU(u); pid.updateState(u); time = time + pid.par.Ts*1000; // Increment time waitUntil(time); // Wait until "time“- RTOS call }

26 void updateState(double u) void updateState(double u) { states.I = states.I + par.bi*(signals.uc - signals.y) +par.ar*(u - signals.v); states.yold = signals.y; }

27 calculateOutput( ) double calculateOutput(double uc, double y) { …. double P = par.K*(par.b*uc - y); states.D = par.ad*states.D - par.bd*(y - states.yold); signals.v = P + states.I + states.D; if (signals.v < par.ulow) { signals.u = par.ulow; } else { if (signals.v > par.uhigh) { signals.u = par.uhigh; } else { signals.u = signals.v;}} return signals.u; }

28 Summary of PID  PID is a useful controller.  Things to consider:  Filtering of the derivative term  Updating the integrator  Anti windup compensation

29 Some practical issues  Numerical accuracy is improved if more bits are used:  float coeff; vs double coeff; (64 bits)  A/D and D/A  Much less accuracy  Typical resolutions: 8, 12, 16 bits  Better to have a good resolution at the A/D converter than D/A  A control system is less crucial for a quantized signal applied to the input of the plant.

30 … practical issues zNonlinearities such as quantization by A/D can result in oscillations yDo simulations to find out if A/D, D/A resolutions can improve performance z Selection of the sampling period  A common rule:  = 0.1 to 0.6,  : desired BW of the closed-loop system

31 … practical issues zAnti-aliasing filters yMust provide attenuation at Nyquist frequency zAnti-reset windup is important to include in the controller.


Download ppt "Computer Control: An Overview Wittenmark, Åström, Årzén Computer controlled Systems The sampling process Approximation of continuous time controllers Aliasing."

Similar presentations


Ads by Google