Main Content

addComposition

Add composition to AUTOSAR architecture model

Description

compositions = addComposition(archCM,compNames) adds one or more compositions specified in the compNames argument to composition or architecture model archCM.

The archCM argument is a composition or architecture model handle returned by a previous call to addComposition, autosar.arch.createModel, or autosar.arch.loadModel. The compositions output argument returns one or more composition handles, which are autosar.arch.Composition objects.

example

compositions = addComposition(archCM,compNames,VariantName=VariantNameValue) adds a variant subsystem with variant component VariantNameValue.

example

Examples

collapse all

In an AUTOSAR classic architecture model, add a composition named Sensors. Inside the composition, add AUTOSAR sensor-actuator components named PedalSnsr and ThrottleSnsr.

Create an AUTOSAR Classic Platform architecture model.

modelName = "myArchModel";
archModel = autosar.arch.createModel(modelName);

Add a composition named Sensors to the architecture model.

composition = addComposition(archModel,"Sensors");

Add two Classic Component blocks to the composition.

names = ["PedalSnsr","ThrottleSnsr"];
sensorSWCs = addComponent(composition,names,Kind="SensorActuator");
layout(composition);

By default, autosar.arch.createModel creates an AUTOSAR architecture model for the Classic Platform, and compositions added to a classic architecture model support classic modeling components. Mixing classic and adaptive components in the same architecture model is not supported.

Since R2023a

In an AUTOSAR adaptive architecture model, add a composition named Sensors. Inside the composition, add two AUTOSAR adaptive application components named Sensor1 and Sensor2.

Create an AUTOSAR Adaptive Platform architecture model.

modelName = "myArchAdaptive";
archModel = autosar.arch.createModel(modelName,platform="Adaptive");

Add a composition named Sensors to the architecture model.

composition = addComposition(archModel,"Sensors");

Add two Adaptive Component blocks to the composition.

names = ["Sensor1","Sensor2"];
sensorSWCs = addComponent(composition,names,Kind="AdaptiveApplication");
layout(composition);

Compositions added to an adaptive architecture model support adaptive modeling components. Mixing classic and adaptive components in the same architecture model is not supported.

Input Arguments

collapse all

AUTOSAR composition or architecture model to which to add one or more compositions. The argument is a composition or architecture model handle returned by a previous call to addComposition, autosar.arch.createModel, or autosar.arch.loadModel.

Example: archModel

Names of the compositions to add to the specified composition or architecture model.

Example: ["Sensors","Actuators"]

Name of the variant subsystem, specified as a character vector or string scalar. The variant choices are added as Composition blocks contained with the variant subsystem specified by VariantNameValue and can be found by querying the architecture model for its compositions.

Example: "VariantCompositionBlock"

Data Types: char | string

Output Arguments

collapse all

Returns one or more AUTOSAR composition handles, which are autosar.arch.Composition objects, with composition properties.

Version History

Introduced in R2020a

expand all