Control Task Timing and Quality of Control Anton Cervin Department of Automatic Control Lund University Sweden Joint work with Bo Lincoln, Dan Henriksson, Martin Andersson and Karl-Erik Årzén Anton Cervin Control Task Timing and Quality of Control
Outline Introduction 1 Inverted pendulum example 2 Controller timing 3 Analysis of quality of control 4 The Jitter Margin Jitterbug TrueTime Conclusion 5 Anton Cervin Control Task Timing and Quality of Control
1. Introduction Anton Cervin Control Task Timing and Quality of Control
Classical Control Systems Reference Control Output Controller Process Feedback Process: Continuous-time dynamics (differential equations) Controller: Continuous-time dynamics Anton Cervin Control Task Timing and Quality of Control
Computer-Controlled Systems Computer Task i−1 A/D Controller D/A Process Task i+1 Process: Continuous-time dynamics Controller: A task executing in an operating system Anton Cervin Control Task Timing and Quality of Control
A Typical Control Task t = current_time(); while (1) { read_input(); compute_control(); write_output(); t = t + T; wait_until(t); } Anton Cervin Control Task Timing and Quality of Control
Control Performance The performance of a control task depends on the task timing Some rules of thumb: The shorter the period, the better the control performance A suitable task period T is given by 0.2 / ω b < T < 0.6 / ω b where ω b is the bandwidth of the closed -loop system (fast system � high bandwidth) The larger the delays and jitter, the worse the performance Delays and jitter smaller than 10% of the period can usually be ignored Anton Cervin Control Task Timing and Quality of Control
Some Interesting Design Trade-Offs Trade -off between resource usage and control performance Trade-off between delay and jitter Jitter can be reduced at the expense of more delay But, a long, constant delay is often worse than a short, time-varying delay Trade-off between different control tasks How to optimize the global performance? Anton Cervin Control Task Timing and Quality of Control
2. Inverted Pendulum Example Anton Cervin Control Task Timing and Quality of Control
Inverted Pendulum Example Suppose you want to control three inverted pendulums using one CPU: y 3 y 1 y 2 u 1 u 2 u 3 u 1 y 1 CPU u 2 y 2 RTOS u 3 y 3 Anton Cervin Control Task Timing and Quality of Control
Design Discrete -time LQG controllers Sampling intervals: ( T 1 , T 2 , T 3 ) = ( 10, 14.5, 17.5 ) ms (short pendulum � short sampling period) Assumed execution time: C i = 3.5 ms Schedulable under both rate-monotonic and earliest-deadline-first scheduling (assuming D i = T i ) U = � C i T i = 0.79 Anton Cervin Control Task Timing and Quality of Control
TrueTime Simulations Ideal simulation (no scheduling, only fixed delay of 3.5 ms) 1 Rate -monotonic scheduling 2 Earliest-deadline-first scheduling 3 Anton Cervin Control Task Timing and Quality of Control
3. Controller Timing Analysis Anton Cervin Control Task Timing and Quality of Control
Ideal Controller Timing ( ) ( ) y t u t t t ( ) ( ) y t u t Process Hold Sampler y k u k u k D-A Computer A-D y k t t Periodic sampling, no delays, no jitter Anton Cervin Control Task Timing and Quality of Control
Real Controller Timing – Single Task L k L k + 1 L k − 1 io io io I O I O I O ( k − 1 ) T ( k + 1 ) T t kT T – nominal sampling period io – input -output latency in period k L k varying execution time, hardware interrupts Anton Cervin Control Task Timing and Quality of Control
Real Controller Timing – Multiple Tasks L k − 1 L k − 1 L k L k s io s io I O I O I ( k − 1 ) T ( k + 1 ) T t kT L k s – sampling latency in period k preemption from other tasks io – input -output latency in period k L k preemption from other tasks and varying execution times Anton Cervin Control Task Timing and Quality of Control
Definition of Jitters L k − 1 L k − 1 L k L k s io s io I O I O I t k − 1 t k t k + 1 t def L k L k Sampling jitter: = max s − min J s s k k def Input -output jitter: J io L k L k = max io − min io k k J s and J io can be found using scheduling theory Anton Cervin Control Task Timing and Quality of Control
Computing the Jitters Response -time analysis for fixed-priority scheduling: worst-case analysis [Joseph & Pandya, 1986]: � R i � � R i = C i + C j T j j ∈ hp ( i ) best-case analysis [Redell & Sanfridson, 2002]: � � R b i − T j R b i = C b � C b i + j T j j ∈ hp ( i ) (Response-time analysis under EDF is more complicated) Anton Cervin Control Task Timing and Quality of Control
Computing the Jitters Sampling jitter of task i : τ i with ˜ Replace task τ i by short “sampling task” ˜ C i � 0 L k min s i = 0 k s i = ˜ L k max R i k J si = ˜ R i − 0 = ˜ R i Input -output jitter of task i : L k ioi = R b min i k L k max ioi = R i k J ioi = R i − R b i Anton Cervin Control Task Timing and Quality of Control
4. Analysis of Quality of Control Anton Cervin Control Task Timing and Quality of Control
Analysis of Quality of Control Constant delay and no jitter – easy the delay decreases the phase margin still a linear, time -invariant system standard linear control theory can be used Time-varying delays (jitter) – more difficult worst-case stability analysis – the Jitter Margin stochastic performance analysis – Jitterbug detailed co-simulation – TrueTime Anton Cervin Control Task Timing and Quality of Control
The Jitter Margin Anton Cervin Control Task Timing and Quality of Control
The Jitter Margin Generalizes the classical delay margin to systems with jitter Assumptions: Periodic sampling ( J s = 0 ) hardware - or interrupt-driven sampling plant is sampled when the task is released Time-varying input-output delay L io = L + J io L – minimum delay J io – input-output jitter J io L t 0 T Input Output Anton Cervin Control Task Timing and Quality of Control
Jitter Margin Definition: The jitter margin J m ( L ) is the largest input -output jitter J io that guarantees stability of the closed-loop system, given a minimum delay of L . Numerically computed example (Pendulum controller 3): 9 8 7 6 Jitter margin J m 5 4 3 2 1 L m 0 0 5 10 15 Constant delay L Anton Cervin Control Task Timing and Quality of Control
Computing the Jitter Margin Simplified continuous -time version: Continuous-time plant P ( s ) , including constant delay L Continuous-time controller K ( s ) Time-varying control delay in the interval [ 0, J io ] Theorem [Kao & Lincoln, 2004]: Closed loop stable if � P ( i ω ) K ( i ω ) � 1 � � � < J io ω , ∀ ω ∈ [ 0, ∞] � � 1 + P ( i ω ) K ( i ω ) � Anton Cervin Control Task Timing and Quality of Control
Example Bode Magnitude Diagram 2 10 1 J io ω 1 10 Magnitude (abs) 0 10 PK � � −1 10 � � 1 + PK −2 10 0 1 2 10 10 10 Frequency (rad/sec) Anton Cervin Control Task Timing and Quality of Control
The Pendulum Example – RM Rate -monotonic scheduling Measure/calculate L and J io for each task Compute the jitter margin J m ( L ) for each task J io < J m ( L ) � Stable Task Stable J m ( L ) L J io 1 3.5 0 4.4 Yes 2 3.5 3.5 6.4 Yes 3 3.5 10.5 8.1 Cannot say Anton Cervin Control Task Timing and Quality of Control
The Pendulum Example – EDF Earliest -deadline-first scheduling Slightly larger jitter for Task 2 Smaller jitter for Task 3 Task Stable L J io J m ( L ) 1 3.5 0 4.4 Yes 2 3.5 4.0 6.4 Yes 3 3.5 7.0 8.1 Yes (In general, EDF distributes the jitter more evenly than RM) Anton Cervin Control Task Timing and Quality of Control
Summary of the Jitter Margin Pros: Only assumes knowledge of minimum and maximum delays Gives hard (worst -case) stability guarantees Can be used to assign meaningful task deadlines Assign D < J m ( L ) to guarantee stability Cons: Can be conservative Does not handle sampling jitter Says little about performance Anton Cervin Control Task Timing and Quality of Control
Jitterbug Anton Cervin Control Task Timing and Quality of Control
Jitterbug Is a MATLAB toolbox Performs stochastic analysis of control performance Assumes known latency probability distributions Assumes white noise disturbances in the control loop Measures the performance by a quadratic cost function � t 1 x T ( τ ) Qx ( τ ) d τ V = lim t t →∞ 0 x – full state vector Q – weighting matrix Anton Cervin Control Task Timing and Quality of Control
Jitterbug Model – Example Signal model: Timing model: v 1 u y L s P ( s ) S ( z ) 2 K ( z ) S ( z ) L io K ( z ) 3 P ( s ) – process S ( z ) – sampler, K ( z ) – controller/actuator L s , L io – latency probability distributions Anton Cervin Control Task Timing and Quality of Control
Jitterbug Example Script Ls = ... ; Lio = ... ; N = initjitterbug(dt,h); N = addtimingnode(N,1,Ls,2); N = addtimingnode(N,2,Lio,3); N = addtimingnode(N,3); N = addcontsys(N,1,P,3,Q,R1,R2); N = adddiscsys(N,2,S,1,2); N = adddiscsys(N,3,K,2,3); N = calcdynamics(N); V = calccost(N) Anton Cervin Control Task Timing and Quality of Control
Recommend
More recommend