Main Content

Configure AUTOSAR Runnable Execution Order

For AUTOSAR Classic Platform 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. You can view and manipulate the constraints at the component level or, in AUTOSAR architecture models, at the Virtual Function Bus (VFB) level.

In Simulink®, you can:

  • Import component- and VFB-level execution order constraints from ARXML files.

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

  • Export component- and VFB-level execution order constraints to ARXML files.

  • In a component model, update execution order constraints by importing ARXML changes.

In an AUTOSAR software component model, use the Schedule Editor to schedule and specify the execution order of the runnables belonging to that component. The Schedule Editor 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 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.

In a standalone AUTOSAR component model, to open the Schedule Editor, open the Modeling tab and select Schedule Editor. For the 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.

    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 matlabroot/help/toolbox/autosar/examples/mAutosarMultitasking.slx, which models periodic runnables that have multiple sample rates.

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

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

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

  4. In the model window, open the Code Mappings editor and select the Functions tab. Map the P1 partition function to an AUTOSAR runnable.

    1. If the configuration does not contain an AUTOSAR runnable to map, add a runnable. Open the AUTOSAR Dictionary, Runnables view, and click the Add button . For this example, create runnable Runnable_P1. Then select the runnable and create a timing event.

    2. In the Functions tab, map P1 to Runnable_P1.

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. This ARXML code shows the execution order constraint exported for the runnables in mAutosarMultitasking, based on the Schedule Editor configuration.

<SWC-TIMING UUID="...">
    <SHORT-NAME>mAutosarMultitasking</SHORT-NAME>
    <TIMING-REQUIREMENTS>
        <EXECUTION-ORDER-CONSTRAINT UUID="...">
            <SHORT-NAME>EOC</SHORT-NAME>
            <ORDERED-ELEMENTS>
                <EOC-EXECUTABLE-ENTITY-REF UUID="...">
                    <SHORT-NAME>Runnable_Step</SHORT-NAME>
                    <EXECUTABLE-REF DEST="RUNNABLE-ENTITY">
                      /pkg/swc/mAutosarMultitasking/IB/Runnable_Step
                    </EXECUTABLE-REF>
                    <SUCCESSOR-REFS>
                        <SUCCESSOR-REF DEST="EOC-EXECUTABLE-ENTITY-REF">
                          /Timing/mAutosarMultitasking/EOC/Runnable_P1
                        </SUCCESSOR-REF>
                    </SUCCESSOR-REFS>
                </EOC-EXECUTABLE-ENTITY-REF>
                <EOC-EXECUTABLE-ENTITY-REF UUID="...">
                    <SHORT-NAME>Runnable_P1</SHORT-NAME>
                    <EXECUTABLE-REF DEST="RUNNABLE-ENTITY">
                      /pkg/swc/mAutosarMultitasking/IB/Runnable_P1
                    </EXECUTABLE-REF>
                    <SUCCESSOR-REFS>
                        <SUCCESSOR-REF DEST="EOC-EXECUTABLE-ENTITY-REF">
                          /Timing/mAutosarMultitasking/EOC/Runnable_Step1
                        </SUCCESSOR-REF>
                    </SUCCESSOR-REFS>
                </EOC-EXECUTABLE-ENTITY-REF>
                <EOC-EXECUTABLE-ENTITY-REF UUID="...">
                    <SHORT-NAME>Runnable_Step1</SHORT-NAME>
                    <EXECUTABLE-REF DEST="RUNNABLE-ENTITY">
                      /pkg/swc/mAutosarMultitasking/IB/Runnable_Step1
                    </EXECUTABLE-REF>
                    <SUCCESSOR-REFS>
                        <SUCCESSOR-REF DEST="EOC-EXECUTABLE-ENTITY-REF">
                          /Timing/mAutosarMultitasking/EOC/Runnable_Step2
                        </SUCCESSOR-REF>
                    </SUCCESSOR-REFS>
                </EOC-EXECUTABLE-ENTITY-REF>
                <EOC-EXECUTABLE-ENTITY-REF UUID="...">
                    <SHORT-NAME>Runnable_Step2</SHORT-NAME>
                    <EXECUTABLE-REF DEST="RUNNABLE-ENTITY">
                      /pkg/swc/mAutosarMultitasking/IB/Runnable_Step2
                    </EXECUTABLE-REF>
                    <SUCCESSOR-REFS>
                        <SUCCESSOR-REF DEST="EOC-EXECUTABLE-ENTITY-REF">
                          /Timing/mAutosarMultitasking/EOC/Runnable_Step3
                        </SUCCESSOR-REF>
                    </SUCCESSOR-REFS>
                </EOC-EXECUTABLE-ENTITY-REF>
                <EOC-EXECUTABLE-ENTITY-REF UUID="...">
                    <SHORT-NAME>Runnable_Step3</SHORT-NAME>
                    <EXECUTABLE-REF DEST="RUNNABLE-ENTITY">
                      /pkg/swc/mAutosarMultitasking/IB/Runnable_Step3
                    </EXECUTABLE-REF>
                </EOC-EXECUTABLE-ENTITY-REF>
            </ORDERED-ELEMENTS>
        </EXECUTION-ORDER-CONSTRAINT>
    </TIMING-REQUIREMENTS>
    <BEHAVIOR-REF DEST="SWC-INTERNAL-BEHAVIOR">
      /pkg/swc/mAutosarMultitasking/IB
    </BEHAVIOR-REF>
</SWC-TIMING>

See Also

Related Examples

More About