Main Content

Create Algorithmic Model Content That Represents AUTOSAR Software Component Behavior

AUTOSAR Blockset software supports AUTOSAR software component modeling for the AUTOSAR Classic Platform. To develop an AUTOSAR software component in Simulink®, create a Simulink model that represents the AUTOSAR 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 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 uses example model autosar_swc to show a sample model representation of an AUTOSAR software component.

  1. Open model autosar_swc.

  2. Explore the model components. The model consists of:

    • Periodic runnable Runnable_1s, which is configured with a sample rate of 1 second (In1_1s).

    • Periodic runnable Runnable_2s, which is configured with a sample rate of 2 seconds (In2_2s).

    • Initialize Function block, Runnable_Initialize, which initializes the integrator in Runnable 2s to a value of 1.

  3. Explore the model configuration.

    Model configuration parameter System target file is set to autosar.tlc. That system target file setting enables use of AUTOSAR Blockset software.

    To maximize execution efficiency, the model is configured for multitasking mode. Solver settings are:

    • Type is set to Fixed-step.

    • Solver is set to discrete (no continuous states).

    • Fixed-step size (fundamental sample time) is set to auto.

    • Treat each discrete rate as a separate task is selected.

    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. Red represents the fastest discrete rate. Green represents the second fastest discrete rate. Yellow represents a mixture of the two rates.

    Because the model has multiple rates and the Solver parameter Treat each discrete rate as a separate task is selected, the model simulates in multitasking mode. The model handles the rate transition for In2_2s explicitly by using the Rate Transition block.

    The Rate Transition block parameter Ensure deterministic data transfer is cleared to facilitate integration into an AUTOSAR run-time environment.

    Generated code for the model schedules subrates in the model. For this model, the rate for Inport block In2_2s, the green rate, is a subrate. The generated code properly transfers data between tasks that run at different rates.

Next, configure elements of the AUTOSAR software component for use in the Simulink modeling environment.

Related Topics