You are on page 1of 34

1.

Proportional-Integral-Derivative (PID) Control

PID controllers are commonly used to regulate the time-domain behavior of many different types of dynamic plants. These controllers are extremely popular because they can usually provide good closed-loop response characteristics, can be tuned using relatively simple design rules, and are easy to construct using either analog or digital components. Consider the feedback system architecture shown in Figure 1 where we assume that the plant is a DC motor whose shaft position must be accurately regulated.

Figure 1 The PID controller K(s) is placed in the forward path, so that its output becomes the voltage applied to the motors armature. The feedback signal is either an angular shaft position or velocity, measured by a potentiometer or a tachometer, respectively. In the block diagram, these transducer dynamics are in the feedback path. The output position signal y (t) (or velocity signal) is summed with a reference signal r (t), or command signal, to form the error signal e (t). Finally, the error signal is the input to the PID controller. The concept for this closed-loop system is simple. The sensor, which is attached to the motor shaft, provides a voltage that is compared to the reference voltage r (t) at the summer. When this error signal is non-zero, there will be an input to the controller, and hence some action taken by the DC motor. Once the sensor signal is equal to the reference signal, there is no input to the controller and no voltage applied to the motor, causing the motor to stop. However, this simple explanation does not provide us a with a method whereby the motor position can be brought to an exact position (with absolute accuracy) and does not tell us how to make the motor perform this positioning task as quickly as possible. Before examining the input-output relationships and design methods for the PID controller, it is helpful to review typical characteristics observed for the velocity response of a DC motor to a step voltage input. Different characteristics of the motor response (steady-state error, peak overshoot, rise time, etc.) are controlled by selection of the three gains that modify the PID controller dynamics. This is discussed in detail below. The PID controller is defined by the following relationship between the controller input e(t) and the controller output v(t) that is applied to the motor armature:

Taking the Laplace transform of this equation gives the transfer function K(s):

This transfer function clearly illustrates the proportional, integral, and derivative gains that make up the PID compensator. Select new definitions for the gain terms according to

Then, the transfer function can be expressed to easily show that the PID controller leads to a pole at the origin of the Laplace plane and design freedom over two zeros:

The block diagram for the PID controller can be sketched in several different ways. One possible block diagram is shown next:

This schematic represents a starting point for construction of the actual PID controller using either analog electronics or digital programming of the VT84 microcontroller prototyping board. In the next section, we focus on the digital implementation.

5.2 PID in detail


Given the basic system with a plant, G(s) and a series controller K(s).

r(s) = input (desired output) e(s) = error signal u(s) = control action on plant y(s) = actual system output Quite often, the input is a "step" command: u(t) =1 if t>=0 u(t) =0 if t<0 We want the output to "track" the step input. So for a plant with 2nd order dynamics: The step response looks like:

Rarely will responses be perfect. There are compromises between tr, Mp, ts, and ess. Consider the plant:

e(s)=r(s)-y(s) So the transfer function (output vs input) is:

For a 2nd order system, we know the typical response to a step change in r(s). (shown above) Controllers can be designed to "shape" certain features of the transient step response: Peak overshoot, Mp Rise time, settling time, tr, ts, Steady state error, ess

Intuitively, the controllers effect will depend on the type of operation it applies to the error signal.

Proportional Control,
Proportional control amplifies the error to motivate the plant towards the desired response. It can reduce but not eliminate stead-state error. Proportional control can also produce excessive overshoot and oscillation.

For proportional feedback, K(s)=K. This is an amplifier, i.e., turn the know, change K. Therefore the control signal, u, is linearly proportional to the error, e. Intuitive description of proportional control here Example:

Characteristic Equation:

Solving for the roots vs K, i.e., using the Root Locus Analysis. What can we say about proportional control from the result?

This root locus plot shows us that the system is stable for any K, resulting in guaranteed stability. In the real world, this is almost never the case. Remember: Increasing overshoot with increasing K.

Recall:

, is decreasing Decreasing rise time with increasing K.

Recall:

; n is increasing

Steady-state error decreases with increasing K but is not eliminated

Type 0 system :

ess decreases as K increases, but ess never reaches zero.

Integral Control,
The control acts on the "history" of the error, balancing the positive and negative portions of the response. It can eliminate steady state error. Usually small integral gains are used to avoid destabilizing the closed-loop system.

Or

Look at the effect on the system type. Weve added a "free integrator" or a pole at the origin. Recall steady-state error to a step depends on the system type.

Type 0: Type 1: Returning to our example from before, the root locus becomes:

Integral gain must be kept small to avoid instabilities and oscillations.

Derivative Control,
The control acts on the slope of the error, thereby minimizing overshoot. It provides "rate" feedback, resulting in more damping. High derivative gains can increase trise and tsettling. It is difficult to realize in practice because differentiation leads to "noisy" signals.

Or

(u=0 for constant error) We are adding a zero to the closed-loop system, generally a stabilizing influence.

PID Control Combines all three controllers.

The PID controller provides two zeros that we get to place as well as onep ole at the origin.

Compensator pole-zero locations PID Block Diagram:

How do we select the gains?

Tuning PID Controllers


There are procedures suggested for selecting the three gains, KI, TI, and TD. Ziegler-Nichols Tuning:

1.

Based on "process reaction curve" (first order) L=td ~time delay ~ time constant of effection first-order system K~steady state gain R=K/

Now, design the closed loop system so that transients decay to 25% of the initial amplitude in one period. ( =0.21) Then, set K=1/RL K=0.9/RL TI=L/0.3 K=1.2/RL TI=2L TD=0.5L 2. for proportional control only for proportional-integral only for complete PID control

Ultimate sensitivity method

Set

i.e. increase K until output begins to oscillate, (at K=Ku)

Then set:

K=0.5Ku Measure Pu (oscillation period) K=0.45Ku TI=(1/1.2)Pu K=0.6K TI=(1/2)Pu TD=(1/8)Pu

for proportional control only for proportional-integral only

for complete PID control

.1 Comparison of Actuators
1. Rotary DC Electric (permananet magnet brush type) Advantages Fast and accurate Small in size Reversible by changing input polarity Good for position and velocity control Inexpensive Easily controlled using feedback, amenable to sophisticated control strategies

10

Disadvantages Inherently high-speed, low-torque devices (usually needing a gear or other reduction unit, which increases cost) Commutator and brushes limit life Electric arcing dangerous in a flammable atmosphere Not self locking (brake required) High current at stall leads to heat generations

2. Rotary DC Electric (brushless) Similar in characteristics and performance to brush-type permanent magnet motors. Same advantages and disadvantages except: Suppy current switching accomplished by solid-state circuit rather than brushes Long-life, low maintenance More expensive and complex

3. DC Steppers Advantages

Discrete steps allow open-loop position control (no feedback needed) Inexpensive (especially considering total system cost) Long-life, low maintenance

Disadvantages

Poor energy efficiency Subject to oscillation (ringing) Noisy, especially at high speed under load Fixed step size Not self locking (brake required) High current at stall leads to heat generation

4. AC Servo (the word servo implies the ability to accurately control position or velocity) Advantages

No permanent magnets; fields are created by induction Most reliable, longest-life electric motor Good for position and velocity control

Disadvantages Inherently high-speed, low-torque devices Inverter or complex electronics needed to produce variable-frequency sine waves

11

Not self locking (brake required)

5. Gear motors (a motor with an integral gear reduction unit, or gearhead) 6. Torque motor (a motor specifically designed to produce high torque and slow speeds) 7. Hydraulic Actuators (linear and rotary) Advantages

High force or torque (especially relative to size and weight) Self-locking by closing valves Accurate servo control possible Good near stall speeds (good low-speed performance) Usually safe in explosive atmosphere Smooth operation

Disadvantages

Expensive, especially supply and controls Leaky seals common Supply and return lines needed Poor high-speed response

8. Pneumatic Actuators (linear and rotary) Advantages


Inexpensive (assuming air supply is available) High speed Non-polluting, non-flammable Good for force-control applications No return line needed

Disadvantages

Compressible air limits accuracy and ability to control position Noise due to escaping air

12

4.4 Data Acquisition


Sensor information must be converted from analog to digital form before it is accessible to the computer. We will cover the following subjects which are inherent to all forms of data acquisition systems: Sampling Theorem and Aliasing Anti-Aliasing filters Data Acquistion System Components Design Considerations

Before computers, sensor signals were confined to analogue operations (which can still be done today).

For a long T,

The meter output is related to the signal power in the filtered bandwidth. Mechatronic designs rely on a computer interface. Sensor signals are converted to discrete-time sequences:

13

Sampling Theorem A time signal y(t) can be exactly recovered from its sequence y(nT) provided that the sample period Ts<1/(2fmax), where fmax is the signal bandwidth in Hz. When the signal is not limited in frequency content to a value less than one-half the sampling frequency, the signal is undersampled and aliasing occurs. To show this, begin with the system:

The signal f1(t) is sampled periodically by the switch with period Ts=1/2W. The output of the sampler in the time domain is:

and in the frequency domain :

If F1(f) is given, Fs(f) can be found as follows:

14

The Fourier transform:

becomes

This leads to

For to/T=1/2:

The sampling function is a series of impulses at harmonics of the sampling frequency, with magnitudes given by the sinc distribution. Now, the convolved spectrum

15

for fs=2fmax=2W is shown.

For the undersampled case, fs < 2fmax < 2W, the spectral component centered around the first harmonic overlaps the spectrum centered at zero frequency. This is called aliasing.

16

Aliasing must be avoided by Sampling at very high frequencies Filtering the signal f1(t) before sampling to remove its frequency content above fs/2. Anti-Aliasing filters

Low-pass filtering must provide enough rejection to eliminate any possibility of aliasing for the case where no information is know about the sampled data spectra.

Will this signal be aliased if fs=2fH? It all depends on the filter design.

17

Anti-aliasing filters are typically six to eight pole filters, whose corner frequencies are set equal to the Nyquist frequency. For some signal analyzers performing N-point DFTs, the corner frequency is set to fNyq and they retain N/2.56 bins for display.

For multiple input data acquisition systems, matched anti-aliasing filters must be used to retain correct temporal relationships. Be aware of potential phase inversions from anti-aliasing filters (caused by inverting amplifiers). System components

There are three essential elements:

18

1. 2. 3.

Analog multiplexer(s) Sample/Hold Amplifier(s) Analog-to-Digital Converter(s)

Analog Multiplexers: Analog Multiplexers are similar to a single pole, n position switch. The switch position is selected based on the binary code input.

Features for design: Settling time time required for transients to decay, dominated by source and load capacitance Switching time time required for the FET to turn on after a new digital select code is applied to the Channel Address inputs Crosstalk amount of signal feedthrough from the seven off channels appearing at the multiplexer output. Performance degradation occurs because of: Amplifier bias current Load impedance mismatch Multiplexer leakage current

Multiplexers can be connected in a tiered structure all contributing to a signal output node. This allows many more signals to be multiplexed into one output.

19

Sample/Hold Amplifiers The logic controlled amplifier charges an internal hold capacitor based on the input. A compensation network is used to minimize sample-to-hold charge offset.

Goals of a good sample/hold amplifier are to minimize droop, feedthrough, aperture delay time, and acquisition time. Simultaneous sample/hold data acquisition systems are required if temporal relationships among inputs need to be preservered. In other words, you must sample all inputs at the same time.

20

A/D Converters: An analog input is converted (typically using successive approximation architecture) to an n bit binary signal in an A/D converter.

Example: If a plus or minus 10V signal is fed into a 12 bit converter, the digital values would be: -10V 000000000000 -5V 0V 5V 10V 010000000000 011111111111 101111111111 111111111111

A/D converters vary in the number of binary outputs (or output resolution) from 3 bits to 16 bits and more.

21

A digital to analog converter(DAC) accepts an n-bit input word (b1, b2, , bn) of fractional binary value Di and produces an analog signal proportional to Di. For a voltage-output DAC, the transfer characteristic is:

Kv = scaling constant Vr=Reference voltage Vo=output voltage

The ADC0838 uses the technique of successive approximation to perform the ADC.

Successive Approximation uses a code search strategy to complete an n-bit conversion in just n clock periods. The logic is referred to as the Successive Approximation Register (SAR).

22

Starting with the MSB (most significant bit), the SAR inserts a trial bit 1 and interrogates the comparator to find whether this causes the DAC output to rise above Vi. The procedure is repeated for all subsequent bits one at a time, until all bit have been tested, thus performing an n-bit conversion in n-clock cycles. This is faster than many other ADC schemes.

Example: Consider an input voltage Vi=10.75 V. The ADC has a 4 bit resolution and Vfs=16V. So the DAC has a resolution of:

The DAC is offset 1/2 LSB (-0.5V) Operation:

1. 2. 3. 4. 5. 6. 7. 8. 9.

Start SAR sets b1=1, b2=0, b3=0, b4=0 DAC output voltage = 16 (1 x 2-1 + 0 x 2-2 + 0 x 2-3 + 0 x 2-4) - 0.5, VDAC=7.5 V Wait for end of the clock period T1, compare VDAC to VI 7.5<10.75, so leave b1=1 SAR sets b2=1, b3=0, b4=0 DAC output voltage = 16 (1 x 2-1 + 1 x 2-2 + 0 x 2-3 + 0 x 2-4) - 0.5, VDAC=11.5 V Wait for end of the clock period T2, compare VDAC to VI 11.5>10.75, so change b2=0 SAR sets b3=1, b4=0 DAC output voltage = 16 (1 x 2-1 + 0 x 2-2 + 1 x 2-3 + 0 x 2-4) - 0.5, VDAC=9.5 V

23

10. 11. 12. 13.


14.

Wait for end of the clock period T3, compare VDAC to VI 9.5<10.75, so leave b3=1 SAR sets b4=1 DAC output voltage = 16 (1 x 2-1 + 0 x 2-2 + 1 x 2-3 + 1 x 2-4) - 0.5, VDAC=10.5 V Wait for end of the clock period T2, compare VDAC to VI 10.5<10.75, so leave b4=1 Finished, final ouput is 1011 (Decimal 11)

4.3 Devices for Measuring Force and Torque


There are two general methods to indirectly sense force:

1. 2.
Strain Gages

Measure the change in resistance of elastic element that expands or contracts Measure the deflection of an elastic element

Force Stress (force/area) Strain (deformation per unit length) Gage is bonded to surface Strain of surface causes gage to undergo strain Strain causes change in electrical resistance

A typical metallic foil strain gage looks like:

Typical standard strain gage patterns:

Diaphragm

Rosette

Torque

24

Typical Compression Load Cell and Wheatstone Bridge Circuit Load Cell: A pre-packaged set of strain gages forming a force or torque measuring unit

The strain of a typical strain gage is usually less than 0.005 mm/mm, or 5000 microstrain.

Torsional Load Cells

25

A more complex application of the strain gage is in a six-axis load cell for a robotic wrist

26

27

The second method to indirectly measure force is to measure the deflection of an elastic element: A typical deflection-measuring force transducer:

28

4.1 Light Sensors


Infrared Sensors combine an infrared source and an infrared receiver. Sources include: IR LEDs IR Lasers Photon Counters sensors which can detect about 1 photon of light Photoresistors CdS: Resistance increases as incident light decreases Photodiodes can produce current proportional to incident light (solar cells) Phototransistors a switch based on the incident light:

Receivers include:

29

Proximity Sensors detect presence of reflective object, but not range. Thru-the-beam Highly directional and long range (<km) Retro-Reflective Less directional and long range Diffuse Reflective Not directional; short range (~cm)

To measure range you can use a PSD(position-sensitive-device). This device can measure the distance d; with that distance and some triangle geometry, the distance L can be computed . This requires prior knowledge of dx and theta.

Other Optoelectric devices:

30

Opto-Coupler: used to isolate a control signal from a device. No possibility that a large voltage can jump across.

IR Remote Control: To eliminate ambient light interference, the transmitted IR light signal is modulated. Then a demodulator is used in the receiver to decode the signal. This can be used to transmit binary encoded information without interference from sunlight, ambient lights, etc. Take a look at a sample data sheet of Archer, GP1U52X receiver/demodulator Pyroelectric Detector: senses IR radiation in the HEAT range can sense body heat for example. IR Imager: a camera that "sees" heat, used for testing devices, night vision, etc. Vendors of above devices include: Honeywell EG&G Hamamatsu Texas Instruments Optex UDT

4.2 Ultrasonic Sensors


Ultrasonic sensors use a combination speaker/microphone (capacitive transducer) to send out a pulse of sound and measure how long it takes to return to the speaker.

Then the distance traveled is 2d, (the distance from the sensor to the object is d, so the sound pulse must travel twice that distance)

31

2d=c* (delta t) Which depends on the speed of sound: c=1138 ft/sec in air c=5034 ft/sec in sea water The combination speaker/microphone can be an electrostatic device. The device is a gold plated mylar film (~1" diameter, 0.0005" thick) stretched to a high tension with a high bias voltage placed on it (~400V). When the voltage is modulated, the diaphragm will move back and forth, generating sound pressure waves. The electrostatic device usually operates in the range of 20kHz-50kHz (low frequency). Piezoelectric devices can also be used for this application and operate at less than 600kHz (high frequency). There is a definite range limitation with these devices. The power of the sound pulse decreases as the inverse-square law:

also molecular absorption,

where alpha is the attenuation coefficient which depends on frequency (high frequencies attenuate faster and R is the distance away from the sound source. So overall, the initial pulse of energy Io, decreases with R as:

Also, reflection coefficients Kr and the fact the wave has to travel back to the sensor after reflecting off of the object:

Kr is the coefficient of reflectivity, or the proportion of reflected intensity to the incident intensity.

Za=acoustic impedance of air Zo=acoustic impedance of the object

The closer that Za and Zo match, the less reflection will occur.

32

Implementation Issues With an oblique surface, the reflection may not go back towards the sensor. A diffuse surface will scatter the sound pulse instead of reflecting it back to the sensor. On the Polaroid sensor, the surface cannot be more than 25 degrees off perpendicular with the sensor.

With a wide beam sensor, it has more of a chance of hitting something normal, but then directionality is lost. If the sensor finds an obstruction, it could be anywhere in front then. With a narrow beam, the object must reflect the pulse close to exactly right, but if it does, the sensor is sure of its location. The width of the beam (theta) is inversely proportional to the width of the sensor and directly proportional to the wavelength of the sound being emitted:

where d is the width of the sensor. Consider the case of d=0 which would be a point source. In this case, theta would be 360 degrees, or equal intensity at all points around the sensor. The other limiting case is d=infinite which produces a plane wave, theta=0 degrees. Along with beam width problems, another problem is spurious reflections. Since there could be several objects in the view of the sound pulse, several reflections may come back to the sensor confusing the system. A solution to this problem is to use sensor arrays, several sensors that scan overlapping areas. If a couple sensors agree that there is an object at the same distance, then the system knows that the object is in a certain area. Selecting Frequencies of Operation The distance and angle resolution is directly proportional to the energy in the bandwidth of the sensor (which frequency). But molecular attenuation increases at high frequencies, so keeping low frequencies is beneficial. Other effects that determine the performance of the system are: Air turbulence Air temperation, which can affect the distance perceived by the sensor

If the object is moving that the sensor is trying to locate, a Doppler shift may occur. Fixed observer, moving source:

33

minus if closing Moving observer, fixed source:

plus if closing Reflected off moving target:

fe: emitted frequency fr: reflected frequency V: speed of object c: speed of sound

Applications of Ultrasonic Sensors: Distance measurement Density measurement Crack/failure detection Flow rate measurement (Doppler) Fluid level sensing Speed measurements (Doppler)

34

You might also like