model-based development of deterministic, portable real

65
Model-based development of deterministic, portable real-time software components Prof. Dr. Wolfgang Pree Univ. Salzburg

Upload: others

Post on 24-Feb-2022

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Model-based development of deterministic, portable real

Model-based development of deterministic, portable real-time software components

Prof. Dr. Wolfgang Pree Univ. Salzburg

Page 2: Model-based development of deterministic, portable real

© 2009, W. Pree 2 Modeling with TDL

Overview

  Timing Definition Language (TDL) in a nut shell   TDL execution   TDL extensions   Transparent distribution of TDL components   TDL development process   TDL tools   TDL advantages

Page 3: Model-based development of deterministic, portable real

© 2009, W. Pree 3 Modeling with TDL

TDL in a nut shell

Page 4: Model-based development of deterministic, portable real

© 2009, W. Pree 4 Modeling with TDL

What is TDL?

  A high-level textual notation for defining the timing behavior of a real-time application.

  TDL covers all aspects that are required to model safety-critical software as found, for example, in cars, airplanes, Unmanned Aerial Vehicles (UAVs), automation systems

  seamless integration of time-triggered (synchronous) and event-triggered (asynchronous) activities

  TDL’s specification is public; could form the basis of an open standard

Page 5: Model-based development of deterministic, portable real

© 2009, W. Pree 5 Modeling with TDL

TDL is conceptually based on Giotto

Giotto project: 2000 – 2003, University of California, Berkeley

TDL = Giotto concepts

+ Syntax

+ Component Architecture

+ Tool Chain

+ Extensions

Page 6: Model-based development of deterministic, portable real

© 2009, W. Pree 6 Modeling with TDL

TDL tools

  TDL:Compiler   TDL:VisualCreator   TDL:VisualDistributor   TDL:VisualAnalyzer

  requires Java 1.5 or later   optional integration with MATLAB/Simulink from

The MathWorks

  TDL:Machine (alias E-Machine)   platform-specific, typically in C

Page 7: Model-based development of deterministic, portable real

© 2009, W. Pree 7 Modeling with TDL

TDL tool chain

.tdl TDL:Compiler TDL:Machine* .ecode

functionality code

* Simulink, OSEK, dSpace, ARM, AES, INtime, RTLinux, ...

Page 8: Model-based development of deterministic, portable real

© 2009, W. Pree 8 Modeling with TDL

TDL tool chain

.tdl TDL:Compiler TDL:Machine* .ecode

functionality code

* Simulink, OSEK, dSpace, ARM, AES, INtime, RTLinux, ...

platform specific

AST

platform specific

Platform plugin*

Page 9: Model-based development of deterministic, portable real

© 2009, W. Pree 9 Modeling with TDL

TDL:VisualCreator

TDL tool chain

.tdl TDL:Compiler TDL:Machine .ecode

functionality code

platform specific

AST

platform specific

Platform plugin*

Page 10: Model-based development of deterministic, portable real

© 2009, W. Pree 10 Modeling with TDL

TDL:VisualDistributor

TDL:VisualCreator

TDL tool chain

.tdl TDL:Compiler TDL:Machine .ecode

functionality code

platform specific

AST

platform specific

Platform plugin*

Page 11: Model-based development of deterministic, portable real

© 2009, W. Pree 11 Modeling with TDL

TDL:VisualAnalyzer

TDL tool chain

TDL:Machine node1

TDL:Machine node2

TDL:Machine node3

Page 12: Model-based development of deterministic, portable real

© 2009, W. Pree 12 Modeling with TDL

TDL programming model: multi-rate, multi-mode systems (I)

Page 13: Model-based development of deterministic, portable real

© 2009, W. Pree 13 Modeling with TDL

TDL programming model: multi-rate, multi-mode systems (II)

LET-semantics

Page 14: Model-based development of deterministic, portable real

© 2009, W. Pree 14 Modeling with TDL

Logical Execution Time (LET) abstraction

ET <= WCET <= LET

results are internally available at ‘stop (ET)’

results are externally visible at ‘terminate’

spare time between ‘stop’ and ‘terminate’

time task invocation

Logical Execution Time (LET)

Logical

Physical

start stop (ET)

suspend resume

release terminate

stop (WCET)

Page 15: Model-based development of deterministic, portable real

© 2009, W. Pree 15 Modeling with TDL

LET advantages

  observable (logical) timing is identical on all platforms

  allows for simulation   allows for composition   allows for distribution

Page 16: Model-based development of deterministic, portable real

© 2009, W. Pree 16 Modeling with TDL

Periodic execution in TDL modes

  Every mode has a fixed period.   A task t has a frequency f within a mode.   The mode period is filled with f task invocations.   The LET of a task invocation is modePeriod / f.

time task t invocation 1 Logical

task t invocation 2

Mode Period Mode Start Mode End

Page 17: Model-based development of deterministic, portable real

© 2009, W. Pree 17 Modeling with TDL

TDL module: modes, sensors and actuators form a unit

Page 18: Model-based development of deterministic, portable real

© 2009, W. Pree 18 Modeling with TDL

Motivation for TDL modules

  e.g. modern cars have up to 80 electronic control units (ECUs = nodes)

  ECU consolidation is a topic   run multiple programs on one ECU   leads to TDL modules

ECU1 Program1

ECU2 Program2

ECU3 Program3

Page 19: Model-based development of deterministic, portable real

© 2009, W. Pree 19 Modeling with TDL

TDL modules

  ProgramX is called a module   modules may be independent   modules may also refer to each other   modules can be used for multiple purposes

ECU Program1 Program2 Program3

Page 20: Model-based development of deterministic, portable real

© 2009, W. Pree 20 Modeling with TDL

Example: Receiver imports from Sender module

module Sender module Receiver

Page 21: Model-based development of deterministic, portable real

© 2009, W. Pree 21 Modeling with TDL

module Sender module Receiver

Example: Receiver imports from Sender module

public

Page 22: Model-based development of deterministic, portable real

© 2009, W. Pree 22 Modeling with TDL

module Sender module Receiver

Example: Receiver imports from Sender module

public

private

Page 23: Model-based development of deterministic, portable real

© 2009, W. Pree 23 Modeling with TDL

TDL syntax by example module Sender {

sensor boolean s1 uses getS1; actuator int a1 uses setA1;

public task inc { output int o := 10; uses incImpl(o); }

start mode main [period=5ms] { task [freq=1] inc(); // LET = 5ms / 1 = 5ms actuator [freq=1] a1 := inc.o; // update every 5ms mode [freq=1] if exitMain(s1) then freeze; }

mode freeze [period=1000ms] {} }

s1 inc [5ms] a1 Sender (mode main)

Page 24: Model-based development of deterministic, portable real

© 2009, W. Pree 24 Modeling with TDL

Module import module Receiver {

import Sender; … task clientTask { input int i1; … } mode main [period=10ms] { task [freq=1] clientTask(Sender.inc.o); // LET = 10ms / 1 = 10ms … } }

s1 a1 Sender

clientTask [10ms] a1

Receiver inc [5ms]

20 ms

Page 25: Model-based development of deterministic, portable real

© 2009, W. Pree 25 Modeling with TDL

LET-behavior (independent of component deployment)

t Sender inc inc

Receiver clientTask

inc inc

10 ms

5 ms

communication of inc’s output to clientTask

clientTask

Page 26: Model-based development of deterministic, portable real

© 2009, W. Pree 26 Modeling with TDL

TDL execution

Page 27: Model-based development of deterministic, portable real

© 2009, W. Pree 27 Modeling with TDL

TDL run-time environment

  based on a virtual machine, called TDL:Machine   executes virtual instruction set, called E-code

(embedded code)   E-code is executed at logical time instants   synchronized logical time for all components   E-code generated by TDL compiler from TDL

source   covers one mode period   contains one E-code block per logical time instant

Page 28: Model-based development of deterministic, portable real

© 2009, W. Pree 28 Modeling with TDL

one TDL:Machine per node

TDL:Machine single node

Page 29: Model-based development of deterministic, portable real

© 2009, W. Pree 29 Modeling with TDL

one TDL:Machine per node

TDL:Machine node1

TDL:Machine node2

TDL:Machine node3

Page 30: Model-based development of deterministic, portable real

© 2009, W. Pree 30 Modeling with TDL

TDL extensions

Page 31: Model-based development of deterministic, portable real

© 2009, W. Pree 31 Modeling with TDL

TDL slot selection

  f = 6

time Logical

Mode Period Mode Start Mode End

slot 1 slot 2 slot 3 slot 4 slot 5 slot 6

Page 32: Model-based development of deterministic, portable real

© 2009, W. Pree 32 Modeling with TDL

  f = 6   task invocation 1 covers slots 1 – 2   task invocation 2 covers slots 4 – 5

time Logical

Mode Period Mode Start Mode End

task invoc. 1 task invoc. 2

slot 1 slot 2 slot 3 slot 4 slot 5 slot 6

TDL slot selection

Page 33: Model-based development of deterministic, portable real

© 2009, W. Pree 33 Modeling with TDL

TDL slot selection allows the specification of ...   an arbitrary repetition pattern   the LET more explicitly   gaps   task invocation sequences   optional task invocations

Page 34: Model-based development of deterministic, portable real

© 2009, W. Pree 34 Modeling with TDL

Physical layer / E-code blocks

time Logical

Mode Period Mode Start Mode End

task invoc. 1 task invoc. 2

slot 1 slot 2 slot 3 slot 4 slot 5 slot 6

  E-Code block follows fixed pattern: 1.  task terminations 2. actuator updates 3. mode switches 4.  task releases

E-code block

E-code block

E-code block

E-code block

Physical

Page 35: Model-based development of deterministic, portable real

© 2009, W. Pree 35 Modeling with TDL

E-code compression

  E-code blocks may be identical   compression feature would be welcome   new instruction:

REPEAT <targetPC>, <N>   jumps N times to targetPC, then to PC + 1.   uses a counter per module   counter is reset upon mode switch

Page 36: Model-based development of deterministic, portable real

© 2009, W. Pree 36 Modeling with TDL

Adding asynchronous activities

time Logical

Mode Period Mode Start Mode End

task invoc. 1 task invoc. 2

slot 1 slot 2 slot 3 slot 4 slot 5 slot 6

Priority levels   black: highest priority (E-code)

E-code block

E-code block

E-code block

E-code block

Physical

Page 37: Model-based development of deterministic, portable real

© 2009, W. Pree 37 Modeling with TDL

time Logical

Mode Period Mode Start Mode End

task invoc. 1 task invoc. 2

slot 1 slot 2 slot 3 slot 4 slot 5 slot 6

Priority levels   black: highest priority (E-code)   red: lower priority (synchronous tasks)

E-code block

E-code block

E-code block

E-code block

Physical

Adding asynchronous activities

Page 38: Model-based development of deterministic, portable real

© 2009, W. Pree 38 Modeling with TDL

time Logical

Mode Period Mode Start Mode End

task invoc. 1 task invoc. 2

slot 1 slot 2 slot 3 slot 4 slot 5 slot 6

Priority levels   black: highest priority (E-code)   red: lower priority (synchronous tasks)   blue: lowest priority (asynchronous activities)

E-code block

E-code block

E-code block

E-code block

Physical

Adding asynchronous activities

Page 39: Model-based development of deterministic, portable real

© 2009, W. Pree 39 Modeling with TDL

Asynchronous activities rationale

  event-driven background tasks   may be long running   not time critical   could be implemented at platform level, but:   platform-specific   unsynchronized data-flow to/from E-machine

  support added toTDL   Goal: avoid complex synchronization constructs

and the danger of deadlocks and priority inversions

Page 40: Model-based development of deterministic, portable real

© 2009, W. Pree 40 Modeling with TDL

Kinds of asynchronous activities

  task invocation   similar to synchronous task invocations except

for timing   input ports are read just before physical

execution   output ports are visible just after physical

execution   data flow is synchronized with E-machine

  actuator updates   similar to synchronous actuator updates except

for timing   data flow is synchronized with E-machine

Page 41: Model-based development of deterministic, portable real

© 2009, W. Pree 41 Modeling with TDL

Trigger Events

  hardware and software interrupts   periodic asynchronous timers   port updates

Use a registry for later execution of the async activities.

Parameter passing occurs at execution time.

Registry functions as a priority queue.

Page 42: Model-based development of deterministic, portable real

© 2009, W. Pree 42 Modeling with TDL

Transparent distribution

Page 43: Model-based development of deterministic, portable real

© 2009, W. Pree 43 Modeling with TDL

TDL module-to-node-assignment (example)

Sender ECU1

ECU2 Receiver

FlexRay bus

Page 44: Model-based development of deterministic, portable real

© 2009, W. Pree 44 Modeling with TDL

Transparent distribution of TDL components:

  Firstly, at runtime a set of TDL components behaves exactly the same, no matter if all components are executed on a single node or if they are distributed across multiple nodes. The logical timing is always preserved, only the physical timing, which is not observable from the outside, may be changed.

  Secondly, for the developer of a TDL component, it does not matter where the component itself and any imported component are executed.

Page 45: Model-based development of deterministic, portable real

© 2009, W. Pree 45 Modeling with TDL

sample physical execution times on ECU1/ECU2

t Sender inc inc

Receiver clientTask

inc inc

10 ms

5 ms

clientTask

ECU1

ECU2

Page 46: Model-based development of deterministic, portable real

© 2009, W. Pree 46 Modeling with TDL

Constraints for automatic schedule generation

Sender inc inc

Receiver clientTask

inc inc

10 ms

5 ms

clientTask

ECU1

ECU2

communication window

communication window

t

stop (WCET)

stop (WCET)

Page 47: Model-based development of deterministic, portable real

© 2009, W. Pree 47 Modeling with TDL

Bus schedule generation

Sender inc inc

Receiver clientTask

inc inc

10 ms

5 ms

clientTask

ECU1

ECU2

communication window

communication window

local buffer

local buffer

t

FlexRay bus

Page 48: Model-based development of deterministic, portable real

© 2009, W. Pree 48 Modeling with TDL

TDL:VisualDistributor maps TDL modules to nodes

Page 49: Model-based development of deterministic, portable real

© 2009, W. Pree 49 Modeling with TDL

TDL-based development process

Page 50: Model-based development of deterministic, portable real

© 2009, W. Pree 50 Modeling with TDL

preeTEC tools in the V model

requirements

functional model

application code test

verification + timing

TDL:VisualCreator in Matlab®/Simulink®

TDL:VisualDistributor generiert for platform 2

generated for platform 1

. . .

C

Page 51: Model-based development of deterministic, portable real

© 2009, W. Pree 51 Modeling with TDL

TDL tools: status quo

Page 52: Model-based development of deterministic, portable real

© 2009, W. Pree 52 Modeling with TDL

Status quo   ready

  TDL:VisualCreator (stand-alone or in Matlab®/Simulink®)   TDL:VisualDistributor (extensible via plugins; currently a plugin for

FlexRay is available as product, together with plug-ins for various cluster nodes such as the MicroAutoBox, and Renesas–AES) The TDL:VisualDistributor is available as stand-alone tool or in Matlab®/Simulink® and provides the following features:   Communication Schedule Generator   TDL:CommViewer   automatic generation of all node-, OS- and cluster-specific files

  TDL:Compiler   TDL:Machine for Simulink, mabx, AES, ARM, INtime, OSEK   seamless integration of asynchronous events with TDL   multiple slot selection (decoupling of LET and period; eg, for event

modeling)   harnessing existing FlexRay communication schedules (via FIBEX) for

their incremental extension   TDL:VisualAnalyzer (recording and debugging tool)

  work in progress   ‘intelligent’ FlexRay parameter configuration editor   TDL:Machine for further platforms (ARM, etc.)

Page 53: Model-based development of deterministic, portable real

© 2009, W. Pree 53 Modeling with TDL

TDL advantages

Page 54: Model-based development of deterministic, portable real

© 2009, W. Pree 54 Modeling with TDL

The TDL way:

develop once

3 dSpace mabx

TT Ethernet

deploy on any platform

Component C

. . . ARM

FlexRay-based communication

(TT) CAN ...

single node

Page 55: Model-based development of deterministic, portable real

© 2009, W. Pree 55 Modeling with TDL

State-of-the-art:

3 dSpace mabx

C-a 2 DeComSys

Renesas

C-b

. . .

C-c

. . .

Page 56: Model-based development of deterministic, portable real

© 2009, W. Pree 56 Modeling with TDL

TDL advantages

  transparent distribution: developers do not have to consider the target platform (processor, OS, communication bus, etc.), which could be a single node or a distributed system

  time and value determinism: same inputs imply corresponding same outputs   significantly improved reliability   simulation = behavior on execution platform

Page 57: Model-based development of deterministic, portable real

© 2009, W. Pree 57 Modeling with TDL

developers have to deal with 3 dimensions

functionality

Page 58: Model-based development of deterministic, portable real

© 2009, W. Pree 58 Modeling with TDL

developers have to deal with 3 dimensions

functionality

timing

Page 59: Model-based development of deterministic, portable real

© 2009, W. Pree 59 Modeling with TDL

developers have to deal with 3 dimensions

functionality

timing

platform

Page 60: Model-based development of deterministic, portable real

© 2009, W. Pree 60 Modeling with TDL

TDL reduces this to 2 dimensions

functionality

timing

platform

Page 61: Model-based development of deterministic, portable real

© 2009, W. Pree 61 Modeling with TDL

TDL reduces this to 2 dimensions

functionality

timing

platform

significantly simplified

Page 62: Model-based development of deterministic, portable real

© 2009, W. Pree 62 Modeling with TDL

TDL allows your developers to focus on the functionality

functionality

timing

platform

Page 63: Model-based development of deterministic, portable real

© 2009, W. Pree 63 Modeling with TDL

TDL allows your developers to focus on the functionality

functionality

timing

platform

3D → 1,5D

Page 64: Model-based development of deterministic, portable real

© 2009, W. Pree 64 Modeling with TDL

TDL leads to enormous gains in efficiency and quality

eg, FlexRay development reduced by a factor of 20   1 person year => 2 person weeks

deterministic system:   simulation and executable on platform always

exhibit equivalent (observable) behavior   time and value determinism guaranteed

flexibility to change topology, even platform   automatic code generators take care of the details

Page 65: Model-based development of deterministic, portable real

© 2009, W. Pree 65 Modeling with TDL

Thank you for your attention!