Integrated Scheduling and Synthesis of Control Applications on Distributed Embedded Systems Soheil Samii1, Anton Cervin2, Petru Eles1, Zebo Peng1 1 Dept. of Computer and Information Science Linköping University Sweden 2 Dept. of Automatic Control Lund University Sweden Motivation • • Many embedded control systems are distributed • Typical example: the modern car Timing delays• System scheduling Controller design • Sampling,•computation, and actuation • Sharing of computation and communication resources • Problem: Degradation of control performance Plant Plant 2 Outline • Motivation • System model • Example and problem formulation • Scheduling and synthesis approach • Experimental results • Summary and contribution 3 System model Plant disturbance v(t) Internal-state vector x(t) Output y(t) Input u(t) Plant Measurement noise e(t) A/D What is a good sampling period? D/A What is a good control law u? Linear plant model: • dx(t)/dt = Ax(t) + Bu(t) + v(t) • y(t) = Cx(t) + e(t) Controller Application model: • Periodic tasks • Data dependencies 4 Control performance • • • • Quadratic cost: J = E{ xTQ1x + uTQ2u } Depends on • the sampling period, • the control law, and • the distribution of the delay between sampling and actuation of the control signal Synthesis of optimal control-law for given • sampling period and • constant delay Toolbox “Jitterbug”, developed at Lund University in Sweden 5 Example: Control of two pendulums y y 0.2 m 0.1 m u u 1 0 0 x x uv g / 0.2 0 g / 0.2 y 1 0 x e • • • J = E{y2 + 0.002u2} Measure the angle y Stabilize in upright position y=0 Control the acceleration u of the cart 6 Example: Platform S S C C A A Decide (1) sampling periods, (2) design control laws, and (3) schedule the tasks and messages 7 Example: Ideal control Sample 20 ms • • Sample 30 ms S S C C A A Control laws synthesized for the constant delays of each application (9 and 13) J1=0.9, J2=2.4, Total=3.3 (achieved for the ideal runtime scenario: dedicated resources) 8 Example: Scheduling Sample 20 ms • S S S • • C Sample 30 ms Ideal case S • J1=0.9, J2=2.4, Total=3.3 C C A A S A C 10 20 30 Delay distribution • Application 1: 32, 29, 14 • Application 2: 44, 24 J1=4.2, J2=6.4, Total=10.6 S S C A 40 C A A C A 50 9 Example: Scheduling Sample 20 ms • S C A • S S • • C A S Sample 30 ms Ideal case S • J1=0.9, J2=2.4, Total=3.3 C A First schedule A AJ2=6.4, Total=10.6 S C A • J1=4.2, A • Compensate for C S C theAdelays C in A (1440 and 21) 50 10 20 the schedule 30 Delay distribution • J1=1.0, J2=3.7, Total=4.7 • Application 1: 14 (constant) • Application 2: 18, 24 J1=1.1, J2=5.6, Total=6.7 C A 10 Example: Change periods Sample 30 ms S S • • Sample 20 ms S S C C A A Good selection of periods combined CwithS integrated C A C A scheduling and control-law • With periods 20 ms and 30 ms: synthesis is important! C A S A J =3.7, S C A • J1=1.0, Total=4.7 2 10 20 30 40 50 Delay distribution • Application 1: 13, 23 • Application 2: 18 J1=1.3, J2=2.1, Total=3.4 (with delay compensation) 11 Problem formulation Plant Plant Available sampling periods Execution-time specifications Deadlines ? Scheduling and synthesis tool Minimize w J i i Periods Control laws 12 Approach (Static-cyclic scheduling) Select controller periods Task periods Schedule the tasks and messages • • • What if we have • (CLP) Geneticpriority-based algorithm for ConstraintDelay logicdistributions programming period scheduling? assignment Minimize delay and jitter Synthesize control-laws and CLP solver ”ECLiPSe” compute cost Cost No Stop? Yes Done! 13 Approach (Priority-based scheduling) Select task and message priorities Priorities No Schedulable? • Yes Simulate Run response-time analysis to obtain • Genetic algorithm for worst-case delays Delaydelays? distributions priority assignment • Bounded • Synthesize Deadlines met? control-laws and compute cost Cost Cost Yes Stop? No 14 Average cost improvement [%] Experimental results Integrated approach Isolated scheduling and control-law synthesis Straightforward period assignment Number of plants 15 Summary and contribution • Problem: Sharing of computation and communication resources degrades the control performance • Solution: Integrate scheduling with control design (period assignment and control-law synthesis) • Contribution: • A tool for such integrated design of distributed embedded control systems with –static-cyclic scheduling or –priority-based scheduling 16 EXTRA SLIDES 17 Evaluation Period optimization with genetic algorithms Integrated control-law synthesis and scheduling Straightforward period assignment Isolated control-law synthesis and scheduling 1. 2. 2. 3. Synthesize Select smallest control-law periodswith for all neglecting applications the implementation (traditional design) Schedule systemaspects and synthesize control-laws ”As as possible” or ”rate-monotonic” If notsoon schedulable, increase the period of the scheduling application with highest resource demand and then go back to Step 2 18 Experiments Integrated control-law Period optimization with synthesis and algorithms •genetic Generated benchmarks with inverted scheduling pendulums, servos, and other examples of unstable plants Isolatednodes control-law • 6 to 45 tasks, 2 to 7 computation Straightforward period synthesis and assignment scheduling • • • Straightforward approach as a baseline, JSF Compute relative cost improvement • (JSF – J) / JSF Evaluate each part of the optimization in isolation 19 Average cost improvement [%] Static-cyclic scheduling Number of plants 20 Average cost improvement [%] Priority-based scheduling Number of plants 21 Average runtime [seconds] Optimization time Number of plants 22