Main Content

addComposition

Add composition to AUTOSAR architecture model

Description

example

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.

Examples

collapse all

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

% Create AUTOSAR architecture model
modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);

% Add a composition
composition = addComposition(archModel,'Sensors');

% Add 2 components inside Sensors
names = {'PedalSnsr','ThrottleSnsr'};
sensorSWCs = addComponent(composition,names,'Kind','SensorActuator');
layout(composition); % Auto-arrange layout

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'}

Output Arguments

collapse all

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

Introduced in R2020a