Performance-Aware Scheduler Synthesis for Control Systems Rupak Majumdar 1, 2 , Indranil Saha 1 and Majid Zamani 1 1 University of California, Los Angeles 2 Max Planck Institute for Software Systems EMSOFT 2011 October 12, 2011 EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 1/24
37
Embed
Performance-Aware Scheduler Synthesis for Control … filePerformance-Aware Scheduler Synthesis for Control Systems Rupak Majumdar 1;2,Indranil Saha and Majid Zamani 1University of
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Performance-Aware Scheduler Synthesis forControl Systems
Rupak Majumdar1,2, Indranil Saha1 and Majid Zamani1
1University of California, Los Angeles
2Max Planck Institute for Software Systems
EMSOFT 2011October 12, 2011
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 1/24
Mathematical Model of a Control System
x(k + 1) = f (x(k),u(k),w(k))
y(k) = h (x(k))
Controller
SensorActuator
Plant
u(k) = κ(x(k))
For linear time-invariant control systems:
Plant : x(k + 1) = Ax(k) + B1w(k) + B2u(k)
y(k) = Cx(k)
Controller : u(k) = −Kx(k)
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 2/24
Mathematical Model of a Control System
x(k + 1) = f (x(k),u(k),w(k))
y(k) = h (x(k))
Controller
SensorActuator
Plant
u(k) = κ(x(k))
For linear time-invariant control systems:
Plant : x(k + 1) = Ax(k) + B1w(k) + B2u(k)
y(k) = Cx(k)
Controller : u(k) = −Kx(k)
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 2/24
Controller to Software Task
Software
Task
SensorActuator
Plant
CPU
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 3/24
Complex Control Systems
Today’s large control systems have many control units.
Boeing 747 has 50 ECUs.
BMW has 70-100 ECUs.
Multiple control loops need to be implemented on a singleprocessor.
Helps moving from federated architecture to integratedarchitecture .
Reduces cost.
Reduces communication complexity.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 4/24
Multiple Control Systems with Shared Resources
Task 1
A/DD/A
Plant 1
Shared CPU
Task 2
A/DD/A
Plant 2
Task N
A/DD/A
Plant N
....
RTOS Scheduler
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 5/24
Multiple Control Systems with Shared Resources
Control: u1 = f1(x)
Timing: τ1
Control: u2 = f2(x)
Timing: τ2
Control: uk = fk (x)
Timing: τk
Virtual World: Control Theory
Real World: Real-time OS
Tasks: T1: Period = τ1
WCET = c1
T2: Period = τ2
WCET = c2. . . . . .
Tk : Period = τk
WCET = ck
Schedulable? Schedule tasks
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 6/24
Hard Real-Time Scheduling
Given tasks with worst case execution times and periods,is there a way to execute them so that all tasks finishexecuting before their deadlines?
Key problem in real-time systems.
System schedulable→ Implement!
System not schedulable→ Send back to designer.
Or: Throw more resources at it!
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 7/24
Not-So-Hard Real-Time Scheduling
Suppose we relax the scheduler:
In some rounds, the scheduler can decide not to execute atask.
The control input generated in the previous cycle is appliedto the plant.
Scheduling problem is easier.
But what happens to the controlled system?
If we ignore a control task too many times, the system maybecome unstable.
Even if the system is stable, what happens to theperformance?
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 8/24
Not-So-Hard Real-Time Scheduling
Suppose we relax the scheduler:
In some rounds, the scheduler can decide not to execute atask.
The control input generated in the previous cycle is appliedto the plant.
Scheduling problem is easier.
But what happens to the controlled system?
If we ignore a control task too many times, the system maybecome unstable.
Even if the system is stable, what happens to theperformance?
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 8/24
Model of a Control System with Packet Dropouts
Plant
x(k+1)=Ax(k)+B1w(k)+B2u(k)y(k)=Cx(k)
w y
KS2
S1
xu
When switch is in position S1 : u(k) = −Kx(k).
When switch is in position S2 : u(k) = u(k − 1).
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 9/24
Successful Transmission Rate
Plant
x(k+1)=Ax(k)+B1w(k)+B2u(k)y(k)=Cx(k)
w y
KS2
S1
xu
The successful transmission rate is the rate at which the switch is inposition S1. The successful transmission rate r is given by
r = limL→∞
1L
L∑k=0
(2− s(k)).
The dropout rate means the rate at which the switch is in S2.
If the successful transmission rate is r , its dropout rate is 1− r .
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 10/24
Successful Transmission Rate
Plant
x(k+1)=Ax(k)+B1w(k)+B2u(k)y(k)=Cx(k)
w y
KS2
S1
xu
The successful transmission rate is the rate at which the switch is inposition S1. The successful transmission rate r is given by
r = limL→∞
1L
L∑k=0
(2− s(k)).
The dropout rate means the rate at which the switch is in S2.
If the successful transmission rate is r , its dropout rate is 1− r .
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 10/24
Relate Successful Transmission Rate to Stability
Theorem [Branicky et al.-CDC’02]Consider the control system with packet loss:
Assume that r is the successful transmission rate and theclosed loop system with no dropout and no disturbance isstable.The LTI control system with dropout, with no disturbance, isexponentially stable for all r > rmin
where rmin = 11−γ1/γ2
,γ1 = log [maxi |λi(A− B2K )|],
and γ2 = log [maxi |λi(A)|].λi(A) is the i-th eigen-value of matrix A.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 11/24
Performance Criteria: L∞ to RMS Gain
For a discrete-time LTI control system, the L∞ to RMS inducedgain from disturbance w to output y [Hassibi et al.-CDC’99] isdefined as follows:
sup‖w‖∞ 6=0,X(0)=0
(lim supl→∞
1l∑l
j=0 yT (j)y(j)) 1
2
‖w‖∞
where ‖w‖∞ = sup{‖w(k)‖2, k ≥ 0},
and ‖w(k)‖2 =√
wT (k)w(k).
The L∞ to RMS induced gain is a performance criterionshowing the effect of the disturbance on the output of theplants.
The Lower is the gain, the better is the performance.EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 12/24
Performance Criteria: L∞ to RMS Gain
For a discrete-time LTI control system, the L∞ to RMS inducedgain from disturbance w to output y [Hassibi et al.-CDC’99] isdefined as follows:
sup‖w‖∞ 6=0,X(0)=0
(lim supl→∞
1l∑l
j=0 yT (j)y(j)) 1
2
‖w‖∞
where ‖w‖∞ = sup{‖w(k)‖2, k ≥ 0},
and ‖w(k)‖2 =√
wT (k)w(k).
The L∞ to RMS induced gain is a performance criterionshowing the effect of the disturbance on the output of theplants.
The Lower is the gain, the better is the performance.EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 12/24
Performance Criteria: L∞ to RMS Gain
For a discrete-time LTI control system, the L∞ to RMS inducedgain from disturbance w to output y [Hassibi et al.-CDC’99] isdefined as follows:
sup‖w‖∞ 6=0,X(0)=0
(lim supl→∞
1l∑l
j=0 yT (j)y(j)) 1
2
‖w‖∞
where ‖w‖∞ = sup{‖w(k)‖2, k ≥ 0},
and ‖w(k)‖2 =√
wT (k)w(k).
The L∞ to RMS induced gain is a performance criterionshowing the effect of the disturbance on the output of theplants.
The Lower is the gain, the better is the performance.EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 12/24
Relate Successful Transmission Rate to Performance
Theorem
Consider the discrete time LTI control system with thesuccessful transmission rate r . The L∞ to RMS gain is lessthan positive constant γ if there exists a piecewise continuousfunction V : Rn+m → R≥0(n and m are dimensions of statespace and control input set respectively), such that V (0) = 0,and γ1, γ2 ∈ R such that
rγ21 + (1− r)γ2
2 < γ2
and
V(
AiX + B1iw)− V (X ) ≤ γ2
i wT w − yT y , for i = 1,2.
We can find upper bound on the gain for different successfultransmission rates through convex optimization.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 13/24
Relate Successful Transmission Rate to Performance
Theorem
Consider the discrete time LTI control system with thesuccessful transmission rate r . The L∞ to RMS gain is lessthan positive constant γ if there exists a piecewise continuousfunction V : Rn+m → R≥0(n and m are dimensions of statespace and control input set respectively), such that V (0) = 0,and γ1, γ2 ∈ R such that
rγ21 + (1− r)γ2
2 < γ2
and
V(
AiX + B1iw)− V (X ) ≤ γ2
i wT w − yT y , for i = 1,2.
We can find upper bound on the gain for different successfultransmission rates through convex optimization.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 13/24
Performance vs. Successful Transmission Rates
Performance is Notmonotonic with respectto successfultransmission rate.→ Increasing resourcesmay not make theperformance better.
Moral: An end-to-end argument can give a better overall systemperformance, even with lower resources.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 14/24
Performance vs. Successful Transmission Rates
Performance is Notmonotonic with respectto successfultransmission rate.→ Increasing resourcesmay not make theperformance better.
Moral: An end-to-end argument can give a better overall systemperformance, even with lower resources.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 14/24
Eligible Successful Transmission Rates
A successful transmission rate ris called eligible if it satisfies thefollowing two conditions:
r ≥ rmin, where rmin is theminimum rate to achievestability.
for each r ′ ∈ [rmin, r), wehave γ(r ′) ≥ γ(r).
γ(r) denote the upper bound onthe L∞ to RMS gain.
For a chosen discretization for r , the set of eligible rates are denotedby Ei for control system i .
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 15/24
Eligible Successful Transmission Rates
A successful transmission rate ris called eligible if it satisfies thefollowing two conditions:
r ≥ rmin, where rmin is theminimum rate to achievestability.
for each r ′ ∈ [rmin, r), wehave γ(r ′) ≥ γ(r).
γ(r) denote the upper bound onthe L∞ to RMS gain.
For a chosen discretization for r , the set of eligible rates are denotedby Ei for control system i .
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 15/24
Optimal Performance Scheduler Synthesis Problem
Choose rates ri ∈ Ei such that the system is schedulable andthe weighted sum wiγ(ri) is minimized.
wi ’s are weights chosen based on the priority of the controlsystems.
Formally,minimize
∑Ni=1 wiγ(ri)
such that ri ∈ Ei for each i ∈ {1, . . . ,N}∑Ni=1 ci ri/τi ≤ 1
The problem is NP-Hard.
- Reduction is from Multiple-Choice Knapsack Problem.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 16/24
Optimal Performance Scheduler Synthesis Problem
Choose rates ri ∈ Ei such that the system is schedulable andthe weighted sum wiγ(ri) is minimized.
wi ’s are weights chosen based on the priority of the controlsystems.
Formally,minimize
∑Ni=1 wiγ(ri)
such that ri ∈ Ei for each i ∈ {1, . . . ,N}∑Ni=1 ci ri/τi ≤ 1
The problem is NP-Hard.
- Reduction is from Multiple-Choice Knapsack Problem.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 16/24
Optimal Performance Scheduler Synthesis Problem
Choose rates ri ∈ Ei such that the system is schedulable andthe weighted sum wiγ(ri) is minimized.
wi ’s are weights chosen based on the priority of the controlsystems.
Formally,minimize
∑Ni=1 wiγ(ri)
such that ri ∈ Ei for each i ∈ {1, . . . ,N}∑Ni=1 ci ri/τi ≤ 1
The problem is NP-Hard.
- Reduction is from Multiple-Choice Knapsack Problem.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 16/24
Our Approach
Find rmin for each control system.
Find rmax for all control systems.
Maximize weighted sum of successful transmission rates.
Weights are based on the priorities of the control systems.
Select r ∈ [rmin, rmax ] such that the performance is the best.
Synthesize a scheduler based on the selected rates.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 17/24
Scheduler Synthesis with Task Drops
Given: Task Ti :
WCET ci .
Period τi .
Successful transmission rate ri = kiKi
Find: Schedule such that
Executions of Task i finish before the deadline.
The scheduler drops 1− r(i) fraction of packets in the longrun.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 18/24
Static Scheduling Problem in SMT
We encode constraints as an SMT problem:
Hyperperiod = {lcm of periods of all tasks (τi ’s)} × {lcm ofthe denominators of the rates (Ki ’s)}.
Boolean variable s[i , j]: if task i is scheduled in round j .
- If s[i , j] = 1, then wcet ci slots in the j ’th periodallocated to task i .
Variable t [i , j]: time when task of controller i in the j ’thperiod starts.
Fraction of the number of periods in the hyperperiod inwhich task i is chosen = r(i).
A task should be scheduled after it is generated andshould finish before the end of the period.
A slot should not be assigned to multiple tasks.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 19/24
Finding the Maximal Transmission Rates
Problem: What is the maximum successful transmission ratesfor the control systems such that all packets can be scheduled?
Solution: Solving a maximization problem.
Constraints are same as the previous problem, only therates are treated as variables.
The objective function is the weighted sum of the ratevariables.
- Weights are derived from priorities.
Solve the optimization problem using bisection method andsolving a series of feasibility problems.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 20/24
Example: Inverted Pendulum
x = Ax + B1w + B2u
y = Cx
A =
»0 1gl
ρ
ml2
–B2 =
»01
ml
–,
B1 =
»0.10
–C = [0.001, 0].
x1 - the angular position
x2 - the angular velocity of the point mass
u - the applied force (control input)
w - the disturbance input
m - the mass
l - the length of the rod
g - acceleration due to gravity
ρ - the rotational friction coefficient
Systems Mass (kg) Length(m) Priority Controller Sampling ComputationGain Time (s) Time (s)
Table: Time required to find maximal schedule and optimal schedule
tm - time required to find the maximal successful transmissionrates.ts - time required to find the final schedule.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 22/24
Related Works
Co-design of feedback controllers and schedulers
Choose the sampling time to obtain optimal performance[Seto et al.-RTSS’96, Årzen et al.-CDC’00, Zhang etal.-RTSS’08, and others]
Drop some control packets to make the scheduling problemeasier without compromising control properties(focus is on Stability)[Branicky et al.-CDC’02, Goswami et al.-ASP-DAC’11]
Marriage of control theoretic calculation and softwareverification/synthesis
Schedulability and stability[Weiss et al. - HSCC’09]
Fixed-point implementation of controller and stability[Anta et al. - EMSOFT’10]
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 23/24
Conclusion
Contributions:We present theoretical results as well as a tool for aController-Scheduler Co-design problem.Co-design lets us relax constraints on the hard real-timescheduling problem, while potentially getting betterperformance from the system.
Future Work:Techniques can be generalized with other sources of error,such as quantization errors or additional network effects.Explore how dynamic scheduling policies interact with ourcontrol-theoretic analysis.Extend our results to more complex hybrid systems withseveral discrete modes.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 24/24
Conclusion
Contributions:We present theoretical results as well as a tool for aController-Scheduler Co-design problem.Co-design lets us relax constraints on the hard real-timescheduling problem, while potentially getting betterperformance from the system.
Future Work:Techniques can be generalized with other sources of error,such as quantization errors or additional network effects.Explore how dynamic scheduling policies interact with ourcontrol-theoretic analysis.Extend our results to more complex hybrid systems withseveral discrete modes.
EMSOFT 2011 Majumdar, Saha and Zamani Performance-Aware Scheduler Synthesis 24/24