HAL Id: inria-00158172
https://hal.inria.fr/inria-00158172v3
Submitted on 20 Jul 2007
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of
sci-entific research documents, whether they are
pub-lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d’enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.
Real-Time Quality-of-Service
Mathieu Grenier, Nicolas Navet
To cite this version:
Mathieu Grenier, Nicolas Navet. Fine-Tuning MAC-Level Protocols for Optimized Real-Time
Quality-of-Service. [Research Report] RR-6247, INRIA. 2007, pp.22. �inria-00158172v3�
0
2
4
9
-6
3
9
9
IS
R
N
IN
R
IA
/R
R
--6
2
4
7
--F
R
+
E
N
G
Thème COM
Fine-Tuning MAC-Level Protocols for Optimized
Real-Time Quality-of-Service
Mathieu Grenier — Nicolas Navet
N° 6247
June 2007
Unité de recherche INRIA Lorraine
LORIA, Technopôle de Nancy-Brabois, Campus scientifique,
615, rue du Jardin Botanique, BP 101, 54602 Villers-Lès-Nancy (France)
Téléphone : +33 3 83 59 30 00 — Télécopie : +33 3 83 27 83 19
Quality-of-Servi e Mathieu Grenier∗
, Ni olas Navet∗
ThèmeCOM Systèmes ommuni ants
ProjetTRIO
Rapportdere her he n°6247June200721pages
Abstra t: Indistributedreal-timesystems,meetingthereal-time onstraintsismandatorybutthesatisfa tion
of other appli ation-dependent riteria is most generally required as well. In parti ular, Networked Control
Systems (NCS) areknownto besensitiveto ommuni ationdelays su h asframe response time jitters. Well
knownMediumA essControl(MAC)algorithmssu hNon-PreemptiveDeadlineMonotoni (NP-DM)or
Non-PreemptiveEarliestDeadline First(NP-EDF)aree ientin termsofbandwidthusagebuttheymayperform
poorly regarding other appli ation dependent performan e riteria. This paper highlights a lass of on-line
s hedulingpoli iestargetedats hedulingframesattheMAClevel,andprovidesas hedulabilityanalysisthat
isvalidforallpoli ieswithinthe onsidered lass. Asitwillbeshown,thesealgorithmsareeasilyimplementable
on COTS omponents(e.g., ControllerArea Network ontrollers)andoergoodtrade-osbetweenfeasibility
and thesatisfa tionofotherappli ation-dependent riteriasu hastheresponsetimejitter.
Key-words: Real-timesystems, ontrol systems, ommuni ationsystems,s heduling,proto ols,eld buses.
∗
LORIA - TRIO Group, Campus S ientique - BP 239, 54506 Vandoeuvre-lès-Nan y Cedex, Fran e. Email:
Résumé: Danslessystèmesdistribuéstempsréel,lerespe tdes ontraintestempsréelestsine quanon mais
la satisfa tion d'autres ritèresest également le plus souvent requis. En parti ulier, les "systèmes ontrlés
en réseau" (Networked Control System - NCS) sont onnus pour leur sensibilité aux délais de
ommuni a-tion omme la gigue sur les temps de réponse. Les proto oles les plus ourants pour l'a ès au médium de
ommuni ation(Medium A ess Control - MAC)tel queDeadline Monotoni (NP-DM) ouEarliest Deadline
Firstnon-préemptif(NP-EDF) sont e a esen termesd'utilisation debandepassantemais peuventavoirun
omportementmédio reau regarddes autres ritèresdeperforman esdépendantsdel'appli ation. Ce papier
présenteune lassedepolitiquesd'ordonnan ementenlignepourl'ordonnan ementdestramesauniveauMAC,
et fournit uneanalysed'ordonnan ementappli ableàtouteslespolitiquesappartenantà ette lasse. Comme
nous lemontrerons, es algorithmessontfa ilementimplémentables surdes omposantsdu ommer e, omme
des ontrleurs de ommuni ationCAN, et orent un bon ompromis entre faisabilité et la satisfa tion des
ritèrespropresàl'appli ation ommelagiguesurlestempsderéponse.
Mots- lés : Systèmestempsréel,systèmesde ontrle,systèmesde ommuni ation,ordonnan ement,
1 Introdu tion
Context of paper Indistributed real-time systems,therespe t oftiming onstraintisabasi requirement
but other appli ation-dependent riteriabesidesfeasibility areofinterest. Forinstan e,in NetworkedControl
Systems (NCS), where the ontrol system is distributed through a network, message ex hanges indu e
non- onstant delays in the ontrol-loop, whi h ae ts the performan e and even the stability of the ontrolled
system [1, 2,3℄. Theframe s hedulingalgorithm at theMedium A essControl (MAC) hasalargeinuen e
onthesedelaysandthus,should be hosena ordingto theappli ation'sperforman erequirements.
Problem denition TheproblemistodeviseMAClevels hedulingalgorithmsthataree ientintermsof
bandwidthusageas well asforthesatisfa tionofappli ation dependent riteria. Moreover,asfaraspossible,
these algorithmsshould beimplementable onCOTShardwareandindu e smalloverhead. Inthefollowing,we
will onsiderthat theMACs hedulingalgorithm isimplementedontopof aprioritybus,su hasCAN [4,5℄,
VAN [6℄orJ1850[7℄. Indeed,prioritybuseshaveprovento beee tiveinareal-time ontext, andarewidely
availableandused.
Related work Many studies have been devoted to nd s heduling solutions that are well suited to the
appli ation's requirements,bothforthes hedulingoftasksandthes hedulingofmessages.
1. S hedulingoftasks:
In[8℄, amodiedversionof theConstantBandwidth Server(CBS), initially proposed in [9℄, is used to
eliminate jitters. Data inputand data output o urat xed points in time and ontrol tasks runin a
CBS,whi hisanabstra tionofadedi atedCPUoeringa hosenfra tionoftheoriginalCPU,toensure
that ontroltasksnishbeforetheoutputofthedata.
Tobetterttothepro essingrequirementsofa ontrolsystem,newtaskmodelshavebeen on eived. In
[10,11℄,theelasti taskmodelisproposedtohandleoverruns: taskadapttheirperiodatruntimeinsu h
awayastokeepthesystemsunderloaded. In[12,13℄,itisproposedthat ontroltasksaresubdividedin
three dierentparts: sampling, omputation, a tuation. Samplingand a tuationsub-tasksareassigned
ahigh priorityinordertoredu e thejitters.
Anothersolutionistoadjust theparametersofthetaskstoa hievethedesiredgoals. In[14℄,the
worst- ase end-of-exe ution jitter is minimized by hoosing appropriate deadlines. In [15℄, initial osetsand
prioritiesareadjustedto redu ejitterbyminimizing preemption.
Improvements analsobebroughtby well hoosingthe parametersof thes hedulingpoli ies. In[16℄, a
priorityallo ations hemeis proposed toredu e theaverageresponsetime while,in [17℄, theproblemof
hoosings hedulingpoli iesandprioritiesonaPosix1003.1b ompliantoperatingsystem(OS)ista kled.
Finally, anotherwayisto reatenews hedulingpoli ies. In[18℄,thes heduler issynthetized asatimed
automatafrom thePetrinetmodelingthesystemandtheproperties expe tedfrom thesystem. In[19℄,
alsostartingfromaPetrinetmodelofthesystem,anoptimals hedulingsequen eisfoundbyexamining
themarking graphof the Petrinet. In dire t link with this study is thework published in [20℄, where
on-linetasks hedulingpoli iesare on eivedforoptimizingappli ation-dependentperforman es riteria.
2. Messages heduling:
E ients hedulings hemeshavebeenproposedin[21℄and[22℄toensurefairnessandbandwidthisolation
betweenstreamsofmessagessentonaCANbus,respe tivelywitha entralized(i.e.,amasternodehas
full ontroloverthes heduling)and de entralizeds heme.
Other studies proposed solutions for implementing Non-Preemptive Earliest Deadline First (NP-EDF)
CAN in [23, 24, 25℄ with solutions where deadlines areen oded on alogarithmi time s ale, whi h has
been shown to minimize the priority inversions due to the limited number of priority bits. In [26℄, a
NP-EDF implementation isproposed ontop ofFTT-CAN while [27℄ addresses thesameproblem when
theappli ationmakesuseofthestandardizedCANappli ationlayersCAL CiA[28℄andCANOpen[29℄.
Anothers heme,publishedin [30℄,allowstoredu e theresponsetimejitterdueto bit-stungby
intro-du ingsomerestri tionsontheprioritiesthat anbeallo atedtothestreamofframesonaCANnetwork.
Toa hievethesamegoal,theauthorsin[31,32℄proposeageneti algorithm toadjustthe initialosets
ofmessagesin ordertoredu etransmissionjitter(samegoalas[15℄fortheunipro essor ase).
Overviewoftheapproa h Inthisstudy,theproblemaddressedistoe ientlygranta esstothenetwork
at the MAC level. The performan e riteria are the s hedulability of the systems and the satisfa tion of
appli ation dependant riteria, su h astheframe response time jitter whi h is ru ial for Networked Control
Systems. Theproposalis omprisedofthreedistin tsteps:
1. dene thepropertiesthat agood MAC-level real-times hedulingpoli ies must possess and identify a
sub- lass,parti ularlypromising intermsofperforman es,
2. deriveas hedulabilityanalysisforthissub- lass lassofs hedulingpoli iesandaddressthe
implementa-tionissues,
3. explore the sear h spa e and nd out themost e ient poli ies. Two ases an be distinguished. The
asewhere the poli y has to be e ient onaverage (it anbeused with dierenttra streams whose
hara teristi sareapriorinotknown). And,the asewherethepoli yshouldbenetunedforaparti ular
appli ation.
Organisation of the paper Inse tion 2, the omputational model is stated. In se tion3, the properties
requiredfrom agood s hedulingalgorithm inthereal-time ontextareexihibited. Amongthis setof good
poli ies, thesub- lass onsidered in thefollowingispresented. Inse tion 4,theimplementationissueson top
oftheCANprioritybusaredis ussed. Se tion5isdevotedtothes hedulabilityanalysis. Finally,experiments
showingtheee tiveness oftheproposalaresummarizedinse tion6.
2 Network model
This studydealswiththes hedulingofframesattheMediumA essControllevel;in parti ularitisassumed
thatsegmentationtakespla eintheupperlayersofthe ommuni ationsta k. Thea esstothebusisgranted
by an algorithm (e.g., prioritybased, token bus,et .) that is termedthe s heduling poli y in therest of the
paper.
2.1 Tra stream model
A set
F
ofm
tra streamsis onsidered. Nodes,inter onne tedthroughanetwork,sendthestreams. There maybeseveraltra streamssentbythesamenode. Ea htra streamf
k
generatesandqueuesperiodi ally frames, wheref
k,n
denotes then
th
frame of the tra stream
f
k
. By analogy to the periodi task model used in CPU s heduling, a tra streamf
k
is hara terized by a triple(C
k
, D
k
, T
k
)
whereC
k
is the worst- asetransmissiontime ofaframe belongingto the stream,D
k
the relative deadline (i.e. maximum tolerable delaybetweenthetransmissionrequestandthere eptionatallre eivingnodes),andT
k
theinter-arrival time between two instan es off
k
. The releasetime of a framef
k,n
is denoted byA
k,n
. For the sake of larity, sporadi streamsand jittersinthe availabilitydates arenot onsideredherebut anbetakenintoa ountasCon rete and non- on rete tra streams A on rete tra stream
(f
i
, A
i,1
)
isastreamforwhi h the release time of its rst frameA
i,1
is known before run-time while the releasetimes of non- on rete streams are unknown. A set ofn
non- on rete tra streams is denoted byΩ = {f
1
, f
2
, ..., f
n
}
, wheref
k
is the streamwithindexk
,whileasetofn
on retetra streamsisω
= {(f
1
, A
1,1
), (f
2
, A
2,1
)...(f
n
, A
n,1
)
},whereA
k,1
is the initial osetof streamf
k
(i.e. the releasetimeof the rstinstan e). Without restri tionson the initial osets,thereis aninnitenumberofmappingfrom thesetof non- on retetra streamsΩ
to theset of on retetra streamsω
.Feasibility and optimality A on reteset of tra streams
ω
issaid feasible (or s hedulable) ifnoframe ofthesystemisre eivedafteritsabsolutedeadlineD
k,n
= A
k,n
+ D
k
. Anon- on retesetoftra streamsΩ
is feasible,ifallthe on rete setsω
,whi h anbegeneratedfromΩ
, arefeasible.A s heduling poli y is optimal with respe t to a ertain riterion (e.g. feasibility, average response time)
within its lass if noother poli y of the lass performsbetter withrespe t to the riterion. In thefollowing,
optimal isusedto meanoptimal withrespe t tofeasibility. As hedulingpoli yis non- on reteoptimal (with
respe ttofeasibility)ifitsu essfullys hedules allthenon- on rete setsthat ares hedulablewithapoli yof
the lass. Asshownin[34℄,Non-PreemptiveEarliestDeadlineFirst(NP-EDF -smallertheabsolutedeadline,
greaterthepriority)isnon- on reteoptimalwithinthe lassofnon-idlingpoli y,where non-idlingmeansthat
thenetworkisnotidlewhenthereareframesawaitingfortransmission.
2.2 Dening poli ies through priority fun tion.
Priority fun tions is a onvenient way of formally dening in a non-ambiguous manner s heduling poli ies,
whi h toourbest knowledge, was introdu edfortherst timein [35℄. Thepriorityfun tion
Γ
k,n
(t)
indi ates thepriorityofaframef
k,n
attimet
. Thenetworkisallo ated,atea htime,a ordingtotheHighest Priority First (HPF)paradigm.Fun tion
Γ
k,n
(t)
takesitsvaluefromatotallyorderedsetP
,whi his hosenin[35℄tobethesetof multi-dimensionalIR
-valuedve torsP = {(p
1
, ..., p
n
) ∈ R
n
| n ∈ N}
providedwith alexi ographi al order. Between
twove tors, oordinates are ompared onebyonestartingfrom the left,the rstdierent oordinate de ides
thepriorityorderwiththe onventionthesmallerthenumeri alvalue,thehigherthepriority. Forinstan e,
Γ
i,j
(t) = (3, 4, 5)
andΓ
k,n
(t) = (3, 4, 6)
impliesthatf
i,j
hasahigherprioritythanf
k,n
attimet
. Priorityve tors of dierent sizes anbe ompared with thesamerule asaboveand the onventionthat amissing oordinateis thelowestnumeri alvalue(e.g.
Γ
i,j
(t) = (3, 4, 5)
andΓ
k,n
(t) = (3, 4)
meansthatf
k,n
hasahigherpriority thanf
i,j
attimet
). Finally, twove torsareequalitheyhavethesamesizeand ifthe omponentsareequal one by one. As it will be explained in se tion 4, on apriority bussu h as CAN, the priority ve tor an bemappedtothepriority odedintheIdentiereld oftheframes. Thisallowstotakeadvantageofthenative
arbitrationme hanismoftheprioritybustoperformthearbitrationa ordingtothes hedulingpoli ydened
bythepriorityfun tion
Γ
k,n
(t)
.Mostreal-times hedulingpoli ies anbedenedeasilyusingpriorityfun tions. Forinstan e,thepriorityof
aframe
f
k,n
under NP-EDFandNon-PreemptiveDeadlineMonotoni (NP-DM-smallertherelativedeadline, greaterthepriority),prioritybe omes:Γ
N P−EDF
k,n
(t) =
(
(A
k,n
+ D
k
, k, n)
ift < B
k,n
(−∞, k, n)
ift ≥ B
k,n
,Γ
N P−DM
k,n
(t) =
(
(D
k
, k, n)
ift < B
k,n
(−∞, k, n)
ift ≥ B
k,n
where
B
k,n
is thetransmissionbeginoff
k,n
(the last two oordinatesk, n
areneeded to ensurede idability, seedenition2). The−∞
valueoftherst omponentofthepriorityve torafterthestartoftransmission(i.e.t
≥ B
k,n
)ensuresnon-preemptiveness. A lassofpoli iesofparti ularinterest,towhi hNP-EDFandNP-DM belong,isthePriority PromotionatExe utionBeginning poli ies.Denition 1 [35℄A s heduling poli y
A
isaPriority Promotion atExe utionBeginning(PPEB)poli yif the priority of aframemay hange onlyatthe startof transmissionB
k,n
ofthe frame:Γ
P P EB
k,n
(t) =
(
−
→
P
k,n
ift < B
k,n
−
→
Q
k,n
ift
≥ B
k,n
,
where the priorityve torof aframe
f
k,n
before (resp. after) itsexe utionbeginning is−
→
P
k,n
(resp.−
→
Q
k,n
).Besidesprovidingnon-ambiguousdenition ofthes hedulingpoli y, priorityfun tions enableusto
distin-guish lassesofs hedulingpoli iesandtoderivegeneri resultsthatarevalidforallthepoli ieswithina ertain
lass. Thenextse tionpresentsthesub- lassofnon-preemptives hedulingpoli iesthat willbestudiedin the
rest ofthepaper.
3 Study Domain
An arbitrarypriorityfun tion doesnotne essarilydene as hedulingofinterestfor real-time omputing nor
apoli y that anbeimplemented inpra ti e. Inthisse tion, thepropertiesrequirefrom agood s heduling
poli yispre ised,wheregood meansapoli y that anbeimplementedinpra ti eandthatissuitedto
real-time omputing. Then,amongthesetofallgoodpoli ies,theparti ular lassofs hedulingpoli ies onsidered
in thisstudyisdened.
3.1 Good s heduling poli ies
A good poli y mustmeeta ertainnumberof riteria,whi hareneeded forthepoli yto beimplementedin
areal-time ontext.
De idablepoli ies Poli iesmustbede idable: atanytime
t
,thereisexa tlyoneframeofmaximalpriority among the set ofa tiveframes(i.e. frames whi h ontend forthe hannel). This on ept ofde idabilitywasintrodu edin [35℄fortheunipro essor ase.
Denition 2 [35℄Apriority fun tionisde idable i,atea htime
t
su hthat workispending,thereisexa tly one framewiththe highest priority amongthe setof pending frames.Forinstan e, thelast two omponents of
−
→
P
N P−EDF
k,n
= (A
k,n
+ D
k
, k, n)
ensure de idability in ase of equal deadlines. Notethat thispropertyisalsorequiredforanimplementationonaprioritybus.Temporalinvariant poli ies Inthisstudy,forthesakeofpredi tabilityofthesystem,theonlys heduling
poli ies of interestare su h that the relative priority between twoframes doesnot depend on the numeri al
value ofthe lo al lo ks. Therelativepriority mustremain thesameif thearrivalof allframes isshiftedto
theleftortheright. Thepoli yisthusindependentofthevalueofthelo al lo ksatstart-uptime.
Su h poli ies are said shift temporal invariant (STI) poli ies. NP-EDF is a STI poli y sin e the priority
betweentwoframesonlydependsontheosetbetweenarrivaldatesandonrelativedeadlines. Onthe ontrary,
apoli y dened by
−
→
P
k,n
= (C
k
· A
k,n
, k, n)
is notSTI;just onsiderf
i,1
andf
j,1
withA
i,1
= 0
,C
i
= 10
andA
j,1
= 1
withC
j
= 1
andthesametwoframesex eptthatthearrivaldatesareshiftedtotherightbyoneunit oftime.Denition 3 Lettwo on retetra streamsetsbe
ω
= {(f
1
, A
1,1
), (f
2
, A
2,1
)...(f
n
, A
n,1
)
}andω
′
= {(f
1
, A
1,1
+
Φ), (f
2
, A
2,1
+ Φ)...(f
n
, A
n,1
+ Φ)
}whereω
′
As hedulingpoli y
A
isShiftTemporalInvariant(STI)iforallpossibleΦ ∈ Z
,∀i, j, k, n
su hthat(k, n) 6=
(i, j)
(twodistin t frames), onehas:∀t Γ
A,ω
k,n
(t)
≻ (
resp≺) Γ
A,ω
i,j
(t)
=⇒
Γ
A,ω
k,n
′
(t + Φ) ≻ (
resp≺)
Γ
A,ω
′
i,j
(t + Φ)
whereΓ
A,ω
k,n
(t)
isthe priority off
k,n
of the on retetra streamsetω
attimet
.Implementable poli ies Forbeing implementable in pra ti e, omponents of the priority ve tor must be
representablebyalimitednumberofbits(forinstan e,11bitsonstandardCAN).Inthefollowing, oordinates
of the priority ve tor take their value in the set of rational numbers
Q
; the impre ision due to the limited numberofavailablebits, alledquantizationerror asin[23℄,will betakeninto a ountin thes hedulabilityanalysis developedinparagraph5.
Any good MAC-levels hedulingalgorithm intended to be implemented on topof a prioritybus has to
fulll theaforementionedproperties: thepoli ymustbede idable,shifttemporalinvariantandimplementable.
Inthenextparagraph,the lassofnon-preemptivepoli iesstudiedin therest ofthepaperisdened.
3.2 Sear h spa e
Thesear hspa ebelongstothe lassofNon-PreemptiveArrivalTimeDependent poli ies. First,this lassof
poli iesisdened andthis hoi eisjustied.
Non-Preemptive Arrival TimeDependent poli ies ThetermNon-PreemptiveArrivalTime
Depen-dent (NP-ATD) poli ies omes from the fa t that, within this lass, the priority of a frame depends on its
arrivaltime. NP-ATD poli ies isasub- lassofPPEBpoli iesintrodu edearlier(seedenition1).
Denition 4 ANon-Preemptive Arrival Time Dependentpoli yisapoli ywhose priorityfun tion anbe put
under the form:
Γ
k,n
(t) =
(
−
→
P
k,n
= (A
k,n
+ p
k
, k, n)
ift < B
k,n
−
→
Q
k,n
= (−∞, k, n)
ift
≥ B
k,n
(1) wherep
k
:k
7→ Q
+
.p
k
isanarbitraryfun tion of thestreamf
k
, whi h returnsapositivevalueidenti al forallframesoff
k
. The value anbean arbitrarynumeri alvalueorit anbedependent ofsome hara teristi softhetra stream(i.e.
D
k
,T
k
orC
k
). Forinstan e,forNP-EDF,p
k
isequaltotherelativedeadlineD
k
.MotivationsforNon-PreemptiveArrival TimeDependentpoli ies Firstofall,NP-ATDpoli iesare
good s hedulingpoli ies:
de idabilityisensuredbythelasttwo omponentsofthepriorityve tors,
NP-ATD poli ies are Shift Temporal Invariant, see denition 3, sin ethe relativeprioritybetween two
frames
f
k,n
andf
i,j
depends only on the oset between arrival dates and on the values returned by fun tionsp
k
andp
i
, thepoli iesareimplementable;se tion4isdevotedto theimplementationissues.
Se ond, NP-ATD poli ies are promising in terms of performan es. Indeed, NP-EDF, whi h is optimal with
poli iesthatperform losetoNP-EDFintermsoffeasibilitywhilehavingamu hbetterbehaviorwithrespe t
toappli ation-dependent riteria. Theexperimentspresentedin paragraph6 onrmthisintuition. Third,asit
will beshowninparagraph4,ageneri feasibilityanalysis,throughresponsetimebound omputation, anbe
derivedforallNP-ATDpoli ies.
4 S heduling frames with NP-ATD poli ies
This se tion deals with thepra ti al issuesof implementing NP-ATD poli ies fors hedulingmessagesat the
MAC level. In the following, an implementation on top of the CAN network is onsidered. Indeed, CAN
networkiswidelyused,very heapanditisawellmasteredte hnologythatpossessesinterestingfeaturesfora
wide-rangeofreal-timesystems. Theme hanismsdis ussedinthefollowing anbeadaptedinastraightforward
mannerto allother prioritybuses, su hasVAN [6℄andtheJ1850[7℄.
Severalstudies[36,23,24,25℄haveta kledtheproblemofs hedulingmessageswithNP-EDF,whi hbelongs
toNP-ATDpoli ies,ontopofCAN.Inthefollowing,thesolutionsin[23℄andrenedlaterin[24,25℄isextended
to NP-ATDpoli ies.
4.1 Basi s of CAN MAC proto ol
OnCAN,anynodemaystartatransmissionwhenthebusisidle. Possible oni tsareresolvedbya
priority-basedarbitrationpro ess. In aseofsimultaneoustransmissions,thehighestpriorityframewillbesentdespite
the ontentionwithlowerpriorityframes. Thearbitrationisdeterminedbytheidentieroftheframes(i.e. their
priority)withthe onventionthesmallerthenumeri alvalue,thehigherthepriority. Thereis noneedthat
su essiveinstan es of are urrentframe havethesameidentier. This allowstheimplementation ofpoli ies
withdynami prioritiessu h asNP-EDF andNP-ATDpoli y.
4.2 NP-ATD poli ies s heduling on CAN
With NP-ATD poli ies, priority of frames are inversely proportionalto
A
k,n
+ p
k
. The basi idea [36℄ is to en odethepriorityoftheframeinthelargestpartoftheidentier. Sin eitisimposedonCANthatallframeshavedistin tidentiers,somebits arekepttoensuretheuniquenessof theidentier. Asolutionisto assigna
bitpatterndistin tforea htra stream. However,s hedulingmessageswithNP-ATDpoli iesonCANraises
severalproblems. These problems,expli itlystatedin [36℄,arethesameasNP-EDF:
1. priorities
A
k,n
+ p
k
be omelargerandlargerwithtimesin eA
k,n
dependsonthe urrent lo kvalue, 2. the mapping of the priorities to a limited number of bits indu es so- alled quantization errors (seeAppendixA): twodistin tpriorities anbeassignedthesameidentierduetoitslimitednumberofbits.
Withoutlossofgenerality,thetime anbe onsidereddis retewhereitsgranularityisthebit-time(i.e.,thetime
betweentheemissionoftwosu essivebitsofthesameframe). Tosolveproblem1,theauthorsin[36,23,24,25℄
proposetoexpressthepriorityrelativelytoatimeoriginthatisin reasingovertime. Pre isely,thetimeorigin
t
start
is updatedto ea h newtransmission beginning (i.e.t
start
=
maxk,n
(B
k,n
≤ t)
): it is equalto thevery rstbitoftheframe(StartofFramebit). Thepriorityofea hpendingmessagehastobeupdatedatea hnewtransmission start. This omputation indu es averysmalloverhead. Forinstan e, itiswasestimated[25℄ to
belessthan3%onthewidelyused SiemensC167CRmi ro ontroller.
An ee tive solution to Problem 2 was developed in [23℄. The authors use a logarithmi s ale to map
deadlines. One anexa tly reuse thiste hniquefor priorities of NP-ATD poli ies. The timeline isdivided in
so- alledblo kswhosesizeareexponentiallyin reasing(seegure5inAppendixA ). Allblo ksaresubdivided
falls. Thiss hemeallowstomapasetofframeshavingalargerangeofprioritiestoalimitednumberofpriority
bits. In [23℄, it is formally proven that this te hnique greatly improvesthe s hedulability of the system by
limiting quantizationerrors. Detailsof priorityen oding usinglogarithmi s ale applied to NP-ATD poli ies
aregiveninAppendixA. Thankstothete hniquesused,quantizationerrorsisredu edbutthey annotbefully
avoidedandthushavetobetakenintoa ount. Inthefollowing,as hedulabilityanalysisofNP-ATDpoli ies
that in ludes quantizationerrors is proposed. It is worth pointingout that, theimplementation of NP-ATD
poli ies anbeadaptedtoToken-RingandCSMA-CDnetworksasmadein[25℄forNP-EDF.
5 S hedulability analysis of NP-ATD poli ies
S hedulability an be analysed under NP-EDF using feasibility tests [34℄ and omputation of bounds on the
Worst Case Response Times(WCRT)[37, 38℄. Theaim ofthis se tion is topresentas hedulabilityanalysis
throughWCRTboundswitharbitrarydeadlinesandtakingintoa ountthequantizationerrors. Thisextends
theanalysismadein [23,24,25℄ whereonlythe asewhere deadlinesarelowerthanperiodsishandled. First,
paragraph5.1summarizesexistingresultsonWCRTandappliesthemtoNP-ATDpoli ies. Then,paragraph5.2
introdu estheoverheadbroughtbyquantizationerrors.
5.1 WCRT under NP-EDF: a re ap
The response time
r
k
(
a)
of aframe is the time elapsed betweenits arrivala and its ompletion. The set of tra streams is feasible under a given s hedulingpoli y if the response time of ea h frame is lowerthan orequal to the relative deadline. In general, it is not possible to omputethe response times of all frames for
all foreseeabletraje toriesof thesystem; asolutionfor assessingfeasibilityisto omputebounds onresponse
times. Su h an analysis wasderivedfor preemptiveEDF in [33℄, later for NP-EDF in [37, 38℄. In [37℄, it is
shown that the worst aseresponse time of a frame of atra stream o urs after a ertain arrivalpattern
termed the As SoonAs Possible pattern (ASAP for short). Theauthors use the on eptof deadline busy
period fora frame
f
k,n
, whi his aperiod ofnetwork utilization withoutidle-time during whi h onlyframes withdeadlinenotgreaterthanf
k,n
areexe uted.Lemma1 [37 ℄ Aboundontheresponsetimeofaframe,belongingtotra stream
f
k
,releasedaunitsoftime after the beginning of its deadline busy period an be found in the deadline busy period indu ed by the ASAPpattern. TheASAPpattern isthe situationwhere:
f
k
releasesaframeattimea (otherframes mayhavebeenreleasedbeforetimea), allframes, whi h relative deadline
D
i
issmallerthanorequal toa+ D
k
,arereleasedfromtimet
= 0
on attheirmaximum rate, the largest frame of all tra streamswith relative deadline greater than a
+ D
k
, if any, is released at timet
= −1
. This onstitutesthe so- alledblo king fa torduetonon-preemptiveness.Thislemmaallowsto omputeaboundontheresponsetime
r
k
(
a)
ofatra streamf
k
releasedattimea, denotedf
k
(
a)
in thefollowing. Itwasproven[37℄that theexe utionoff
k
(
a)
starts,at thelatest,atthetimet
solutionofthefollowingequationwhi h anbesolvedbyre urren e:t
= W
k
(
a, t) + B
k
(
a) +
aT
k
· C
k
. (2)in whi h
t
is the lengthL
k
(
a)
of the deadline busy period, and whereW
k
(
a, t)
is an upper bound for the "higher priorityworkload"(i.e. work indu edbyframesoflowerorequaldeadlines)in anintervalof lengtht
(
(x)
+
def
= min(x, 0)
):W
k
(
a, t) =
X
i6=k
min
t
T
i
+ 1,
a+ D
k
− D
i
T
i
+ 1
+
|
{z
}
maximumnumberofinstan esin interval
t
withadeadlinelowerthanorequalto a+ D
k
.C
i
(3)with
B
k
(
a)
theblo kingfa tor(i.e. thelongestframehavingagreaterdeadlinethanframef
k
(
a)
):B
k
(
a) = max
i=1..m
{C
i
| D
i
>
a
+ D
k
} − 1
(4)and wheretheworkoftheotherframesoftra stream
f
k
is:a
T
k
· C
k
(5)Thus,aboundontheresponsetimeofaframe
f
k
(
a)
is:r
k
(
a) =
max{C
k
, L
k
(
a) + C
k
−
a}
. (6)Theresponsetimeboundfor
f
k
ismax
ar
k
(
a
)
. Itwouldbeverytime onsumingto omputer
k
(
a)
forallvalues of abutitisprovenin [33,37℄thattheonlysigni ant valuesof aaretheelementsofthefollowingsetA
k
:A
k
= {t = n · T
i
+ D
i
− D
k
| t ≥ 0
,t
≤ L − C
k
,n
∈ N
,i
= 1...m}
(7)where
L
isthelongestbusyperiod(longestdurationoftheresour ewithoutidletime,see[33℄for omputation details). Thesigni ant valuesarethe valueswhi himply hanges in the higherpriority workload omputedwith equation3. Thenextse tionshowshowthisanalysis anbeadapted whenpriorityinversions mayo ur
due tothelimitednumberofbitsavailableforen odingthedeadlines.
5.2 WCRT under NP-EDF with quantization error
When the logarithmi s ale is used, frames whi h have distin t deadlines an belong to the same slot. The
initialpriorityorderinggivenbydeadlinesisthenlostandpriorityinversionsmaytakepla e. Intheworst- ase,
when omputingtheWCRTboundofaframe
f
k
(
a)
,allframeshavingadeadlineinthesameslotareassumed to be of higherprioritythanf
k
(
a)
. Pre isely, the higher priorityworkloadis nowmade of allframes having a deadline loweror equalthanA
k,n
+ D
k
+ S
k
(
a, t)
, whereS
k
(
a, t)
is abound on thesize of the slot where a+ D
k
− t
start
falls. ThusthehigherpriorityworkloadW
k
(
a, t)
be omes:W
k
(
a, t) =
X
i6=k
min
t
T
i
+ 1,
a+ D
k
+ S
k
(
a, t) − D
i
T
i
+ 1
+
· C
i
(8)Ajusti ationoftheaboveformulaisgiveninAppendixB. Adi ultyisthatthelengthofslot
S
k
(
a, t)
isnot onstantovertime: itdependsonthevalueofthedeadlinethatistobeen oded(i.e. a+ D
k
),andonthetime originof thelogarithmi s ale(t
start
), whi h is updatedat ea hnewtransmissionbeginning. As explainedin Appendix B,thesize ofS
k
(
a, t)
in reases monotoni allywitha+ D
k
− t
start
. To deriveanupperbound onS
k
(
a, t)
, onehastondalowerboundonthevalueoft
start
atwhi hf
k
(
a)
maygainthe hannel. Sin ef
k
(
a)
arrivesin a, an obvious lowerbound is a but one an improvethat resulta ording to the s heme proposedWhi hatoanalyze Asshownin[33,37℄,theonlysigni antvaluesof
a
thatarereallyneededtobeanalyzed arevalueswhi himply hangesinthehigherpriorityworkload omputedbyequation8. Pre isely,thesevaluesareintegralvaluesoftheform
n
· T
i
+ D
i
− D
k
− S
k
(
a, t)
; aproblemisthat thelengthoftheslotS
k
(
a, t)
isa prioriunknownsin eitdependsalsoona. Thelogarithmi en odings hemepresentedinAppendix Aensuresthat,atanytime,thelengthofaslottakesitsvaluein
[U, 2
k
max
U
]
,where
U
isthelengthofthersttimeslot. A solutionto apture a hange in the higherpriority workload is thus to onsider all possible values for theslot's length;theset of atoanalysebe omes:
A
k
= {t = n · T
i
+ D
i
− D
k
− x | t ≥ 0
,t
≤ L − C
k
,n
∈ N
,x
∈ N
,x
= U...2
k
max
U
,
i
= 1...m}.
(9) Thenextse tionshowshowthisanalysis anbeeasilyadaptedtoArrivalTimeDependentpoli ies.5.3 WCRT for NP-ATD poli ies with quantization error
Aframe
f
k,n
underNP-EDFpossessesaninitialpriorityve tor−
→
P
k,n,
equalto(A
k,n
+D
k
, k, n)
;NP-EDFisthus aparti ular aseofNP-ATDpoli y wherep
k
: k 7→ D
k
(see denition ofNP-ATD poli iesin paragraph3.2). Inthefollowing,itwill beshownthat Lemma1aswellastheset ofarrivaldates to onsider aftertheASAPpattern (see equation 7) remain valid withthe onditionthat
D
k
is repla ed byp
k
. Deadlinebusy periods be omes priority busy periods for a framef
k,n
whi h are intervals of network utilization without idle-time during whi h onlyinstan eswithhigherprioritythanf
k,n
areexe uted.Lemma2 A bound on the response time of a frame, belonging to tra stream
f
k
, released a units of time after the beginning of its priority busy period an be found in the priority busy period indu ed by the ASAPpattern. TheASAPpattern isthe situationwhere:
f
k
releasesaframeattimea (otherframes mayhavebeenreleasedbeforetimea), all frames, for whi h
p
i
is smaller than or equal to a+ p
k
, are released from timet
= 0
on at their maximumrate, thelargestframeof alltra streamswith
p
i
greaterthana+ p
k
,ifany,isreleasedattimet
= −1
. This onstitutesthe so- alledblo king fa tor duetonon-preemptiveness.Sket hOfProof:
ConsidervirtualNP-EDF, amodied version of NP-EDFthat woulds hedule framesnot by taking intoa ount their
deadline
A
k,n
+ D
k
butanarbitraryvirtualdeadlineA
k,n
+ p
k
. Thepriorityfun tionofthisvirtualNP-EDFwouldbe:Γ
virtual N P−EDF
k,n
(t) =
(
−
→
P
k,n
= (A
k,n
+ p
k
, k, n)
ift < B
k,n
−
→
Q
k,n
= (−∞, k, n)
ift
≥ B
k,n
,where
p
k
,asD
k
,possessesthepropertythatitsvalueisequalforallframesoftra streamf
k
. Indeed,thispropertyonp
k
isneededforlemma 4.1 in[33 ℄to hold(pre isely,whenbuildingthe ASAPpattern,shiftingleftaframemust in reasethehigherpriorityworkload).
A ordingtolemma1 ,aresponsetimeboundfor
f
k
undervirtual-NP-EDFo ursaftertheASAPpattern,asdenedby Spuri[33 ℄,whereD
k
isrepla edbyp
k
intheequations3and7. Toassessthefeasibility,theresponsetimeboundsjusthave tobe omparedwiththea tualrelativedeadlinesD
k
.Thewayto omputetheworst aseresponsetimes underaNP-ATD poli y isthesameasunder NP-EDF
6 Experiments
In this following, the performan es of NP-ATD s hedulingpoli ies are assessed in the ontext of Networked
ControlSystems,whi h isanimportantappli ationeldof ourproposal.
6.1 Sear h spa e
The aim is to nd s heduling poli ies that perform well in terms of feasibility, for optimizing the use of the
networkbandwidth,but that arealsoe ientwithrespe tto the riteriaimportantforNCS (denedin6.2.1
and6.3.2). Inthefollowing,simulationsaredonewithinasub- lassofNP-ATDpoli ieshavingapriorityve tor
−
→
P
k,n
expressedas:−
→
P
k,n
= (A
k,n
+ c · C
k
+ d · D
k
, k, n)
withc
∈ [0, 50]
andd
∈ [0, 1]
, (10) whi h means that, in denition 4, onehasp
k
: k → c · C
k
+ d · D
k
. Thus, apoli y belonging to our sear h spa eisdenedbyapriorityfun tionhavingtheformofequation10. Simulationshaveshownthatparametersc
∈ [0, 50]
andd
∈ [0, 1]
deneasear hspa ewhere, mostgenerally,thepoli iesofinterestaretobefound. This sub- lassof NP-ATD poli ies was hosen be ause itis expe tedto ontain poli ies providinga goodtrade-o betweenfeasibility and the satisfa tionof the other riteria importantfor NCS (see 6.2.1). Indeed,
NP-EDF a tually belongs to this lass (
p
k
= D
k
)and poli ies whose priority fun tion is lose to NP-EDF are expe ted to perform similarly in terms of s hedulability. On the other hand, introdu ing a term thatdepends onthe transmissiontimeshould help to improvetheother riteria. Inparti ular, it hasbeenshown
that preemptive Shortest Remaining Pro essing Time First (SRPTF) is optimal for average response times
(see[39,40℄quotedin[41℄)and,inoursimulations,Non-PreemptiveShortestMaximumPro essingTimeFirst
(NP-SMPTF), whi h is thenon-preemptiveversionofSRPTF dened with
−
→
P
k,n
= (C
k
, k, n)
, outperformed NP-EDF forall onsidered riteriabesidesfeasibility.Inthefollowing,theperforman esofNP-ATD poli ies areevaluated againstNP-SMPTFand NP-EDF.In
addition, Non-PreemptiveDeadline Monotoni (NP-DM) is also onsidered be ause it is known for its good
performan esintermsofs hedulability 1
anditseaseof implementation.
6.2 Performan e wrt s heduling
6.2.1 Performan e riteria
Classi ally, a ontrol loop is omprised ofthe sampling (i.e. dataare read from sensors), the omputation of
the ontrol,and thea tuation(i.e. transmissionof the ontroloutputsto thea tuators). Spe i delayshave
beenidentied to impa tthestabilityand, moregenerally,the performan es ofthesystem (see,for instan e,
studiesin [42,1,3℄). Thesedelaysin lude:
the input-outputlaten y: thetimeelapsedbetweenthesamplingandthea tuation,
the samplinginterval: thetimeintervalbetweentwo onse utivesamplingpoints,
the samplinglaten y: thetimeelapsedbetweenthetheoreti alsamplingtimeanditsa tualo urren e.
InNCS,wherethe ontrolloopisdistributedoveranetwork,datatransferedfromthesensorstothe ontroller,
and from the ontroller to the a tuators are ex hanged over a network. The ommuni ations from sensors
to ontroller (response time denoted by
t
sc
) and from ontroller to a tuators (response time denoted byt
ca
) indu enon- onstantdelaysintheinput-outputlaten y(equaltot
sc
+
omputationtime+t
ca
),anditsvariability is known to havea ru ial inuen e on the ontrol-loop performan es (see, for instan e, [1℄ and experiments1
Non-PreemptiveDeadline Monotoni is optimal wrt to feasibilityfor the non preemptives heduling with
D
k
≤
T
k
whenof paragraph6.3). An e ient ommuni ationsystemsshouldthus minimize ommuni ationdelaysandtheir
variabilities. Intheexperimentsthatfollow,theimpa tofNP-ATDpoli iesontheresponsetimesofthetra
streams(i.e.,delaybetweenthequeuingtimeandthetransmissionend)isstudied.
6.2.2 Simulation setup
One onsiders several tra streams ex hanged on a CAN network. As to our best knowledge there are no
analyti te hniquesforevaluatingthevaluesofour riteria,simulationisemployed. Agiven riterionisevaluated
forapoli y astheaveragevalueoveralltra streams.
The byte transmission time is the smallest time unit, whi h means that the propagation delay and the
bit-stungarenegle ted(sin ebit-stungdependsonthea tualdatatransmitted,itisoutofthes opeofthis
study). Thetransmissiontimeofaframe,denotedby
C
k
,israndomly hosenbetween8
and16
a ordingtoan uniformlaw. Theutilisationrate(C
k
T
k
)oftra stream
f
k
isuniformallydistributedinU
m
· 0.9
,U
m
· 1.1
whereU
isthenetworkloadandm
thetotalnumberoftra streams. TherelativedeadlinesD
k
areuniformally hosen in the intervalT
k
−
T
k
−C
2
k
, T
k
+
T
k
−C
2
k
. Simulation onsists in s heduling on rete sets of tra streams,
whi haregeneratedfromnon- on reteonesbyrandomly hoosingtheinitialosetforea htra stream
f
k
in theinterval[0, T
k
]
. Response timebound omputations andsimulationshavebeenimplementedin C++,and anappletversionofthesimulatorisfreelyavailable athttp://www.loria.fr/~grenier/logi iel/SimApplet.html.6.2.3 Inuen e ofparameters
In this paragraph it is assessed how the parameters
c
andd
inuen e feasibility and average response time jitters,asmeasuredbythestandarddeviationoftheresponsetimes. Fortheformer riterion,theperforman efor apoli y
A
is the per entageof tra streams that are feasible under NP-EDF and that remainsfeasible underA
.Figures 1(a) and 1(b) shows the performan es of the set of poli ies dened by equation 10 where
d
∈
{0.2, 0.5, 0.9}
andc
takesitsvaluein[0, 50]
withstepsequalto0.5
. Theperforman esarepresentedin terms of feasibility in gure 1(a) and average response time jitter in gure 1(b). The average valuesare omputedover1500simulationruns:
100
non- on retesetsof10
tra streamswith15
dierentosetswithaglobalload randomly hosenintheinterval[0.6, 0.7]
. Onlytasksetsthat arefeasibleunder NP-EDF weresele ted.50
55
60
65
70
75
80
85
90
95
100
0
10
20
30
40
50
% of feasible task sets
Parameter ’c’ in priority vector
d=0.2
d=0.5
d=0.9
(a)Feasibility0
2
4
6
8
10
12
14
16
0
10
20
30
40
50
% of improvement over NP-EDF
Parameter ’c’ in priority vector
d=0.2
d=0.5
d=0.9
(b)Averageresponsetimejitters
Figure1: Feasibilityandaverageresponsetimejittersforpoli iesdenedbyequation10with
d
∈ {0.2, 0.5, 0.9}
andc
rangingfrom0
to50
. Ea hpointistheaveragevalueover1500
simulationsoftasksetsof ardinality10
withanaverageloadof0.65
. thelarger thevalue of
c
in−
→
P
k,n
, thebetterthe averageresponse timejitters. The ounterpartis that feasibilitysigni antlydiminisheswhenc
in reases. thelargerthe valueof
d
in−
→
P
k,n
, the better thefeasibility withthe drawba kthat reponse time jitters in rease.Indeed,when
c
be omeslargeinequation10,c
·C
k
hasmoreinuen ethanA
k,n
andd·D
k
ontheframepriority. Thus, thepoli y tendstobehavein asimilar mannerasNon-PreemptiveShortestMaximumPro essingTimeFirst(seeparagraph6.1). Thesamereasonexplainsthatwhen
d
in reases,thepoli yperforms losetoNP-EDF forboth riteria. Itisworthnotingthatnosigni antdieren esamongpoli iesfortheaverageresponsetimesare observed. This fa t isdue tothe relativelysmall variationsoftransmissiontime
C
k
imposed bytheCAN proto ol.Forthesakeof omparison,table1presentstheperforman esofNP-SMPTFandNP-DMby omparisonto
NP-EDF withthesamesimulatedtasksets. Fromgure1andtable 1, oneseesthat NP-ATDpoli ies learly
Feasibility(%)
Avgresponsetimejitter
:
improvementoverNP-EDFNP-SMPTF
57.5
17.9
NP-DM
100
−4.5
Table1: Feasibilityandaverageresponsetimejitters(in
%
)forNP-SMPTFandNP-DM.outperformsNP-SMPTFintermsoffeasibility(when
c
lowerthan40
),andisbetterthanNP-DMandNP-EDF fortheresponsetimejitters. Forinstan e,thepoli ydened by−
→
P
k,n
= (A
k,n
+ 18 · C
k
+
10
2
D
k
, k, n
)leadsto feasibles hedulesforabout70
%ofthesetsoftra streamswhilea hievinganaverageimprovementof10.2
% over NP-EDF for the response time jitter. On the same simulation setup, NP-SMPTF is feasible for57.5
% of thetra stream sets whileimprovingjittersof17.9
%. On theotherhand,NP-DM leadsto100
%feasible s hedulesbutisworstthanNP-EDF regardingthejitters.In pra ti e, most NCS will have better performan es (i.e., lower response time jitter in the simulations)
withawell- hosenNP-ATDpoli yensuringfeasibilitythanunderNP-EDForNP-DM.Furthermore,feasibility
withNP-ATD poli yismu hbetterthanunderNP-SMPTF.NP-ATD poli iesenabletheappli ationdesigner
to implement aMAClevelproto ol providing agood trade-o betweenfeasibility and appli ation-dependent
riteriasu hasjitterminimization.
6.3 Control performan e
In this part,aparti ularNCS is studied and theperforman esof thebest feasibleNP-ATD poli y foundare
ompared to the performan es of NP-EDF. The pro ess is a DC servo with a transfer fun tion dened as
G(s) =
1000
s
2
+s
. The system, see gure 2, onsists of a ontrol-loop where the sensor, the ontroller and the a tuator nodesaredistributedoveraCAN network at125
kbit/s. Thereisalsoaninterfering nodegenerating networktra thatmodelstheotherreal-timetra streamsex hangedonthebus. ThissystemissimulatedwiththetoolboxTrueTimeunderMatlab/Simulink,andisdes ribedinmoredetailin[43℄. Forthis study,the
NP-ATDMAClayerproto oldes ribedinse tion4.1hasbeenimplementedinTrueTime.
6.3.1 Ar hite ture overview
Figure2: Thear hite tureoftheNCS onsistsofa ontrol-loopwherethesensor,the ontrollerandthea tuator
nodesaredistributed overaCANnetworkat
125
kbit/s. An interferingnodegeneratesdisturbingtra . asensornode(onetask-periodi )wherethesensortasksamplesthepro esswithaperiodof
0.01
s. Then, thetask sendsthe resulty(k)
to the ontrolleroverthe network (C
= 80
bits). The delay between the samplingtimeandthequeuingtimeissetto9 · 10
−4
s.
a ontroller node (one task -eventdriven)where the ontroller task, ea h time it re eivesaframe from
thesensor, omputesthe ontrol outputsignal
u(k)
andsendsittothea tuator. Thedelaybetweenthe re eption of the frame and the queuing of the ontrol signal frame (C
= 80
bits) is set to5 · 10
−4
s. A
PD- ontrollerisused, andimplementeda ordingto thefollowingequations:
u(k) = P (k) + D(k),
P
(k) = 1.5 · (r(k) − y(k)),
D(k) = 3.5 · 10
−5
· D(k − 1) + 5.25 · (y(k − 1) − y(k)),
where
r(k)
,thereferen e,isaunit step(see[43℄ and[44℄formoredetails). an a tuator node (one task - event-driven) ontrols the a tuator a ordingto the data re eived in the
ontroller'sframe. Thedelaybetweenthere eptionoftheframeandthea tuationis
5 · 10
−4
s.
theinterferingnode(onetask-time-driven)generatesthedisturbingtra . Thesetofitstra streams
israndomlygeneratedasfollows: foragivenload
U
,arandomtra streamisiterativelyaddeduntilthe loadofthenodebe omeshigherthanU
. Theperiod ofea htra streamisset atrandoma ordingto theuniformlawin theset{0.01, 0.02, 0.05, 0.1, 0.5}
,andthenumberofdatabytes takesarandomvalue intheinterval[1, 8]
.6.3.2 Performan e riteria
Theunitstepresponseofthesystem(inoursimulation,if
t <
0
,r(t) = 0
elser(t) = 1
)isusedwiththeovershootO
,thesettlingtimeT
settling
andtheIAE
(IntegraloftheAbsolutemagnitudeError)astheperforman emetri s. Inthisstudy,IAE
=
R
T
sim
0
|e(t)| dt
,whereT
sim
= 0.5
sisthedurationofthesimulation,andthesettlingtime6.3.3 Simulation results
Figure 3shows aninstan e oftheunit step response ofthesystem(at aload
U
= 0.5
)with thebest feasible NP-ATDpoli yofthesear hspa eandwithNP-EDF.Asone ansee,theovershootisredu edfrom1.155
to1.085
,whileT
settling
dropsfrom46 · 10
−3
to
119 · 10
−3
withthebestfeasibleNP-ATDpoli y.
0.8
0.85
0.9
0.95
1
1.05
1.1
1.15
1.2
0
0.1
0.2
0.3
0.4
0.5
time (s)
unit step reference
NP-EDF
NP-ATDP best
Figure 3: Unit step response of the NCS with NP-EDF and the best feasible NP-ATD poli y found by an
exhaustivesear h(
c
= 35
andd
= 0.4
). Theloadisequalto0.5
.Figure4presentstheaverageperforman esimprovement(over
100
runsforea hpoint)ofthebestfeasible NP-ATDpoli yfoundoverNP-EDFforthethreeperforman emetri sofinterest. Itprovides lear- uteviden esof theimprovementbroughtbyNP-ATD overNP-EDF fortheNCS under study. Indeed,theimprovementis
signi antwhatevertheloadandin reaseswithit. Forinstan e, ataloadequalto
0.6
, theimprovementover NP-EDF is35.5
%forthesettlingtime,30.1
%fortheovershootand14.3
%fortheIAE
.7 Con lusion and future work
Thispaperintrodu esthe lassofNon-PreemptiveArrivalTimeDependent(NP-ATD)poli iesintendedforthe
s hedulingofframesattheMAClevel. Thesepoli iesareeasilyimplementableonCOTS omponents(e.g.,CAN
ontrollers)andprovideagoodtrade-obetweenfeasibilityandthesatisfa tionofotherappli ation-dependent
riteriasu hastheresponsetimejitter. AnNP-ATDpoli y anbebuilt fortheperforman erequirementsof
aparti ularappli ationorbe hosentoprovidegoodaverageperforman esonrandomsetsoftra streams.
InordertoassessthefeasibilityofsystemsusingNP-ATDpoli ies,as hedulabilityanalysisthat isgeneri
for all poli ies of the lass was proposed. In the ontext of Networked Controlled Systems where delaysand
jittersimpa ttheperforman esofthe ontrolloop,simulationshaveshownthatwell hosenpoli ies anbring
signi antimprovementsoverplainNP-EDF orNP-DM.
In a future work, a more a urate evaluation of the impa t of the s heduling poli ies on the ontrolled
5
10
15
20
25
30
35
40
45
50
0.3
0.4
0.5
0.6
0.7
0.8
0.9
% of improvement over NP-EDF
Load
Setlling time
Overshoot
IAE
Figure 4: Average improvement of overshoot, settling time and
IAE
over NP-EDF with the best feasible NP-ATDpoli yfoundbyanexhaustivesear h.sear h te hniques for exploring the poli y sear h spa e; preliminary experiments have shown that a simple
neighbourhood te hnique su h a hill- limbing with a Tabu list is more e ient than the exhaustive sear h.
Finally, this work ould be extendedto other lassof poli iessu h astime-sharingpoli y (e.g. Round-Robin
[45℄, Pfair[46℄);themainproblemwillbehereto omeupwithas hedulabilityanalysisvalidforallpoli iesof
the lass.
Referen es
[1℄ B.Wittenmark,J.Nilsson,andM.Törngren,Timing problemsinreal-time ontrolsystems, in Pro . of
the Ameri anControl Conferen e,vol.3,pp.20002004,1995.
[2℄ M. Törngren,Fundamentals ofimplementingreal-time ontrol appli ations in distributed omputer
sys-tems, Real-TimeSystems,vol.14,no.3,pp.219250,1998.
[3℄ K.-E. Årzén, A. Cervin, J. Eker, and L. Sha, An introdu tion to ontrol and s heduling o-design, in
Pro . ofthe 39thIEEE Conferen eonDe isionandControl, (Sydney,Australia),2000.
[4℄ R.Bos h,CANSpe i ationVersion2.0, 1991.
[5℄ ISO,ISO InternationalStandard11898-Roadvehi les -Inter hangeofDigitalInformation -Controller
AreaNetwork(CAN)forHigh-SpeedCommuni ations, 1993.
[6℄ ISO,ISOInternationalStandard11519-3-Roadvehi les-Low-speedserialdata ommuni ation-Vehi le
AreaNetwork(VAN), 1994.
[7℄ SAE,SAEJ1850Class Bdata ommuni ationnetworkinterfa e, 1992.
[8℄ A. Cervin andJ. Eker,Control-s heduling odesign of real-timesystems: The ontrolserverapproa h,
Journalof EmbeddedComputing,vol.1,no.2,2004.
[9℄ L.AbeniandG.Buttazzo,Integratingmultimediaappli ationsinhardreal-timesystems, inPro . ofthe
[10℄ G.Buttazzo, G.Lipari,and L.Abeni, Elasti taskmodel foradaptiverate ontrol, in Pro . ofthe 19th
IEEE Real-time SystemsSymposium(RTSS1998), pp.286295,1998.
[11℄ M.Ca amo,G.Buttazzo,andL.Sha,Elasti feedba k ontrol,inPro .ofthe12thEuromi roConferen e
on Real-TimeSystems (Euromi ro-RTS2000), pp.121128,2000.
[12℄ A.Crespo,I.Ripoll,andP.Albertos,Redu ingdelaysinRT ontrol:the ontrola tioninterval,inPro .
of the14th IFACWorld Congress,1999.
[13℄ A. Cervin,IntegratedControl and Real-Time S heduling. PhDthesis, Departmentof Automati Control,
LundInstituteof Te hnology,2003.
[14℄ S.Baruah,G.Buttazzo,S.Gorinsky,andG.Lipari,S hedulingperiodi tasksystemstominimizeoutput
jitter, in Pro . of the 6th International Conferen e on Real-Time Computing Systems and Appli ations
(RTCSA1998), (HongKong,China),pp.6269,1998.
[15℄ L.David, F.Cottet, and N. Nissanke, Jitter ontrol in on-line s hedulingofdependentreal-time tasks,
in Pro . of the22nd IEEEReal-timeSystems Symposium(RTSS2001), pp.4958,2001.
[16℄ J.GoossensandP.Ri hard,Performan eoptimizationforhardreal-timexedprioritytasks, inPro . of
the 12thInternational Conferen eon Real-TimeSystems (RTS2004), pp.241258,2004.
[17℄ N. Navetand J.Migge,Finetuning thes hedulingof tasksthroughageneti algorithm: Appli ationto
Posix1003.1b ompliantOS, IEEPro eedings Software, vol.150,no.1,pp.1324,2003.
[18℄ K. Altisen, G. Goessler, A. Pnueli, J. Sifakis, S. Tripakis, and S. Yovine, A framework for s heduler
synthesis, inPro . ofthe 20thIEEE Real-Time SystemsSymphosium(RTSS1999),pp.154163,1999.
[19℄ E.GrolleauandA. Choquet-Geniet,S hedulingreal-timesystemsbymeansofpetrinets, inPro . ofthe
IFAC25thWorkshop on Real-TimeProgramming(WRTP'00),(PalmadeMallor a),pp.95100,2000.
[20℄ M. Grenier and N. Navet, New on-line preemptive s heduling poli ies for improving real-time
be-havior, in Pro . of the 10th IEEE International Conferen e on Emerging Te hnologies and F
a -tory Automation (ETFA 2005), vol. 2, (Catania, Italy), pp. 315322, sep 2005. Available at
http://www.loria.fr/~nnavet/publi/etfa2005_mgnn.pdf.
[21℄ T.Nolte,M.Nolin,andH.Hansson,Real-timeserver-based ommuni ationforCAN,IEEETransa tions
on IndustrialInformati s,vol.1,no.3,pp.192201,2005.
[22℄ G.CenaandA.Valenzano,A hievinground-robina essin ontrollerareanetworks,IEEETransa tions
on IndustrialEle troni s,vol.49,no.6,pp.12021213,2002.
[23℄ A.Mes hi,M.D.Natale,andM.Spuri,EarliestDeadlinemessages hedulingwithlimitedpriority
inver-sion,inPro .ofthe4thInternationalWorkshoponParallelandDistributedReal-TimeSystems(WPDRTS
'96),pp.8794,1996.
[24℄ M. D. Natale, S heduling the CAN bus with Earliest Deadline te hniques, in Pro . of the 21st IEEE
Real-timeSystemsSymposium(RTSS2000), pp.259268,2000.
[25℄ M.D.NataleandA.Mes hi,S hedulingmessageswithEarliestDeadlinete hniques,Real-TimeSystems,
vol.20,no.3,pp.255285,2001.
[26℄ P. Pedreirasand L.Almeida, Flexibles hedulingon ontrollerareanetwork, inPro . of the 10th
[27℄ S.Cavalieri,Meetingreal-time onstraintsinCAN, IEEETransa tionson IndustrialInformati s,vol.1,
no.2,pp.124135,2005.
[28℄ CiA,CANappli ationlayerforindustrialappli ations: CAN intheOSIreferen emodel, 1996.
[29℄ CiA,CAL-Based ommuni ationproleforindustrialsystems-CANOpen. Version3,1996.
[30℄ T.Nolte,H.Hansson,andC.Norström,MinimizingCANresponse-timejitterbymessagemanipulation,
in Pro . of the 8th IEEE Real-Time and Embedded Te hnology andAppli ations Symposium(RTAS'02),
(SanJose,California,USA),pp.197206,IEEEComputerSo iety,September2002.
[31℄ F. Coutinho,J.Fonse a,J.Barreiros, andE. Costa,Usinggeneti algorithmsto redu e jitterin ontrol
variablestransmittedoverCAN, inPro .ofthe 7thInternationalCANConferen e(ICC2000),
(Amster-dam,TheNetherlands),o t2000.
[32℄ J.Barreiros,E.Costa,J.Fonse a,andF.Coutinho,Jitterredu tioninareal-timemessagetransmission
system using geneti algorithms, in Pro . of Congress on Evolutionary Computation (CEC'2000), (La
JollaMarriott,SanDiego, USA),2000.
[33℄ M.Spuri,Analysisofdeadlines hedulinginreal-timesystems, Te h.Rep.RR-2772,INRIA,1996.
Avail-ableathttp://www.inria.fr/rrrt/rr-2772.html.
[34℄ K. Jeay, D. Stanat, and C. Martel, On non-preemptive s heduling of periodi and sporadi tasks, in
Pro . ofthe 12thIEEE Real-time SystemsSymposium(RTSS1991), pp.129139,1991.
[35℄ J. Migge,S heduling under Real-TimeConstraints: a Traje tory Based Model. PhDthesis, Universityof
Ni eSophia-Antipolis,1999.
[36℄ K. Zuberi and K. Shin, Non-preemptive s heduling of messages on Controller Area Network for
real-time ontrolappli ations, in Pro . ofthe Real-TimeTe hnology andAppli ations Symposium(RTAS'95),
pp.240249,1995.
[37℄ L.George,N.Rivierre,andM.Spuri,Preemptiveandnon-preemptivereal-timeunipro essors heduling,
Te h.Rep.RR-2966,INRIA,1996. Availableathttp://www.inria.fr/rrrt/rr-2966.html.
[38℄ J.A.Stankovi ,M.Spuri,K.Ramamritham,andG.C.Buttazzo,DeadlineS hedulingforReal-TimeSystems
EDF andRelatedAlgorithms. KluwerA ademi PublishersISBN 0-7923-8269-2,1998.
[39℄ L. S hrage, A proof of the optimality of the shortest remaining time dis ipline, Operations Resear h,
vol.16,pp.687690,1968.
[40℄ D. Smith,Anewproofoftheoptimalityoftheshortestremainingtimedis ipline, Operations Resear h,
vol.26,no.1,pp.197199,1976.
[41℄ D.P.Bunde,SPTisoptimally ompetitiveforunipro essorow,InformationPro essingLetters,vol.90,
no.5,pp.233238,2004.
[42℄ K.AstromandB.Wittenmark,Computer-ControlledSystems.Prenti eHallISBN0-13-168600-3,thirded.,
1997.
[43℄ M. Ohlin, D. Henriksson, and A. Cervin, TrueTime 1.5 Referen e Manual. Department of Automati
Control,LundUniversity,Sweden,Jan2007.
[44℄ Åström,K.Johan,andT.Hägglund,Advan edPIDControl. Resear hTrianglePark,NorthCarolina: ISA
[45℄ J.Migge,A.Jean-Marie,andN.Navet,Timinganalysisof ompounds hedulingpoli ies: Appli ationto
Posix1003.1b,Journalof S heduling, vol.6,no.5,pp.457482,2003.
[46℄ J. Anderson and A. Srinivasan, Pfair s heduling: Beyond periodi task systems, in Pro . of the 7th
InternationalConferen eonReal-timeComputingSystemsandAppli ations,pp.297306,IEEEComputer
So ietyPress,de 2000.
A Logarithmi s ale to map priority
This appendix presents the logarithmi s ale, introdu ed in [23℄ for the deadline ase, to map the priority
A
k,n
+ p
k
of a framef
k,n
to a limited numbern
of priority bits in order to redu e quantization errors by providingnerresolutionfor loserdeadline.0
2
1
p
min
2
h−1
p
min
2
h
p
min
slot blo k
2
h
p
min
2
h
S
t
start
p
min
2
h+1
p
min
t
qslotsFigure5: Logarithmi s alestartingat
t
start
,wherep
min
istheminimumrelativepriorityinthetra stream,h
istheindexoftheblo k omputedwithequation11andS
isthesizeofthersttimeslot(i.e.p
min
q
).Anexampleofalogarithmi s aleisshowningure5. Thetimeoriginofthelogarithmi s ale,denotedby
t
start
,isupdatedatea hnewtransmissionbeginning(t
start
def
=
maxk,n
(B
k,n
≤ t)
,wheret
is the urrenttime). Timeline, fromt
start
top
max
(p
max
def
=
maxτ
k
∈T
(p
k
)
)is divided in blo ksof in reasinglength. Ea h blo kis dividedintoq
slots whereq
isanintegerknownat thedesignstage(seeequation12). Thepriorityof aframe orrespondsto the index of the slot ontainingthe urrent deadlineA
k,n
+ p
k
− t
start
. Indexi
, from [23℄, is omputedasfollow:i
= h · q +
— A
k,n
+ p
k
− t
start
− 2
h
p
min
2
h
S
,
where
S
isthesize ofthersttimeslot (S
def
=
p
min
q
andp
min
def
=
minτ
k
∈T
(p
k
)
). Theindexoftheblo k, alledh
,wherethe urrentdeadlineA
k,n
+ p
k
− t
start
falls,from [23℄,is:h
=
(
j
log
2
A
k,n
+p
k
−t
start
p
min
k
ifA
k,n
+ p
k
− t
start
> p
min
0
otherwise.
(11)Thenumberofslots
q
inablo k(seeAppendix Aof[23℄for omputationdetails)isgivenby:q
=
$
2
n
⌊log
2
k
max
⌋ +
2
⌊log2kmax ⌋
k
max
%
,
(12) wherek
max
def
=
p
max
p
min
. Bydenition,thesizeoftheslotwhere
A
k,n
+ p
k
− t
start
falls isequalto2
h
S
.
Whenthe logarithmi s aleis used (or when a limitednumber ofbits are devoted for priority en oding),
frames whi h havedistin t deadlines anbelong to the sameslot and an inversion ofprioritymay o ur. In
su ha ase,these errorsare alledquantizationerrors.
B Higher priority workload
W
k
(
a, t
)
This appendix details omputation of higher priority workload
W
k
(
a, t)
when priority inversions due to the limitednumberofbits availableforen odingthedeadlineso ur.The higher priority workload
W
k
(
a, t)
is, by denition, the work indu ed by frames of tra streamf
i
, dierentthanf
k
,inadeadlinebusyperiodoflengtht
. Adeadlinebusyperiodisaperiodofnetworkutilization without idle-timeduring whi honly frameswithprioritygreaterthanf
k
(
a)
areexe uted. Inthefollowing,u
is thebeginning ofthe deadlinebusy period.A
i,j
0
= min{A
i,j
| j ∈ N, A
i,j
≥ u}
andA
i,j
1
= max{A
i,j
| j ∈
N, A
i,j
≤ u + t}
arerespe tivelytherstandthelastframeofthetra streamf
i
inthedeadlinebusyperiod. Thenumberofframesoff
i
intheinterval[u, u + t]
isn
= j
1
− j
0
+ 1
.Thegoalistobound,forea htra stream
f
i
,theworkindu edbyframesoff
i
in[u, u + t]
. Theworkof thelast frameoftra streamf
i
arrivedatA
i,j
1
istakeintoa ounti:1.
f
i,j
1
arrivesbefore theend oftheinterval[u, u + t]
:A
i,j
1
≤ u + t
.A
i,j1
≤ u + t
A
i,j
0
+ (n − 1) · T
i
≤ u + t
Thus:n
=
— t
T
i
+ 1 ≤
t
T
i
+ 1
be ausen
∈ N
andA
i,j
0
≥ u
2. Furthermore, thelast frame
f
i,j
1
must haveaprioritygreater thanf
k
(
a)
. Forthis purpose, we assume that allframeshavingadeadlinebelongingto thesameslotasA
k,n
+ D
k
− t
start
are ofhigherpriority thanf
k
(
a)
. Thus,frameshavingadeadlinelowerorequalthanA
k,n
+ D
k
+ S
k
(
a, t)
are onsideredtohave ahigherpriority(S
k
(
a, t)
isan upperbound of thesize ofthe slotto whi hA
k,n
+ D
k
− t
start
belongs, see[24℄for omputationdetails).A
i,j
1
+ D
i
− t
start
≤ u +
a+ D
k
+ S
k
(
a, t) − t
start
Thus:
n
=
—
a+ D
k
+ S
k
(
a, t) − D
i
T
i
+ 1 ≤
a+ D
k
+ S
k
(
a, t) − D
i
T
i
+ 1
be ausen
∈ N
Hen e, an upperbound of the number of frames
n
indu ed by atra streamf
i
in a deadline busy period of lengtht
is:min
j
t
T
i
k
+ 1,
j
a+D
k
+S
k
(
a,t)−D
i
T
i
k
+ 1
. A bound on thehigher priority workW
k
(
a, t)
, due to tra streamsdierentfromf
k
,isthus:W
k
(
a, t) =
X
i6=k
„
min
„— t
T
i
+ 1,
—
a+ D
k
+ S
k
(
a, t) − D
i
T
i
+ 1
««
+
· C
i
.LORIA, Technopôle de Nancy-Brabois - Campus scientifique
615, rue du Jardin Botanique - BP 101 - 54602 Villers-lès-Nancy Cedex (France)
Unité de recherche INRIA Futurs : Parc Club Orsay Université - ZAC des Vignes
4, rue Jacques Monod - 91893 ORSAY Cedex (France)
Unité de recherche INRIA Rennes : IRISA, Campus universitaire de Beaulieu - 35042 Rennes Cedex (France)
Unité de recherche INRIA Rhône-Alpes : 655, avenue de l’Europe - 38334 Montbonnot Saint-Ismier (France)
Unité de recherche INRIA Rocquencourt : Domaine de Voluceau - Rocquencourt - BP 105 - 78153 Le Chesnay Cedex (France)
Unité de recherche INRIA Sophia Antipolis : 2004, route des Lucioles - BP 93 - 06902 Sophia Antipolis Cedex (France)
Éditeur
INRIA - Domaine de Voluceau - Rocquencourt, BP 105 - 78153 Le Chesnay Cedex (France)
http://www.inria.fr