Configure AUTOSAR Runnable Execution Order

For AUTOSAR software components that contain multiple runnables, the AUTOSAR Timing Extensions specification defines execution order constraints. These constraints specify the execution order of runnable entities within a component.

In Simulink®, you can:

  • Import execution order constraints from ARXML files.

  • Open an AUTOSAR component model and use the Schedule Editor to modify the execution order of runnables.

  • Export execution order constraints to ARXML files.

  • Update execution order constraints in an AUTOSAR component model by importing ARXML changes.

In an AUTOSAR software component model, you can use the Schedule Editor to schedule and specify the execution order of runnables. The Schedule Editor is a scheduling tool that displays partitions in a model, the data connections between them, and the order of those partitions. In AUTOSAR component models, partitions correspond to runnable entities that execute independently. In the Schedule Editor, you can:

  • View a graphical representation of runnables as partitions in an AUTOSAR component.

  • Create partitions and map them to AUTOSAR runnables.

  • Directly specify the execution order of runnables.

The Schedule Editor supports multiple modeling styles, including rate-based and export-function modeling. For more information, see Using the Schedule Editor and Create Partitions.

You can also use the Schedule Editor in AUTOSAR architecture modeling. See Configure AUTOSAR Scheduling and Simulation.

For runnables in an AUTOSAR component model, the Schedule Editor initially displays implicit partitions, created based on the component modeling style. You can view and configure the implicit partitions or create explicit partitions and map them to new or existing AUTOSAR runnables.

To view and configure implicit partitions:

  1. Open AUTOSAR example model autosar_swc_expfcns, which uses Simulink exported functions to model AUTOSAR runnables.

  2. Open the Modeling tab and select Schedule Editor. The Schedule Editor displays the periodic exported functions, which map to AUTOSAR runnables, as implicit partitions.

    You can use the editor controls to reorder the partitions. For example, in the Order section, click directional arrows or drag table entries.

To create an explicit partition in an AUTOSAR software component:

  1. Open AUTOSAR example model autosar_swc, which models periodic runnables with multiple sample rates.

    Initially, from a Schedule Editor perspective, the model contains implicit partitions D1 and D2.

  2. To create a partition, open the block parameters dialog box for the SS1 subsystem and select Treat as atomic unit. Set parameter Schedule as to Periodic partition. Specify a partition name, such as P1, and sample time 1. Click Apply.

  3. Open the Modeling tab and select Schedule Editor. The Schedule Editor displays the explicit periodic partition in the model.

    For rate-based models, you can reorder only partitions that have the same rate. Because this model contains two partitions with different rates, the editor controls for reordering partitions are not available.

  4. In the model window, open the Code Mappings editor and select the Functions tab. Map the partition function P1 to an AUTOSAR runnable. If you need to add an AUTOSAR runnable, open the AUTOSAR Dictionary, Runnables view, and click the Add button . For this example, map P1 to runnable Runnable_1s.

Building an AUTOSAR model that contains execution order constraints exports component timing information. If you set the AUTOSAR Dictionary XML option Exported XML File Packaging to Modular, the timing information is exported into the file modelname_timing.arxml. Here is the execution order constraint exported for the runnables in autosar_swc, based on the Schedule Editor configuration.

<SWC-TIMING UUID="...">
    <SHORT-NAME>ASWC</SHORT-NAME>
    <TIMING-REQUIREMENTS>
        <EXECUTION-ORDER-CONSTRAINT UUID="...">
            <SHORT-NAME>EOC</SHORT-NAME>
            <ORDERED-ELEMENTS>
                <EOC-EXECUTABLE-ENTITY-REF UUID="...>
                    <SHORT-NAME>Runnable_1s</SHORT-NAME>
                    <EXECUTABLE-REF DEST="RUNNABLE-ENTITY">
                      /Company/Powertrain/Components/ASWC/ASWC_IB/Runnable_1s
                    </EXECUTABLE-REF>
                    <SUCCESSOR-REFS>
                        <SUCCESSOR-REF DEST="EOC-EXECUTABLE-ENTITY-REF">
                          /Timing/ASWC/EOC/Runnable_2s
                        </SUCCESSOR-REF>
                    </SUCCESSOR-REFS>
                </EOC-EXECUTABLE-ENTITY-REF>
                <EOC-EXECUTABLE-ENTITY-REF UUID="...">
                    <SHORT-NAME>Runnable_2s</SHORT-NAME>
                    <EXECUTABLE-REF DEST="RUNNABLE-ENTITY">
                      /Company/Powertrain/Components/ASWC/ASWC_IB/Runnable_2s
                    </EXECUTABLE-REF>
                </EOC-EXECUTABLE-ENTITY-REF>
            </ORDERED-ELEMENTS>
        </EXECUTION-ORDER-CONSTRAINT>
    </TIMING-REQUIREMENTS>
    <BEHAVIOR-REF DEST="SWC-INTERNAL-BEHAVIOR">
      /Company/Powertrain/Components/ASWC/ASWC_IB
    </BEHAVIOR-REF>
</SWC-TIMING>

See Also

Related Examples

More About