Top Banner
Alexios Lekidis 1 , Marius Bozga 1 , Didier Mauuary 2 , Saddek Bensalem 1 1 UJF-Grenoble 1 / CNRS-VERIMAG, 2 Cyberio 14th international CAN Conference Eurosites Republique, Paris (France) November 12-13,2013 A model based design flow for CAN- based systems Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 1/35
56

Lekidis-iCC2013

Jan 20, 2015

Download

Technology

Alexis Lekidis

Model-based design in Controller Area Network systems
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lekidis-iCC2013

Alexios Lekidis1, Marius Bozga1, Didier Mauuary2, Saddek Bensalem1

1UJF-Grenoble 1 / CNRS-VERIMAG, 2Cyberio

14th international CAN Conference Eurosites Republique, Paris (France)

November 12-13,2013

A model based design flow for CAN-based systems

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 1/35

Page 2: Lekidis-iCC2013

1) Design challenges for CAN-based systems 2) Model-based design flow using BIP

• BIP overview • CAN protocol model • Application software modeling • Construction of the system model

3) Application and experimental results 4) Conclusion and ongoing work

Outline

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 2/35

Page 3: Lekidis-iCC2013

Outline

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 2/35

1) Design challenges for CAN-based systems 2) Model-based design flow using BIP

• BIP overview • CAN protocol model • Application software modeling • Construction of the system model

3) Application and experimental results 4) Conclusion and ongoing work

Page 4: Lekidis-iCC2013

CAN system example: automotive application

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 3/35

Engine Control

Antilock Breaks

Airbag Control

Traction Control

Gearbox Control

Seat Control

Transmission Control

Lights Control

Suspension Control

Environment Control

Dashboard

Each unit in the network

may incorporate many subsystems

• Increased communication complexity • System design becomes difficult

Page 5: Lekidis-iCC2013

Emergence of higher layer protocols

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 4/35

• Organize and abstract low-level communication complexity • Extend its usage to a wide range of applications including:

• Machine automation, medical devices, photovoltaic systems, maritime electronics e.t.c.

J1939 CANopen DeviceNet

CAN Controller

CAN Bus

Page 6: Lekidis-iCC2013

Emergence of higher layer protocols

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 4/35

• Organize and abstract low-level communication complexity • Extend its usage to a wide range of applications including:

• Machine automation, medical devices, photovoltaic systems, maritime electronics e.t.c.

J1939 CANopen DeviceNet

CAN Controller

CAN Bus

System integration and validation is too

difficult

Page 7: Lekidis-iCC2013

J1939 CANopen

Emergence of higher layer protocols

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 4/35

DeviceNet

CAN Controller

CAN Bus

Successful design

remains a challenge

• Organize and abstract low-level communication complexity • Extend its usage to a wide range of applications including:

• Machine automation, medical devices, photovoltaic systems, maritime electronics e.t.c.

System integration and validation is too

difficult

Page 8: Lekidis-iCC2013

Conformance testing Verifies the correct

implementation and integration of the system

Essential step towards interoperability and portability

Occurs late in the development cycle Requires the final system implementation

Potential design errors can lead to a new implementation of the system

Performance aspects are ignored during the design process

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 5/35

Page 9: Lekidis-iCC2013

Solution: Model-based design

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 6/35

Formal approach expressing the behavior and functionality of embedded systems • Validation and verification enabled at any stage • Formal models for the software and hardware allowing:

• Separation of concerns • Modularity • Reusability

Page 10: Lekidis-iCC2013

Solution: Model-based design

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 6/35

Formal approach expressing the behavior and functionality of embedded systems • Validation and verification enabled at any stage • Formal models for the software and hardware allowing:

• Separation of concerns • Modularity • Reusability

Previous work is based on multi-language frameworks, in order to provide a design flow for automotive systems

Page 11: Lekidis-iCC2013

Solution: Model-based design

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 6/35

Formal approach expressing the behavior and functionality of embedded systems • Validation and verification enabled at any stage • Formal models for the software and hardware allowing:

• Separation of concerns • Modularity • Reusability

Semantically unrelated formalisms lead to lack of continuity

Previous work is based on multi-language frameworks, in order to provide a design flow for automotive systems

Page 12: Lekidis-iCC2013

Solution: Model-based design

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 6/35

Rigorous design flow for CAN-based systems: • Based on a single

semantic framework • Encapsulates the

protocol’s communication mechanisms and primitives

• Incremental design using composite components Semantically unrelated formalisms lead

to lack of continuity

Previous work is based on multi-language frameworks, in order to provide a design flow for automotive systems

Formal approach expressing the behavior and functionality of embedded systems • Validation and verification enabled at any stage • Formal models for the software and hardware allowing:

• Separation of concerns • Modularity • Reusability

Page 13: Lekidis-iCC2013

Design flow

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 7/35

Page 14: Lekidis-iCC2013

Design flow

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 7/35

Tools

Component reuse

Page 15: Lekidis-iCC2013

Design flow

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 7/35

Verification of safety properties

Tools

Platform dependent skeleton

C/C++ code

Component reuse

Page 16: Lekidis-iCC2013

1) Design challenges for CAN-based systems 2) Model-based design flow using BIP

• BIP overview • CAN protocol model • Application software modeling • Construction of the system model

3) Application and experimental results 4) Conclusion and ongoing work

Outline

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 8/35

Page 17: Lekidis-iCC2013

• BIP (Behavior-Interaction-Priority) is a formal language for the hierarchical construction of composite components

• Provides a rich set of tools for analysis and

performance evaluation

B E H A V I O R

Interactions (collaboration)

Priorities (conflict resolution)

BIP component framework

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 9/35

Composition glue

Atomic components

Page 18: Lekidis-iCC2013

r:=0 t:=0

s:=0 t:=0

print(r)

BIP: Atomic components

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 10/35

Finite state automata (Petri nets) extended with data and functions described in C/C++

s SEND

SEND s:=s+1

[s<100] S_COM

S_COM

TICK TICK t:=t+1

TICK t:=t+1

R_COM

TICK

r

RECV

RECV

R_COM

TICK

Page 19: Lekidis-iCC2013

r:=0 t:=0

s:=0 t:=0

print(r)

BIP: Interactions

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 10/35

Communication between components involving data exchange

r:=r+s

TICK t:=t+1

R_COM

TICK

r

RECV

RECV

R_COM

TICK

s SEND

SEND s:=s+1

[s<100] S_COM

S_COM

TICK TICK t:=t+1

Page 20: Lekidis-iCC2013

BIP: Interactions

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 10/35

Communication between components involving data exchange

r:=r+s

TICK t:=t+1

R_COM

TICK

r

RECV

RECV r:=0 t:=0

R_COM

TICK

print(r)

s SEND

SEND s:=s+1

s:=0

[s<100] S_COM

S_COM

TICK TICK t:=t+1

t:=0

Page 21: Lekidis-iCC2013

BIP: Priorities

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 10/35

Used among competing interactions

TICK<R_COM

r:=r+s

TICK t:=t+1

R_COM

TICK

r

RECV

RECV r:=0 t:=0

R_COM

TICK

print(r)

s SEND

SEND s:=s+1

s:=0

[s<100] S_COM

S_COM

TICK TICK t:=t+1

t:=0

Page 22: Lekidis-iCC2013

The BIP toolset

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 11/35

Offers: Translators from

various languages and models into BIP

Source-to-source transformers

Code generation by dedicated compilers

More information and related material at: http://bip-components.com

Page 23: Lekidis-iCC2013

Modeling the CAN protocol

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 12/35

Page 24: Lekidis-iCC2013

Main aspects of the CAN protocol model (1)

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 13/35

• Represents the classic CAN protocol functionality [CAN specification version 2.0]

• Supports the Basic CAN interface [ISO 11898-1] • Is compliant with the High-Speed physical layer

standard [ISO 11898-2] • Does not consider transmission errors

Page 25: Lekidis-iCC2013

Main aspects of the CAN protocol model (1)

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 13/35

Airbag Control

Engine Control

Traction Control

Seat Control

CAN Bus

• Represents the classic CAN protocol functionality [CAN specification version 2.0]

• Supports the Basic CAN interface [ISO 11898-1] • Is compliant with the High-Speed physical layer

standard [ISO 11898-2] • Does not consider transmission errors

Page 26: Lekidis-iCC2013

Main aspects of the CAN protocol model (1)

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 13/35

Airbag Control

Engine Control

Traction Control

Seat Control

CAN Bus

• Represents the classic CAN protocol functionality [CAN specification version 2.0]

• Supports the Basic CAN interface [ISO 11898-1] • Is compliant with the High-Speed physical layer

standard [ISO 11898-2] • Does not consider transmission errors

Page 27: Lekidis-iCC2013

CAN station

CAN bus

ARBITRATION CONTROL DATA EOF SOF

ARBITRATION CONTROL DATA EOF SOF

CAN station

ARBITRATION CONTROL DATA EOF SOF ACK ACK

ACK

CAN protocol model

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 14/35

RECV REQUEST frame frame RECV REQUEST frame frame

Page 28: Lekidis-iCC2013

Main aspects of the CAN protocol model (2)

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 15/35

Each CAN frame: • Is one of the following types:

• Data transmission (data frame) • Data request (remote frame)

• Contains the following fields: • arb : frame identifier • rtr : Remote Transfer Request (RTR) bit • ide : Identifier Extension (IDE) bit • length : Length of data • payload : Frame data

Page 29: Lekidis-iCC2013

CAN station component

• Queuing policy is of type: • First-In-First-Out (FIFO) • High Priority First (HPF)

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 16/35

• Acceptance filters: I. Receive every frame

from the Bus II. Deliver it to the

application or ignore it

RECV

HANDLE

EOF ACK DATA CONTROL ARBITRATION SOF

RECV

REQUEST

Filter Controller

arb rtr ide payload length

frame

frame frame

frame

Page 30: Lekidis-iCC2013

Controller component

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 17/35

Page 31: Lekidis-iCC2013

CAN bus component

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 18/35

Page 32: Lekidis-iCC2013

CAN bus component: Timing model

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 18/35

Discrete time step advance Transmission of one bit ( ) corresponds to one tick

bitτ

Page 33: Lekidis-iCC2013

CAN bus component: Timing model (2)

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 19/35

Overall frame transmission time is: • , where: • g denotes the number of ticks spent in the arbitration phase

• Equal to 12 for a standard frame • Equal to 32 for an extended frame

• s denotes the number of additional ticks related to bit-stuffing The computation of the bit-stuffing for every frame can be:

• Fixed • Stochastic

[32 (8 ) ]frame bitC g length s τ= + + × +

Used for the transmission of each frame field Duration is indicated by a fixed number of ticks

Page 34: Lekidis-iCC2013

CAN bus component: Timing model (3)

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 20/35

The additional transmission time due to bit-stuffing is: • , where:

• • Equal to 11 for a standard frame • Equal to 31 for an extended frame

• , where the upper bound indicates the worst case

The detailed frame transmission time is: •

(23 8 1)100stuffing bit

sw lengthC τ = + + × −

1w g= −

[1, 25]s∈

[32 (8 ) ] (23 8 1)100total frame stuffing bit

sg length s w lengthC C C τ = + = + + × + + + + × −

Page 35: Lekidis-iCC2013

Modeling the application software

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 21/35

Page 36: Lekidis-iCC2013

Modeling the application software

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 22/35

• Every application consists of a number of Devices • Each Device generates a set of frames

• Transmission is defined by the following attributes: • Periodic, event-triggered or purely stochastic • With or without offsets • Abortable or non-abortable request

• Currently provided by XML-based descriptions • Compliance with NETCARBENCH [Navet et al., 2007]

• Accordingly provided Device examples with focus on the transmission part

Page 37: Lekidis-iCC2013

N frames, with a transmission jitter chosen by a given distribution and periods: D[i] , i=1, .. N

N periodic frames, where periods are: P[i] , i=1,…,N

Device examples

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 23/35

ECU with stochastic transmission ECU with periodic transmission

Page 38: Lekidis-iCC2013

N frames, with a transmission jitter chosen by a given distribution and periods: D[i] , i=1, .. N

N periodic frames, where periods are: P[i] , i=1,…,N

Device examples

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 23/35

ECU with stochastic transmission ECU with periodic transmission

Page 39: Lekidis-iCC2013

The CAN-based system model

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 24/35

Page 40: Lekidis-iCC2013

RECV REQUEST

Constructing the system model

Device 1

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 25/35

Application model RECV REQUEST

Device 2

RECV REQUEST

Device 3

RECV REQUEST

Device n

Page 41: Lekidis-iCC2013

CAN station 1

CAN bus

RECV REQUEST

Constructing the system model

Device 1

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 25/35

REQUEST RECV

CAN station 2

REQUEST RECV

CAN station n

REQUEST RECV

CAN protocol model

COMM COMM COMM

COMM

RECV REQUEST

Device 2

RECV REQUEST

Device 3

RECV REQUEST

Device n Application model

Page 42: Lekidis-iCC2013

CAN station 1

CAN bus

RECV REQUEST

Constructing the system model

Device 1

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 25/35

REQUEST RECV

CAN station 2

REQUEST RECV

CAN station n

REQUEST RECV

CAN protocol model

COMM COMM COMM

COMM

RECV REQUEST

Device 2

RECV REQUEST

Device 3

RECV REQUEST

Device n Application model

Page 43: Lekidis-iCC2013

1) Design challenges for CAN-based systems 2) Model-based design flow using BIP

• BIP overview • CAN protocol model • Application software modeling • Construction of the system model

3) Application and experimental results 4) Conclusion and ongoing work

Outline

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 26/35

Page 44: Lekidis-iCC2013

Deterministic powertrain network

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 27/35

Case study using the BIP design flow, where: • The application software consists of:

• 5 Devices • 30 periodic frames with associated:

• CAN identifier, period and payload • HPF queuing policy in every Device • Fixed 10% bit-stuffing for all the frames • No transmission offsets

• The Bus has a bit-rate of 500 kbit/s • Load equally distributed among the Devices

Page 45: Lekidis-iCC2013

Experiments

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 28/35

The generated system model contains: • 20 atomic components • 60 connectors • 255 transitions • 1250 lines of BIP code

Page 46: Lekidis-iCC2013

Results: Response times

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 29/35

• 1 hour of real system time was simulated in 5 minutes and 30 seconds

Page 47: Lekidis-iCC2013

Results: Response times

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 29/35

• The same results can be obtained using RTaW-Sim [RealTime-at-Work] • Much shorter simulation time (13.5 seconds)

• 1 hour of real system time was simulated in 5 minutes and 30 seconds

Page 48: Lekidis-iCC2013

Stochastic powertrain network

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 30/35

• Extension to the previous case study: I. Probabilistic margin (jitter) for every period II. Stochastic bit-stuffing

Page 49: Lekidis-iCC2013

Stochastic powertrain network

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 30/35

• Extension to the previous case study: I. Probabilistic margin (jitter) for every period II. Stochastic bit-stuffing

Page 50: Lekidis-iCC2013

Stochastic powertrain network

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 30/35

• Extension to the previous case study: I. Probabilistic margin (jitter) for every period II. Stochastic bit-stuffing

Page 51: Lekidis-iCC2013

Stochastic powertrain network

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 30/35

• Extension to the previous case study: I. Probabilistic margin (jitter) for every period II. Stochastic bit-stuffing

• This analysis cannot be performed with RTaW-Sim

Page 52: Lekidis-iCC2013

1) Design challenges for CAN-based systems 2) Model-based design flow using BIP

• BIP overview • CAN protocol model • Application software modeling • Construction of the system model

3) Application and experimental results 4) Conclusion and ongoing work

Outline

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 31/35

Page 53: Lekidis-iCC2013

Summary

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 32/35

Proposed method: Rigorous design flow resolving effectively the current challenges in CAN-based systems • Encapsulates the primitives and communication

mechanisms of the CAN protocol • Separates software and hardware design issues • Fully automated and tool-supported • Leads to the construction of a mixed hardware and software

system model used for: • Performance analysis • Verification of functional and extra-functional properties • Code generation

• Conducted experiments on existing benchmarks illustrate the capabilities and the method’s scalability

Page 54: Lekidis-iCC2013

Ongoing work

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 33/35

• CAN protocol model • Selection of the most appropriate distribution for the

bit-stuffing and the period margin • Design flow for CAN FD-based systems

• Considered application software • MATLAB/Simulink to BIP translation

• Further extensions • Analysis and verification of properties using the

Statistical Model Checking BIP tool • Generation of optimal device configurations • Validation of CAN-higher layer protocols, such as

CANopen

Page 55: Lekidis-iCC2013

Extensions related to the CAN FD protocol

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 34/35

Applied only in the CAN protocol model

• Additional frame fields: • Flexible Data Format (FDF) bit

• If recessive, RTR bit becomes automatically disabled • Bit Rate Switch (BRS) bit

• Timing model: • Transmission of one bit will be shorter than one tick ( ) • Switch factor related to the selection of CAN hardware

components • The additional transmission time due to bit-stuffing in

CAN FD is:

bitτ

7 8 4stuffing bit

w lengthsC τ + + × = +

Page 56: Lekidis-iCC2013

Lekidis, Bozga, Mauuary, Bensalem A model-based design flow for CAN-based systems 35/35

Thank you for your attention. Further details: [email protected]