Create AUTOSAR Software Component in Simulink
To create a Simulink® representation of an AUTOSAR software component, import an AUTOSAR XML component description into a new model or create a component in an existing model.
To create an AUTOSAR software component in an existing model, use one of these resources:
AUTOSAR Component Quick Start — Creates a mapped AUTOSAR software component for your model and opens the model in the AUTOSAR code perspective.
Simulink Start Page — Provides AUTOSAR Blockset model templates as a starting point for AUTOSAR software development.
Alternatively, if you have Simulink Coder™ and Embedded Coder® software, you can use the Embedded Coder Quick Start. To create an AUTOSAR software component for your model, open Embedded Coder Quick Start from the Embedded Coder C Code tab or the AUTOSAR Blockset AUTOSAR tab. As you work through the quick-start procedure, in the Output window, select output option C code compliant with AUTOSAR or C++ code compliant with AUTOSAR Adaptive Platform.
Create Mapped AUTOSAR Component with Quick Start
To create a mapped AUTOSAR software component using the AUTOSAR Component Quick Start:
Open a Simulink component model for which an AUTOSAR software component is not mapped. This example uses AUTOSAR example model
swc. For adaptive component creation, you can use AUTOSAR example model
In the model window:
Open the Configuration Parameters dialog box, Code Generation pane, and set the system target file to either
autosar_adaptive.tlc. Click OK.
On the Apps tab, click AUTOSAR Component Designer. Because the model is unmapped, the AUTOSAR Component Quick Start opens.
To configure the model for AUTOSAR software component development, work through the quick-start procedure.
In the Set Component pane:
For a Classic Platform software component, specify an AUTOSAR short name, package path, and component type, or accept default values.
Component types include
ServiceProxy. The most common types are
SensorActuator. For more information, see Import AUTOSAR Software Composition with Atomic Software Components (Classic Platform).
For an Adaptive Platform software component, specify an AUTOSAR short name and package path.
For the Classic Platform, you can also map a submodel referenced from an AUTOSAR software component model. For more information, see Map Calibration Data for Submodels Referenced from AUTOSAR Component Models.
If you are creating a Classic Platform software component, a Set Interfaces pane opens.
In the Set Interfaces pane, select an option for creating component interface properties.
If you select Create defaults based on the Simulink model, at the conclusion of the quick-start procedure, the software creates component interface properties by applying AUTOSAR defaults to the model.
If you select Import from ARXML, an ARXML Files field opens. Specify one or more AUTOSAR XML files containing shared AUTOSAR element definitions (not AUTOSAR software component descriptions). For more information, see Import and Reference Shared AUTOSAR Element Definitions.
The Finish pane opens.
When you click Finish, your model opens in the AUTOSAR code perspective. To continue configuring the component model, see AUTOSAR Component Configuration.
Create Mapped AUTOSAR Component with Simulink Start Page
The Simulink Start Page provides AUTOSAR Blockset model templates as a starting point for AUTOSAR software component development. You can select either a Classic Platform or Adaptive Platform component template and click Create Model. (If you have System Composer™ software, you can also select an architecture model template. For more information, see Create AUTOSAR Architecture Models.)
The created model is preconfigured with AUTOSAR system target file and other code generation settings, but is not yet mapped to an AUTOSAR software component. After you examine and refine the template model, use the AUTOSAR Component Quick Start (or potentially the Embedded Coder Quick Start) to map the model to an AUTOSAR software component. For example:
Open the Simulink Start Page. For example, enter the MATLAB® command
simulinkor open a new model from the MATLAB or Simulink toolstrip.
The Start Page opens. On the New tab, scroll down to AUTOSAR Blockset and expand the product row.
Place your cursor over the template you want to use and click Create Model. A model based on the template opens. (The Simulink Start Page closes.)
In this example, the created model is a starting point for developing a software component for the AUTOSAR Classic Platform.
Explore the model and refine the configuration according to your requirements. Optionally, you can develop the component behavior. To map the model to an AUTOSAR software component, use the AUTOSAR Component Quick Start. On the Apps tab, click AUTOSAR Component Designer. Because the model is unmapped, the AUTOSAR Component Quick Start opens.
Work through the quick-start procedure. If necessary, refer to Create Mapped AUTOSAR Component with Quick Start. When you click Finish, your model opens in the AUTOSAR code perspective. To continue configuring the component model, see AUTOSAR Component Configuration