80
Julien Delange <julien dot delange at esa dot int> Introduction to SCADE Julien Delange <[email protected]> This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

Introduction to SCADE · Julien Delange About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Introduction to SCADE

Julien Delange <[email protected]>

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or

send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

Page 2: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

About this course

• Introduction, not a complete lecture• Cover most SCADE concepts

• For interested students, resources available on the internet

• See the links section

• Focused on main SCADE aspects and practical use• Flow-based approach, state machines definition

• Relation with the LUSTRE language

• Code generation & certification concerns

Page 3: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Overview

• Flow-based approach, introduction to Lustre

• SCADE for data-flow specification

• SCADE state machines

• Code generation

• Conclusion & links

Page 4: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Overview

• Flow-based approach, introduction to Lustre

• SCADE for data-flow specification

• SCADE state machines

• Code generation

• Conclusion & links

Page 5: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: rationale

• Safety-critical software must be deterministic

• System execution behaves as expected (specs.)

• Reaction to events and associated values

• Sensors, actuators

• Domain-specific and math approach

• System specified engineers

• Not programmers !

Page 6: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Transformation vs. reactive systems

• Transformational systems• Take input, produce outputs

• Execution time not bound

• Ex: calculator, C program, etc.

• Reactive systems• React to signals

• System rhythm is predefined

• Ex: speed control system

Page 7: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: overview

• Data-flow approach• New data are produced at each i instant

• Data are computed at each reaction

• Many advantages• Closed to maths

• Data-based dependencies

Page 8: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Data-flow example

• Must consider data dependencies• X depends on Y and Z

• W depends on X (and so, on Y and Z)

• New data produced at each instant

X(t) = 2 x Y(t) + Z(t)W(t) = X(t) + 1

x

+

Y

2

Z

+

1

X

W

Page 9: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre, flow-based synchronous language

• Software separated into NODES• Take one or several input values

• Produces one or several output values at each reaction

• Use usual types• Integer, boolean, etc.

• Lustre operators• Usual: +, -, mod, /, *, etc …

• pre(val): value at previous reaction

• current(val): value at current reaction

Page 10: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre, syntax

• Expressions separated with ;• Parallel execution

• Assignment =• X = 1

• Initial value → • X = 0 → pre (X) + 1;

• Previous value pre()• X = pre (Y)

• Current value current()• X = current (Y)

• Verification system values: assert()• Assert (not X)

Page 11: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre, syntax (2)

• Node call: nodename (param1, param2, ...)• X = mynode (param1)

• Tuples (val1, val2) = (var3, var4)• (X, Y) = (2, 3)

Page 12: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre, syntax (3)

• Traditional boolean operators• and, or, not, xor

• Condition if• N = 0 → if (Y) then X

• N = 0 → if (Y) then X else Z

• N = 0 → if (Y) else Z

• Filtering values when• Y = Z when X

Page 13: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: first node

node COMPUTE (Y, Z: int)returns (X, W: int)let X = 2 * Y + Z; W = X + 1;tel

Page 14: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: EDGE node

node EDGE (b : bool)returns (edge :bool);letedge = false → b and not pre b;tel

Instant 1 2 3 4 5 6 7

b True False False True True False True

edge false false false true false false true

Page 15: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: cyclic data dependencies

X = if W then Y else Z;Y = if W then Z else X;

• Cyclic dependency

• Non-sense !

• Self-dependency

• A data cannot depends on itself !

X = X + 1;

X = X + 1;

Page 16: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: WATCHDOG1 node

node WATCHDOG1 (set, reset, deadline : bool) returns (alarm : bool) var watchdog_is_on : bool;let alarm = deadline and watchdog_is_on; watchdog_is_on = false → if set then true else if reset then false else pre(watchdog_is_on); assert not (set and reset);tel

Page 17: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: WATCHDOG2 node

node WATCHDOG2 (set, reset: bool, delay : int)returns (alarm : bool)varremaining_delay : int;deadline : bool;let alarm = WATCHDOG1(set,reset,deadline); deadline = EDGE (remaining_delay = 0); remaining_delay = if set then delay else (0->pre(remaining_delay) - 1);tel

Page 18: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Lustre: first node

node COMPUTE (Y, Z: int)returns (X, W: int)let X = 2 * Y + Z; W = X + 1;tel

Page 19: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Overview

• Flow-based approach, introduction to Lustre

• SCADE for data-flow specification

• SCADE state machines

• Code generation

• Conclusion & links

Page 20: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE

• Flow-based design• Similar as Lustre

•• State machines integration

• Interaction with flows

•• Specific graphical notation

• Drag & drop approach

Page 21: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: main features

• System design• Data flows & state machines

• Predefined operators

•• Simulation

• Graphical simulation, automatic GUI integration

•• Code generation

• Certified code

• Integration with RTOS

Page 22: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: overview

Page 23: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: state-flow design

• Define input and output signals• Specify types

• Potential for ASN.1 types reuse

• Use predefined operators & SCADE blocks• Lustre operators + many additional

• Drag & drop approach

• Potential use of extended library• Math functions, etc.

• Ex: abs(), log(), ...

Page 24: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: state-flow example

Initial value(→ Lustre operator)

Additioner(+ Lustre operator)

Text expression

Previous value(pre() Lustre operator)

Page 25: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: corresponding Lustre node

node incrementer () returns (valout : int)let Valout = 0 → pre (valout) + 1;tel

Page 26: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: data-flow simulation

Signal values

System cyclesInput/output values

Page 27: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Overview

• Flow-based approach, introduction to Lustre

• SCADE for data-flow specification

• SCADE state machines

• Code generation

• Conclusion & links

Page 28: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

State machines characteristics

• Input and output

• Use same types as data flow diagrams

• States

• States and sub-states

• Start in an initial state

• Content = application behavior

• Transitions

• From one state to another

• Triggered by condition

Page 29: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: state machine example

State

Transitions

Transitionsconditions

When off, ison=false

When on, ison=true

Inputs&outputs

Page 30: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

SCADE: state machine simulation

Active state

Fired transition

State application content

Page 31: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Mixing state machines and data flows

• Execution semantics

• Parallel execution

• Data flows in state machines

• Output value state-dependent

• Data flows as input for state machines

• Use output of DF as SM input

Page 32: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Mixing state machines and data flows (2)

Data-flow block

State-machine block

Page 33: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Overview

• Flow-based approach, introduction to Lustre

• SCADE for data-flow specification

• SCADE state machines

• Code generation

• Conclusion & links

Page 34: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Code generation overview

• Certifiable code• DO178 compliance

• Clean code, rigid structure !• Avoid Simulink/Matlab code generation trends!

• Interfacing potential with user-defined code• Clean code = easy integration

Page 35: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Code generation structure

• Type outC_<operator__pkg>• Structure

• One member for each input/output/states

• Other member for input/output/states computations

• Reaction function• Produce new data or compute new states

• void <operator__pkg> (outC_<operator__pkg>*)

• Init/reset function• Put default struct values

• void <operator__reset__pkg> (outC_<operator__pkg*>

Page 36: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Code generation, files

• Generated files• <operator__pkg>.h: types & functions for code integration

• <operator__pkg>.c: implementation of system behavior

• kcg_types.h

• mapping of SCADE types to C

• application-specific types

• SCADE-included files• External libraries

• Other files• Generation/optimization reports

Page 37: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Generated code integration example

#include "incrementer_mypkg.h"

int main(){ outC_incrementer_mypkg val;

incrementer_reset_mypkg (&val);

while (1) { incrementer_mypkg (&val); printf ("val=%d\n", val.valout); sleep (1); }}

Page 38: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Overview

• Flow-based approach, introduction to Lustre

• SCADE for data-flow specification

• SCADE state machines

• Code generation

• Conclusion & links

Page 39: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Conclusion

• Application concerns abstraction• Close to engineering concerns

• Simulation & validation facilities

• Automatic certified code generation• Automatic compliance with DO178

• Reduce development time & costs

• Requires integration• Communication with system environment

• Interaction with other languages

Page 40: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>

Perspectives

• Integration with system environment• Merge SCADE models with other application modeling approaches

• Automatic integration of SCADE generated code

• But brings new problems• System consistency (types to be shared)

• Management of heterogeneous environment

• Certification with other standards• ECSS, AUTOSAR, ...

Page 41: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Introduction to SCADEJulien Delange <[email protected]>This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

Page 42: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>About this course•Introduction, not a complete lecture•Cover most SCADE concepts•For interested students, resources available on the internet•See the links section•Focused on main SCADE aspects and practical use•Flow-based approach, state machines definition•Relation with the LUSTRE language•Code generation & certification concerns

Page 43: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Overview•Flow-based approach, introduction to Lustre •SCADE for data-flow specification•SCADE state machines•Code generation•Conclusion & links

Page 44: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Overview•Flow-based approach, introduction to Lustre •SCADE for data-flow specification•SCADE state machines•Code generation•Conclusion & links

Page 45: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: rationale•Safety-critical software must be deterministic•System execution behaves as expected (specs.)•Reaction to events and associated values•Sensors, actuators•Domain-specific and math approach•System specified engineers•Not programmers !

Page 46: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Transformation vs. reactive systems•Transformational systems•Take input, produce outputs•Execution time not bound•Ex: calculator, C program, etc.•Reactive systems•React to signals•System rhythm is predefined•Ex: speed control system

Page 47: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: overview•Data-flow approach•New data are produced at each i instant•Data are computed at each reaction•Many advantages•Closed to maths•Data-based dependencies

Page 48: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Data-flow example•Must consider data dependencies•X depends on Y and Z•W depends on X (and so, on Y and Z)•New data produced at each instantX(t) = 2 x Y(t) + Z(t)W(t) = X(t) + 1x+Y2Z+1XW

Page 49: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre, flow-based synchronous language•Software separated into NODES•Take one or several input values•Produces one or several output values at each reaction•Use usual types•Integer, boolean, etc.•Lustre operators•Usual: +, -, mod, /, *, etc …•pre(val): value at previous reaction•current(val): value at current reaction

Page 50: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre, syntax•Expressions separated with ;•Parallel execution•Assignment =•X = 1•Initial value → •X = 0 → pre (X) + 1;•Previous value pre()•X = pre (Y)•Current value current()•X = current (Y)•Verification system values: assert()•Assert (not X)

Page 51: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre, syntax (2)•Node call: nodename (param1, param2, ...)•X = mynode (param1)•Tuples (val1, val2) = (var3, var4)•(X, Y) = (2, 3)

Page 52: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre, syntax (3)•Traditional boolean operators•and, or, not, xor•Condition if•N = 0 → if (Y) then X•N = 0 → if (Y) then X else Z •N = 0 → if (Y) else Z•Filtering values when•Y = Z when X

Page 53: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: first nodenode COMPUTE (Y, Z: int)returns (X, W: int)let X = 2 * Y + Z; W = X + 1;tel

Page 54: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: EDGE nodenode EDGE (b : bool)returns (edge :bool);letedge = false → b and not pre b;telInstant1234567bTrueFalseFalseTrueTrueFalseTrueedgefalsefalsefalsetruefalsefalsetrue

Page 55: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: cyclic data dependenciesX = if W then Y else Z;Y = if W then Z else X;•Cyclic dependency•Non-sense !•Self-dependency•A data cannot depends on itself !X = X + 1;X = X + 1;

Page 56: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: WATCHDOG1 nodenode WATCHDOG1 (set, reset, deadline : bool) returns (alarm : bool) var watchdog_is_on : bool;let alarm = deadline and watchdog_is_on; watchdog_is_on = false → if set then true else if reset then false else pre(watchdog_is_on); assert not (set and reset);tel

Page 57: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: WATCHDOG2 nodenode WATCHDOG2 (set, reset: bool, delay : int)returns (alarm : bool)varremaining_delay : int;deadline : bool;let alarm = WATCHDOG1(set,reset,deadline); deadline = EDGE (remaining_delay = 0); remaining_delay = if set then delay else (0->pre(remaining_delay) - 1);tel

Page 58: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Lustre: first nodenode COMPUTE (Y, Z: int)returns (X, W: int)let X = 2 * Y + Z; W = X + 1;tel

Page 59: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Overview•Flow-based approach, introduction to Lustre •SCADE for data-flow specification•SCADE state machines•Code generation•Conclusion & links

Page 60: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE•Flow-based design•Similar as Lustre••State machines integration•Interaction with flows••Specific graphical notation•Drag & drop approach

Page 61: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: main features•System design•Data flows & state machines•Predefined operators••Simulation•Graphical simulation, automatic GUI integration••Code generation•Certified code•Integration with RTOS

Page 62: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: overview

Page 63: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: state-flow design•Define input and output signals•Specify types•Potential for ASN.1 types reuse•Use predefined operators & SCADE blocks•Lustre operators + many additional•Drag & drop approach•Potential use of extended library•Math functions, etc.•Ex: abs(), log(), ...

Page 64: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: state-flow exampleInitial value(→ Lustre operator)Additioner(+ Lustre operator)Text expressionPrevious value(pre() Lustre operator)

Page 65: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: corresponding Lustre nodenode incrementer () returns (valout : int)let Valout = 0 → pre (valout) + 1;tel

Page 66: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: data-flow simulationSignal valuesSystem cyclesInput/output values

Page 67: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Overview•Flow-based approach, introduction to Lustre •SCADE for data-flow specification•SCADE state machines•Code generation•Conclusion & links

Page 68: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>State machines characteristics•Input and output•Use same types as data flow diagrams•States•States and sub-states•Start in an initial state•Content = application behavior•Transitions•From one state to another•Triggered by condition

Page 69: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: state machine exampleStateTransitionsTransitionsconditionsWhen off, ison=falseWhen on, ison=trueInputs&outputs

Page 70: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>SCADE: state machine simulationActive stateFired transitionState application content

Page 71: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Mixing state machines and data flows•Execution semantics•Parallel execution•Data flows in state machines•Output value state-dependent•Data flows as input for state machines•Use output of DF as SM input

Page 72: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Mixing state machines and data flows (2)Data-flow blockState-machine block

Page 73: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Overview•Flow-based approach, introduction to Lustre •SCADE for data-flow specification•SCADE state machines•Code generation•Conclusion & links

Page 74: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Code generation overview•Certifiable code•DO178 compliance•Clean code, rigid structure !•Avoid Simulink/Matlab code generation trends!•Interfacing potential with user-defined code•Clean code = easy integration

Page 75: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Code generation structure•Type outC_<operator__pkg>•Structure•One member for each input/output/states•Other member for input/output/states computations•Reaction function•Produce new data or compute new states•void <operator__pkg> (outC_<operator__pkg>*)•Init/reset function•Put default struct values•void <operator__reset__pkg> (outC_<operator__pkg*>

Page 76: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Code generation, files•Generated files•<operator__pkg>.h: types & functions for code integration•<operator__pkg>.c: implementation of system behavior•kcg_types.h•mapping of SCADE types to C•application-specific types•SCADE-included files•External libraries•Other files•Generation/optimization reports

Page 77: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Generated code integration example#include "incrementer_mypkg.h"int main(){ outC_incrementer_mypkg val; incrementer_reset_mypkg (&val); while (1) { incrementer_mypkg (&val); printf ("val=%d\n", val.valout); sleep (1); }}

Page 78: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Overview•Flow-based approach, introduction to Lustre •SCADE for data-flow specification•SCADE state machines•Code generation•Conclusion & links

Page 79: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Conclusion•Application concerns abstraction•Close to engineering concerns•Simulation & validation facilities•Automatic certified code generation•Automatic compliance with DO178•Reduce development time & costs•Requires integration•Communication with system environment•Interaction with other languages

Page 80: Introduction to SCADE · Julien Delange  About this course •Introduction, not a complete lecture • Cover most SCADE concepts • For interested

Julien Delange <julien dot delange at esa dot int>Perspectives•Integration with system environment•Merge SCADE models with other application modeling approaches•Automatic integration of SCADE generated code•But brings new problems•System consistency (types to be shared)•Management of heterogeneous environment•Certification with other standards•ECSS, AUTOSAR, ...