feedback systems - eecsweb.eecs.umich.edu/~jfr/embeddedctrls/files/lecture7.pdf · feedback systems...
TRANSCRIPT
-
Feedback Systems
Many embedded system applications involve the concept offeedback
Sometimes feedback is designed into systems:
CPU
Operator Input
Actuator PhysicalSystem
positionvelocitytemperaturecurrent...
Sensor
Other systems have naturally occuring feedback, dictated bythe physical principles that govern their operation
EECS461, Lecture 7, updated September 24, 2008 1
-
Feedback Systems
Some examples we will see:- op-amp
- motor equations: mechanical
- motor equations: electrical
- DC motor: back EMF
- current controlled amplifier
- velocity feedback control
How many examples of feedback can you think of?
EECS461, Lecture 7, updated September 24, 2008 2
-
Issues with Feedback
A feedback loop in a system raises many issues- requires a sensor!
- changes gain
- reduces effects of parameter uncertainty
- may alter stability
- changes both steady state as well as dynamic response
- introduces phase lag
- sensitive to computation/communication delay
Detailed analysis (and design) of feedback systems is beyondthe scope of our course, but we will need to understand these
basic issues...
EECS461, Lecture 7, updated September 24, 2008 3
-
Feedback and Gain
Using high gain in a feedback system can make output trackinput:
u y
-
GK
e
feedback response:
y =KG
1 + KGu
error response:e =
1
1 + KGu
high gain: as K , y u and e 0- open loop gain: |KG| 1- closed loop gain: |KG/(1 + KG)| 1 we can make the output track the input even if we don;t
know the exact value of the open loop gain!
CAVEAT: only useful if system is stable!- for all but very simple systems, use of excessively high gain
will tend to destabilize the system!
a simple example where dynamics are usually ignored: op amp
EECS461, Lecture 7, updated September 24, 2008 4
-
Operational Amplifier (Op Amp)
An op amp [2] is used in many electronics found in embeddedsystems. Hence it is of interest in its own right, as well as
being a simple example of a feedback system
-
+
v1
v2vo
v1, v2: input voltages
vo: output voltage
output voltage depends on difference of input voltages
vo = K(v2 v1) = K(v1 v2)
Typically K 105 106, but varies significantly due tomanufacturing tolerances
Ideal op amp- no current flows into input terminals
- output voltage unaffected by load
In reality- op amp is a low pass filter with very high bandwidth
- draws a little current
- is slightly affected by load
we shall assume an ideal op amp
EECS461, Lecture 7, updated September 24, 2008 5
-
Inverting Amplifier, I
Q: How to use the op amp as an amplifier given that gain isuncertain?
A: Feedback!
-
+vi
vo0
v
R1I1
R2I2
currents:I1 =
vi v
R1, I2 =
v voR2
feedback equations:- from previous page, vo depends on v
: vo = Kv- v depends on vo: v
= vo + R2I2
-K
-1
R2I2 vo
-
v
EECS461, Lecture 7, updated September 24, 2008 6
-
Inverting Amplifier, II
Feedback diagram:
-K
-1
R2I2 vo
-
v
Apply rule for transfer function of feedback system:
vo =
K
1 + K
R2I2
If K >> 1, then the feedback equations imply that
vo R2I2
It further follows that v = vo + R2I2 0. By assumptionthat the op amp draws no current, I1 = I2, and thus
vo =
R2
R1
vi
Feedback allows us to use an op amp to construct an amplifierwithout knowing the precise value of K!
EECS461, Lecture 7, updated September 24, 2008 7
-
More Complex Feedback Examples
to analyze op amp, we ignored dynamics and treated the opamp as a pure gain that was constant with frequency
in general, dynamics cannot be ignored- transient response
- stability
Two examples where feedback arises from the physics- motor dynamics: mechanical
- motor dynamics: electrical
we shall discuss these examples, but we will first consider asimple case: feedback around an integrator
EECS461, Lecture 7, updated September 24, 2008 8
-
Integrator
Equations of integrator
x = u
x(t) = x(0) +
Z t0
u()d
Examples:- u is velocity, x is position
- u is acceleration, v is velocity
- voltage and current through inductor: I = 1LR
V dt
- voltage and current through capacitor: V = 1CR
Idt
Integrator is an unstable system- the bounded input, u(t) = 1, yields the unbounded output
x(t) = x(0) + t
Transfer function of an integratorZ
1
s
integrator has infinite gain at DC, s = 0
EECS461, Lecture 7, updated September 24, 2008 9
-
Feedback Around an Integrator
Suppose there is feedback around integrator:x
.x
u -
K
differential equation of feedback system
x = Kx + Ku
Transfer function of feedback system:
xu
-
K
s
X(s) =
K/s
1 + K/s
U(s) =
K
s + K
U(s)
The system is stable if K > 0.
The response to the constant input u(t) = 1 yields
x(t) 1
x(t) 0
independently of the value of K
EECS461, Lecture 7, updated September 24, 2008 10
-
Uses of an Integrator
sometimes integrators arise from the physics other times they are constructed
- to perform analog simulation of physical system
- to add integral control to a system
Op-amp integrator
-
+
R1
C2
vo
vi
-
+
R3
R4
- Transfer function:
vo =R4
R3
1
R1C2svi
Can also implement integrator on a microprocessor- discrete simulations
- digital control
EECS461, Lecture 7, updated September 24, 2008 11
-
Motor Equations, Mechanical
equations of motion for shaft dynamics
J = TM B
=
1
J
TM
B
J
: shaft speed, B 0: friction coefficient, J > 0: shaftinertia, TM : motor torque
Feedback diagram
1
J
-
TM 1
s
B
.
Transfer function:
(s) =1
sJ
1 + BsJTM(s) =
1/B
sJ/B + 1TM(s)
Constant torque speed goes to a steady state value:
ss = TM/B
NOTE: with no friction (B = 0), system is unstable!- constant torque implies (t)
EECS461, Lecture 7, updated September 24, 2008 12
-
Motor Equations, Electrical
equations of armature winding (ignoring back emf)
LI = V RI
I =
1
L
V
R
L
I
I: current, R: resistance, J : inductance, V : applied voltage
Feedback diagram
1
L
-
V 1
s
R
.
Transfer function:
I(s) =1
sL
1 + RsLV (s) =
1/R
sL/R + 1V (s)
Constant voltage current goes to a steady state value:
Iss = V/R
EECS461, Lecture 7, updated September 24, 2008 13
-
First Order Systems
Shaft dynamics and circuit dynamics are each examples of afirst order systems; i.e., they each have one integrator
In general, a first order system may be written in the form
x = ax + bu
where x is the integrator state, u is the input, and a and b
are constants.
Feedback diagram:
ux
-
a
.x
b
Equivalently
ux
-
a/b
.x
b
Transfer function:
X(s) = H(s)U(s)
H(s) =
b
a
1
s/a + 1
EECS461, Lecture 7, updated September 24, 2008 14
-
Stability and Time Constant
Time response:
x(t) = eat
x(0) +
Z t0
ea(t)
bu()d
Response to a unit step, u(t) = 1, t 0:
x(t) =b
a
1 eat
The system is stable if a > 0
- stability implies that x(t) ba as t
Rate of convergence determined by time constant, = 1/a- at t = , step response achieves 63% of its final value
- at t = 2 , step response achieves 87% of its final value
- at t = 3 , step response achieves 95% of its final value
To easily compare rate of convergence, normalize so that b = a Normalized frequency response:
x = H(j)u, H(j) =
1
j + 1
NOTE: The time constant determines the rate at which the
response of the system must be sampled in order to adequately
represent it in digital form.
EECS461, Lecture 7, updated September 24, 2008 15
-
Bandwidth and Response Speed
Time constant, determines1
- bandwidth of frequency response:
102
101
100
101
102
70
60
50
40
30
20
10
0
mag
nitu
de, d
b
frequency response of first order filter, 1/(j+1)
= 0.1 = 1 = 10
102
101
100
101
102
100
80
60
40
20
0
, radians/second
phas
e, d
egre
es
- speed of response to unit step input, u(t) = 1:
0 1 2 3 4 5 6 7 8 9 100
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1step response of first order filter, 1/(j+1)
time, seconds
= 0.1 = 1 = 10
1Plots created with Matlab file first order.m.
EECS461, Lecture 7, updated September 24, 2008 16
-
Complete Motor Model
The motor has both electrical and mechanical components,interconnected by the back EMF feedback loop:
-
V-VBKM
KV
1
L
1s
R
.
1
J
-
TM 1
s
B
.
V
-
VB
Two integrators a second order system
Rules for combining transfer functions
(s) =
1
sL+R
KM
sJ+B
1 +
Kv
sL+R
KM
sJ+B
V (s)=
KM
(sJ + B)(sL + R) + KvKMV (s)
EECS461, Lecture 7, updated September 24, 2008 17
-
Second Order Systems
Question: How to analyze and describe properties of secondorder systems?
- stability
- steady state response
- transient response
Approach 1:- If the system can be decomposed into component first order
subsystems, then (perhaps) properties of the overall system
can be deduced from those of these subsystems.
- Example: DC motor
Approach 2: General analysis procedure.- Roots of characteristic equation
- Damping coefficient and natural frequency determine
response
- Example: Virtual spring/mass/damper systems
We will need to understand the relation between transientresponse and characteristic roots (natural frequency and damping)
in order to design force feedback algorithms in Lab 6!
EECS461, Lecture 7, updated September 24, 2008 18
-
Time Scale Separation
For a DC motor, the time constants for each first ordersubsystem may be very different:
- electrical subsystem: e = L/R = 0.001
- mechanical subsystem: m = J/B = 0.35
Mechanical subsystem is much slower than the electricalsubsystem
- Response of motor shaft is dominated by the mechanical
subsystem
- On the shaft speed time scale, current appears to be
instantaneous
- Since current and torque are related directly, TM = KMI,
torque also responds rapidly2
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50
0.05
0.1
0.15
0.2
0.25
0.3
0.35response of DC motor to a unit step in voltage input
time, seconds
speed torque
2Matlab files motor linear.m and DC motor linear.mdl
EECS461, Lecture 7, updated September 24, 2008 19
-
Second Order Systems
Electrical dynamics can be ignored by setting L = 03
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50
0.05
0.1
0.15
0.2
0.25
0.3
0.35response of DC motor to a unit step in voltage input
time, seconds
speed, L = 0 torque, L = 0 speed, L = 0.01 torque, L = 0.01
Detail:
0.95 0.96 0.97 0.98 0.99 1 1.01 1.02 1.03 1.04 1.050
0.02
0.04
0.06
0.08
0.1
0.12response of DC motor to a unit step in voltage input
time, seconds
L = 0 L = 0.01
Will need to model current when we implement torque control3Matlab files motor neglect circuit.m and DC motor linear.mdl
EECS461, Lecture 7, updated September 24, 2008 20
-
Second Order Systems
Systems with two integrators- DC motor
- system with input and output described by the differential
equation
y + by + ay = cu
-
u
-
c
y
a
.y
b
..y
The frequency response function can be written as
H(s) =c
s2 + bs + a
Example: DC Motor
H(s) =
KMJL
s2 +`
BL+JRJL
s +
BR+KMKV
JL
EECS461, Lecture 7, updated September 24, 2008 21
-
Characteristic Roots
Suppose the frequency response is given by
H(s) =c
s2 + bs + a
Define the characteristic equation:
s2+ bs + a = 0
Characteristic roots
s =b
b2 4a
2(1)
Possibilities:(i) b2 4a > 0 two distinct real roots
s-plane
xx
(ii) b2 4a = 0 one repeated real root
s-plane
x+
(iii) b2 4a < 0 two complex conjugate roots
s-planex
x
EECS461, Lecture 7, updated September 24, 2008 22
-
Characteristic Roots and Stability
Second order system is- stable if the characteristic roots lie in the Open Left Half
Plane (OLHP)
- unstable if the characteristic roots lie in the Closed Right
Half Plane (CRHP)
- (roots on the imaginary axis are sometimes called marginally
stable)
stable unstable
s-plane
EECS461, Lecture 7, updated September 24, 2008 23
-
Natural Frequency and Damping
Parameterize roots of s2 + bs + a = 0 by
s = n jnp
1 2 (2)
where natural frequency, n, and damping coefficient, , are
defined by (compare (2) with (1))
b = 2n, a = 2n
roots lie on circle of radius n at an angle
= arctan /p
1 2
with the imaginary axis:
jn
+
+
Roots are- real if 2 1- complex and stable if 0 < < 1
- imaginary if = 0
EECS461, Lecture 7, updated September 24, 2008 24
-
Frequency and Time Response
Natural frequency, n and damping ratio, determine4
- bandwidth and peak of frequency response:
101
100
101
60
40
20
0
20
40
mag
nitu
de, d
bfrequency response of second order filter, 1/((j/
n)2 + 2(j/
n)+1)
= 1 = 0.2 = 0
101
100
101
200
100
0
100
200
/n
phas
e, d
egre
es
- speed and overshoot of unit step response:
0 2 4 6 8 10 12 14 16 18 200
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
step response of second order filter, 1/((j/n)2 + 2(j/
n)+1)
nt
= 1 = 0.2 = 0
4Plots created with Matlab m-file second order.m.
EECS461, Lecture 7, updated September 24, 2008 25
-
General Systems
The characteristic equation of an n-th order system will haven roots; these roots are either real, or they occur in complex
conjugate pairs.
The characteristic polynomial can be factored as
NRYi=1
(s + pi)
NC/2Yi=1
(s2+ bis + ai)
Each pair of complex roots may be written as
si =bi2
qb2i 4ai
2= xi jyi
and have natural frequency and damping defined from
si = ini jniq
1 2i
Hence and n can be computed from the real and imaginaryparts as
ni =q
x2i + y2i , i = xi/ni
Note: It often happens that the response of a high order systemis well approximated by one complex pair of characteristic
roots.
EECS461, Lecture 7, updated September 24, 2008 26
-
Spring/Mass/Damper System
K
BM
F
y
Newtons laws:
My + By + Ky = F
y = B
My
K
My +
F
M
Second Order System
-
F
-
1M
y
K
.y
B
..y
Transfer Function:
Y (s) =1M
s2 + BM s +KM
F (s)
EECS461, Lecture 7, updated September 24, 2008 27
-
Motor Control Strategies
Can conceive of controlling four signals associated with themotor
- input voltage, V
- shaft position,
- shaft velocity,
- torque, TM (equivalently, current, I)
-
V-VBKM
KV
1
L
1s
R
.
1
J
-
TM 1
s
B
.
V
-
VB
-
TL
1s
Issues:- Input (V ) vs. output (, , I) variables
- Open loop vs. feedback control (i.e., do we use sensors?)
- Effect of load torque
- Control algorithm (P, I, ...)
Motor control results in higher order systems (more than twointegrators)
Higher order systems- Can still define characteristic polynomial and roots
- Stability dictates that characteristic roots must lie in OLHP
- Integral control may still be used to obtain zero error
(provided that stability is present)
- More complex control algorithms may be required to obtain
stability
EECS461, Lecture 7, updated September 24, 2008 28
-
Voltage Control
Apply desired V (either with a linear or a PWM amplifier) Suppose there is a constant load torque, TL. Then steady
state speed and torque depend on the load:
=KMV RTLKMKV + RB
TM =KM(V B + KV TL)
KMKV + RB
Position
-
V-VBKM
KV
1
L
1s
R
.
1
J
-
TM 1
s
B
.
V
-
VB
-
TL
1s
Issues:- V is an input variable, and usually not as important as TM ,
, or
- Suppose we want to command a desired speed (or torque),
independently of load or friction
* Problem: usually load torque (and often friction) are
unknown
- Suppose we want to command a desired position
* Problem: no control at all over position!
EECS461, Lecture 7, updated September 24, 2008 29
-
Position Control, I
Suppose we want to control position We can use a sensor (e.g., potentiometer) to produce a voltage
proportional to position, and compare that to a commanded
position (also in volts).
1sL+R
1sJ+B
V-VBKM
KV
I
-
TM 1s
potentiometerradiansvolts
-
* (volts) errorP-I
an integral controller cannot stabilize the system. Instead usea proportional-integral (P-I) controller: 10 + 1s
responses of speed, torque, and position due to a unit stepcommand to position5
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 50.2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
time, seconds
speed torque position
5Matlab files motor position FB.m and DC motor position.mdl
EECS461, Lecture 7, updated September 24, 2008 30
-
Position Control, II
P-I control: if feedback system is stable, then error approacheszero, and position tracks desired value
Can implement analog P-I control using op amp circuit Control can also be implemented digitally using a
microprocessor
An encoder can be used instead of a potentiometer to obtaindigital measurement
PWM can be used instead of linear amplifier
EECS461, Lecture 7, updated September 24, 2008 31
-
Velocity Control, I
Using an analog velocity measurement, from a tachometer,and an analog integral controller, allows us to track velocity
controller 1sL+R
1sJ+B
radians/second
V-VBKM
KV
I
-
TM
tachometervolts
-
* (volts) error
VB
V
TL
-
despite the presence of an unknown load torque6
0 1 2 3 4 5 6 7 8 9 100
0.2
0.4
0.6
0.8
1
1.2
1.4
time, seconds
load torque, TL = 0.5
speed torque
6Matlab files motor speed FB.m and DC motor speed.mdl
EECS461, Lecture 7, updated September 24, 2008 32
-
Velocity Control, II
microprocessor control- use encoder measurement to generate digital velocity
estimate
- compare measured speed with desired speed
- feed error signal into digital integral controller
- generate PWM signal proportional to error
Note: Performance depends on the controller gain7. Considerthe difference between 10/s and 100/s:
0 1 2 3 4 5 6 7 8 9 100.2
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
time, seconds
speed, K = 10 torque, K = 10 speed, K = 100 torque, K = 100
Usually,excessively high gain leads to oscillatory response orinstability!
7Matlab files motor speed FB.m and DC motor speed.mdl
EECS461, Lecture 7, updated September 24, 2008 33
-
Torque Control
Using a measurement of current and an analog integralcontroller, allows us to track torqe, which is directly
proportional to current: TM = KMI
controller 1
sL+R
1
sJ+B
V-VBKM
KV
I
-
TM
-
I* I error
VB
V
TL
-
despite the presence of an unknown load torque8
0 1 2 3 4 5 6 7 8 9 100
0.5
1
1.5
2
2.5
3
3.5
4
time, seconds
load torque, TL = 0.5
speed torque
Question: How does our lab setup implement torque control?8Matlab files and motor current FB.m and DC motor current.mdl
EECS461, Lecture 7, updated September 24, 2008 34
-
PWM Amplifier, I
Copley 4122D DC brush servo amplifier with PWM inputs [1] Two feedback control modes:
- velocity control (requires a tachomoter)
- torque (current) control
We use torque control so that we can provide force feedbackthrough our haptic interface
+HV
GND
+
1
2
3
4
5
J1
J1
MOTOR
ENCODER
+6
16
J2
10
13
12
11
GND
ENABLE
POS ENABLE
NEG ENABLE
PWM
DIR
VELOCITY MODE
Note: JP1 on pins 2-3 ( default )
J2 TACH
+
5
4
+HV
GND
+
1
2
3
4
5
J1
J1
MOTOR
ENCODER
+6
16
J2
10
13
12
11
GND
ENABLE
POS ENABLE
NEG ENABLE
PWM
DIR
TORQUE MODE
Note: JP1 on pins 2-3 ( default )
Notes
1. All amplifier grounds are common (J1-3, J1-4, J2-2, J2-7, and J2-10 ) Amplifier grounds are isolated from case &heatplate..
2. Jumper JP1 default position is on pins 2-3 for ground active /Enable input ( J2-11 )For /Inhibit function at J2-11 ( +5V enables ), move JP1 to pins 1-2
3. For best noise immunity, use twisted shielded pair cable for tachometer inputs. Twist motor and power cables and shield to reduce radiated electrical noise from pwm outputs.
EECS461, Lecture 7, updated September 24, 2008 35
-
PWM Amplifier, II
one-wire mode: 50% duty cycle corresponds to zerorequested torque
analog integral controller with anti-windup H bridge PWM amplifier 25 kHz PWM output
NEG ENABLE
POS ENABLE
ENABLE *
-
+-
+RH7
RH6 CH8
RH10 CH11
100PF
TACH AMPGv = 1
DIR
PWM
RH1
CURRENT LIMITSECTION
Gv = +HV10
PWM
MOSFET"H"
BRIDGE
STAGE
GND
GND
MOTOR +
MOTOR -
+HV
-
+
CH17RH15
CH1647K
47K
PEAK
CONT
PEAK
RH13
RH12
CH14
Voltage gain = 1
TIME
1K
33NF
1K
33NF
CURRENTMONITOR
CURRENTREF
1K
OUTPUTCURRENT
SENSE
+HV
DC / DCCONVERTER
-15
+15
GND
+FAULT OUTPUT+5V
CONTROLLOGIC
STATUS&
MOTOR
AUXILIARYDC OUTPUTS
SERVOPREAMP
CW
TACH LEAD
INTEGRATOR
CURRENTERROR
AMP
LED
GREEN = NORMALRED = FAULT
+15V
-15V
BALANCE50K
CASE GROUNDNOT CONNECTEDTO CIRCUIT GROUND
CASE MAY BE GROUNDED
MOMENTARY SWITCH CLOSURE RESETS FAULTWIRE RESET TO GROUND FOR SELF-RESET
+5
+15
-15
POWER GROUND AND SIGNAL GROUNDS ARE COMMON
J2 SIGNAL CONNECTOR
J1 MOTOR & POWER CONNECTOR
-+
VOLTAGEGAIN
+/-6V for+/-Ipeak
+/-6V at+/-Ipeak
60.4 K
100 K
10 MEG
4.8 kHz FILTER
4.8 kHz FILTER
RESET
10k
10k
INTEGRATOR RESET SWITCHES TURN ON WHEN AMP IS DISABLED
FOR SHIELDING
16
6
GND7
4
5
9
8
1
3
15
14
13
11
12
1
2
3
4
5
VALUE DEPENDS ON MODELSEE "ARMATURE INDUCTANCE" TABLE
2TACH(-) / GND
+15V
-15V
CH9 (OPEN)
*JP1
10
-
+
123
* JP1: PINS 2-3 FOR /ENABLE AT J2-11PINS 1-2 FOR /INHIBIT AT J2-11
0.47U
4.7MEG
182K
NOTE:
DEFAULT VALUE OF CH11 IS 0 OHMSFOR TORQUE MODE OPERATION
FOR VELOCITY MODE ( BRUSH TACH )SEE APPLICATIONS SECTION
CURRENT
CURRENT
*
*
PWMTO
+/-10vANALOG
CONVERSION
-
+
RH5
100 K
PWM BOARD
+/-10VMAX
TACH
Rext
Rin = 47K
LM-629
PWM MAG
PWM SIGN
19
18
EECS461, Lecture 7, updated September 24, 2008 36
-
References
[1] Copley Controls. Models 4122D, 4212D DC brush servo
amplifiers with PWM inputs. www.copleycontrols.com.
[2] K. Ogata. Modern Control Engineering. Prentice-Hall, 3rd
edition, 1997.
EECS461, Lecture 7, updated September 24, 2008 37