Main Content

createComponentAsModel

Create万博1manbetxrepresentation of AUTOSAR ARXML atomic software component

Description

example

createComponentAsModel(ar,ComponentName)creates a Simulink®com AUTOSAR原子模型相应的软件ponentComponentName. The component description is part of AUTOSAR information previously imported from AUTOSAR XML files, which is represented byarxml.importerobjectar.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, seeAUTOSAR 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.

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

Examples

collapse all

Import AUTOSAR software component/pkg/swcfrom XML filemySWC.arxmland 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/swcfrom XML filemySWC.arxmland 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/swcfrom XML filemySWC.arxmland create an initial Simulink representation of the component. Place Simulink data objects corresponding to AUTOSAR data types into data dictionaryardata.sldd.

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

Import AUTOSAR software component/pkg/swcfrom XML filemySWC.arxmland create an initial Simulink representation of the component. Configure AUTOSAR runnableRunnable_Initas 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/swcfrom XML filemySWC.arxmland create an initial Simulink representation of the component. UsePredefinedVariantSenior 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/swcfrom XML filemySWC.arxmland create an initial Simulink representation of the component. UseSwSystemconstantValueSets 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 anarxml.importerobject handle.

Absolute short-name path of the atomic software component.

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

Name-Value Arguments

Specify optional pairs of arguments asName1=Value1,...,NameN=ValueN, whereNameis the argument name andValueis 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 encloseNamein 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,createComponentAsModelimports 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 specifyAuto, 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, seeImport AUTOSAR Software Component with Multiple Runnables.

Example:'ModelPeriodicRunnablesAs','AtomicSubsystem'

Path to aPredefinedVariantdefined in the AUTOSAR XML file. APredefinedVariantdescribes 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 thePredefinedVariantto initializeSwSystemconstdata that serves as input to control variation points.

For more information, seeControl AUTOSAR Variants with Predefined Value Combinations.

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

Paths to one or moreSystemConstValueSets defined in the AUTOSAR XML file. ASystemConstValueSetspecifies 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 theSystemConstValueSets to initializeSwSystemconstdata that serves as input to control variation points.

For more information, seeControl AUTOSAR Variants with Predefined Value Combinations.

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

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 thearxml.importerobject 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 tocreateComponentAsModelandcreateCompositionAsModel.

  • 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 underName-Value Pair Arguments.

Version History

Introduced in R2008a