Вы находитесь на странице: 1из 13

Outline Introduction

Classification of Control Systems Analog Controllers


Op-amp circuits PID Implementation Comparison

Classification of Control Systems y


Continuous-time Continuous time Control
Mostly referred to as Analog Control Controller takes corrective action continuously y in time. Analog circuit elements are used to implement such controllers.

Signals in Control Engineering Elements of Control Computer


I/O interfaces Control computer Control C t l algorithm l ith

Discrete-time Control
Also known as Digital- or Numerical Control Corrections take place at particular instances in time.
Controllers output stays constant between these instances.

Example: Water Level Control


P control law Hysteresis control

Microprocessors are generally employed to realize these controllers.

Hybrid Control
A blend of both control systems (and strategies).

Chapter 1

ME 534

Chapter 1

ME 534

Discrete-time Control Applications pp


Home appliances pp
Dishwasher Washing machine Fridge

Digital g Applications pp ( (Contd) )


Automobiles
Several computers are on board. Some functions performed by these computers (called electronic control units or ) ECUs)
Fuel injection / Ignition control Anti-lock Break Systems (ABS) Stability and traction control (anti-skid) Active suspension Climate control Automatic transmission y system
Chapter 1 ME 534 5

Millitary y applications pp
Advanced weapons systems Radar systems

Robotics
Mobile robots Industrial I d t i l robots b t

CNC Machine Tools Electric Motor Drivers Consumer g goods


TV sets CD / DVD players / recorders Camcorders Mobile phones

Automations systems
Factory y automation

Aerospace applications
Aircraft control / guidance Satellites Rocket / missile guidance

Personal Computing
Hard H d di disk kd drives i CD-RW drives

Chapter 1

ME 534

Typical yp Digital g Control System y


Power Disturbance m(t) Control Element u(t) y(t)

Typical yp Analog g Control System y

Control Computer
b(t) Sensor

Function of control computer:


Computation of correction signal Generating command / reference Decision making Implementation of complex logical operations operations.
ME 534 6

Function of analog computer:


Analog filtering of the measurement noise in the input signals Comparison of the measurement (b) and the command (r) Generation of correction signal (m) on a continuous basis.
Chapter 1 ME 534 7

Chapter 1

Analog g Control using g Op-amps p p

Offset null 1 Inverting input 2 Non-inverting input 3 -V


4
_

Inverting g Amplifier p
A number of different functions can be implemented by employing op-amps with various passive circuit elements.

8 7 6

No connection +V Output

Analog controllers are frequently implemented via operational amplifiers (or simply op-amps).
One can implement almost any desired function.

Integrator:
ZA = R ZB = 1/(Cs)

5 Offset null

Op-amps are very versatile amplifiers:


Precise Error tolerant / Robust Low-cost

There exists a wide variety of specialized op-amps for different applications:


Radio/video S Sonar/radar / d Automation Automotive I t Instrumentation, t ti etc. t
8

Transfer function of this circuit is

E o (s) 1 1 = E i (s) RC s

Eo ( s ) Z ( s) = Gi ( s ) = B Ei ( s ) Z A ( s)
where ZA, ZB refer to the generalized impedances [] of the components. Note that the bipolar voltage supply (+V, -V) of the circuit is customarily NOT shown for the sake of simplicity. simplicity
Chapter 1

Differentiator:
ZA = 1/(Cs) ZB = R

E o (s) = (RC)s E i (s)


ME 534 9

Chapter 1

ME 534

Common Co o Op Op-amp a pC Circuits cu s


Summing Amplifier (Mixer):
Rf

Differential e e a Amplifier p e

Buffer (Voltage Follower):

_ Rn
+ +

eo = ei
+

R1 e1 RL

en

eo

Low-pass Filter:
Differential amplifier p is used to amplify small signals buried in much larger signals. R2 resistances (along with R1s) must be equalized to reduce the effect of common mode voltage on p ( (vo) ). the output
ME 534 11

eo =
i =1

Rf Ri

ei

Eo ( s ) 1 = Ei ( s ) ( RC ) s + 1

vo =
Chapter 1

R2 R1

( v 2 v1 ) = k e

Chapter 1

ME 534

10

Voltage g Limiter
Output of op-amps cannot exceed a certain voltage level Vsat:
o Vsatt is a few volts (usually 2 Volts) lower than the supply voltage (Vs). )

Analog g PID Controller


D-control

Kd r(t) + _
P-control I-control

d dt

Analog computations involved in PID:


m(t) Integration (dt) Diff Differentiation ti ti (d/dt) Amplification (by a gain) Summation (addition, subtraction)

One can built a voltage limiter using this important property. To accomplish that, two cascaded op-amp circuits are designed:
o o The first one ( (Amplifier) Amplifier ) is to amplify ei such that the output at this stage will saturate at the some desired level. The following circuit (Attenuator) , which has a reciprocal of the amplifiers gain, reverts the amplified voltage back. As an illustration, assume that we would like to limit ei such that -5 [V] ei 5 [V] Let Vs = 15 [V] and Vsat = 13 [V]. In this case, the gain of the amplifier is calculated as Vsatt/ei,max =13/5 = 2 2.6 6 i Hence, we choose R1 = 10 k and R2 = 26 k.

Ki

dt

Transfer Function:

Kp b(t)

2 ( s + 1)( 2 s + 1) M (s) K d s + K p s + Ki = = Ki 1 E ( s) s s E ( s) = R( s) B( s)

Circuit Parameters:

1 = R1C1 2 = R2C2
Ki =
Chapter 1 ME 534

R4 R1 R3C2
13

Chapter 1

ME 534

12

Another PID Controller


A more versatile version of the PID controller can be built by simply implementing each control law via a separate circuit. Controller gains can be conveniently adjusted via R1, R2, and R3.

A Multi-purpose p p PID Controller

Control Parameters:

Kp = Ki =

R3 R4 1 R1C1

K d = R2C2

Chapter 1

ME 534

14

Chapter 1

ME 534

15

Comparison p
Analog Control Digital Control
Control computations (such as dt, d/dt, All computations are performed in , , , etc.) are continuous in time. distinct time intervals. Op-amps are used as computing elements. H d i d Not Hardwired N t suitable it bl f for reconfiguration. Very sensitive to measurement- and process noise. p for simple p control systems y Inexpensive but can be quite costly for complex systems.
Chapter 1

Signals in Control Engineering


1. 1 2. 3. 4 4. Continuous-time Continuous time signal Discrete-time signal Amplitude-quantized discrete-time signal Amplitude-quantized Amplitude quantized continuous-time continuous time signal

Ps, DSPs, Cs, PLCs are commonly utilized. Fl ibl / easily Flexible il programmed. d Somewhat sensitive to signal conversion errors, quantization noise, and round-off / truncation errors. Hardware is inexpensive p but control software development tools can be expensive.

ME 534

16

Chapter 1

ME 534

17

Type yp 1: Continuous-time
f(t) f*(t)

Type 2: Discrete-time Discrete time


,...} } f (t ), t {0, T , 2T , f * (t ) = else 0,
0 T 2T 3T

Time: t [0, [0 +) The signal ranges between a lower bound (fmin) and an upper bound (fmax): f [fmin, fmax ] By definition, f(t) = 0 when t < 0.
Chapter 1 ME 534 18

Time: t {0, T, 2T, ... , kT, ...} g ranges g between a lower bound (fmin) The signal and an upper bound (fmax): f [fmin, fmax ]
Chapter 1 ME 534 19

Type 3: Amplitude Quantized Discrete-time


Quantization Level:
f

Type 4: Quantized Continuous-time Continuous time


Time: t [0, +) The range of the function is
~

f =
~*

f max f min m+n

3 f f

f (t ) f floor , t {0, T ,...} f (t ) = f 0, else

f = [ f min , f max ]

2T 3T

Time: t {0, T, 2T, ... , kT, ...} The Th range of f the th function f ti becomes b

f * {nf , (n 1)f , , 0, f , 2f , , mf }
Chapter 1 ME 534 20 Chapter 1 ME 534

Since the transitions of the function at T, 2T, 3T, ... are extremely fast, the function values predominantly reside at the quantized levels.
21

Properties of Digital Control Systems


All physical quantites are represented by corresponding (binary) numbers with finite length. All computations are synchronized and are p y carried out periodically. The period in which all these computations are performed is called sampling period (T).
Chapter 1 ME 534 22

Properties p ( (Contd) )
All q quantites in discrete-time domain could be expressed as
X(t = kT) X(k) where k {0, 1, 2, ...} k is called time index.

Control algorithm is essentially an algeabric expression (difference equation) which depends on not only the history of error but also that of the manipulation):

m(k ) = ai m(k i ) + b j e(k j )


i =1 j =0
Chapter 1 ME 534 23

A General Digital Control System


Power r(kT)
t

Elements of I/O Interfaces


t Output

Disturbance u(t) y(t)


t Manipulated Input

e(kT) +
t Error

Difference Equation

m(kT)
t Manipulation

Output Interface

~ m(t)
t

Command

Control Algorithm

Latch & D/A

Control Element

Plant

Clock ~ b(kT)
Measurement t

b(t)
t

Control Computer and Software Digital Domain

Sampler & A/D


Input Interface

Sensor

Analog Domain

I. I II. III. IV IV.

Sampler Analog-to-Digital (A/D) Converter Latch Digital-to-Analog Digital to Analog (D/A) Converter

Control elements:
M Motor t Driver Di + El Electric ti M Motor t Servo-valve + Hydraulic Cylinder / Motor Power Converter + Electric Heater
Chapter 1 ME 534 24 Chapter 1 ME 534 25

I) ) Sampler p
f(t) Type 1 f(t) t
0 T 3T

II) ) A/D Converter


f*(t) Type 2

Sampler

f*(t) t

Samples a continuous continuous-time time signal at sampling instances. Converts effectively an analog signal (Type 1) into a discrete-time one (Type 2).
Chapter 1 ME 534 26

It converts a voltage level into a corresponding (binary) number representation at a particular instant of time.
Chapter 1 ME 534 27

Properties p of A/D Converters


Input Voltage Range:
5V U Unipolar: i l 0 +5V 5V Bipolar: -5V +5V 10V Unipolar: 0 +10V 10V Bipolar: -10V +10V

A/D Converters (Contd) ( )


A/D converters are integrated circuits designed specifically to do this conversion:
Vin [Vmin, Vmax] Vout0, ..., VoutN {0, 5 V} (TTL)

Resolution:
Denotes quantization level Output is N-bit binary number

For convenience, , output p voltage g states are represented as binary numbers:


0 Volt 0 (low logic level) 5 Volts 1 1 (high logic level)

Conversion time:
Time required to convert the voltage into an N-bit binary number
Chapter 1 ME 534 28 Chapter 1

For A/D converter chips, prices go up as


Resolution (and accuracy) increases Conversion time decreases

ME 534

29

Unipolar p A/D Converter


For a unipolar A/D converter (ADC) with 8 8-bit bit resolution, resolution we have the following ADC output code:
Output Voltage at Pins [V] DB7 0 0 0 0 5 DB6 0 0 0 0 5 DB5 0 0 0 0 5 DB4 0 0 0 0 DB3 0 0 0 0 DB2 0 0 0 0 5 DB1 0 0 5 5 5 DB0 0 5 0 5 5 Binary Number 00000000 00000001 00000010 00000011 Unsigned Integer 0 1 2 3

Unipolar p ADC Output p ( (8-bit) )


Output of ADC 11111111 11111110

00000011 00000010 00000001 00000000 Input Voltage

...
5 5

...
11111111

...
255

(Vmin)
Chapter 1 ME 534 30 Chapter 1

ME 534

31

Bipolar p ADC Output p ( (8-bit) )


Note that the ADC output format in bipolar operation is device-dependent: Device manufacturers commonly employ direct (straight) binary binary- and/or two twos s complement representations.

Example p A/D Converter


Consider a 10V unipolar A/D converter with 8 bit (N = 8) resolution. 8-bit l ti
a) ) Determine the voltage g resolution of this device. b) Find the output representation (as unsigned integer) when an input voltage of 3.27 V is applied.

12 27 V

-127 7 V

Chapter 1

(V Vmin) -128 8 V

-126 6 V

ME 534

12 26 V

12 28 V (V Vmax)

32

Chapter 1

ME 534

33

Solution Part (a) ( )


Voltage resolution (i.e. quantization level) can be given as
V = | Vmax Vmin | 2N

Solution Part (b) ( )


The corresponding number representation can be simply expressed as
V output = floor in V 3.27 = 83 = floor 39 0625 103 39.0625

where floor is a function rounding its argument to the lowest integer integer.
Input Voltage Range [V] Binary # Rep. Unsigned Int. Rep.

Hence,
V = |10 0 | 10 = = 39.0625 [mV ] 28 256

[0, 0.0391) [3.2422, 3.2813) [9.9219,9.9609) [9.9609,10) [ , )


34 Chapter 1

00000000 01010011 11111110 11111111


ME 534

0 83 254 255
35

Chapter 1

ME 534

Quantization Error ( (or Accuracy) y)


A/D conversion mentioned here leads to a quantization error of one V (or one least significant bit: LSB) at maximum. Such an quantization error might g be unacceptable for certain applications.

Quantization Error (Contd) ( )


To reduce this error, a better A/D conversion method is adapted by ADC manufacturers:
A bias of V/2 is internally added to Vin. Quantization error now ranges between -V/2 and V/2 (or LSB). LSB)

Output (code) of the ADC can be expressed as


output = floor(Vin/V + )

Chapter 1

ME 534

36

Chapter 1

ME 534

37

Input p Interface
f(t) Type 1 f(t) () t Sampler S l & ADC ~ f*(t) f (t)
3 f f

III) ) Latch
Latch holds a binary number during one sampling li period. i d It is an integrated g circuit which holds the input (N-bit digital) signal throughout one sampling period period.
The output of the device remains the same d ring this period during period.

~ f*(t) Type 3 t
T 3T

In p practice, , sampler p & ADC are considered to be a single unit:


Input p to the unit is an analog g voltage g varying y g in time, , Output is binary number sequence with finite word length.
Chapter 1 ME 534 38

Chapter 1

ME 534

39

IV) ) D/A Converter


Converts an N-bit digital signal into a p g voltage g level: corresponding
Complementary operation of A/D converter.

Output p Interface

Important properties:
Output Voltage Range:
5V unipolar, 5V bipolar, 10V unipolar, 10V bipolar

Resolution ( (and Accuracy) y) Conversion Time


Chapter 1 ME 534 40

Latch and D/A converter (DAC) are rolled into a single unit (output interface). Output interface oftentimes referred to as Sample and Hold (S/H) Unit.
Chapter 1 ME 534 41

Errors in Digital g Control Systems y

Control Computer p

As control computers, there exist a wide variety of choices in practice:


PC + Data Acquisition Board (DAQ) PC + Motion Control Card Microcontroller: Single Control IC Programmable g Logic g Controller ( (PLC) )
Chapter 1 ME 534 42 Chapter 1 ME 534 43

A Simple p Control Algorithm g


1. 1 2. 3. 4 4. 5. 6. 7 7.
Chapter 1

Illustrative Example p
Level Se ensor

Fetch sensor value b(k) Fetch (or generate) command r(k) Compute error e(k) = r(k) - b(k) Calculate compensation m(k) Output p m(k) ( ) Wait till end of sampling period G to Go t Step St 1
ME 534 44

Consider the water level control system. (or Prop. p Servo-valve ( Flow Control Valve):
m(t) is control voltage:
0 V qi = 0 lt/s 5 V qi = 100 lt/s

Sensor: S
b(t) is sensor output voltage:
0V h=0m 5V h=5m
Chapter 1 ME 534 45

Control System
qo(t)
8-bit / 5V unipolar

C Library y Functions
h(t)

r(k) + _

Control Algorithm

m(k)

Latch & D/A

m(t)

ServoValve

qi(t)

Water Tank

T Clock

Data Acquisition Board

b(k) PC running Control Program

Sampler & A/D


8-bit / 5V unipolar

b(t)

Level Sensor

Most DAQ board manufacturers provide device drivers along with high-level language support (i.e. library functions) for free. For this example, let us assume that the following functions are available:
returns water-level as unsigned integer. write_DAC(m): ( ) g generates output p voltage g depending p g on the input argument m. Here, m < 256 is an unsigned integer. pause(n): delays d l th the execution ti by b n miliseconds. ili d init(): initializes the units on the DAQ board.
read_ADC():
46 Chapter 1 ME 534 47

Control System: PC (w/ RT-OS) + DAQ Desired water level: Control Law: Proportional Control Sampling p g Time: T = 0.1 sec. D/A Converter: 8-bit / 5V unipolar A/D Converter: 8-bit / 5V unipolar
Chapter 1 ME 534

Control Program g 1( (ANSI C) )


#include <math.h> #include <stdlib.h> #include control.h # #define K 1.2 void main() { q unsigned g int m; float r,dr,e,b,qi; r = 0; dr = 3/3000; init(); /* Initialize */ while(1){ /* Infinite loop */ b = 5*read_ADC()/255; /* Read sensor */ r += dr; if (r>3) r = 3; /* Calculate cmd */ e = r b; qi = K*e; /* P-control law */ if (qi < 0) qi = 0; /* 0 <= qi <= 100 */ if (qi > 100) qi = 100; m = floor(2.55*qi); write_DAC(m); it DAC( ) /* O Output t t */ pause(100); /* Wait for 100 ms */ } }
Chapter 1 ME 534 48
R1 b(t) r(t) R1

Analog g P-Controller
R2 _ m(t)

+
R2

m(t ) = K e =

R2 R1

[r(t ) b(t )]

Desired P-gain (K) can be obtained by selecting a proper R2/R1 ratio. Measurement noise present t in i b(t) is i a major j drawback on performance. Generating an arbitrary r(t) in continuous-time is apparently difficult.

Chapter 1

ME 534

49

Hysteresis y Control
Another very simple control strategy is hysteresis (a.k.a. bang-bang or on/off) control. The power control element (PCE) is either switched fully on or off depending on the magnitude of error:
If error > threshold then PCE is switched on on. If error < -threshold then PCE is switched off.

Hysteresis y Control (Contd) ( )

th threshold h ld is i oftentimes ft ti referred f d to t as error band, deadband, or tolerance.


Chapter 1 ME 534 50 Chapter 1 ME 534 51

Control Program g 2( (ANSI C) )


#include <math.h> #include <stdlib.h> #include control.h # #define dh 0.1 void main() { g int float r,dr,e,b; unsigned r = 0; dr = 3/3000; init(); write_DAC(255); _ while(1) { b = 5*read_ADC()/255; r += dr; if (r>3) r = 3; e = r b; if (e > dh) m = 255; if (e <-dh) m = 0; write_DAC(m); it DAC( ) pause(100); } }
Chapter 1 ME 534

Questions to be Addressed
Ho How to pick a control la law and determine its parameters in discrete-time domain?
Stability Performance objectives
Command tracking Disturbance rejection

/* Define deadband */ m; /* /* /* /* /* /* /* /* /* Initialize */ Turn on valve */ Infinite loop */ Read sensor */ Calculate cmd */ Hit lower bound? */ Hit upper bound? */ O Output t t */ Wait for 100 ms */

How to select a proper sampling period? How about hardware / software design?
52 Chapter 1 ME 534 53