Create Algorithmic Model Content That Represents AUTOSAR Adaptive Software Component Behavior
AUTOSAR Blockset software supports AUTOSAR software component modeling for the AUTOSAR Adaptive Platform. To develop an AUTOSAR adaptive software component in Simulink®, create a Simulink model that represents the AUTOSAR adaptive software component. Initiate the model creation in one of these ways:
Import an existing AUTOSAR XML (ARXML) component description into the Simulink environment as a model. You import a component description by using the AUTOSAR ARXML importer.
Rework an existing Simulink model into a representation of the AUTOSAR adaptive software component.
Starting from an AUTOSAR Blockset model template, create a Simulink model.
After creating an initial model design, refine the algorithmic content.
This tutorial shows a sample model representation of an AUTOSAR adaptive software component.
Open model
LaneGuidance
.Explore the model. It consists of a subsystem,
LaneGuidanceAlgorithm
. The subsystem has six inports, which represent required ports of the AUTOSAR adaptive software component:leftLaneDistance
,leftTurnIndicator
,leftCarInBlindSpot
,rightLaneDistance
,rightTurnIndicator
, andrightCarInBlindSpot
. Two outports represent provider ports:leftHazardIndicator
andrightHazardIndicator
.Set model configuration parameter System target file to
autosar_adaptive.tlc
. That system target file setting enables use of AUTOSAR Blockset software and affects other model configuration parameter settings. For example:Language is set to
C++
.Generate code only is selected.
Toolchain is set to
AUTOSAR Adaptive | CMake
.Code interface packaging is set to
C++ class
.
At the top level of the model, set up event-based communication. An AUTOSAR adaptive software component provides and consumes services. Each component contains:
An algorithm that performs tasks in response to received events
Required and provided ports, each associated with a service interface
Service interfaces, with associated events and associated namespaces
AUTOSAR Blockset provides Event Receive and Event Send blocks to make the necessary event and signal connections.
After each root inport, add an Event Receive block, which converts an input event to a signal while preserving the signal values and data type.
Before each root outport, add an Event Send block, which converts an input signal to an event while preserving the signal values and data type.
To expedite the block insertion, you can copy the event blocks from the completed version of the example model
autosar_LaneGuidance
.Explore the model configuration. Solver settings are:
Type is set to
Fixed-step
.Solver is set to
auto (Automatic solver selection)
.Fixed-step size (fundamental sample time) is set to
1/10
.Periodic same time constraint is set to
Unconstrained
.
In the Simulink Editor, you can enable sample time color-code by selecting the Debug tab and selecting Diagnostics > Information Overlays > Colors. A sample time legend shows the implicit rate grouping. The legend for this model shows that the model uses a single rate of 0.1 second. The model simulates in single-tasking mode.
Save the model to a writable folder on your current MATLAB® search path. Name the file
my_autosar_LaneGuidance.slx
.
Next, configure elements of the AUTOSAR adaptive software component for use in the Simulink modeling environment.