Main Content

Import AUTOSAR Software Component

In Simulink®, you can import an AUTOSAR software component description from ARXML files and create a model representing the AUTOSAR software component. You use the AUTOSAR ARXML importer, which is implemented as an arxml.importer object. For more information, see AUTOSAR ARXML Importer.

Use arxml.importer functions in the following order:

  1. Call the arxml.importer function to create an importer object that represents the software component information in the specified XML file or files. For example, this call specifies a main AUTOSAR software component file, mr_component.arxml, and related dependent files containing data type, implementation, and interface information that completes the software component description.

    ar = arxml.importer({'mr_component.arxml','mr_datatype.arxml',...

    This call specifies an ARXML file, ThrottlePositionControlComposition.arxml, which describes an AUTOSAR software composition and its aggregated AUTOSAR components. The ARXML file is located at matlabroot/examples/autosarblockset/data, which is on the default MATLAB® search path.

    ar = arxml.importer('ThrottlePositionControlComposition.arxml')

    If you enter the arxml.importer function call without a terminating semicolon (;), the importer lists the AUTOSAR content of the specified XML file or files. The information includes paths to software components in the AUTOSAR package structure, which you use in the next step.

    In this example, the path to software composition ThrottlePositionControlComposition is /Company/Components/ThrottlePositionControlComposition. The path to software component Controller is /Company/Components/Controller.

    ar =
    The file "path/ThrottlePositionControlComposition.arxml" contains:
      1 Composition-Software-Component-Type:
      2 Application-Software-Component-Type:
      3 Sensor-Actuator-Software-Component-Type:
  2. To import a parsed atomic software component or composition into a Simulink model, call function createComponentAsModel, createCompositionAsModel, or updateModel. If you have not specified all dependencies for the components, you will see errors.

    • createComponentAsModel — Create Simulink representation of AUTOSAR ARXML atomic software component.

      For example:


      The ModelPeriodicRunnablesAs property controls whether the importer models AUTOSAR periodic runnables as atomic subsystems with periodic rates (the default) or function-call subsystems with periodic rates. Specify AtomicSubsystem unless your design requires use of function-call subsystems. For more information, see Import AUTOSAR Software Component with Multiple Runnables.

      To import Simulink data objects for AUTOSAR data into a Simulink data dictionary, you can set the DataDictionary property on the model creation. If the specified dictionary does not already exist, the importer creates it.

      To explicitly designate an AUTOSAR runnable as the initialization runnable in a component, use the InitializationRunnable property on the model creation.

      For more information, see the createComponentAsModel reference page and the example Import AUTOSAR Component to Simulink.

    • createCompositionAsModel — Create Simulink representation of AUTOSAR ARXML software composition.

      For example:


      To include existing Simulink atomic software component models in the composition model, use the ComponentModels property on the composition model creation.

      For more information, see the createCompositionAsModel reference page and the example Import AUTOSAR Composition to Simulink.

    • updateModel — Update AUTOSAR model with ARXML changes.

      For example:

      ar2 = arxml.importer('ThrottlePositionControlComposition_updated.arxml');

      For more information, see the updateModel reference page, Import AUTOSAR Software Component Updates, and the example Import AUTOSAR Component to Simulink.

After you import your software component or composition into Simulink, you can develop the behavior and configuration of the component or composition model. To refine the component configuration, see AUTOSAR Component Configuration.

To configure AUTOSAR code generation options and XML export options, see Configure AUTOSAR Code Generation.

To help support the round trip of AUTOSAR elements between an AUTOSAR authoring tool (AAT) and the Simulink model-based design environment, ARXML import preserves imported AUTOSAR XML file structure, elements, and element universal unique identifiers (UUIDs) for ARXML export. For more information, see Round-Trip Preservation of AUTOSAR XML File Structure and Element Information.

See Also

Related Examples

More About