10 Best Practices for Deploying AUTOSAR
Using Simulink
By David Jaffry and Holly Keener
Contents
Glossary .....................................................................................................................................................................2
Introduction...............................................................................................................................................................3
Overview of Simulink Support for AUTOSAR ..................................................................................................4
Best Practices for Adopting AUTOSAR...............................................................................................................6
Learn More...............................................................................................................................................................20
Glossary
A discussion of AUTOSAR deployment involves many acronyms. Here is a short list of terms used in
this guide.
Acronym
Meaning
AAT
API
AUTOSAR authoring tool
Application programming interface
ARXML
AUTOSAR XML
AUTOSAR
AUTomotive Open System ARchitecture
BSW
CRL
ECU
IDE
OEM
PIL
RTE
SIL
SWC
V&V
XML
Basic software
Code Replacement Library (feature of Embedded Coder)
Electronic control unit
Integrated development environment
Original equipment manufacturer
Processor-in-the-loop
Run-time environment
Software-in-the-loop
Software component
Verification and validation
eXtensible Markup Language
2
10 Best Practices for Deploying AUTOSAR Using Simulink
Introduction
AUTOSAR
AUTOSAR (AUTomotive Open System ARchitecture) is a worldwide development partnership of
vehicle manufacturers, suppliers, and other companies from the electronics, semiconductor, and soft-
ware industry. The AUTOSAR standard is designed to enable software standardization, reuse, and
interoperability.
The AUTOSAR standard provides two platforms to support the current and the next generation of
automotive ECUs. The first is the Classic Platform, used for traditional applications such as pow-
ertrain, chassis, body and interior electronics, and so forth. The second is the Adaptive Platform, used
for new applications such as highly automated driving, Car-to-X, software updates over the air, or
vehicles as part of the Internet of Things. The Foundation AUTOSAR standard is introduced to
enforce interoperability between the AUTOSAR platforms.
MathWorks Support
MathWorks is an AUTOSAR Premium Member and actively participates in the development of the
standard with focus on how to use Model-Based Design with an AUTOSAR development process for
automotive electronic control units (ECUs). Using Simulink® and Embedded Coder® (Figure 1), you
can:
• Model AUTOSAR software components created in Simulink or imported from ARXML compo-
nent descriptions.
• Refine AUTOSAR component configuration and create algorithmic model content.
• Simulate AUTOSAR component interactions at the system level, including Basic Software services
such as NVRAM Manager and Diagnostic Event Manager.
• Generate ARXML component descriptions and algorithmic C code for testing in Simulink or inte-
gration into the AUTOSAR Runtime Environment (RTE).
This guide summarizes recommended best practices for AUTOSAR deployment with Simulink based
on substantial experience deploying AUTOSAR with Model-Based Design. The result is a process for
a systematic approach to enterprise-wide AUTOSAR development, designed to maximize benefits
while minimizing the costs, risks, and disruptions associated with achieving those benefits. These
recommendations are based on practical experience in guiding automotive OEM and supplier cus-
tomers in their model-based AUTOSAR deployment with MATLAB® and Simulink.
3
10 Best Practices for Deploying AUTOSAR Using Simulink
SOFTWARE ARCHITECTURE DEFINITION
APPLICATION LAYER
AUTOSAR
Software
Component 1
AUTOSAR
Software
Component 2
AUTOSAR
Software
Component n
BEHAVIOR
MODELING
AND CODE
GENERATION
RUNTIME ENVIRONMENT (RTE)
BASIC SOFTWARE
Services
Layer
Abstraction
Layer
- NVRAM Manager
- Diagnostics Event
Manager
Microcontroller
Abstraction
Layer
Complex
Drivers
BSW CONFIGURATION
AND RTE GENERATION
MODELING AND
SIMULATION
ECU HARDWARE
Figure 1. Classic AUTOSAR layered architecture.
Select a data management strategy
The top 10 best practices for effective AUTOSAR deployment with Simulink are:
1. Determine your strategy for migrating existing Simulink models to AUTOSAR
2. Use one AUTOSAR workflow
3.
4. Establish a modeling standard
5.
6. Use production code generation
7. Use Simulink to migrate legacy code to AUTOSAR
8. Automate, automate, automate
9. Plan ahead for ISO 26262
10. Actively plan for migration
Simulate before you generate code
Overview of Simulink Support for AUTOSAR
Let’s start with a quick review of how the Simulink product family supports AUTOSAR. You can use
Simulink and Stateflow® to design, implement, and verify AUTOSAR atomic software components
(SWCs). Each AUTOSAR software component can contain one or many entry point functions, which
are implemented in AUTOSAR as runnable entities. The AUTOSAR Target is an extension of
Simulink and Embedded Coder that allows a Simulink model to be mapped to AUTOSAR such that
4
10 Best Practices for Deploying AUTOSAR Using Simulink
Embedded Coder is able to generate AUTOSAR-compliant C code and AUTOSAR XML (ARXML)
files.
Specific aspects of the Simulink model are used to implement AUTOSAR concepts. Once you config-
ure a Simulink model to use the AUTOSAR Target, you can manage the AUTOSAR attributes and
map the Simulink model to AUTOSAR through the editor shown in Figure 2.
Figure 2. Simulink to AUTOSAR mapping.
You can select from several approaches and workflows when adopting AUTOSAR. Two common
approaches, which are depicted in Figure 3, are the top-down approach and the bottom-up approach.
Top-down approach
You start by designing the architecture of the system in the AUTOSAR authoring tool (AAT), then
generate ARXML files and import them into Simulink to generate a shell of a model. You then design
the Internal Behavior in Simulink. After validating your software component, you generate C code.
The AAT manages all ARXML files.
Bottom-up approach
You continue to use Simulink to develop and validate your software components. You export ARXML
files and import them into the AUTOSAR authoring tool. The AAT generates the run-time environ-
ment (RTE) and re-generates ARXML files of the SWC.
5
10 Best Practices for Deploying AUTOSAR Using Simulink
Figure 3. AUTOSAR workflows using Simulink. A top-down approach starts in the AUTOSAR authoring tool; a bottom-up
approach starts in Simulink.
Best Practices for Adopting AUTOSAR
1. Determine your strategy for migrating existing Simulink models to AUTOSAR
A common workflow is to use Simulink to design software algorithms prior to the adoption of
AUTOSAR (Figure 4). Deciding on a uniform approach for the development team to use in migrating
these designs from a non-AUTOSAR approach to AUTOSAR is important to ensure the team can use
common processes and tools. The three options for handling the migration of these designs to
AUTOSAR are:
• Clean sheet
• Complete migration to AUTOSAR
• One model for AUTOSAR and non-AUTOSAR
6
10 Best Practices for Deploying AUTOSAR Using Simulink
Figure 4. Code generation from Simulink.
Clean sheet
If you will be substantially redesigning the algorithms, starting with a “clean sheet” is the best
approach. You start the design process from requirements, and develop new Simulink models that are
well suited for AUTOSAR from the start (Figure 5). This option provides for the most flexibility in
getting the most out of AUTOSAR and Model-Based Design because there are no legacy design con-
straints. However, this option is only practical if there will be minimal reuse of those legacy
implementations.
7
10 Best Practices for Deploying AUTOSAR Using Simulink
Figure 5. Clean sheet migration.
Complete migration to AUTOSAR
If you need to reuse existing Simulink algorithms but will be abandoning your current software
architecture in favor of AUTOSAR, the best approach is to completely convert or migrate your
Simulink models to the optimal modeling style for AUTOSAR. You select the ideal Simulink model-
ing style and feature set for AUTOSAR and then plan to migrate each model to adopt this approach
(Figure 6). Where necessary, you should update the Simulink implementation to reflect this modeling
style. A best practice is to perform regression testing using simulations prior to and after changing
the Simulink model to ensure you have not introduced any change in the functionality. This approach
is an effective compromise between reuse of legacy implementations and taking advantage of
AUTOSAR with Model-Based Design.
Figure 6. Complete migration to AUTOSAR.
8
10 Best Practices for Deploying AUTOSAR Using Simulink