35
Modeling with the Timing Definition Language (TDL) Wolfgang Pree Professor Department of Computer Science Univ. Salzburg, Austria

Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

Modeling with the Timing Definition Language (TDL)

Wolfgang Pree Professor

Department of Computer Science Univ. Salzburg, Austria

Page 2: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 2 CHESS seminar, UC Berkeley, Sept 26, 2006

Overview

  What is TDL?   TDL component model   TDL tool chain   simulation in Matlab/Simulink   transparent distribution of components

Page 3: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 3 CHESS seminar, UC Berkeley, Sept 26, 2006

What is TDL?

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

  Conceptually based on Giotto

  TDL = Giotto + syntax + cleanups + component architecture + control engineering enhancements.

Analogy: IDL (CORBA, MIDL) vs. TDL

IDL defines an interface for a distributed application

=> Separates interface from implementation

TDL defines the timing for a real-time application

=> Separates timing from implementation

Page 4: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 4 CHESS seminar, UC Berkeley, Sept 26, 2006

Embedded hard real-time software

Page 5: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 5 CHESS seminar, UC Berkeley, Sept 26, 2006

Multi-rate, multi-mode systems (Giotto)

Page 6: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 6 CHESS seminar, UC Berkeley, Sept 26, 2006

Multi-rate, multi-mode systems (II)

LET-semantics

Page 7: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 7 CHESS seminar, UC Berkeley, Sept 26, 2006

Logical Execution Time (LET) abstraction

ET <= WCET <= LET

results are available at 'terminate'

time task invocation

Logical Execution Time (LET)

Logical

Physical

start stop suspend resume

release terminate

Page 8: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 8 CHESS seminar, UC Berkeley, Sept 26, 2006

Motivation for the TDL component model

  e.g. modern cars have up to 80 control units (ECUs)   ECU consolidation is a topic   run multiple programs on one ECU   leads to TDL component model

ECU1 Program1

ECU2 Program2

ECU3 Program3

Page 9: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 9 CHESS seminar, UC Berkeley, Sept 26, 2006

TDL component model

  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 10: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 10 CHESS seminar, UC Berkeley, Sept 26, 2006

Modules

Page 11: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 11 CHESS seminar, UC Berkeley, Sept 26, 2006

Modules

public

Page 12: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 12 CHESS seminar, UC Berkeley, Sept 26, 2006

Modules

public

private

Page 13: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 13 CHESS seminar, UC Berkeley, Sept 26, 2006

TDL syntax by example module M1 {

sensor boolean s1 uses getS1; actuator int a1 := 10 uses setA1;

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

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

mode freeze [period=1000ms] {} }

Page 14: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 14 CHESS seminar, UC Berkeley, Sept 26, 2006

Module import

module M2{

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

TDL supports

  structured module names (e.g. com.avl.p1.M1)

  import with rename: (e.g. import com.avl.p1.M1 as A1;)

  group import: (e.g. import com.avl.p1 {M1, M2, M3};)

Page 15: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 15 CHESS seminar, UC Berkeley, Sept 26, 2006

Module summary

  provides a named program component   provides a name space   partitions the set of actuators   allows for exporting sensors, constants, types, task outputs   may be imported by other module(s)   acts as unit of composition   acts as the unit of distribution   acts as the unit of loading   acts as the unit of execution

TDL supports multi mode & multi rate & multi program systems.

Page 16: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 16 CHESS seminar, UC Berkeley, Sept 26, 2006

TDL tool chain

Page 17: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 17 CHESS seminar, UC Berkeley, Sept 26, 2006

core tool chain

.tdl Compiler E-machine* .ecode

functionality code

*Simulink, FlexRay-AES, OSEK, INtime, RTLinux, ...

Page 18: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 18 CHESS seminar, UC Berkeley, Sept 26, 2006

plug-in architecture of compiler

.tdl Compiler

Platform plugin* platform

specific

AST

platform specific

.ecode

*Simulink, FlexRay-AES, OSEK, INtime, RTLinux, ...

functionality code

E-machine*

Page 19: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 19 CHESS seminar, UC Berkeley, Sept 26, 2006

tool chain overview

.tdl Compiler

Platform plugin* platform

specific

AST

platform specific

.ecode

Decoder .txt TDL: Visual

Creator

Matlab/Simulink

*Simulink, FlexRay-AES, OSEK, INtime, RTLinux, ...

functionality code

E-machine*

Model

Page 20: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 20 CHESS seminar, UC Berkeley, Sept 26, 2006

Simulation in Matlab/Simulink

Page 21: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 21 CHESS seminar, UC Berkeley, Sept 26, 2006

How can we ensure that simulated behavior and behavior on a specific platform are equivalent?

  we use the same E-machine implementation   in Matlab/Simulink the E-machine implementation is

wrapped within an S-function

Page 22: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 22 CHESS seminar, UC Berkeley, Sept 26, 2006

Matlab/Simulink simulation of TDL modules

  before the simulation is started, the TDL compiler processes the textual representation of each TDL module and generates E-code that is then interpretetd by the S-function-E-machine

  The E-machine operates at a single discrete sample time that is computed from the minimum period used by any activity in all possible modes.

Page 23: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 23 CHESS seminar, UC Berkeley, Sept 26, 2006

Transparent distribution

Page 24: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 24 CHESS seminar, UC Berkeley, Sept 26, 2006

Transparent distribution of TDL modules (I)

  Modules are the natural choice as unit of distribution because dataflow within a module (cohesion) will most probably be much larger than dataflow across module boundaries (adhesion).

  The possibility to distribute modules across different computation nodes leads us to the notion of transparent distribution.

Page 25: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 25 CHESS seminar, UC Berkeley, Sept 26, 2006

Transparent distribution of TDL modules (II)

  We define the term transparent distribution in the context of hard real-time applications with respect to two points of view:

  Firstly, at runtime a set of modules behaves exactly the same, no matter if all modules (i.e. 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 module, it does not matter where the module itself and any imported modules are executed.

Page 26: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 26 CHESS seminar, UC Berkeley, Sept 26, 2006

Communication scheduling requirements resulting from transparent distribution (I)

Example:

Page 27: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 27 CHESS seminar, UC Berkeley, Sept 26, 2006

Communication scheduling requirements resulting from transparent distribution (II)

  sample execution of the two tasks on a single node:

Page 28: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 28 CHESS seminar, UC Berkeley, Sept 26, 2006

Distributed components (I)

  M1 and M2 on different nodes.   We call the local memory buffer of node1 comm1 and

the local memory buffer of node 2 comm2.

Page 29: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 29 CHESS seminar, UC Berkeley, Sept 26, 2006

Distributed components (II)

Page 30: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 30 CHESS seminar, UC Berkeley, Sept 26, 2006

Distributed components (II)

communication window

Page 31: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 31 CHESS seminar, UC Berkeley, Sept 26, 2006

Transparent distribution challenge

each mode combination => another static bus schedule The challenge was to beat the combinatorial explosion of the number of static bus schedules, as we need to generate potentially one static bus schedule for each mode/phase combination. If we have i communicating modules and each module k (1 <= k <= i) has kmodes modes, we would have to generate

bus schedules.

Page 32: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 32 CHESS seminar, UC Berkeley, Sept 26, 2006

solution with what we call dynamic multiplexing

Page 33: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 33 CHESS seminar, UC Berkeley, Sept 26, 2006

sample binding of several messages to one frame

Page 34: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 34 CHESS seminar, UC Berkeley, Sept 26, 2006

Status quo

  ready   TDL:VisualCreator   TDL:Compiler and Bus Schedule Generator for FlexRay   TDL:Machine for Simulink, FlexRay-AES, INtime, OSEK   Decoder   TDL:VisualDistributor

  you can get a free trial version of the TDL:VisualCreator in Simulink (includes the TDL:Compiler)

  work in progress   fine-grained integration with DESIGNERPRO (DeComSys.com)   TDL extensions

Page 35: Modeling with TDL - Chess · 22 W. Pree CHESS seminar, UC Berkeley, Sept 26, 2006 Matlab/Simulink simulation of TDL modules before the simulation is started, the TDL compiler processes

W. Pree 35 CHESS seminar, UC Berkeley, Sept 26, 2006

Thank you for your attention!