Main Content

importFromARXML

Import compositions and components from ARXML files into AUTOSAR architecture model

Since R2020b

Description

importFromARXML(archElementOrModel,arxmlInput,compQName) imports composition or component compQName from arxmlInput into the composition, component, or architecture model archElementOrModel.

example

importFromARXML(archElementOrModel,arxmlInput,compQName,Name=Value) specifies additional import options using one or more name-value arguments. For example, you can specify:

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

  • To import AUTOSAR data types as data objects stored in a Simulink® data dictionary.

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

  • Component options and how to model periodic runnables when creating Simulink behavior models from imported AUTOSAR software components.

  • To use a predefined variant or system constant value set to resolve component variation points.

  • To import client-server ports as Simulink function ports in the created Simulink behavior models.

  • To import AUTOSAR data types as Simulink.ValueType objects.

example

Examples

collapse all

Create an AUTOSAR Blockset architecture model and import an AUTOSAR composition.

Access the relevant ARXML file and create an AUTOSAR architecture model.

openExample("ThrottlePositionControlComposition.arxml");
modelName = "myArchModel";
archModel = autosar.arch.createModel(modelName);

Use an arxml.importer object to import an AUTOSAR composition from ARXML file ThrottlePositionControlComposition.arxml.

importerObj = arxml.importer("ThrottlePositionControlComposition.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

Import AUTOSAR compositions and link them to existing component models.

Create an AUTOSAR architecture model with no functional content.

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

Import AUTOSAR software composition /pkg/rootComposition from ARXML file mySWCs.arxml into the architecture model. For software components mySwc1 and mySwc2 contained within the composition, link existing Simulink component models rather than creating new ones.

importFromARXML(archModel,"mySWCs.arxml","/pkg/rootComposition", ...
  ComponentModels={'mySwc1','mySwc2'})

Import an AUTOSAR composition defined in an arxml.importer object, resolve variation points for the imported composition by providing the full path to a predefined variant in the imported ARXML files.

Create an AUTOSAR architecture model with no functional content.

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

Import AUTOSAR software composition /CompositionType/myComposition from ARXML file myComposition.arxml into the architecture model. For each software component contained within the composition, at component model creation time, use predefined variant Senior to resolve variation points in the component.

importerObj = arxml.importer("MyComposition.arxml"); 
importFromARXML(archModel,importerObj,"/CompositionType/myComposition", ...
  PredefinedVariant="/pkg/body/Variants/Senior");

Input Arguments

collapse all

AUTOSAR component, composition, or architecture model to import the composition or component specified by compQName into.

AUTOSAR information previously imported from ARXML files, specified as one of these:

  • An arxml.importer object handle.

  • One or more ARXML file names, specified as a character vector, string scalar, cell array of character vectors, or string array.

Example: "myComposition.arxml"

Example: ["myComposition.arxml","myDataTypes.arxml"]

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

Example: "/CompositionType/myComposition"

Example: "/Components/myComponent"

Name-Value Arguments

collapse all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: importFromARXML(archModel,importerObj,"/CompositionType/myComposition", PredefinedVariant="/pkg/body/Variants/Senior");

Names of existing atomic software component models to link when creating a Simulink representation of the composition, specified as a cell array of character vectors or string array. The function incorporates the specified existing component models in the composition model instead of creating new ones.

Example: ComponentModels=["mySwc1","mySwc2"]

Simulink data dictionary to import data objects corresponding to AUTOSAR data types in the ARXML file into, specified as a character vector or string scalar. If the specified dictionary does not exist, the importer creates it. The composition and its components are then linked to that data dictionary.

Example: DataDictionary="ardata.sldd"

Option to allow or suppress the import of software components that define the behavior of the composition, specified as numeric or logical 1 (true) or 0 (false). When suppressing the component model behavior the import still links models specified by the ComponentModels name-value argument.

Example: ExcludeInternalBehavior=true

Option to define an imported composition as a model or subsystem, specified as "Model" or "Subsystem".

Example: ImportCompositionAs="Model"

For imported components, the subsystem type for periodic runnables, specified as one of these values:

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

  • "AtomicSubsystem" — 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 reports an error.

  • "FunctionCallSubsystem" — Model periodic runnables as function-call subsystems with periodic rates.

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

Example: ModelPeriodicRunnablesAs="FunctionCallSubsystem"

For imported components, the path to a predefined variant defined in the ARXML files, specified as a character vector or string scalar. A predefined variant 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 predefined variant to initialize software system constant 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"

For imported components, paths to one or more system constant value sets defined in the ARXML files. A system constant value set 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 software system constant to initialize software system constant 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"]

Option to import client-server ports as Simulink function ports, specified as numeric or logical 1 (true) or 0 (false).

  • true — Use port-scoped Simulink functions and function callers.

  • false — Use global Simulink functions and function callers.

Example: UseFunctionPorts=true

Data Types: logical

Option to import AUTOSAR data types as Simulink.ValueType data type objects, specified as numeric or logical 1 (true) or 0 (false).

Example: UseValueTypes=true

Data Types: logical

Version History

Introduced in R2020b

expand all