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).

Starting at the top level of the architecture model, use the composition editor and the Simulink® Toolstrip Modeling tab to add and connect AUTOSAR software compositions and components. See Add and Connect AUTOSAR Compositions and Components.

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.

Composition import 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.

Import AUTOSAR Composition By Using AUTOSAR Importer App

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. For example, enter this MATLAB® command:

    archModel = autosar.arch.createModel("myArchModel");
  2. In the open architecture model, on the Modeling tab, select Import from ARXML.

  3. 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, enter ThrottlePositionControlComposition.arxml. The ARXML file is located at matlabroot/examples/autosarblockset/data, which is on the default MATLAB search path.

    Click Next. The app parses the specified ARXML file.

  4. 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:

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

    • 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 software components.

    • 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.

  5. 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 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

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.

The ARXML file is located at matlabroot/examples/autosarblockset/data, which is on the default MATLAB search path.

% Create AUTOSAR architecture model
modelName = "myArchModel";
archModel = autosar.arch.createModel(modelName);

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

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

See Also

Related Topics