Dynamic Scheduling and Control-Quality Optimization of Self-Triggered Control Applications Soheil Samii, Petru Eles, Zebo Peng Department of Computer and Information Science Linköping University, Sweden Paulo Tabuada Anton Cervin Department of Electrical Engineering Department of Automatic Control University of California, Los Angeles, USA Lund University, Sweden CPU Motivation Act P1 Sen Act P2 Sen Act P3 Sen Periodic implementation Conservative CPU usage when the control error is small Constraints in the number of controller executions Sensing, computation, actuation 2 Motivation Self-triggered control: Control ”when needed” [Velasco et al., 2003], [Anta and Tabuada, 2008] More often when the control error is large, and vice versa Reduced number of controller executions Ensures stability 3 Motivation This paper: Scheduling of multiple self-triggered tasks on a CPU Optimize control quality and reduce CPU usage 4 Outline Self-triggered control System model Motivational example Scheduling heuristic Experimental results Conclusions 5 Self-triggered control Act P Sen Periodic execution Self-triggered execution Deadline based on control law plant state plant model time Deadline must be met to ensure stability Executing earlier than the deadline can give better control 6 Scheduler CPU System model dx1/dt = Ax1(t) + Bu1(t) d1 u1=K1x1 u1 Act d2 u2 d3 Act x1 P1 x2 P2 Sen x3 u3 Act Sen P3 Sen Control quality Deadline constraints Reduce CPU usage 7 Scheduling – Control quality time 10 13 Deadline J(t start ) T x(t) Qx(t)dt Control cost Completion time Control cost Latest measurements Difference between deadline and completion time Normalized! Next execution 8 Scheduling – CPU cost time 13 CPU cost 10 Next execution 9 Scheduling – Trade-off! time 10 13 +ρ (CPU demand) = Total cost Combined cost of a task Next execution 10 Scheduling – How? ? 10 time 13 How does the scheduler 1. find the best trade-off? 2. decide whether and where to move scheduled executions? 3. guarantee that all deadlines are met? 11 Problem formulation When a task completes execution: Schedule its next execution before its deadline The other tasks are already scheduled for execution Can be moved! Cost to minimize: all tasks J control J CPU all tasks 12 Scheduler outline Optimization of start time Candidate start times Schedule realization Set of candidate schedules Not empty Choose best solution Empty Emergency schedule 13 Optimization of start time time 10 13 Total cost Golden-section search Cost evaluation for a limited number of points Precalculated values Interpolation Next execution 14 Schedule realization A B B C A Candidate start time D C D E F time E F time 1. Are deadlines for tasks C and D violated? 2. Compute new costs for tasks C and D Golden-section search has been performed at previous scheduling points 15 Emergency schedule Can we guarantee that all deadlines are met? Yes, if Σ WCET ≤ minimum deadline! How? time ? 16 Scheduler – summary 1. Golden-section optimization of start times 2. Conflicting executions are moved forward 3. Stability is guaranteed by construction of the heuristic and an offline verification 17 Total control cost Comparison to periodic control Periodic Our approach CPU usage [%] Time overhead of the scheduler has been considered! 18 Conclusion Runtime scheduling of multiple control tasks Adaptive implementation of self-triggered controllers achieving the required trade-off between control quality and CPU usage 19