Main Content

Import AUTOSAR Composition from ARXML

After you create an AUTOSAR architecture model, develop the top-level AUTOSAR software design. The composition editor provides a view of AUTOSAR software architecture based on the AUTOSAR Virtual Function Bus (VFB).

If you have an ARXML description of an AUTOSAR software composition, you can import the composition into an AUTOSAR architecture model. The import creates a Simulink® representation of the composition at the top level of the architecture model.

Importing a composition requires an open AUTOSAR architecture model with no functional content. To import a composition, open the AUTOSAR Importer app or call the architecture function importFromARXML.

If you do not have an ARXML description to import, you can use the composition editor to add and connect AUTOSAR software compositions and components. See Add and Connect AUTOSAR Classic Components and Compositions or Add and Connect AUTOSAR Adaptive Components and Compositions.

Import AUTOSAR Composition Using AUTOSAR Importer App

The example in this section describes importing a classic architecture composition. The workflow for importing an adaptive composition is the same.

To import an AUTOSAR software composition from ARXML files into an architecture model:

  1. Create or open an AUTOSAR architecture model that has no functional content.

    archModel = autosar.arch.createModel("myArchModel");

    By default, autosar.arch.createModel creates an AUTOSAR architecture model for the Classic Platform. To specify the Adaptive Platform or explicitly specify the Classic Platform, use the platform name-value argument. Mixing classic and adaptive components in the same architecture model is not supported.

    archModel = autosar.arch.createModel("myArchModel","platform","Classic");
  2. On the Modeling tab, in the Platform section, note the platform kind for the architecture model.

    If needed, change the platform kind before importing ARXML files.

  3. On the Modeling tab, in the Component section, select Import from ARXML.

  4. In the AUTOSAR Importer app, in the Select ARXML pane, in the ARXML Files field, enter the names of one or more ARXML files (comma separated) that describe an AUTOSAR software composition.

    For this example, use ThrottlePositionControlComposition.arxml to import a classic architecture composition.


    Click Next. The app parses the specified ARXML file.

  5. In the Create Composition pane, the Composition name menu lists the compositions found in the parsed ARXML file. Select the composition /Company/Components/ThrottlePositionControlComposition.

    Optionally, to view additional modeling options for composition creation, select Configure Modeling Options.

    You can specify:

    • Simulink data dictionary in which to place data objects for imported AUTOSAR data types.

    • Names of existing Simulink behavior models to link to imported AUTOSAR components.

    When importing classic compositions, you can additionally specify:

    • Whether to include or exclude AUTOSAR software components, which define composition behavior. By default, the import includes components within the composition.

    • Component options to apply when creating Simulink behavior models for imported AUTOSAR software components. For example, how to model periodic runnables, or a PredefinedVariant or SwSystemconstantValueSets with which to resolve component variation points.

    For more information about modeling options and behavior, see importFromARXML.

  6. To finish importing the composition into the architecture model, click Finish. The Diagnostic Viewer displays the progress of the composition creation.

    On completion, the imported composition appears in the software architecture canvas.

Because this composition import was configured to include AUTOSAR classic software components (modeling option Exclude internal behavior from import was cleared), the import created Simulink models for each component in the composition.

Next you develop each component in the composition. For each component model, you refine the AUTOSAR configuration and create algorithmic model content. For an example of developing component algorithms, see Design and Simulate AUTOSAR Components and Generate Code, section "Develop AUTOSAR Component Algorithms".

Import AUTOSAR Composition By Calling importFromARXML

The example in this section describes importing a classic architecture composition. The workflow for importing an adaptive composition is the same.

You can access the AUTOSAR classic ARXML file ThrottlePositionControlComposition.arxml by using the openExample command.


To programmatically import an AUTOSAR software composition from ARXML files into an architecture model, call the importFromARXML function. This example:

  1. Creates AUTOSAR architecture model myArchModel.

  2. Imports software composition /Company/Components/ThrottlePositionControlComposition from AUTOSAR example file ThrottlePositionControlComposition.arxml into the architecture model.

% Create AUTOSAR architecture model
modelName = "myArchModel";
archModel = autosar.arch.createModel(modelName); % Defaults to the Classic Platform 

% Import composition from file ThrottlePositionControlComposition.arxml
importerObj = arxml.importer("ThrottlePositionControlComposition.arxml");  % Parse ARXML
Creating model 'ThrottlePositionSensor' for component 1 of 5:
Creating model 'ThrottlePositionMonitor' for component 2 of 5:
Creating model 'Controller' for component 3 of 5:
Creating model 'AccelerationPedalPositionSensor' for component 4 of 5:
Creating model 'ThrottlePositionActuator' for component 5 of 5:
Importing composition 1 of 1:

For more information about import options and behavior, see the importFromARXML reference page.

See Also

Related Topics