Who, What, Where, Why, and How Synchron'08 Aussois Mouaiad ALRAS - - PowerPoint PPT Presentation

who what where why and how
SMART_READER_LITE
LIVE PREVIEW

Who, What, Where, Why, and How Synchron'08 Aussois Mouaiad ALRAS - - PowerPoint PPT Presentation

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model Who, What, Where, Why, and How Synchron'08 Aussois Mouaiad ALRAS December 2008 Who LIG, POPART Where Alain GIRAULT What Why How Mouaiad ALRAS Whole


slide-1
SLIDE 1

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

Synchron'08 Aussois Mouaiad ALRAS

December 2008

Who, What, Where, Why, and How

slide-2
SLIDE 2

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

2

Pascal RAYMOND Alain GIRAULT

Paul CASPI Mouaiad ALRAS Synchrone LIG, POPART

slide-3
SLIDE 3

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

3

Where

A special-purpose computer system, Often designed with real-time computing constraints, and limited resources. Usually embedded as part of a complete device including hardware.

Embedded Systems

slide-4
SLIDE 4

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

4

What

Simulink Synchronous Model Lustre RTOS Xenomai

What is the story ?

Model-based design (MBD) precisely attempts at replacing the manual coding phase by an automatic code generation one. The main issue raised by MBD is the faithfulness of the generated code with respect to the initial model, the latter being defined by the simulation semantics.

slide-5
SLIDE 5

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

5

What

What is Simulink ?

An interactive graphical environment that let you design, simulate, implement, and test a variety of systems.

slide-6
SLIDE 6

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

6

What

What is Lustre ?

Lustre is a formally defined, declarative, and synchronous dataflow programming language, for programming reactive systems.

slide-7
SLIDE 7

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

7

What

What is Xenomai RTOS ?

Xenomai is a real-time development framework cooperating with the Linux kernel, in order to provide a pervasive, interface-agnostic, hard real-time support to user-space applications, seamlessly integrated into the GNU/Linux environment.

Categories of services :

➢ Ta s k m a n a g e m e n t.

C re a te a n e w re a l-tim e ta s k . S ta rt a re a l-tim e ta s k . M a k e a re a l-tim e ta s k p e rio d ic . S e n d a m e s s a g e to a ta s k . R e p ly to a ta s k . W a it

  • n

th e te rm in a tio n

  • f

a re a l-tim e ta s k . ....

➢ T im in g a n d A la rm s s e rv ic e s .

C re a te a n a la rm

  • b je c t.

W a it fo r th e n e x t a la rm s h o t. C o n v e rt n a n o s e c o n d s to in te rn a l c lo c k tic k s . In q u ire a b o u t th e tim e r. S e t th e s ys te m c lo c k ra te . ....

➢ S y n c h ro n iz a tio n s u p p o rt.

C o u n tin g s e m a p h o re s , M u te x e s , C o n d itio n v a ria b le s , E v e n t fla g g ro u p s .

➢ M e s s a g in g a n d c o m m u n ic a tio n .

M e s s a g e q u e u e s , M e m o ry h e a p s , M e s s a g e p ip e s .

➢ D e v ic e I/ O h a n d lin g . ➢ R e g is try s u p p o rt.

slide-8
SLIDE 8

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

8

Why

Why Model-based ?

In the domain of embedded systems, it offers the huge advantage of avoiding the time-consuming and error-prone final coding phase.

Why Simulink ?

One of the most popular design tool for automatic control application. Automatic control people love Simulink.

Why Lustre ?

Software people do not like Simulink. Lustre, as a synchronous language, has a clean mathematical semantics. Using Lustre as a intermediare model permet the use of Lustre tools for simulation and validation

slide-9
SLIDE 9

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

9

Why

Why Model-based ?

In the domain of embedded systems, it offers the huge advantage of avoiding the time-consuming and error-prone final coding phase.

Why Simulink ?

One of the most popular design tool for automatic control application. Automatic control people love Simulink.

Why Lustre ?

Software people do not like Simulink. Lustre, as a synchronous language, has a clean mathematical semantics. Using Lustre as a intermediare model permet the use of Lustre tools for simulation and validation

slide-10
SLIDE 10

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

10

Why

Why Model-based ?

In the domain of embedded systems, it offers the huge advantage of avoiding the time-consuming and error-prone final coding phase.

Why Simulink ?

One of the most popular design tool for automatic control application. Automatic control people love Simulink.

Why Lustre ?

Software people do not like Simulink. Lustre, as a synchronous language, has a clean mathematical semantics. Using Lustre as a intermediare model permet the use of Lustre tools for simulation and validation

slide-11
SLIDE 11

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

11

Why

Objective

Our goal is to bridge the gap between the high-level model and the low-level implementation, and to develop a complete multi-tier MBD tool that goes from a Simulink model to a real-time implementation for the Xenomai RTOS.

Simulink Synchronous Model Lustre RTOS Xenomai

slide-12
SLIDE 12

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

12

How

Restrictions, Confinements:

To prevent unsafe behaviors of Simulink.

User Guidelines:

in order to produce better code, we propose user guidelines in two directions: Grouping tasks to generate minimum number of RTOS threads, Using exclusive modes with data sharing to generate efficient and better structured code.

Meta-operators:

We extend Lustre with specific meta-operators, witch are used to subsume new features of simulink on one hand, and to incarnate on the other hand the real-time and system-level items of Xenomai library.

slide-13
SLIDE 13

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

13

How

node main(in1: int, in3:bool) returns (out1,out2:int); var clk_20_0 : bool; let clk_20_0 = clock<<20,0>>();

  • ut1 = condact<<G,clk_20_0,1>>(in1)

+ condact<<H,clk_20_0,2>>(in1);

  • ut2 = condact<<F, in3,0>>(in2);

tel 1 in1 in1

  • ut1

G T=20, Init=1 in1

  • ut1

H T=20, Init=2 1

  • ut1

+ in1

  • ut1

F Init=0 2 in2 2

  • ut2

The Clock & Condact Meta-operators

Lustre' code

slide-14
SLIDE 14

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

14

How rt_task task_G; rt_alarm clk_20_0; rt_alarm_create(&clk_20_0,"clk_20_0"); rt_alram_start(&clk_20_0, 0, ns2ticks(20 * MILLE)); rt_task_create(&task_G, "task_G"); ctx->out1 = 1; //initial value rt_task_start(&task_G, &calc_G, ctx); void calc_G(void* ctx){ while(1){ rt_alarm_wait(&clk_20_0); ... call_step(ctx); ... } }

1 in1 in1

  • ut1

G T=20, Init=1 in1

  • ut1

H T=20, Init=2 1

  • ut1

+ in1

  • ut1

F Init=0 2 in2 2

  • ut2

Xenomai code

slide-15
SLIDE 15

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

15

How

1 in1 in1

  • ut1

Atomic subsystem GH 1

  • ut1

in1

  • ut1

F Init=0 2 in2 2

  • ut2

The Atomic subsystem guideline

slide-16
SLIDE 16

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

16

How

The multi-modes guideline

slide-17
SLIDE 17

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

17

How

node shift_control ( in_trig: bool, in_omega_t:real, in_omega_cr:real, in_T_t:real ) returns ( out_tc1:real, out_tc2:real, out_to_gear:int ) var tmp_mod: int; let (tmp_mod, tmp_gear) = condact<<mode_control,in_trig>>(in_omega_t, in_omega_cr); .... switch tmp_mod case mod_1: (out_tc2, out_tc1) = first_pressure(in_T_t) case mod_2: (out_tc2, out_tc1) = change_of_mind(in_T_t) case mod_3: (tmp_tc2, out_tc1) = second_pressure(in_T_t) ; .... tel

The switch-case meta-operator

slide-18
SLIDE 18

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

18

How

node shift_control (in_trig: bool, in_omega_t:real, in_omega_cr:real, in_T_t:real ) returns ( out_tc1:real, out_tc2:real, out_to_gear:int ) var mem_tc2 : memory<<real,0>>; tmp_tc2 : real; tmp_mod: int; let (tmp_mod, out_to_gear) = condact<<mode_control,in_trig>>(in_omega_t, in_omega_cr); switch tmp_mod case mod_1: (out_tc2, out_tc1) = first_pressure(in_T_t) case mod_2: (out_tc2, out_tc1) = change_of_mind[mem_tc2](in_T_t) case mod_3: (tmp_tc2, out_tc1) = second_pressure[mem_tc2](in_T_t) ; void = memory_write<<mem_tc2>>(tmp_tc2);

  • ut_tc2 = tmp_tc2;

tel

The memory meta-operator

slide-19
SLIDE 19

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

19

How

The ford gear-shift study case

slide-20
SLIDE 20

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

20

How

type modes_shift = enum {do_1, do_2, do_c, do_t, do_i}; node shift_control( i_do_control: bool, i_w_t: real, i_w_cr: real, i_to_gear: int, i_T_t: real) returns(o_tc1:real, o_tc2:real, o_gear) var t_mode: modes_shift, t_reset: bool last tc2 : real = 0; omega : real = 0; torque : real = 0; let (o_gear, t_mode, t_reset) = condact<<mode_control, in_do_control>>(i_omega_t, i_omega_cr, i_to_gear); switch mode case do_1: (o_tc1, o_tc2) = first(i_T_t) case do_2: (o_tc1, o_tc2) = second(in_T_t) case do_c: (o_tc1, o_tc2) = change_of_mind(i_T_t, last tc2) case do_t: (o_tc1, o_tc2, torque, omega) = torque_12(i_w_t, i_T_t, last tc2) case do_i: (o_tc1, o_tc2) = inertia_12(last torque, last omega, i_w_t, i_w_cr, i_reset, i_T_t) ; tc2 = o_tc_2; tel

slide-21
SLIDE 21

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

21

Whole

Simulink Model Intermediary Model Lustre + Meta-operators Behavioral Model pure Lustre Executable code functional + OS Glue XML LUS2XEN MDL2XML XML2LUS parsing, filtering conformity analyzing, translation test, checking validation Modeling, simulation

slide-22
SLIDE 22

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

22

What

What next

Apply the method to a real and complete study case. Integrate the tools of filtering, simulation, validation, and code generation in on framework tool. Generalize our MBD method to a wider class of meta-operators to cover: more RTOS sevices. Code distribution annotations. ...

slide-23
SLIDE 23

Where Whole How Why What What Who

Model-Based Design of Embedded Control Systems with a Synchronous Intermediate Model

23

Merci for your attention