Main Content

createComponentAsModel

Create Simulink representation of AUTOSAR ARXML atomic software component

Description

[model,status] = createComponentAsModel(ar,ComponentName) creates a Simulink® model that corresponds to the AUTOSAR atomic software component ComponentName, and returns a handle to the model, represented by model, and a status indicating whether the action was successful, represented by status.

The component description is part of AUTOSAR information previously imported from AUTOSAR XML (ARXML) files, that are represented by the arxml.importer object ar. The importer creates an initial Simulink representation of the imported AUTOSAR component, with an initial default mapping of Simulink model elements to AUTOSAR component elements. This initial representation provides a starting point for further AUTOSAR configuration and Model-Based Design. For more information, see AUTOSAR ARXML Importer.

The initial representation of AUTOSAR component behavior in the created model depends on the ARXML description:

  • If the ARXML description of the component does not describe component behavior, the importer creates a model with a default representation of AUTOSAR runnables and ports.

  • If the ARXML description of the component describes component behavior, the importer creates a model based on AUTOSAR elements that are accessed in the component.

    For example, AUTOSAR ports must be accessed by runnables in order to generate the corresponding Simulink elements. If a sender-receiver or client-server port in ARXML is not accessed by a runnable, the importer does not create the corresponding inports, outports, or Simulink functions.

example

[model,status] = createComponentAsModel(ar,ComponentName,Name=Value) specifies options using one or more name-value arguments. For example, to direct the importer to model AUTOSAR periodic runnables as atomic subsystems with periodic rates, set ModelPeriodicRunnablesAs to "AtomicSubsystem".

Examples

collapse all

Import AUTOSAR software component /pkg/swc from ARXML file mySWC.arxml and create an initial Simulink representation of the component. Model AUTOSAR periodic runnables as atomic subsystems with periodic rates.

ar = arxml.importer("mySWC.arxml");
createComponentAsModel(ar,"/pkg/swc",ModelPeriodicRunnableAs="AtomicSubsystem");

Import AUTOSAR software component /pkg/swc from ARXML file mySWC.arxml and create an initial Simulink representation of the component. Model AUTOSAR periodic runnables as function-call subsystems with periodic rates.

ar = arxml.importer("mySWC.arxml");
createComponentAsModel(ar,"/pkg/swc",ModelPeriodicRunnableAs="FunctionCallSubsystem");

Import AUTOSAR software component /pkg/swc from ARXML file mySWC.arxml and create an initial Simulink representation of the component. Import Simulink data objects corresponding to AUTOSAR data types to data dictionary ardata.sldd.

ar = arxml.importer("mySWC.arxml");
createComponentAsModel(ar,"/pkg/swc",ModelPeriodicRunnableAs="AtomicSubsystem", ...
  DataDictionary="ardata.sldd");

Import AUTOSAR software component /pkg/swc from ARXML file mySWC.arxml and create an initial Simulink representation of the component. Configure AUTOSAR runnable Runnable_Init as the initialization runnable for the component.

ar = arxml.importer("mySWC.arxml");
createComponentAsModel(ar,"/pkg/swc",ModelPeriodicRunnableAs="AtomicSubsystem", ...
  InitializationRunnable="Runnable_Init");

Import AUTOSAR software component /pkg/swc from ARXML file mySWC.arxml and create an initial Simulink representation of the component. Use predefined variant Senior to resolve variation points in the component at model creation time.

ar = arxml.importer("mySWC.arxml");
createComponentAsModel(ar,"/pkg/swc",ModelPeriodicRunnableAs="AtomicSubsystem", ...
  PredefinedVariant="/pkg/body/Variants/Senior");

Import AUTOSAR software component /pkg/swc from ARXML file mySWC.arxml and create an initial Simulink representation of the component. Use system constant value sets A and B to resolve variation points in the component at model creation time.

ar = arxml.importer("mySWC.arxml");
createComponentAsModel(ar,"/pkg/swc",ModelPeriodicRunnableAs="AtomicSubsystem", ...
  SystemConstValueSets={"/pkg/body/SystemConstantValues/A","/pkg/body/SystemConstantValues/B"});

Input Arguments

collapse all

AUTOSAR information previously imported from ARXML files, specified as an arxml.importer object handle.

Absolute short-name path of the atomic software component specified as a character vector or string scalar.

Example: "/Company/Powertrain/Components/ASWC"

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: createComponentAsModel(ar,"/pkg/swc/",ModelPeriodicRunnablesAs="AtomicSubsystem")

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 model is then linked to that data dictionary.

Example: DataDictionary="ardata.sldd"

Name of an existing AUTOSAR runnable to select as the initialization runnable for the component, specified as a character vector or string scalar.

Example: InitializationRunnable="Runnable_Init"

Subsystem type for periodic runnables, specified as "AtomicSubsystem", "FunctionCallSubsystem", or "Auto". By default, createComponentAsModel imports AUTOSAR periodic runnables found in 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 predefined variant in the ARXML file, specified as a cell array of character vectors or a string array. A predefined variant describes a combination of system constant values among potentially multiple valid combinations to apply to an AUTOSAR software component. Use this argument to resolve variation points in the AUTOSAR software component at 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"

Paths to one or more system constant value sets defined in the ARXML file. A system constant value set specifies a set of system constant values to apply to an AUTOSAR software component. Use this argument to resolve variation points in the AUTOSAR software component at model creation time. If specified, the importer uses the system constant value sets to initialize 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 use bus element ports instead of Simulink inports and outports for port-based sender-receiver communication specified as numeric or logical 1 (true) or 0 (false).

Example: UseBusElementPorts=true

Data Types: logical

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

Output Arguments

collapse all

Handle of the model that corresponds to the specified AUTOSAR atomic software component ComponentName.

Success or failure status of the import, returned as one of these values:

  • true — The import was successful.

  • false — The import was not successful.

Tips

  • If you enter the arxml.importer object function call without a terminating semicolon, the importer lists the AUTOSAR content of the specified ARXML file or files. The information includes paths to software components in the AUTOSAR package structure, which you can specify in calls to createComponentAsModel and importFromARXML.

  • When importing an AUTOSAR software component into a model, it is recommended that you explicitly specify the ModelPeriodicRunnablesAs argument.

Version History

Introduced in R2008a

expand all