Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

From Simulink to AUTOSAR: Enabling

AUTOSAR Code Generation with


Model-Based Design
Durvesh Kulkarni

© 2015 The MathWorks, Inc.


1
Agenda

 Introduction to AUTOSAR
 Simulink approach to AUTOSAR
 Overview of Modeling SWCs & Modeling Styles
 AUTOSAR Design Workflows
 Bottom Up, Top Down & Round Trip
 Advanced Topics – Top 5
 Startup, Reset, and Shutdown Modeling
 Basic Software (BSW) Access
 J-MAAB Type B Architecture
 Mode Management (ModeSenderPorts, ModeSwitchPoints, …)
 Variability inside a Software Component
 Getting Started Resources

2
What is AUTOSAR?
AUTOSAR® (AUTomotive Open System ARchitecture) is an open and
standardized automotive software architecture

Application Layer

RTE

ECU Abstraction Layer Complex


Services
Layer Basic Software Device
Drivers

Microcontroller Abstraction Layer

ECU Hardware

3
2.0
90 files
Components specification

2.1
120 files
Body and Interior Electronics APIs…

3.0
125 files
APIs for Powertrain, Chassis…

3.1
129 files
DCM, DEM Revisions...

3.2
136 files
Added safety concepts…

RTE Enhancements...
AUTOSAR Releases
4.0
183 files
Complexity of Classic AUTOSAR is growing

Variant Handling for


4.1

Application Interfaces...
198 files

Efficient NV Data
Handling via RTE…
4.2
227 files

Crypto Interface,
4.3

www.autosar.org

V2X support……..
238 files

4
AUTOSAR Standards

Classic Platform Adaptive Platform

OSEK based POSIX based

ROM Execution App. loaded into RAM

Same address space App. Has own address space

Signal Communication Service Communication


(CAN)
Static Task Schedule Dynamic Task Schedule

C Programming C++ Programming

www.autosar.org 5
AUTOSAR Adoption

6
Video

7
AUTOSAR Members
11 Development
9 Core Partners
Members

88 Associate Members
57 Premium Member 17 Attendees

General Generic Standard Tools and Semi-


OEM Tier 1 Software Services conductors

www.autosar.org 8
AUTOSAR Support from Embedded Coder and Simulink
Authoring Tools Software Architecture Definition

Application Layer Behavior


AUTOSAR Software AUTOSAR Software ………. AUTOSAR Software Modeling
Component 1 Component 2 Component n & Code
Generation

Run Time Environment (RTE)


BSW Configuration
Modeling and & RTE Generation
Simulation
Basic Software
Basic SW Providers
ECU Abstraction Layer
Complex Device
Services Layer
Basic Software Drivers

Microcontroller Abstraction Layer

ECU Hardware

9
Agenda

 Introduction to AUTOSAR
 Simulink approach to AUTOSAR
 Overview of Modeling SWCs & Modeling Styles
 AUTOSAR Design Workflows
 Bottom Up, Top Down & Round Trip
 Advanced Topics – Top 5
 Startup, Reset, and Shutdown Modeling
 Basic Software (BSW) Access
 J-MAAB Type B Architecture
 Mode Management (ModeSenderPorts, ModeSwitchPoints, …)
 Variability inside a Software Component
 Getting Started Resources

10
Simulink Approach to AUTOSAR

Available via web Simulink and Embedded Coder No separate


download + AUTOSAR Support package for Embedded Coder AUTOSAR
Blockset needed

C Code and
ARXML
Import Export

Code-generation
through Mapping

11
AUTOSAR Schema Versions
Seamless support for AUTOSAR
Releases

 Import detects AUTOSAR 2.x – 4.x release


from ARXML file
MATLAB Release AUTOSAR Release
 User selects AUTOSAR release from
configuration set options for code generation R2015b, R2016a/b, R2017a 2.1, 3.0, 3.1, 3.2 (Rev 3.2.2), 4.0, 4.1, 4.2 (Rev 4.2.1, 4.2.2)
and ARXML export R2014b, R2015a 2.1, 3.0, 3.1, 3.2, 4.0, 4.1 (Rev 4.1.1)
R2012a/b, R2013a/b, R2014a 2.1, 3.0, 3.1, 3.2, 4.0 (Rev 4.0.2)

R2011b 2.0, 2.1, 3.0, 3.1, 3.2


R2010a/b, R2011a 2.0, 2.1, 3.0, 3.1
R2009a/b 2.0, 2.1, 3.0
R2008a/b 2.0, 2.1

12
Agenda

 Introduction to AUTOSAR
 Simulink approach to AUTOSAR
 Overview of Modeling SWCs & Modeling Styles
 AUTOSAR Design Workflows
 Bottom Up, Top Down & Round Trip
 Advanced Topics – Top 5
 Startup, Reset, and Shutdown Modeling
 Basic Software (BSW) Access
 J-MAAB Type B Architecture
 Mode Management (ModeSenderPorts, ModeSwitchPoints, …)
 Variability inside a Software Component
 Getting Started Resources

15
Model AUTOSAR Components
Application Layer

AUTOSAR
Software … AUTOSAR
Software
Component 1 Component n

Virtual Functional Bus (VFB)

Periodic Rate-Based

Periodic & Asynchronous

Multi-Rate & Asynchronous 16


Modeling AUTOSAR Communication

 Ports in a AUTOSAR software component allow for


communication

 Categories of ports based on direction


– Require port
– Provide port

 Each port can have either of the following Interfaces

17
Supported Events for a Runnable

Each Runnable should have at least one event attached

18
Agenda

 Introduction to AUTOSAR
 Simulink approach to AUTOSAR
 Overview of Modeling SWCs & Modeling Styles
 AUTOSAR Design Workflows
 Bottom Up, Top Down & Round Trip
 Advanced Topics – Top 5
 Startup, Reset, and Shutdown Modeling
 Basic Software (BSW) Access
 J-MAAB Type B Architecture
 Mode Management (ModeSenderPorts, ModeSwitchPoints, …)
 Variability inside a Software Component
 Getting Started Resources

19
Bottom-Up Workflow (Starting from Simulink)
AUTOSAR Authoring Tool

Import
SWC Description

Export SWC Description/


Generate SWC C code

AUTOSAR design
(Meta-model)

20
Using MATLAB for automating common tasks

%% Setup AUTOSAR Configuration programmatically

model = ‘Average_VehicleSpeed_Calculation';

% Modify AUTOSAR Properties


autosarProps = autosar.api.getAUTOSARProperties(model);
set(autosarProps, 'Input', 'IsService', true);
set(autosarProps, 'XmlOptions', 'ArxmlFilePackaging','SingleFile');

% Modify Simulink Mapping to AUTOSAR


slMap = autosar.api.getSimulinkMapping(model);
mapInport(slMap, 'Input' , 'Input', 'Input' , 'ExplicitReceive');
mapOutport(slMap, 'Output' , 'Output', 'Output' , 'ExplicitSend');

21
Top-Down Workflow (Starting from SWC Description)
AUTOSAR Authoring Tool

Export Merge
SWC Description SWC Description

Import Export SWC Description/


SWC Description Generate SWC C code

Model Based
Design

22
Top Down Workflow
Top Down Workflow
AUTOSAR Authoring Tool
Starts with Authoring Tool, then user
exports ARXML files from Authoring tool.

User can then either import the ARXML


files into a new Simulink Skeleton model
or Update an existing Simulink Model.

ARXML FIles

Update existing Simulink model


Import as new Simulink model

OR

23
Updating Existing Models from ARXML
V1.arxml Updated to V2.arxml

26
Update Existing Models from ARXML

27
Round-Trip Workflow
AUTOSAR Authoring Tool

Export Merge
SWC Description SWC Description

Export SWC Description/


Merge
Generate SWC C code
SWC Description

28 28
ARXML Import using Vector DaVinci
AUTOSAR Authoring Tool

Export Merge
SWC Description SWC Description

Export SWC Description/


Merge
Generate SWC C code
SWC Description

29 29
Verification with Software- and Processor-In-The-Loop (PIL)
 Support for SIL/PIL with AUTOSAR target

 Profile code and measure execution time on target

 Develop a custom PIL target for AUTOSAR using the toolchain


build approach

30
MISRA C:2012 for AUTOSAR target

100% Compliance with MISRA C:2012 Mandatory and Required rules

31
Agenda

 Introduction to AUTOSAR
 Simulink approach to AUTOSAR
 Overview of Modeling SWCs & Modeling Styles
 AUTOSAR Design Workflows
 Bottom Up, Top Down & Round Trip
 Advanced Topics – Top 5
 Startup, Reset, and Shutdown Modeling
 Basic Software (BSW) Access
 J-MAAB Type B Architecture
 Mode Management (ModeSenderPorts, ModeSwitchPoints, …)
 Variability inside a Software Component
 Getting Started Resources

32
j
Startup, Reset, and Shutdown Modeling

33
AUTOSAR Startup, Reset, and Shutdown Modeling

New Simulink blocks for Initialize


Function and Terminate Function

 You can map each Simulink initialize, reset, or


terminate entry-point function to an
AUTOSAR runnable
 All modeling styles are supported
– Flexibility to use either Rate-Based or Export
function modeling style
 Less wiring is required
 Can perform SIL

» rtwdemo_autosar_swc

34
k
Basic Software (BSW) Access

35
AUTOSAR Basic Software (BSW) block library

Simulate BSW including Diagnostic


Event Manager (DEM) and NVRAM
Manager (NvM)

 Out of the box solution for calls to AUTOSAR BSW


services
– Drag and drop DEM/NvM blocks for Basic
Software simulation
– Everything is preconfigured

» rtwdemo_autosar_nvm_emulation

36
Power Up Power Down AUTOSAR NvM Emulation

 Initialize, Reset & Terminate Blocks can be


effectively used to model Start Up and Shut
Down functionalities.

 System Level Modelling of AUTOSAR


Components & Services Basic Software
blocks can be used.

37
l
J-MAAB Type B Support

38
AUTOSAR J-MAAB Type B Modeling

R2016b adds support for JMAAB type beta


modelling in AUTOSAR models

 This model shows the implementation


leveraging periodic and asynchronous rates
(sample times).
 Asynchronous function-call runnable at the
top level of the model interacts with a periodic
rate-based runnable.
 Model type B (β) — Places function layers
above scheduling layers.

» rtwdemo_autosar_swc_fcncalls

39
m
Mode Management (ModeSenderPorts, ModeSwitchPoints, …)

40
AUTOSAR ModeSenderPorts and ModeSwitchPoints

Modeling of AUTOSAR Mode-Switch (M-S)


communication

 Ability to model application mode manager


components, including AUTOSAR mode
sender ports.
 Mode sender ports output a mode switch to
connected mode user components.

41
n
Variability inside a Software Component

42
Variants in AUTOSAR component modeling

Create variants for Ports and Runnables

 Import Variation Points on Ports and


Runnables into Simulink
 Model using Variant Source and Variant Sink
blocks
 Validate variant conditions on blocks match
designed behavior from imported ARXML
files

43
Agenda

 Introduction to AUTOSAR
 Simulink approach to AUTOSAR
 Overview of Modeling SWCs & Modeling Styles
 AUTOSAR Design Workflows
 Bottom Up, Top Down & Round Trip
 Advanced Topics – Top 5
 Startup, Reset, and Shutdown Modeling
 Basic Software (BSW) Access
 J-MAAB Type B Architecture
 Mode Management (ModeSenderPorts, ModeSwitchPoints, …)
 Variability inside a Software Component
 Getting Started Resources

44
http://www.mathworks.com/hardware-support/autosar.html 45
http://www.mathworks.com/matlabcentral/fileexchange/47890-embedded-coder-support-package-for-autosar-standard 46
AUTOSAR Training Module

47
48
And one last thing …
AUTOSAR – Antagonizing the „German Coast Guard“ Effect

Source: https://youtu.be/zkalf0odHs8 German Coast Guard Commercial 'We are Sinking' [HD]
49
Speaker Details Contact MathWorks India
Email: Durvesh.Kulkarni@mathworks.in Products/Training Enquiry Booth
LinkedIn: https://www.linkedin.com/in/durvesh- Call: 080-6632-6000
kulkarni-17402527/
Email: info@mathworks.in

Your feedback is valued.


Please complete the feedback form provided to you.

50

You might also like