createCompositionAsModel
Create Simulink representation of AUTOSAR ARXML software composition
Syntax
Description
[
creates a Simulink® model that corresponds to the AUTOSAR atomic software composition
model,status] = createCompositionAsModel(ar,CompositionName)CompositionName, and returns a handle to the model,
represented by model, and a status indicating whether the
action was successful, represented by
status.
The composition 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
composition.
The initial representation provides a starting point for further AUTOSAR
configuration and Model-Based Design. For more information, see AUTOSAR ARXML Importer.
[
specifies additional options for Simulink model creation using one or more name-value arguments. For example, to
direct the importer to model AUTOSAR periodic runnable as atomic subsystems with
periodic rates, set model,status] = createCompositionAsModel(ar,CompositionName,Name=Value)ModelPeriodicRunnablesAs to
"AtomicSubsystem".
Examples
Import AUTOSAR software composition
/Company/Components/ThrottlePositionControlComposition
from ARXML file ThrottlePositionControlComposition.arxml, and
create an initial Simulink representation of the composition.
openExample("ThrottlePositionControlComposition.arxml"); ar = arxml.importer("ThrottlePositionControlComposition.arxml"); names = getComponentNames(ar,"Composition")
names =
1×1 cell array
{'/Company/Components/ThrottlePositionControlComposition'}createCompositionAsModel(ar,"/Company/Components/ThrottlePositionControlComposition");Import AUTOSAR software composition
/pkg/rootComposition from ARXML file
mySWCs.arxml and create an initial Simulink representation of the composition. For components
mySwc1 and mySwc2 contained within the
composition, use existing Simulink component models rather than creating new ones.
ar = arxml.importer("mySWCs.arxml") createCompositionAsModel(ar,"/pkg/rootComposition",ComponentModels={"mySwc1","mySwc2"})
Import AUTOSAR software composition
/pkg/rootComposition from ARXML file
mySWCs.arxml and create an initial Simulink representation of the composition. Import Simulink data objects corresponding to AUTOSAR data types to data
dictionary ardata.sldd.
ar = arxml.importer("mySWCs.arxml") createCompositionAsModel(ar,"/pkg/rootComposition",DataDictionary="ardata.sldd")
Import AUTOSAR software composition
/Company/Components/ThrottlePositionControlComposition
from ARXML file ThrottlePositionControlComposition.arxml, and
create an initial Simulink representation of the composition.
For each imported component, the importer stores shareable AUTOSAR component
properties, such as interfaces and data types, in data dictionary
ardata.sldd. Components within the composition can then
share the stored properties.
openExample("ThrottlePositionControlComposition.arxml"); ar = arxml.importer("ThrottlePositionControlComposition.arxml") createCompositionAsModel(ar,"/Company/Components/ThrottlePositionControlComposition",... ModelPeriodicRunnablesAs="Auto",... DataDictionary="ardata.sldd",ShareAUTOSARProperties=true);
To view the shared properties, open the AUTOSAR Dictionary of a component
model. This example opens ThrottlePositionSensor. Expand
the AUTOSAR Dictionary node ardata.sldd. You can view
read-only properties, such as shared component interfaces, and modify XML
options for composition and component export.
autosar_ui_launch("ThrottlePositionSensor")
Import AUTOSAR software composition
/pkg/rootComposition from ARXML file
mySWCs.arxml and create an initial Simulink representation of the composition. Model AUTOSAR periodic
runnables as function-call subsystems with periodic rates.
ar = arxml.importer("mySWCs.arxml") createCompositionAsModel(ar,"/pkg/rootComposition",... ModelPeriodicRunnablesAs="FunctionCallSubsystem")
Import AUTOSAR software composition
/pkg/rootComposition from ARXML file
mySWCs.arxml and create an initial Simulink representation of the composition. Use predefined variant
Senior to resolve variation points in components at model
creation time.
ar = arxml.importer("mySWCs.arxml") createCompositionAsModel(ar,"/pkg/rootComposition",... PredefinedVariant="/pkg/body/Variants/Senior");
Import AUTOSAR software composition
/pkg/rootComposition from ARXML file
mySWCs.arxml and create an initial Simulink representation of the composition. Use system constant values
A and B to resolve variation points in
components at model creation time.
ar = arxml.importer("mySWCs.arxml") createCompositionAsModel(ar,"/pkg/rootComposition",... SystemConstValueSets={'/pkg/body/SystemConstantValues/A','/pkg/body/SystemConstantValues/B'});
Input Arguments
AUTOSAR descriptions from imported ARXML files, specified as an arxml.importer object handle.
Absolute short-name path of the software composition specified as a character vector or string scalar.
Example: "/Company/Powertrain/Components/RootComposition"
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.
Example: createCompositionAsModel(ar,"/pkg/rootComposition",ModelPeriodicRunnablesAs="AtomicSusbsytem")
Names of existing atomic software component models to use when creating a Simulink representation of the composition, specified as a cell array of character vectors or a 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 model is then linked to that data dictionary.
If you specify true for the
ShareAUTOSARProperties name-value argument, the
specified data dictionary also stores shareable AUTOSAR component
properties, such as interfaces and data types, for sharing among
components in the composition.
Example: DataDictionary="ardata.sldd"
Subsystem type for periodic runnables, specified as
"AtomicSubsystem",
"FunctionCallSubsystem", or
"Auto".
By default, createCompositionAsModel imports
AUTOSAR periodic runnables found in ARXML files and
attempts to model them as atomic subsystems with periodic rates. If
conditions prevent use of atomic subsystems, the function models the
periodic runnables as function-call subsystems with periodic
rates.
To model periodic runnables only as atomic subsystems, specify
"AtomicSubsystem". If conditions prevent use of
atomic subsystems, the function throws an error.
To model periodic runnables only as function-call subsystems, specify
"FunctionCallSubsystem".
For more information, see Import AUTOSAR Software Component with Multiple Runnables.
Example: ModelPeriodicRunnablesAs="AtomicSubsystem"
Option to automatically open composition model, specified as numeric
or logical 1 (true) or
0 (false).
Example: OpenModel=false
Data Types: logical
Path to a predefined variant in an ARXML file. A predefined variant describes a combination of system constant values among potentially multiple valid combinations to apply to AUTOSAR software components. Use this argument to resolve variation points in AUTOSAR software components 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"
Option to add AUTOSAR component properties to a shared data
dictionary, specified as a numeric or logical 1
(true) or 0
(false). To share AUTOSAR component properties,
specify ShareAUTOSARProperties as
true and specify a Simulink data dictionary by using the
DataDictionary name-value argument. For each
imported component, the function stores shareable AUTOSAR component
properties, such as interfaces and data types, in the Simulink data dictionary specified by using the
DataDictionary name-value argument.
Sharing stored AUTOSAR component properties in a Simulink data dictionary can improve the performance of common tasks in AUTOSAR composition modeling. Once component properties are stored in a data dictionary, components within the composition can then share those stored properties. For compositions containing more than 20 software components, sharing AUTOSAR properties among components can significantly improve performance for composition workflows, including import, dictionary navigation, AUTOSAR validation, and code generation. Limiting property replication among components can also reduce component model file sizes.
The AUTOSAR Dictionary provides a central location for viewing and configuring AUTOSAR composition and component properties. You can view read-only properties, such as shared component interfaces, and modify XML options for composition and component export.
For more information, see Import AUTOSAR Composition and Share AUTOSAR Dictionary.
Example: ShareAUTOSARProperties=true
Paths to one or more system constant value sets defined in the ARXML file, specified as a cell array of character vectors or a string array. A system constant value set specifies a set of system constant values to apply to AUTOSAR software components. Use this argument to resolve variation points in AUTOSAR software components at model creation time. If specified, the importer uses the system constant value sets 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
Output Arguments
Handle of the model that corresponds to the specified AUTOSAR software
composition CompositionName.
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 importFromARXML and createComponentAsModel.
Version History
Introduced in R2017bStarting in R2026a, you can choose whether to automatically open the composition
model after you create it by setting the OpenModel name-value
argument.
Starting in R2025a, you can specify whether to import AUTOSAR data types as
Simulink.ValueType objects by using the
UseValueTypes name-value argument.
Starting in R2024b, you can specify the name-value argument UseFunctionPorts to use port-scoped Simulink functions and function callers.
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)