Classical Control Theory for Computer Science

advertisement
An Introduction to Control Theory
With Applications to
Computer Science
Joseph Hellerstein
And
Sujay Parekh
IBM T.J. Watson Research Center
{hellers,sujay}@us.ibm.com
Example 1: Liquid Level
System
Goal: Design the input
valve control to maintain a
constant height regardless
of the setting of the
output valve
(input flow)
qi
Input valve
control
float
R
(height)
(resistance)
H
(output flow)
V
(volume)
Output
valve
qo
2
Example 2: Admission Control
Users
Goal: Design the controller
to maintain a constant
queue length regardless of
the workload
RPCs
Reference
value
Administrator
Tuning
control
Sensor
Controller
Server
Server
Log
Queue
Length
3
Why Control Theory

Systematic approach to analysis and design





Predict system response to some input



Transient response
Consider sampling times, control frequency
Taxonomy of basic controls
Select controller based on desired characteristics
Speed of response (e.g., adjust to workload
changes)
Oscillations (variability)
Approaches to assessing stability and limit
cycles
4
Example: Control & Response in
an Email Server
Response
(queue length)
Good
Control
Bad
(MaxUsers)
Slow
Useless
5
Examples of CT in CS

Network flow controllers (TCP/IP – RED)


Lotus Notes admission control


S. Parekh et al. (IBM)
QoS in Caching


C. Hollot et al. (U.Mass)
Y. Lu et al. (U.Va)
Apache QoS differentiation

C. Lu et al. (U.Va)
6
Outline








Examples and Motivation
Control Theory Vocabulary and Methodology
Modeling Dynamic Systems
Standard Control Actions
Transient Behavior Analysis
Advanced Topics
Issues for Computer Systems
Bibliography
7
Feedback Control System
Reference Value
r (t )
Disturbance
e(t )  r (t )  b(t )
+
S
e(t )
Controller
u (t )
n(t )
Plant
y (t )
–
b(t )
Transducer
8
Controller Design Methodology
Start
System Modeling
Controller
Design
Block
diagram
construction
Controller
Evaluation
Transfer function
formulation and
validation
Objective
achieved
?
N
Model
Ok?
Y
Y
Stop
N
9
Control System Goals

Regulation


Tracking


thermostat, target service levels
robot movement, adjust TCP window to
network bandwidth
Optimization

best mix of chemicals, minimize response
times
10
System Models

Linear vs. non-linear (differential eqns)




Deterministic vs. Stochastic
Time-invariant vs. Time-varying


eg, a1 y  a0 y  b2 x  b0 x
Principle of superposition
Are coefficients functions of time?
Continuous-time vs. Discrete-time

t  R vs k  Z
11
Approaches to
System Modeling

First Principles

Based on known laws



Physics, Queueing theory
Difficult to do for complex systems
Experimental (System ID)



Statistical/data-driven models
Requires data
Is there a good “training set”?
12
The Complex Plane (review)
Imaginary axis (j)
u  x  jy
y
u    tan
r


y
x
| u | r | u | x  y
2
2
r
y
x
Real axis
1
u  x  jy
(complex) conjugate
13
Basic Tool For Continuous
Time: Laplace Transform

L[ f (t )]  F (s)   f (t )e dt
 st
0

Convert time-domain functions and operations
into frequency-domain




f(t)  F(s) (t, s)
Linear differential equations (LDE)  algebraic
expression in Complex plane
Graphical solution for key LDE characteristics
Discrete systems use the analogous z-transform
14
Laplace Transforms of
Common Functions
Name
Impulse
f(t)
1
f (t )  
0
F(s)
t0
t0
1
Step
f (t )  1
1
s
Ramp
f (t )  t
1
s2
Exponential
f (t )  e at
1
sa
Sine
f (t )  sin( t )
1
 2  s2
15
Laplace Transform Properties
Addition/Scaling
Differenti ation
Integratio n
L[af 1 (t )  bf 2 (t )]  aF1 ( s )  bF2 ( s )
d

L  f (t )  sF ( s )  f (0)
 dt

F (s) 1
L  f (t )dt 
  f (t )dt
t 0
s
s




t
Convolution
 f (t  τ)f (τ )dτ  F (s) F (s)
1
2
1
2
0
Initial-value theorem
f (0)  lim sF ( s )
Final -value theorem
lim f (t )  lim sF ( s )
s 
t 
s 0
16
Insights from Laplace
Transforms

What the Laplace Transform says about f(t)

Value of f(0)


Does f(t) converge to a finite value?


Poles of F(s)
Does f(t) oscillate?


Initial value theorem
Poles of F(s)
Value of f(t) at steady state (if it converges)

Limiting value of F(s) as s->0
17
Transfer Function

Definition




X(s)
H(s)
Y(s)
H(s) = Y(s) / X(s)
Relates the output of a linear system
(or component) to its input
Describes how a linear system responds
to an impulse
All linear operations allowed

Scaling, addition, multiplication
18
Block Diagrams



Pictorially expresses flows and relationships
between elements in system
Blocks may recursively be systems
Rules



Cascaded (non-loading) elements: convolution
Summation and difference elements
Can simplify
19
Block Diagram of System
Disturbance
Reference Value
R(s)
+
S
E (s )
N (s )
G1 (s)
Controller
U (s )
G2 (s)
S
–
Plant
Y (s)
B(s)
Transducer
H (s)
20
Combining Blocks
Reference Value
R(s)
+
S
E (s )
(G1 (s)  N (s))  G2 (s)
Combined Block
–
Y (s)
B(s)
Transducer
H (s)
21
Block Diagram of
Access Control
Users
Controller
Sensor
Server
R(z)
+
E(z)
S
G(z)
-
Controller
U(z)
N(z)
Notes
Server
Server
Log
Q(z)
S(z)
Sensor
M(z)
22
Key Transfer Functions
Reference
R(s)
S
+
E (s )
G1 (s)
Controller
G2 (s)
U (s )
Plant
–
Y (s)
H (s)
B(s)
Transducer
Feedforward :
Y ( s) Y ( s) U ( s)

 G1 ( s)G2 ( s)
E ( s) U ( s) E ( s)
B( s )
Open - Loop :
 G1 ( s)G2 ( s) H ( s)
E ( s)
Feedback :
G1 ( s)G2 ( s)
Y ( s)

R( s) 1  G1 ( s)G2 ( s) H23( s)
Rational Laplace Transforms
A( s )
F (s) 
B( s)
A( s )  a n s n  ...  a1 s  a 0
B ( s )  bm s m  ...  b1 s  b0
Poles : s*  B ( s*)  0 (So, F ( s*)  )
Zeroes : s*  A( s*)  0 (So, F ( s*)  0)
Poles and zeroes are complex
Order of system  # poles  m
24
First Order System
Y ( s)
K
K


R( s) 1  K  sT 1  sT
Reference
R(s)
S
E (s )
B(s)
K
U (s )
1
1  sT
Y (s )
1
25
First Order System
Impulse
response
Step response
Ramp response
K
1  sT
K
K
s s 1/ T
Exponential
Step,
exponential
K KT
KT Ramp,
step,
2
s
s s  1 / T exponential
No oscillations (as seen by poles)
26
Second Order System
 N2
Y ( s)
K
Impulse response :
 2
 2
R ( s ) Js  Bs  K s  2 N s   N2
Oscillates if poles have non - zero imaginary part (ie, B 2  4 JK  0)
B
Damping ratio :  
where Bc  2 JK
Bc
Undamped natural frequency :  N 
K
J
27
Second Order System:
Parameters
Interpreta tion of damping ratio
  0 : Undamped oscillation (Re  0, Im  0)
0    1 : Underdamped (Re  0  Im)
1   : Overdamped (Re  0, Im  0)
Interpreta tion of undamped natural frequency
 N gives the frequency of the oscillation
28
Transient Response
Characteristics
2
1.75
1.5
toohsrevo mumixam  p M
1.25
1
0.75
0.5
0.25
0.5
d
t
r
t pt
1
1.5
s
2
2.5
3
t
t d : Delay until reach 50% of steady state value
t r : Rise time  delay until first reach steady state value
t p : Time at which peak value is reached
t s : Settling time  stays within specified % of steady state
29
Transient Response


Estimates the shape of the curve based
on the foregoing points on the x and y
axis
Typically applied to the following inputs




Impulse
Step
Ramp
Quadratic (Parabola)
30
Effect of pole locations
Oscillations
(higher-freq)
Im(s)
Faster Decay
(e-at)
Re(s)
Faster Blowup
(eat)
31
Basic Control Actions: u(t)
Proportional control :
u (t )  K p e(t )
t
Integral control :
u (t )  K i  e(t )dt
0
Differenti al control :
d
u (t )  K d e(t )
dt
U (s)
 Kp
E (s)
U (s) K i

E (s)
s
U (s)
 Kd s
E (s)
32
Effect of Control Actions

Proportional Action


Integral Action



Adjustable gain (amplifier)
Eliminates bias (steady-state error)
Can cause oscillations
Derivative Action (“rate control”)



Effective in transient periods
Provides faster response (higher sensitivity)
Never used alone
33
Basic Controllers


Proportional control is often used by
itself
Integral and differential control are
typically used in combination with at
least proportional control

eg, Proportional Integral (PI) controller:

KI
U ( s)
1 

G( s) 
 Kp 
 K p 1 
E ( s)
s
 Ti s 
34
Summary of Basic Control

Proportional control


PI control



Multiply e(t) and its integral by separate constants
Avoids bias for step
PD control



Multiply e(t) by a constant
Multiply e(t) and its derivative by separate constants
Adjust more rapidly to changes
PID control


Multiply e(t), its derivative and its integral by separate
constants
Reduce bias and react quickly
35
Root-locus Analysis


Based on characteristic eqn of closed-loop
transfer function
Plot location of roots of this eqn



Multiple parameters are ok



Same as poles of closed-loop transfer function
Parameter (gain) varied from 0 to 
Vary one-by-one
Plot a root “contour” (usually for 2-3 params)
Quickly get approximate results

Range of parameters that gives desired response
36
Digital/Discrete Control


More useful for computer systems
Time is discrete


denoted k instead of t
Main tool is z-transform

Z[ f (k )]  F ( z )   f (k ) z  k
k 0



f(k)  F(z) , where z is complex
Analogous to Laplace transform for s-domain
Root-locus analysis has similar flavor

Insights are slightly different
37
z-Transforms of Common
Functions
F(s)
F(z)
1
1
Step
f (t )  1
1
s
z
z 1
Ramp
f (t )  t
1
s2
z
( z  1) 2
Exponential
f (t )  e at
1
sa
Sine
f (t )  sin( t )
1
 2  s2
z
z  ea
z Sin a
z 2  2(Cos a) z  1
Name
Impulse
f(t)
1
f (t )  
0
t0
t0
38
Root Locus analysis of
Discrete Systems



Stability boundary: |z|=1 (Unit circle)
Settling time = distance from Origin
Speed = location relative to Im axis


Right half = slower
Left half = faster
39
Effect of discrete poles
Im(s)
Higher-frequency
response
Longer settling time
Re(s)
Stable
Unstable
|z|=1
Intuition : z  eTs
40
System ID for Admission
Control
E(z)
R(z)
+
S
G(z)
-
U(z)
Controller
ARMA Models
q (t )  a1 q (t  1)  b0 u (t )
m(t )  c1 m(t  1)  d 0 q (t )  d1 q(t  1)
Control Law
u (t )  u (t  1)  K i e(t )
Open-Loop: N ( z ) S ( z ) G( z ) 
N(z)
Notes
Server
Q(z)
S(z)
Sensor
M(z)
Transfer Functions
N ( z) 
b0 z
z  a1
S ( z) 
d 0 z  d1
z  c1
G( z) 
Ki z 1
z 1 z
b0 z d 0 z  d1 K i z 1
z  a1 z  c1 z  1 z 
41
Root Locus Analysis of
Admission Control
Predictions:
•Ki small => No controller-induced oscillations
•Ki large => Some oscillations
•Ki v. large => unstable system (d=2)
•Usable range of Ki for d=2 is small
42
Experimental Results
Response
(queue length)
Good
Control
Bad
(MaxUsers)
Slow
Useless
43
Advanced Control Topics

Robust Control


Adaptive Control


Controller minimizes variance
Optimal Control


Multiple inputs and/or outputs
Stochastic Control


Controller changes over time (adapts)
MIMO Control


Can the system tolerate noise?
Controller minimizes a cost function of error and control energy
Nonlinear systems


Neuro-fuzzy control
Challenging to derive analytic results
44
Issues for Computer Science

Most systems are non-linear

But linear approximations may do


First-principles modeling is difficult


Use empirical techniques
Control objectives are different


eg, fluid approximations
Optimization rather than regulation
Multiple Controls


State-space techniques
Advanced non-linear techniques (eg, NNs)
45
Selected Bibliography

Control Theory Basics




G. Franklin, J. Powell and A. Emami-Naeini. “Feedback Control of Dynamic Systems,
3rd ed”. Addison-Wesley, 1994.
K. Ogata. “Modern Control Engineering, 3rd ed”. Prentice-Hall, 1997.
K. Ogata. “Discrete-Time Control Systems, 2nd ed”. Prentice-Hall, 1995.
Applications in Computer Science







C. Hollot et al. “Control-Theoretic Analysis of RED”. IEEE Infocom 2001 (to appear).
C. Lu, et al. “A Feedback Control Approach for Guaranteeing Relative Delays in Web
Servers”. IEEE Real-Time Technology and Applications Symposium, June 2001.
S. Parekh et al. “Using Control Theory to Achieve Service-level Objectives in
Performance Management”. Int’l Symposium on Integrated Network Management,
May 2001
Y. Lu et al. “Differentiated Caching Services: A Control-Theoretic Approach”. Int’l Conf
on Distributed Computing Systems, Apr 2001
S. Mascolo. “Classical Control Theory for Congestion Avoidance in High-speed
Internet”. Proc. 38th Conference on Decision & Control, Dec 1999
S. Keshav. “A Control-Theoretic Approach to Flow Control”. Proc. ACM SIGCOMM, Sep
1991
D. Chiu and R. Jain. “Analysis of the Increase and Decrease Algorithms for Congestion
Avoidance in Computer Networks”. Computer Networks and ISDN Systems, 17(1), Jun
1989
46
Download