Main Content

createComponentAsModel

Create Simulink representation of AUTOSAR ARXML atomic software component

Description

createComponentAsModel(ar,ComponentName) creates a Simulink® model corresponding to AUTOSAR atomic software component ComponentName. The component description is part of AUTOSAR information previously imported from AUTOSAR XML files, which is represented by 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. The 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 XML description:

  • If the XML 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 XML 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 XML code is not accessed by a runnable, the importer does not create the corresponding inports, outports, or Simulink functions.

example

[mdl, sts] = createComponentAsModel(ar,ComponentName,Name,Value) specifies additional options for Simulink model creation with one or more Name,Value pair arguments.

Examples

collapse all

Import AUTOSAR software component /pkg/swc from XML 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','ModelPeriodicRunnablesAs','AtomicSubsystem')

Import AUTOSAR software component /pkg/swc from XML 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','ModelPeriodicRunnablesAs','FunctionCallSubsystem')

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

ar = arxml.importer('mySWC.arxml')
createComponentAsModel(ar,'/pkg/swc','ModelPeriodicRunnablesAs','AtomicSubsystem',...
  'DataDictionary','ardata.sldd')

Import AUTOSAR software component /pkg/swc from XML 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','ModelPeriodicRunnablesAs','AtomicSubsystem',...
  'InitializationRunnable','Runnable_Init')

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

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

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

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

Input Arguments

collapse all

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

Absolute short-name path of the atomic software component.

Example: '/Company/Powertrain/Components/ASWC'

Name-Value Arguments

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.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: 'ModelPeriodicRunnablesAs','AtomicSubsystem' directs the importer to model AUTOSAR periodic runnables as atomic subsystems with periodic rates.

Simulink data dictionary into which to import data objects corresponding to AUTOSAR data types in the XML file. If the specified dictionary does not already exist, the importer creates it. The model is then associated with that data dictionary.

Example: 'DataDictionary','ardata.sldd'

Name of an existing AUTOSAR runnable to select as the initialization runnable for the component.

Example: 'InitializationRunnable','Runnable_Init'

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 PredefinedVariant defined in the AUTOSAR XML file. A PredefinedVariant 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 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 AUTOSAR XML file. A SystemConstValueSet 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 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'}'

Whether to use bus element ports in place of Simulink inports and outports for port-based sender-receiver communication.

Example: 'UseBusElementPorts',true

Data Types: logical

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

  • true — Port-scoped Simulink functions and function callers are used.

  • false— Global Simulink functions and function callers are used.

Example: "UseFunctionPorts"=true

Data Types: logical

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

Example: "useValueTypes"=false

Data Types: logical

Output Arguments

collapse all

Variable that returns a handle to created model.

Variable that returns true if the import is successful. Otherwise, returns false.

Tips

  • If you enter the arxml.importer object 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 can specify in calls to createComponentAsModel and createCompositionAsModel.

  • When importing an AUTOSAR software component into a model, it is recommended that you explicitly specify the 'ModelPeriodicRunnablesAs' argument. This argument determines how the importer models AUTOSAR periodic runnables in the created model. See the argument description under Name-Value Arguments.

Version History

Introduced in R2008a

expand all