50
Feedback Control Theory a Computer System’s Perspective • Introduction What is feedback control? Why do computer systems need feedback control? Control design methodology System modeling Performance specs/metrics Controller design • Summary

Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Embed Size (px)

Citation preview

Page 1: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Feedback Control Theory a Computer System’s Perspective

• Introduction

• What is feedback control?

• Why do computer systems need feedback control?

• Control design methodology

• System modeling

• Performance specs/metrics

• Controller design

• Summary

Page 2: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Control

• Applying input to cause system variables to conform to desired values called the reference.

• Cruise-control car: f_engine(t)=? speed=60 mph

• E-commerce server: Resource allocation? T_response=5 sec

• Embedded networks: Flow rate? Delay = 1 sec

• Computer systems: QoS guarantees

Page 3: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Open-loop control

• Compute control input without continuous variable measurement

• Simple

• Need to know EVERYTHING ACCURATELY to work right– Cruise-control car: friction(t), ramp_angle(t)– E-commerce server: Workload (request arrival rate? resource

consumption?); system (service time? failures?)

• Open-loop control fails when

• We don’t know everything

• We make errors in estimation/modeling

• Things change

Page 4: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Feedback (close-loop) Control

Actuator

Monitor

reference

control input

controlled variable

manipulatedvariable

Controlled System

+ -

error

controlfunction

Controller

sample

Page 5: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Feedback (close-loop) Control

• Measure variables and use it to compute control input

• More complicated (so we need control theory)

• Continuously measure & correct– Cruise-control car: measure speed & change engine force– Ecommerce server: measure response time & admission control– Embedded network: measure collision & change backoff window

• Feedback control theory makes it possible to control well even if

• We don’t know everything

• We make errors in estimation/modeling

• Things change

Page 6: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Why feedback control?Open, unpredictable environments

• Deeply embedded networks: interaction with physical environments

• Number of working nodes

• Number of interesting events

• Number of hops

• Connectivity

• Available bandwidth

• Congested area

• Internet: E-business, on-line stock broker

• Unpredictable off-the-shelf hardware

Page 7: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Why feedback control?We want QoS guarantees

• Deeply embedded networks

• Update intruder position every 30 sec

• Report fire <= 1 min

• E-business server

• Purchase completion time <= 5 sec

• Throughput >= 1000 transaction/sec

• The problem: provide QoS guarantees in open, unpredictable environments

Page 8: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Advantage of feedback control theory

• Adaptive resource management heuristics

• Laborious design/tuning/testing iterations

• Not enough confidence in face of untested workload

• Queuing theory

• Doesn’t handle feedbacks

• Not good at characterizing transient behavior in overload

• Feedback control theory

• Systematic theoretical approach for analysis and design

• Predict system response and stability to input

Page 9: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Outline

• Introduction

• What is feedback control?

• Why do today’s computer systems need feedback control?

• Control design methodology

• System modeling

• Performance specs/metrics

• Controller design

• Summary

Page 10: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Control design methodology

Controller Design

Root-Locus PI Control

Requirement Analysis

Modeling

analytical system IDs

Dynamic model Control algorithm

Performance Specifications

Satisfy

Page 11: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

System Models

• Linear vs. non-linear (differential eqns)

• Deterministic vs. Stochastic

• Time-invariant vs. Time-varying

• Are coefficients functions of time?

• Continuous-time vs. Discrete-time

• System ID vs. First Principle

Page 12: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Dynamic Model

• Computer systems are dynamic• Current output depends on “history”

• Characterize relationships among system variables• Differential equations (time domain)

• The dot(s) above a variable denote differentiation w.r.t time (number of times!)

)()()()()( 01012 tubtubtyatyatya

• Transfer functions (frequency domain)Y(s) = G(s)U(s)

2

2

1

1

012

2

01)(ps

c

ps

c

asasa

bsbsG

• Block diagram (pictorial)

C(s)R(s) Y(s)-

G(s)

Page 13: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Example Utilization control in a video server

• Periodic task Ti corresponding to each video stream i

• c[i]: processing time, p[i]: period

• Stream i’s requested CPU utilization: u[i]=c[i]/p[i]

• Total CPU utilization: U(t)={k}u[k], {k} is the set of active streams

• Completion rate: Rc(t)= ({kc}u[m])/t, where {m} is the set of terminated video streams during [t, t+t]

• Unknown

• Admission rate: Ra(t)= ({ka}u[j])/t, where {j} is the set of admitted streams during [t, t+t]

• Problem: design an admission controller to guarantee U(t)=Us regardless of Rc(t)

Page 14: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Model Differential equation

U(t)

Ra(t)

C?

Us-

CPU

Rc(t)

• Model (differential equation):

t

ca dRRtU0

))()(()(

• Error: E(t)=Us-U(t)

• Controller C? E(t) Ra(t)

Page 15: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

• Three ways of system modeling

A Diversion to MathSystem representations

u(t) g(t) y(t) t

dutgtutgty0

)()()(*)()(

• Time domain: convolution; differential equations.

U(s) G(s) Y(s) )()()( sUsGsY

• s (frequency) domain: multiplication

s-domain is a simple & powerful “language” for control analysis

• Block diagram: pictorial

Page 16: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

• Laplace transform of a signal f(t)

• Not so different from fourier transform (see DSP course)

A Diversion to MathLaplace transform

0

)()]([)( dtetftfLsF st

where s=+i is a complex variable.• Laplace transform is a translation from time-domain to s-domain

• Differential equation Polynomial function)()()()()( 01012 tubtubtyatyatya

)()(01

22

01 sUasasa

bsbsY

Page 17: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

• Basic translations

• Impulse function f(t)=(t) F(s)=1

• Step signal f(t)=a•1(t) F(s)=1/s

• Ramp signal f(t)=a•t F(s)=a/s2

• Exp signal f(t)=eat F(s)=1/(s-a)

• Sinusoid signal f(t)=sin(at) F(s)=a/(s2+a2)

• Composition rules

• Linearity L[af(t)+bg(t)] = aL[f(t)]+bL[g(t)]

• Differentiation L[df(t)/dt] = sF(s) – f(0-)

• Integration L[tf()d] = F(s)/s

A Diversion to MathLaplace transform – some examples/recipes

Page 18: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

A Diversion to MathTransfer function

• Modeling a linear time-invariant (LTI) system• G(s) = Y(s)/U(s) Y(s) = G(s)U(s)

U(s) G(s) Y(s)

2

2

1

1

012

2

01)(ps

c

ps

c

asasa

bsbsG

E.g., a second order system with poles p1 and p2

Page 19: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

A Diversion to MathPoles and Zeros

• The response of a linear time-invariant (LTI) system

n

i

tpi

n

n

ini

imi

nn

nn

mm

mm

ieCtf

ps

C

ps

C

ps

C

ps

zsK

asasa

bsbsbsF

1

2

2

1

1

1

1

01

1

01

1

)(

...)(

)(

...

...)(

{pi} are poles of the function and decide the system behavior

Page 20: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

A Diversion to MathTime response vs. pole location

•f’(t) = ept, p = a+bj

UnstableStable

Page 21: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

A Diversion to MathBlock diagram

• A pictorial tool to represent a system based on transfer functions and signal flows

• Represent a feedback control system

C(s)R(s) Y(s)-

Go(s)

R(s) Y(s)Gc(s)

)()()(

)()(1

)()(

sRsGsY

sGsC

sGsCG

c

o

oc

Page 22: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Back to Our utilization control example

U(t)

Ra(t)

C?

Us-

CPU

Rc(t)

• Model (differential equation):

t

ca dRRtU0

))()(()(

• Error: E(t)=Us-U(t)

• Controller C? E(t) Ra(t)

Page 23: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

ModelTransfer func. & block diag.

• Inputs: reference Us(s) = Us/s; completion rate Rc(s)

• Close-loop system transfer functions

• Us(s) as input: G1(s) = C(s)Go(s)/(1+C(s)Go(s))

• Rc(s) as input: G2(s) = Go(s)/(1+C(s)Go(s))

• Output: U(s)=G1(s)Us/s+G2(s)Rc(s)

ssG

s

sRsRsUdRRtU o

cat

ca

1)(

)()()())()(()(

0

• CPU is modeled as an integrator

Rc(s)

GoUs/sRa(s)

U(s)C(s)

G1 G2

Page 24: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Control design methodology

Controller Design

Root-Locus PI Control

Requirement Analysis

Modeling

analytical system IDs

Dynamic model Control algorithm

Performance Specifications

Satisfy

Page 25: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Design GoalsPerformance Specifications

• Stability

• Transient response

• Steady-state error

• Robustness• Disturbance rejection

• Sensitivity

Page 26: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Performance Specs: bounded input,bounded output stability

• BIBO stability: bounded input results in bounded output.

• A LTI system is BIBO stable if all poles of its transfer function are in the LHP (pi, Re[pi]<0).

0]Re[:

)(

...)(

)()()()(

1

2

2

1

1

1

1

ittp

i

n

i

tpi

n

n

ini

imi

pifeCNote

eCty

ps

C

ps

C

ps

C

ps

zsKsUsGsY

i

i

Page 27: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Performance SpecsStability

UnstableStable

Page 28: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Performance specifications

Settling time

Overshoot

Controlledvariable

Time

Reference

%

Steady StateTransient State

Steady state error

Page 29: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Example: Control & Response in Email Server (IBM)

Control(MaxUsers)

Response(queue length)

Good

Slow

Bad

Useless

Page 30: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Performance SpecsSteady-state error

• Steady state (tracking) error of a stable system

))()((lim)(lim tytrteett

ss

r(t) is the reference input, y(t) is the system output.

• How accurately can a system achieve the desired state?• Final value theorem: if all poles of sF(s) are in the open left-half of the s-plane, then

)(lim)(lim0

ssFtfst

• Easy to evaluate system long term behavior without solving it

)(lim)(lim0

ssEteest

ss

Page 31: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Performance SpecsSteady-state error

Steady state error of a CPU-utilization control system

U(t)

ess=-20%Us

Page 32: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Performance SpecsRobustness

• Disturbance rejection: steady-state error caused by external disturbances

• Can a system track the reference input despite of external disturbances?

• Denial-of-service attacks

• Sensitivity: relative change in steady-state output divided by the relative change of a system parameter

• Can a system track the reference input despite of variations in the system?

• Increased task execution times

• Device failures

Page 33: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Performance SpecsGoal of Feedback Control

• Guarantee stability

• Improve transient response

• Short settling time

• Small overshoot

• Small steady state error

• Improve robustness wrt uncertainties

• Disturbance rejection

• Low sensitivity

Page 34: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Control design methodology

Controller Design

Root-Locus PID Control

Requirement Analysis

Modeling

analytical system IDs

Dynamic model Control algorithm

Performance Specifications

Satisfy

Page 35: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Controller DesignPID control

• Proportional-Integral-Derivative (PID) Control

C(s)R(s) Y(s)-

Go(s)

E(s) X(s)

sKKsCteKKtx dd

)()()(

KsCtKetx )()()(

s

KKsCdeKKtx i

t

i )()()(0

• Proportional Control

• Integral control

• Derivative control

• Classical controllers with well-studied properties and tuning rules

Page 36: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Controller DesignCPU Utilization Control

• Inputs: set-point Us(s) = Us/s; task completion Rc(s)

• Close-loop system transfer functions

• Us(s) as input: G1(s) = C(s)Go(s)/(1+C(s)Go(s))

• Rc(s) as input: G2(s) = Go(s)/(1+C(s)Go(s))

• C(s)=? to achieve zero steady-state error: U(t) Us

ssG

s

sRsRsUdRRtU o

cat

ca

1)(

)()()())()(()(

0

• CPU is modeled as an integrator

Rc(s)

GoUs/sRa(s)

U(s)C(s)

Page 37: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Proportional ControlStability

• Proportional Controller

• ra(t)=Ke(t); C(s) = K

• Transfer functions

• Us/s as input: G1(s) = K/(s+K)

• Rc(s) as input: G2(s) = 1/(s+K)

• Stability

• Pole p0 = -K<0 System is BIBO stable iff K>0

• Note: System may shoot to 100% if K<0!

Rc(s)

GoUs/sRa(s)

U(s)C(s)

Page 38: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Proportional ControlSteady-state error

• Assume completion rate Rc(t) keeps constant for a time period longer than the settling time: Rc(s)=Rc/s

• System response is

)(

)()()( 21

Kss

RKU

s

sGR

s

sGUsU cscs

• Compute steady-state err using final value theorem,

0lim)(lim)(lim00

K

Re

K

RU

Ks

RKUssUtU c

ssc

scs

sst

• P-control cannot achieve the desired CPU utilization Us; instead it will end up lower by Rc/K Oops!• The larger the proportional gain K is, the closer will CPU utilization approach to Us

Page 39: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

CPU UtilizationProportional Control

U(t)

ess=-20%Us

Page 40: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Proportional-Integral Control - Stability

• Proportional Integral Controller

• ra(t)=K(e(t)+Ki•te()d) ; C(s) = K(1+Ki/s)

• Transfer functions

• Us/s as input: G1(s) = (Ks+KKi)/(s2+Ks+KKi)

• Rc(s) as input: G2(s) = s/(s2+Ks+KKi)

• Stability

• Poles Re[p0]<0, Re[p0]<0

System is BIBO stable iff K>0 & Ki>0Rc(s)

GoUs/sRa(s)

U(s)C(s)

Page 41: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Proportional ControlSteady-state error

• Assume completion rate Rc(t) keeps constant for a time period longer than the settling time: Rc(s)=Rc/s

• System response is

• Compute steady-state err using final value theorem,

• PI control can accurately achieve the desired CPU utilization Us • Control analysis gives design guidance

)(

)()()()( 2

21

i

sicscs

KKKsss

UKKsRKU

s

sGR

s

sGUsU

0)(

lim)(lim)(lim 200

sss

i

sics

ssteU

KKKss

UKKsRKUssUtU

Page 42: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

CPU UtilizationProportional-Integral Control

U(t)

ess=0

ts tr tp

Mp=0Us

Page 43: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Controller DesignSummary & pointers

• PID control: simple, works well in many systems

• P control: may have non-zero steady-state error

• I control: improves steady-state tracking

• D control: may improve stability & transient response

• Linear continuous time control

• Root-locus design

• Frequency-response design

• State-space design

• G. F. Franklin et. al., Feedback control of dynamic systems

Page 44: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Discrete Control

• More useful for computer systems

• Time is discrete; sampled system

• denoted k instead of t

• Main tool is z-transform

• f(k) F(z) , where z is complex

• Analogous to Laplace transform for s-domain

0

)()()]([k

kzkfzFkfZ

Page 45: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Discrete Modeling

• Difference equation– V(m) = a1V(m-1) + a2V(m-2) + b1U(m-1) + b2U(m-2)

– z domain: V(z) = a1z-1V(z) + a2z-2V(z) + b1z-1U(z) + b2z-2U(z)

– Transfer function G(z) = (b1z + b2)/(z2-a1z - a2)

• V(m): output in mth sampling window

• U(m): input in mth sampling window

• Order n: #sampling-periods in history affects current performance

• SP = 30 sec, and n = 2 Current system performance depends on previous 60 sec

Page 46: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

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

Page 47: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Effect of discrete poles

|z|=1

Longer settling time

Re(s)

Im(s)

Unstable

Stable

Higher-frequencyresponse

Tsez :Intuition

Page 48: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Feedback control works in CS

• U.Mass: network flow controllers (TCP/IP – RED)

• IBM: Lotus Notes admission control

• UIUC: Distributed visual tracking

• UVA• Web Caching QoS

• Apache Web Server QoS differentiation

• Active queue management in networks

• Processor thermal control

• Online data migration in network storage (with HP)

• Real-time embedded networking

• Control middleware

• Feedback control real-time scheduling

Page 49: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Advanced Control Topics

• Robust Control

• Can the system tolerate noise?

• Adaptive Control

• Controller changes over time (adapts)

• MIMO Control

• Multiple inputs and/or outputs

• Stochastic Control

• Controller minimizes variance

• Optimal Control

• Controller minimizes a cost function of error and control energy

• Nonlinear systems

• Neuro-fuzzy control

• Challenging to derive analytic results

Page 50: Feedback Control Theory a Computer Systems Perspective Introduction What is feedback control? Why do computer systems need feedback control? Control design

Issues for Computer Science

• Most systems are non-linear

• But linear approximations may do– eg, fluid approximations

• First-principles modeling is difficult

• Use empirical techniques

• Mapping control objectives to feedback control loops

• ControlWare paper

• Deeply embedded networking

• Massively decentralized control problem

• Modelling

• Node failures