createCompositionAsModel
Create Simulink representation of AUTOSAR ARXML software composition
Syntax
Description
createCompositionAsModel(
creates a Simulink® model corresponding to AUTOSAR software composition
ar
,CompositionName
)CompositionName
. The composition 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
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 with one or more mdl
, sts
] = createCompositionAsModel(ar
,CompositionName
,Name,Value
)Name,Value
pair
arguments.
Examples
Import AUTOSAR Composition
Import AUTOSAR software composition
/Company/Components/ThrottlePositionControlComposition
from the file ThrottlePositionControlComposition.arxml
. The
ARXML file is located at
,
which is on the default MATLAB® path. Create an initial Simulink representation of the composition.matlabroot
/examples/autosarblockset/data
ar = arxml.importer('ThrottlePositionControlComposition.arxml'); names = getComponentNames(ar,'Composition')
names = 1×1 cell array {'/Company/Components/ThrottlePositionControlComposition'}
createCompositionAsModel(ar,'/Company/Components/ThrottlePositionControlComposition');
Import AUTOSAR Composition and Include Existing Component Models
Import AUTOSAR software composition
/pkg/rootComposition
from XML 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 Composition and Use Data Dictionary
Import AUTOSAR software composition
/pkg/rootComposition
from XML file
mySWCs.arxml
and create an initial Simulink representation of the composition. Place Simulink data objects corresponding to AUTOSAR data types into data
dictionary ardata.sldd
.
ar = arxml.importer('mySWCs.arxml') createCompositionAsModel(ar,'/pkg/rootComposition','DataDictionary','ardata.sldd')
Import AUTOSAR Composition and Share AUTOSAR Dictionary
Import AUTOSAR software composition
/Company/Components/ThrottlePositionControlComposition
from the file ThrottlePositionControlComposition.arxml
. The
ARXML file is located at
,
which is on the default MATLAB path. Create an initial Simulink representation of the composition.matlabroot
/examples/autosarblockset/data
For each imported component, the importer stores sharable AUTOSAR properties,
such as interfaces and data types, in data dictionary
ardata.sldd
. Components within the composition can then
share the stored properties.
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 for 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 Composition and Model Periodic Runnables as Function-Call Subsystems
Import AUTOSAR software composition
/pkg/rootComposition
from XML 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 Composition and Use PredefinedVariant
to Resolve Variation Points
Import AUTOSAR software composition
/pkg/rootComposition
from XML file
mySWCs.arxml
and create an initial Simulink representation of the composition. Use
PredefinedVariant
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 Composition and Use SwSystemconstantValueSet
s to Resolve Variation Points
Import AUTOSAR software composition
/pkg/rootComposition
from XML file
mySWCs.arxml
and create an initial Simulink representation of the composition. Use
SwSystemconstantValueSet
s 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
ar
— arxml.importer
object
handle
AUTOSAR information previously imported from XML files, specified as an
arxml.importer
object handle.
CompositionName
— Composition path
character vector | string scalar
Absolute short-name path of the software composition.
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.
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.
ComponentModels
— Simulink component models
cell array of character vectors | string array
Names of existing atomic software component models to use when creating a Simulink representation of the composition. The function incorporates the specified existing component models in the composition model instead of creating new ones.
Example: 'ComponentModels',{'mySwc1','mySwc2'}
DataDictionary
— Simulink data dictionary
character vector | string scalar
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.
If you specify true
for the
'ShareAUTOSARProperties'
argument, the specified
data dictionary also stores sharable AUTOSAR properties, such as
interfaces and data types, for sharing among components in the
composition.
Example: 'DataDictionary','ardata.sldd'
ModelPeriodicRunnablesAs
— Subsystem type for periodic runnables
'Auto'
(default) | 'AtomicSubsystem'
| 'FunctionCallSubsystem'
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'
PredefinedVariant
— Path to AUTOSAR predefined variant
character vector | string scalar
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 AUTOSAR software components. Use this argument to resolve
variation points in AUTOSAR software components 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'
ShareAUTOSARProperties
— Add AUTOSAR component properties to shared dictionary
false
(default) | true
To improve the performance of common tasks in AUTOSAR composition modeling, composition import can store sharable component properties, such as interfaces and data types, into a Simulink data dictionary. Components within the composition can then share the 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 reduce component model file sizes.
The shared 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.
To share AUTOSAR properties, specify true
. For each
imported component, the function stores sharable AUTOSAR properties,
such as interfaces and data types, in the Simulink data dictionary specified by the
'DataDictionary'
argument. The
'DataDictionary'
argument must be
specified.
For more information, see Import AUTOSAR Composition and Share AUTOSAR Dictionary.
Example: 'ShareAUTOSARProperties',true
SystemConstValueSets
— Paths to one or more AUTOSAR system constant value sets
cell array of character vectors | string array
Paths to one or more SystemConstValueSet
s defined
in the AUTOSAR XML file. A SystemConstValueSet
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 SystemConstValueSet
s 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'}'
UseFunctionPorts
— Option to use Simulink function ports
false
or 0
(default) | true
or 1
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
Output Arguments
mdl
— Model handle
handle
Variable that returns a handle to created model.
sts
— Success or failure
true or false
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
createCompositionAsModel
and
createComponentAsModel
.
Version History
Introduced in R2017bR2024b: Import client-server ports as Simulink function ports for client-server communication
Starting in R2024b, you can specify the name-value argument UseFunctionPorts
to use port-scoped Simulink functions and function callers.
Commande MATLAB
Vous avez cliqué sur un lien qui correspond à cette commande MATLAB :
Pour exécuter la commande, saisissez-la dans la fenêtre de commande de MATLAB. Les navigateurs web ne supportent pas les commandes MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)