Delay-Aware Period Assignment in Control Systems
Anton Cervin Lund UniversitySweden
Enrico Bini Scuola Superiore Sant’Anna, Pisa, Italy
Real-Time Systems Symposium, 2008
Matlab routine available at: http://retis.sssup.it/~bini/
Overview
We find an analytical solution!!!
• n independent plants to be controlled by n controllers
• one CPU to schedule themProblem: assign the periods {Ti} such that
overall control cost is minimized
1 2 n
T1 T2 Tn CPU
The execution of a controller
•a set of n control tasks {1,...,n}•scheduled by FP
A task i is modeled by (Ci, Ti), where:• Ci is the worst-case computation time;• Ti is the period;• Ui=Ci/Ti is the utilization;• Rij is the job response time;• no deadline is enforced.
The cost of a controller
iTi
iJ
The cost is standard Linear Quadratic Gaussian (LQG) that is
We make a linearization
iiiii TJ
iTi
iJ
iTi
iJ
It applies to any other domain where period, delay minimization is required
The linear cost
“The cost Ji is ”iiiii TJ Let Ji(T,) be any smooth cost function, Ti0 and i0 be nominal values of period and delay of i (for example Ti0=i0=Ci)1. make a linear approx of Ji at (Tik,ik) and we set ik
and ik as the partial derivative of Ji;2. Solve (very efficiently) the linear problem and set Tik+1 as the solution and ik+1 accordingly
3. Go back to 1.The convergence is not demonstrated, but always obtained.
Modeling the delay
In control, i is the separation between sampling and actuationHow do we model i as function of T1,...,Tn?
• separation from activation to completion varies job by job
• i=Ri? Overestimate, no expression func of Ti• i=Riub? Exists expression of Ti, larger overestimate• i=avgj{Rij}? good estimate, no expression
Average response time seems the good one
The delay approximation
•seems a good approximation of avgj{Rij}
• it’s the resp time if hp tasks were fluid
• if, a posteriori, we see good performance then it’s a good delay approximation
We claim that average Rij is “something like”
1
1
approx
1i
j j
ii
U
CR
(2,4)
(3,6)
jj R2avg approx2R jj R2inf jj R2sup
7 5 6 6
Formalization of the problem
0 ,1subject to
1minimize
1
1 1
1
i
n
ii
n
i i
j j
iiii
UU
U
CT
Seto et al [RTSS96] solved with i=0
Notice we don’t care of classic FP schedulability!
We aggregate the overall cost by sum Ji
Solution of the problem
Analytical solutionof the problem
Lagrange multipliers +
Partial differentiation +
Luck =
At pag. 296, Equations (34)--(37), you can see the expression of the solution
The priority assignment
• RM is not guaranteed to be optimal.• What is the control-optimal assignment?Intuition: since the cost is
1
11
i
j j
iiii
U
CT
Since we found the analytical (fast) solution, then we can try to enumerate all possible (n!) priority orderings
• large i high priority to i• two “orthogonal” problems: priority assignment
(based on i) and period assignment (based on i)
Introducing experiments
Tested methods:
• FirstVertex, by Bini, Di Natale [RTSS05]
• RiApprox, this method
• Seto96(1), by Seto et al [RTSS96], U=1
• Seto96(Ulub), Seto96, U=Ulub
One experiment
Ci 2 5 10 1 15
U Jii 4 4 4 4 4
i 20 6 3 4 2
Seto96(Ulub) 22.227 35.145 49.702 15.717 60.872 0.7435 913.4
Seto96(1) 16.526 26.130 36.953 11.686 45.258 1 764.1
FirstVertex 18 36 36 18 36 1 770.2
RiApprox 18.905 29.097 39.364 12.263 38.781 1 754.8
Matlab code available on my homepage
• priority assigned by brute force (n!)
One experiment
Ci 2 5 10 1 15
U Jii 4 4 4 4 4
i 20 6 3 4 2
Seto96(Ulub) 22.227 35.145 49.702 15.717 60.872 0.7435 913.4
Seto96(1) 16.526 26.130 36.953 11.686 45.258 1 764.1
FirstVertex 18 36 36 18 36 1 770.2
RiApprox 18.905 29.097 39.364 12.263 38.781 1 754.8
Matlab code available on my homepage
• priority assigned by brute force (n!)
Quality of delay approx
task priority
• random Ci, i, i, n{3,7,19}• We compute periods according
RiApprox• For all tasks we evaluate Riapprox/Riavg
• Riavg is computed by simulatingthe schedule
• on x axis, tasks by decreasing pri
highest lowest
Riap
prox
/Riav
g
Quality of delay approx
task priorityhighest lowest
Riap
prox
/Riav
g
Comparing the costs
n=2 n=5 n=10 n=20
Seto96(Ulub) 208 393 497 673
FirstVertex 169 353 5012 595
RiApprox 167 333 426 554
n=2 n=5 n=10 n=20
Seto96(Ulub) 246 519 6011 14
FirstVertex 226 429 576 7610
RiApprox 195 406 488 664
n=2 n=5 n=10 n=20
Seto96(Ulub) 273 8124 12113 1559
FirstVertex 278 6114 11 1469
RiApprox 244 10279 10012 1287
2 s
tab
le p
ole
s2
sta
ble
, 1
uns
tab
le p
ole
s3
sta
ble
, u
nsta
ble
po
les
• cost is LQG (not synthetic)• 3 kinds of plant generated randomly
• 2 stable poles• 2 stable pole, 1 unstable• 3 stable/ustable poles
• reference is Ti=Di=Ci• costs are normalized with reference
Comparing the costs
n=2 n=5 n=10 n=20
Seto96(Ulub) 208 393 497 673
FirstVertex 169 353 5012 595
RiApprox 167 333 426 554
n=2 n=5 n=10 n=20
Seto96(Ulub) 246 519 6011 14
FirstVertex 226 429 576 7610
RiApprox 195 406 488 664
n=2 n=5 n=10 n=20
Seto96(Ulub) 273 8124 12113 1559
FirstVertex 278 6114 11 1469
RiApprox 244 10279 10012 1287
2 s
tab
le p
ole
s2
sta
ble
, 1
uns
tab
le p
ole
s3
sta
ble
, u
nsta
ble
po
les
Future works
• Extension in presence of a virtual processor.
• More efficient priority assignment.
• A delay sequence of 2, 4, 2, 4, 2, 4,... may not perform the same as a constant delay of 3. Account for it.
?
?
Quality of delay approx 2
i magnutude (sensitivity to delay)
cost
/Se
to9
6(1
)
• 5 tasks• random Ci, i• we increased the average i• cost is synthetic• reference is Seto(1)