Main Content

linkToModel

Link AUTOSAR architecture component or composition to Simulink implementation model

Since R2020a

Description

example

linkToModel(component,modelName) links the specified AUTOSAR architecture component to existing Simulink® implementation model modelName. The component inherits the interface of the linked implementation model. The component argument is a component handle returned by a previous call to addComponent.

example

linkToModel(composition,modelName) links the specified AUTOSAR architecture composition to an existing Simulink implementation model modelName. The composition argument is a composition handle returned by a previous call to addComposition.

Examples

collapse all

In an architecture model, link an AUTOSAR component to a Simulink® implementation model. The component inherits the interface of the linked implementation model.

Create AUTOSAR architecture model and add component inside the architecture model

modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
component = addComponent(archModel,'SWC1');

Load 'autosar_tpc_controller' model and programmatically set the XML Options Source to 'Inherit'.

load_system('autosar_tpc_controller.slx');
arProps = autosar.api.getAUTOSARProperties('autosar_tpc_controller');
set(arProps,'XmlOptions','XmlOptionsSource','Inherit');

Link to Simulink implementation model and inherit its interface

linkToModel(component,'autosar_tpc_controller');

In an architecture model, link an AUTOSAR composition to a Simulink implementation model.

Create AUTOSAR architecture model and add a composition inside the architecture model.

modelName = 'myArchModel';
archModel = autosar.arch.createModel(modelName);
composition = addComposition(archModel,'Referenced_Sensors');

Open the 'autosar_tpc_composition' model and link it to the composition, Referenced_Sensors, in the Simulink implementation model, archModel.

openExample('autosar_tpc_composition');
linkToModel(composition, 'autosar_tpc_composition');

Input Arguments

collapse all

AUTOSAR architecture component to link to the specified Simulink implementation model. The argument is a component handle returned by a previous call to addComponent.

Example: component

AUTOSAR architecture composition to link to the specified Simulink implementation model. The argument is a composition handle returned by a previous call to addComposition.

Example: composition

Name of the Simulink implementation model to create, based on the specified AUTOSAR architecture component or composition. If not specified, modelName defaults to the name of the component or composition.

Example: 'SWC1'

Version History

Introduced in R2020a