Beruflich Dokumente
Kultur Dokumente
org
MARTE Tutorial
An OMG UML profile to develop Real-Time and
Embedded systems
Sbastien Demathieu
(sebastien.demathieu@thalesgroup.com)
Thales Research & Technology
Acknowledgment
www.omgmarte.org
www.omgmarte.org
In 2005, OMG called for a new UML profile for Modeling and Analysis of
Real-Time and Embedded systems (MARTE)
3
Introducing MARTE
www.omgmarte.org
Key features
Tool
vendors
ARTiSAN Software Tools*
International Business Machines*
Mentor Graphics Corporation*
Softeam*
Telelogic AB (I-Logix*)
Tri-Pacific Software
No Magic
The Mathworks
Industrial companies
Alcatel*
France Telecom
Lockheed Martin*
Thales*
Academics
Carleton University
Commissariat lEnergie Atomique
ESEO
ENSIETA
INRIA
INSA from Lyon
Software Engineering Institute
(Carnegie Mellon University)
Universidad de Cantabria
www.omgmarte.org
profile
Marte
replace
profile
SPT
uses
metamodel
UML 2 Superstructure (L3)
OCL 2
The UML profile for Modeling QoS and FT Characteristics and Mechanisms
Addressed through MARTE NFP package
www.omgmarte.org
MarteFoundations
MarteDesignModel
MarteAnalysisModel
Specialization of Foundations
for annotating model for
analysis purpose: 3 pkgs
GQAM, SAM and PAM
2) Declaration of NFPs
3) Annotation Mechanism
modelLibrary
NFP_Types
VSL Definition
modelLibrary
BasicMeasurementUnits
execHost
execHost
MasterRTU
SlaveRTU
{ procRate=(1.0, @pRm),
clock= (2.0, us) }
modelLibrary
Basic_NFPTypes
{ procRate=@pRs,
clock= (2.0, us) }
Tagged Values
NFP_Constraint
import
import import
{kind=required }
Abstract Syntax
Concrete Syntax
profile
Hardware
profile
SAM
profile
PAM
Constraints
...
1.
2.
3.
Tagged values
Constraints
Direct specification in
UML models by using
NFP types library
Value Spec.
Examples
Real Number
1.2E-3
DateTime
#12/01/06 12:00:00#
Collection
Interval
io@var1
var1
Arithmetic Operation
Call
Conditional
Expression
(($var1<6.0)?(10^6):1)
//scientific notation
//calendar date time
10
profile
SchedulabilityAnalysisModeling
import
metaclass
UML::InstanceSpecification
stereotype
ExecutionHost
UserModelForSchedulabilityAnalysis
executionHost
uC: Controller
apply
executionHost
speedFactor= (expr = $MasterRate*0.25 )
contextSwitch= (value= 8 , unit= us, source= meas)
Controller
nfp speedFactor: NFP_Real (percent, increas)
nfp contextSwitch: NFP_ Duration (max)
uC2: Controller
speedFactor= ($MasterRate*0.25)
contextSwitch= ( 8, us, meas)
11
Time modeling
www.omgmarte.org
Basic ideas
Events TimedEvent
Behaviors and Actions TimedProcessing
Constraints TimedConstraint
Observations TimedObservation
12
Time Structure
Made of several clocks
Clock
A totally ordered set of instants
Access to instant value and duration with units
Relations on Clocks
Expression ClockConstraint
Reflect causality (from algorithm and allocations)
nature
discrete
dense
Logical
clock
Not used
isLogical
true
false
Stereotype properties :
Special semantics
+ optional
set of properties
set of operations
Chronometric clock
discrete
dense
13
:Pilot
:HMI
:Supervision
:Trajectory
: EngineControl
receiveCommand
<<timeInstantObservation>>
updateRoute
@start
compute
{on = idealClock}
A <<timedConstraint>> that
references time observations
to specify a duration
constraint
<<timedConstraint>>
(stop start) < (100, ms)
{interpretation = duration}
{kind = required}
{on = idealClock}
control
<<timeInstantObservation>>
@stop
{on = idealClock}
A UML::TimeObservation
stereotyped as
<<timeInstantObservation>>
that has a reference to a clock
14
ResourceCore
ResourceTypes
ResourceManagement
ResourceUsages
Scheduling
15
<<CommunicationMedia>>
{processingRate=1 .0}
<<ComputingResource>>
{processingRate=1.0 }
CAN_Bus
NT_Station
<<ComputingResource>>
{processingRate=0 .6}
Controller
VME_Bus
<<CommunicationMedia>>
{processingRate=8.5}
<<Storage>>
{elementSize=1024 x1024 x8,
maxRI=256}
<<Device>>
{processingRate=1 .0}
Robot Arm
16
www.omgmarte.org
17
18
Allocation modeling
www.omgmarte.org
Basic ideas
Allocate an application element to an execution platform element
Refine a general element into specific elements
Inspired by the SysML allocation
P1 P2
Can only allocate application to execution platform
Can attach NFP constraints to the allocation
inpC
outpW
outpZ
Example of allocation
timedProcessing
Act M1
allocate
P1
oper1
outW
oper2
outZ
10
oper2
10
true
true
oper1
Unique
Alloc
true
true
true
inpC
allocate
P2
19
www.omgmarte.org
MarteFoundations
MarteDesignModel
MarteAnalysisModel
Specialization of Foundations
for annotating model for
analysis purpose: 3 pkgs
GQAM, SAM and PAM
20
www.omgmarte.org
www.omgmarte.org
22
www.omgmarte.org
CruiseControlSystem
isMain = true
main = start
rtUnit
CruiseControler
rtUnit
ObstacleDetector
tgSpeed: Speed
startDetection()
stopDetection()
spm
1
ppUnit
{concPolicy=guarded}
Speedometer
getSpeed(): Speed
isDynamic = false
isMain = false
poolSize = 10
poolPolicy = create
spm
1
dataType
Speed
act start
@t0 {kind=startAction}
rtf
tgSpeed = spm->getSpeed()
occKind = aperiodic ()
value = (tRef=t0, relDl=(10, ms), miss=(1, %, max))
23
www.omgmarte.org
GRM
SRM
import
import
SW_ResourceCore
import
import
SW_Concurrency
SW_Interaction
SW_Brokering
24
<<SwSchedulableResource>>
Task
<<SwComputingResource>>
priorityElements =
priority
terminateServices =
terminateTask
chainTask
activateServices =
activateTask
chainTask
+activation : UINT32{readOnly}
+autostart : boolean{readOnly}
+priority : UINT32{readOnly}
+schedule : SCHEDULE{readOnly}
TaskService
+terminateTask() : statusType
+getTaskID( TaskID : taskRefType ) : statusType
+declareTask( TaskID : taskType )
+getTaskState( TaskID : taskType, State : taskStateRefType ) : statusType
+chainTask( TaskID : taskType ) : statusType
+activateTask( TaskID : taskType ) : statusType
+schedule() : statusType
<<SwSchedulableResource>>
yieldServices =
+resource
schedule
0..*
<<SwMutualExclusionResource>>
Ressource
(OSEK/VDX_Platform.Osek/VDXLibrary.Interaction.InteractionCore)
+event
0..*
<<SwSchedulableResource>>
BasicTask
<<SwSchedulableResource>>
ExtendedTask
<<NotificationResource>>
Event
(OSEK/VDX_Platform.Osek/VDXLibrary.Interaction.InteractionCore)
Extended tasks are distinguished from basic tasks by being allowed to use the
operating system call WaitEvent, which may result in a waiting state. The waiting state
allows the processor to be released and to be reassigned to a lower-priority task
without the need to terminate the running extended task.
ResumeAllInterrupts
ResumeOSInterrupts
25
www.omgmarte.org
Robot
Robot
+main()
<<RTF>>
Odometry
+UpdatePosition()
+robotPosition
Osek/VDXLibrary
(OSEK/VDX_Platform)
+motionCtrl
1
<<RTF>>
MotionControler
{period = 10}
+odometry
+ControlLoop()
Position
<<Task>>
OsekTask
-x : Integer
-Y : Integer
-position
-position
+getX() : Integer 1
1
+getY() : Integer
+setX( X : Integer )
+setY( Y : Integer )
entryPoint
<<Interrupt>>
OsekInterruptsCategory2
<<SharedResource>>
OsekRessource
entryPoint
<<import>>
OsekOsControl
<<Event>>
OsekEvent
<<Interrupt>>
OsekInterruptsCategory1
<<Alarm>>
OsekAlarm
OsekHook
OsekDataType
(OSEK/VDX_Platform.Osek/VDXLibrary)
RobotInstance
speedy : Robot
odometry = odo
robotPosition = Pos
motionCtrl = mCtrl
<<RTF>>
odo : Odometry
<<import>>
<<RTF>>
mCtrl : MotionControler
position = Pos
MyOsek/VDXImplementation
(OSEK/VDX_Platform)
position = Pos
Pos : Position
<<Task>>
MyOsekPeriodicTask
MyOsek/VDXImplementationInstance
(Robot)
<<Task>>
t1Periodic : MyOsekPeriodicTask
event = evt1
task = task1
alarm = al1
<<SharedResource>>
r1 : OsekRessource
<<Alarm>>
al1 : OsekAlarm
<<Event>>
evt1 : OsekEvent
main : OsekOsControl
<<Task>>
t2Periodic : MyOsekPeriodicTask
alarm = al2
event = evt2
task = task2
<<Alarm>>
al2 : OsekAlarm
<<Task>>
task1 : OsekTask
<<Event>>
evt2 : OsekEvent
<<Task>>
task2 : OsekTask
26
HwComputing resources
HwStorage resources
HwCommunication resources
HwTiming resources
HwDevice resources
Physical view
Provides a description of physical properties
Based on both following packages:
HwLayout
HwPower
27
hwLogical::hwResource
smp : SMP
hwProcessor
cpu1 : CPU
{frequency = 800Mhz}
hwCache
l2 : UL2
{memorySize = 512kB}
hwProcessor
cpu2 : CPU
hwProcessor
cpu3 : CPU
{frequency = 800Mhz}
hwCache
l2 : UL2
{memorySize = 512kB}
{frequency = 800Mhz}
hwCache
l2 : UL2
{memorySize = 512kB}
hwProcessor
cpu4 : CPU
{frequency = 800Mhz}
hwCache
l2 : UL2
{memorySize = 512kB}
hwBus
fsb : FSB
{frequency = 133Mhz,
wordWidth = 128bit}
hwSupport
battery : Battery
hwDMA
dma : DMA
{managedMemories = sdram}
hwRAM
sdram : SDRAM
{frequency = 266Mhz,
memorySize = 256MB}
28
hwCard
smp : SMP
grid = 4,3
area = 5000mm
r_conditions = (Temperature; Operating; ; [10C ,60C])
hwChip
cpu1 : CPU
hwCard
sdram : SDRAM
hwChip
cpu3 : CPU
hwChannel
fsb : FSB
position = [1,4], [2,2]
hwChip
cpu2 : CPU
hwChip
cpu4 : CPU
hwChip
dma : DMA
hwPowerSupply
battery : Battery
position = [4,4], [3,3]
capacity = 10Wh
weight = 150g
29
MarteFoundations
MarteDesignModel
MarteAnalysisModel
Specialization of Foundations
for annotating model for
analysis purpose: 3 pkgs
GQAM, SAM and PAM
30
www.omgmarte.org
Resources
Behavior
Workload
All embedded in an analysis context (may have analysis
parameters)
31
www.omgmarte.org
GenericResourceModel (GRM)
<<import>>
<<import>>
GenericQuantitativeAnalysisModeling (GQAM)
<<import>>
SchedulabilityAnalysisModeling (SAM)
SAM
PerformanceAnalysisModeling (PAM)
GQAM
<<import>>
PAM
www.omgmarte.org
UML2 + Marte
Analysis specific
framework
profile
MARTE
UML2 editor
Model
converter
Analysis model
Annotated model
Analysis tool
Result/Diagnostic
model
Results
converter
Analysis results
33
GQAM::
AnalysisContext
SAM_Workload
import
SAM_Resources
import
SAM_Observers
workloadBehavior
GQAM_Workload::
WorkloadBehavior
SaAnalysisContext
isSchedulable : NFP_Boolean
resourcesPlatform
GQAM_Resources::
ResourcesPlatform
34
ControlServos
{ type=Pattern,
periodic (period = ( 5, ms)) }
ControlTrigg
behaviorScenario
{ respTime= (@r1, ms),
utilization= @u 1,
execTime= (@ e1, ms) }
Control
requestEventStream
ReportProcess
Workload Behavior
maps to Behavior
requestEventStream
{ type=Pattern,
periodic (period = (100, @pR, ms)) }
ReportTrigg
behaviorScenario
{ respTime= (@r2, ms),
utilization= @u 2,
execTime= (@wcet1, max, ms) }
Report
BehaviorScenario
(response times,
hosts utilization)
requestEventStream
ExecuteCommand
end2endFlow
end2endFlow
Event Streams
(arrival patterns)
end2endFlow
EndToEndFlow
(end2end
deadlines and
predicted times)
workloadBehavior
Act NormalMode
{ type=Pattern,
periodic (period = (1, s)) }
ReportTrigg
behaviorScenario
{ respTime= ( @r3, ms),
utilization= @u3,
execTime= (@ e3, ms) }
Command
35
resourcesPlatform
TeleoperatedRobot_Platform
saExecHost
: Station
Processing Hosts
(exec. and comm.
overheads,
throughput,
scheduling
features)
schedulableResource
allocate
{ fp (priority= 22) }
: DisplayRefresherTask
Sched. Resources
(sched.
parameters)
schedulableResource
saCommHost
{ transMode = Half-Duplex
processingRate = (@prCAN)
blockingTime= (111, us, max, meas )
packetTime = (64, us, calc) }
allocate
allocate
{ fp (priority= 24) }
: MsjStatus
schedulableResource
{ fp (priority= 24) }
: MsjCommand
: CAN_Bus
schedulableResource
{ fp (priority= 30) }
: ServosControllerTask
allocate
saExecHost
{ processingRate = (1.0)
clockOverhead = (7, us , meas )
contextSwitchTime = (5, us , meas )
ISRswitchT= (2.5, us , meas )
schedPriorityRange = ([0..30], determ )
ISRPrioRange = ([31..31], determ ) }
schedulableResource
{ fp (priority= 24) }
allocate
: Reporter
schedulableResource
{ fp (priority= 16) }
allocate
: CommandManager
allocate
schedulableResource
: Controller
{ fp (priority= 31) }
: ControllerComm
: VME_Bus
saExecHost
: RobotArm
Schedulers
(sched.
parameters)
scheduler
{ schedPolicy = FixedPriority }
: RTOS_Scheduler
36
Context under
Analysis
saAnalysisContext
{ isSched = (@isSchSys) }
TeleoperatedRobotSAM
Instance of a
WorkloadBehavior
model
variable
variable
variable
variable
{direction=
{direction=
{direction=
{direction=
inout}
inout}
inout}
inout}
workloadBehavior
: NormalMode
resourcesPlatform
: TeleoperatedRobot_Platform
Simple
Schedulability
Analysis context
saAnalysisContext
Schedulability: TeleoperatedRobotSAM
isSched_System= (true, @v0, calc)
wcet_Report= ( 5, ms, determ)
procRate_CAN= (1, determ)
period _Report= (30 , ms, determ )
Context-specific
variables
Sensitivity
Analysis context
saAnalysisContext
SensitivityAnalysis : TeleoperatedRobotSAM
isSched_System= (true, req)
wcet_Report= ( 50, @v1, ms, max, calc)
procRate_CAN= (0.2, @v2, min, calc)
period _Report= (10 , @v3, ms, min, calc)
37
Behaviour
Resources
Reused: ExecHost, CommHost, CommChannel
Specialized: PaProcess
Example: deployment
www.omgmarte.org
commHost
commHost
internet:
lan:
{blockingTime = (100,us)}
execHost
ebHost:
{commRcvOverhead = (0.15,ms/KB),
commTxOverhead = (0.1,ms/KB),
maxRI = 5}
deploy
artifact
ebA
manifest
: EBrowser
{blockingTime = (10,us),
capacity = (100,Mb/s)}
execHost
execHost
webServerHost:
{commRcvOverhead = (0.1,ms/KB),
commTxOverhead = (0.2,ms/KB)}
deploy
artifact
webServerA
manifest
: WebServer
dbHost:
{commRcvOverhead = (0.14,ms/KB),
commTxOverhead = (0.07,ms/KB),
maxRI = 3}
deploy
artifact
databaseA
manifest
: Database
39
eb: EBrowser
paProcess
webServer: WebServer
paProcess
database: Database
{maxRI = (webthreads=80),
component = webserver}
{maxRI = (dbthreads=5),
component = database}
1:
paExecStep
paCommStep
paRequestEventStream
{PWorkloadKind = open,
openIntArrTime = exp(17,ms),
hostDemand = 4.5,ms,
msgSize = (1,KB)}
2:
paExecStep
paCommStep
{hostDemand = (12.4,ms),
repetitions = (1.3,-,mean),
msgSize = (2,KB)}
3:
4:
paCommStep
{msgSize = (50,KB)}
paCommStep
{msgSize = (75,KB)}
40
MARTE Annexes
www.omgmarte.org
MARTE Library
41
UML + MARTE
modelLibrary
NFP_Types
enumeration
DurationUnitKind
unit s
unit ms {baseUnit=s, convFactor=0.001}
unit us {baseUnit=ms, convFactor=0.001 }...
AADL
dataType
NFP_DataSize
dataType
NFP_Duration
unit: DataSizeUnitKind
unit: DurationUnitKind
mass_u;
import
profile
SchedulabilityAnalysisModeling
metaclass
UML::InstanceSpecification
metaclass
UML::Node
stereotype
ExecutionEngine
speedFactor: NFP_Real= (percent, increas)
tickerPeriod: NFP_Duration= ( max, ms)
priorityRange: NFP_Interval= (determ, decreas )
42
Conclusion
www.omgmarte.org
References
www.omgmarte.org
UML 2 Superstructure
http://www.omg.org/cgi-bin/doc?formal/07-02-05
44