Main Content

importFromARXML

Import composition from ARXML files into AUTOSAR architecture model

Description

example

importFromARXML(archModel,arxmlInput,compQName) imports composition compQName from arxmlInput into architecture model archModel. The archModel argument is an architecture model handle returned by a previous call to autosar.arch.createModel or autosar.arch.loadModel. Composition import requires an open AUTOSAR architecture model with no functional content.

example

importFromARXML(archModel,arxmlInput,compQName,Name,Value) specifies additional import options with one or more Name,Value pair arguments. 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.

Examples

collapse all

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

This example shows the function call syntax to:

  1. Create an AUTOSAR architecture model with no functional content.

  2. Import AUTOSAR software composition /pkg/rootComposition from a file named mySWCs.arxml into the architecture model.

  3. For software components mySwc1 and mySwc2 contained within the composition, link existing Simulink component models rather than creating new ones.

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

% Import composition from ARXML file and link existing component models
importFromARXML(archModel,'mySWCs.arxml','/pkg/rootComposition',...
  'ComponentModels',{'mySwc1','mySwc2'})

This example shows the function call syntax to:

  1. Create an AUTOSAR architecture model with no functional content.

  2. Import AUTOSAR software composition /CompositionType/myComposition from a file named myComposition.arxml into the architecture model.

  3. For each software component contained within the composition, at component model creation time, use PredefinedVariant Senior to resolve variation points in the component.

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

% Import composition from ARXML file and use PredefinedVariant for components
importerObj = arxml.importer("MyComposition.arxml"); % Import AUTOSAR information
importFromARXML(archModel,importerObj,"/CompositionType/myComposition",...
  "PredefinedVariant","/pkg/body/Variants/Senior"););

Input Arguments

collapse all

AUTOSAR architecture model into which to import the specified composition. The argument is an architecture model handle returned by a previous call to autosar.arch.createModel or autosar.arch.loadModel.

Example: archModel

ARXML files from which to import the specified composition, specified as one of the following:

  • A handle to AUTOSAR information imported from ARXML files, previously returned by importerObj = arxml.importer(arxmlFiles).

  • One or more ARXML file names.

Example: importerObj, "myComposition.arxml"

Absolute short-name path (qualified name) of the composition to import into the specified composition or architecture model.

Example: "/CompositionType/myComposition"

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: 'DataDictionary','ardata.sldd' directs the importer to place data objects corresponding to imported AUTOSAR data types in the specified Simulink data dictionary.

Names of existing atomic software component models to link when creating a Simulink representation of the composition. For components contained within the composition, link the specified component behavior models instead of creating new ones.

Example: 'ComponentModels',{'mySwc1','mySwc2'}

Simulink data dictionary in which to place data objects corresponding to imported AUTOSAR data types. If the specified dictionary does not exist, the importer creates it. The composition and its components are then associated with that data dictionary.

Example: 'DataDictionary','ardata.sldd'

Specify whether to allow (default) or suppress the import of software components that define the behavior of the composition. If component import is suppressed (true), the import still links models specified by the ComponentModels argument.

Example: 'ExcludeInternalBehavior',true

By default, when importing a software component contained within a composition, importFromARXML imports AUTOSAR periodic runnables found in the ARXML files and models them as atomic subsystems with periodic rates. If conditions prevent use of atomic subsystems, the importer throws an error.

To model periodic runnables as function-call subsystems with periodic rates, specify FunctionCallSubsystem.

If you specify Auto, the importer attempts to model periodic runnables as atomic subsystems. If conditions prevent use of atomic subsystems, the importer models periodic runnables as function-call subsystems.

For more information, see Import AUTOSAR Software Component with Multiple Runnables.

Example: 'ModelPeriodicRunnablesAs','AtomicSubsystem'

Path to a PredefinedVariant defined in the ARXML files. A PredefinedVariant describes a combination of system constant values among potentially multiple valid combinations to apply to an AUTOSAR software component. Use this property to resolve variation points in the AUTOSAR software component at component model creation time. If specified, the importer uses the PredefinedVariant to initialize SwSystemconst data that serves as input to control variation points.

For more information, see Control AUTOSAR Variants with Predefined Value Combinations.

Example: 'PredefinedVariant','/pkg/body/Variants/Senior'

Paths to one or more SystemConstValueSets defined in the ARXML files. A SystemConstValueSet specifies a set of system constant values to apply to an AUTOSAR software component. Use this property to resolve variation points in the AUTOSAR software component at component model creation time. If specified, the importer uses the SystemConstValueSets to initialize SwSystemconst data that serves as input to control variation points.

For more information, see Control AUTOSAR Variants with Predefined Value Combinations.

Example: 'SystemConstValueSets','{'/pkg/body/SystemConstantValues/A','/pkg/body/SystemConstantValues/B'}'

Introduced in R2020b