Main Content

Manage Shared Interfaces and Data Types for AUTOSAR Architecture Models

Interface dictionaries enable interfaces, data types, and AUTOSAR-specific design data to be authored, managed, and shared between AUTOSAR components and compositions modeled in Simulink®. Interface dictionaries provide scalability for system-level and multicomponent designs by containing these shared elements in a central location.

You can programmatically or graphically configure the attributes and contents of an interface dictionary and apply them to an architecture model using this basic workflow:

  1. Create an interface dictionary.

  2. Design interface and data types with the interface dictionary API or the standalone Interface Editor.

  3. Link the interface dictionary to an architecture model.

  4. Apply the interfaces to the architecture model in the Simulink environment.

  5. Deploy the interface dictionary shared interface and data type content in the final application.

To migrate data stored in the base workspace or in a data dictionary hierarchy to the interface dictionary associated with an architecture model, use the interface dictionary Migrator object.

Create Interface Dictionary

To create an interface dictionary programmatically, use the Simulink.interface.dictionary.create function.

% create new interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI = Simulink.interface.dictionary.create(dictName);

Alternatively, to create an interface dictionary from the AUTOSAR architecture model toolstrip, on the Modeling tab, open the Design menu and select New Interface Dictionary from the Interfaces and Types section.

Design menu on the Modeling tab with the Interfaces and Types section highlighted

Design Data Types and Interfaces by Using Interface Dictionary

Once you create your interface dictionary, you can add design data programmatically by using the interface dictionary API or interactively by using the standalone Interface Editor. These tools allow you to author shared elements outside of the context of a particular component or composition and allow multiple team members to share in the definition and management of these elements.

Add Design Data Programmatically

To programmatically create, configure, and manage interfaces and data types in your interface dictionary, use the functions for the Simulink.interface.Dictionary object.

Here, use type-specific functions to add alias types, numeric types, value types, structured types, and enumerations to the interface dictionary.

% add DataTypes
%% AliasTypes
myAliasType1 = dictAPI.addAliasType('aliasType', BaseType='single');
myAliasType1.Name = 'myAliasType1';
myAliasType1.BaseType = 'fixdt(1,32,16)';
myAliasType2 = dictAPI.addAliasType('myAliasType2');
% can also use interface dict type objs
myAliasType2.BaseType = myAliasType1;
%% EnumType
myEnumType1 = dictAPI.addEnumType('myColor');
myEnumType1.addEnumeral('RED', '0', 'RED BLOOD');
myEnumType1.addEnumeral('BLUE', '1', 'Blue Skies');
myEnumType1.DefaultValue = 'BLUE';
myEnumType1.Description = 'I am a Simulink Enumeration';
myEnumType1.StorageType = 'int16';
% set base type of an alias type to be this enum object
myAliasType3 = dictAPI.addAliasType('myAliasType3');
myAliasType3.BaseType = myEnumType1;

%% NumericType
myNumericType1 = addNumericType(dictAPI, 'myNumericType1');
myNumericType1.DataTypeMode = "Single";
%% ValueType
myValueType1 = dictAPI.addValueType('myValueType1');
myValueType1.DataType = 'int32';
myValueType1.Dimensions = '[2 3]';
myValueType1.Description = 'I am a Simulink ValueType';
myValueType1.DataType = myEnumType1; % can also use interface dict type objs
%% StructType
myStructType1 = dictAPI.addStructType('myStructType1');
structElement1 = myStructType1.addElement('Element1');
structElement1.Type.DataType = 'single';
structElement1.Type.Dimensions = '3';
structElement2 = myStructType1.addElement('Element2');
structElement2.Type = myValueType1;
% or
structElement2.Type = 'ValueType: myValueType1';
%% Nested StructType
myStructType2 = dictAPI.addStructType('myStructType2');
myStructType2.Description = 'I am a nested structure';
structElement = myStructType2.addElement('Element');
structElement.Dimensions = '5';
structElement.Type = myStructType1;
% or
structElement.Type = 'Bus: myStructType1';

Add communication interfaces and their data elements.

nvInterface1 = dictAPI.addDataInterface('NV1');

dataElm1 = nvInterface1.addElement('DE1');
dataElm1.Type = myValueType1;
dataElm2 = nvInterface1.addElement('DE2');
dataElm2.Type = myStructType2;
dataElm2.Dimensions = '4';
dataElm2.Description = 'I am a data element with datatype = array of struct type';
% data element with owned type
dataElm3 = nvInterface1.addElement('DE3');
dataElm3.Type.DataType = 'single';
dataElm3.Type.Dimensions = '10';
dataElm3.Type.Minimum = '-5';
srInterface2 = dictAPI.addDataInterface('SR1');

Then, create, configure, and manage platform-specific properties.

% now add AUTOSARClassic mapping
platformMapping = dictAPI.addPlatformMapping('AUTOSARClassic');
% set platform properties
    'Package', '/Interface2', 'InterfaceKind', 'NvDataInterface');
% get the platform properties
[pNames, pValues] = platformMapping.getPlatformProperties(nvInterface1);
% managing AUTOSAR Classic platform related elements (these don't have mapping to Simulink)
arObj = autosar.api.getAUTOSARProperties(dictName);
arObj.addPackageableElement('SwAddrMethod','/SwAddressMethods', 'VAR1', 'SectionType', 'Var');
    'SwAddrMethod', 'VAR1', 'SwCalibrationAccess', 'ReadWrite', 'DisplayFormat', '%.3f');

Add Design Data Using Standalone Editor

Alternatively, you can add design data by using the standalone Interface Editor. To open the editor from outside of the context of a model:

  • Double-click the .sldd file from the MATLAB® Current Folder browser.

  • Use the show function of the interface dictionary object.

  • Enter interfaceeditor at the MATLAB command prompt.

To open the standalone editor from a model:

  • In the Simulink editor of an AUTOSAR architecture model, on the Modeling tab, open the Design menu and select Edit Interface Dictionary.

  • In the Model Explorer, under the External Data node for the model, select the interface dictionary, then click Open Interface Editor from the Dialog pane.

The standalone Interface Editor with an interface selected. The Properties section includes the AUTOSAR property InterfaceKind.

With the standalone Interface Editor, you can create, configure, and manage design data.

  • Create — On the toolstrip, in the Create section, add data type definitions and interfaces. Data types and interfaces each have a dedicated tab for data management.

  • Configure — In the right panel, use the Details pane to configure your data. The Details pane can also display platform-specific properties. For example, when you set the deployment platform to AUTOSAR Classic, Details displays AUTOSAR interface communication properties such as InterfaceKind, IsService, and Package. Setting these properties under Details sets them in the generated interface dictionary .sldd file.

  • Manage — You can filter, sort, and search data on the Interfaces and Data Types tabs.

In addition to the Interfaces and Data Types tabs, the Interface Editor displays platform-specific software address method data for the AUTOSAR Classic Platform in the SwAddrMethods tab.

For more information on using the standalone editor, see Interface Editor.

Link Interface Dictionary to Architecture Model

Once you have a saved interface dictionary, you can link it to your architecture model. Link a dictionary to a model programmatically as follows.

% open a previously defined interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI =;

% create AUTOSAR arch model and link interface dictionary
archModel = autosar.arch.createModel('myTopArchModel');
Alternatively, to link an existing interface dictionary from the AUTOSAR architecture model toolstrip, on the Modeling tab, open the Design menu and select Link Interface Dictionary from the Interfaces and Types section. When you create a component model from an AUTOSAR architecture model, Simulink automatically links it to the interface dictionary.

Use Data Dictionary with Interface Dictionary

The design also allows regular data dictionaries to coexist with an interface dictionary. This approach allows for proper scoping and encapsulation of the data in your model hierarchy.

  • Model workspace — Contains parameters and signal definitions that are scoped to the model.

  • Data dictionary — Contains configuration sets, values, and variants that can be shared with other components but should be separate from interface definitions.

  • Interface dictionary — Contains interface and data type definitions that can be shared across components.

On the left, an interface dictionary linked directly to two component models. On the right, an interface dictionary indirectly referenced from the data dictionaries of the two component models.

To use both dictionaries, first link a data dictionary to a component model, then reference the interface dictionary from the data dictionary.

  1. Create an empty model.

  2. In the Simulink Editor, on the model canvas, right-click and select Model Properties.

  3. In the Model Properties dialog box, create a new data dictionary or link to an existing dictionary.

    Adding a data dictionary on the External Data tab in the Model Properties dialog box

  4. Click the model data badge in the bottom left corner of the model, then click the External Data link.

  5. In the Model Explorer Model Hierarchy pane, under the External Data node, select the node for the data dictionary.

  6. In the Dialog pane, in the Referenced Dictionaries section, add your interface dictionary as a referenced dictionary.

    In the Model Explorer, in the Dialog pane, adding an interface dictionary as a referenced dictionary.

Apply Interfaces to Architecture Model in Simulink Environment

Once your interface dictionary is linked to an AUTOSAR architecture model, you can apply the interfaces to your modeled AUTOSAR application programmatically by using the AUTOSAR architecture model API, or by using the Interface Editor in the Simulink editor window.

Here, you link a dictionary with an AUTOSAR Classic platform mapping to an architecture model then map a SenderPort to an interface in that dictionary.

% open previously created interface dictionary
dictName = 'MyInterfaces.sldd';
dictAPI =;

% link interface dictionary to an AUTOSAR arch model 
archModel = autosar.arch.createModel('myTopComposition'); 

pport = archModel.addPort("Sender", 'PPort');

Alternatively, you can apply the interfaces to your AUTOSAR architecture model by using the Interface Editor or Property Inspector. In the AUTOSAR architecture model toolstrip, on the Modeling tab, open the Design menu and select Interface Editor. The editor opens as a pane in the current Simulink Editor window.

AUTOSAR architecture model with one port and the Interface Editor docked at the bottom. The Property Inspector is docked on the right side.

The primary focus of this model-centric editor is applying interfaces to ports. It displays the available interfaces in the linked interface dictionary. By using Interface Editor you can:

  • Right-click on an interface to assign the interface to a selected port on the canvas.

  • Trace between ports and interfaces

  • Focus on a particular interface by using the Port Interface View

  • Use the Property Inspector to view and configure a selected interface

  • Add data interfaces in the AUTOSAR architecture model. These interfaces can be mapped to SenderReceiverInterface, ModeSwitchInterface, or NvDataInterface by using the Property Inspector.

Deploy Interface Dictionary

Finally, to deploy an interface dictionary to a particular platform, you must provide a mapping of the dictionary elements to the platform. When you build an AUTOSAR architecture model, the build process exports an interface dictionary that is linked to the model as ARXML into a folder with the interface dictionary name. This ensures that the interfaces and types defined in the dictionary are included in the ARXML. In addition, the created ZIP file includes the ARXML files that come out of the dictionary.

Export directory structure with Interface Dictionary folder that contains interface dictionary ARXML files highlighted.

You can also export an interface dictionary independently of an architecture model by using the standalone Interface Editor or the interface dictionary API. In the Interface Editor, in the Share section, select Export > Export to ARXML. To export programmatically, use the following commands.

platformMapping = dictAPI.getPlatformMapping('AUTOSARClassic');


Some limitations for the interface dictionary include:

  • An AUTOSAR classic component model cannot reference multiple interface dictionaries.

  • Interface dictionary reference hierarchies are not supported for interface dictionaries mapped to the AUTOSAR Classic Platform.

  • The editor for the interface dictionary can only view and edit data interfaces. To author and view other kinds of interfaces for AUTOSAR workflows, such as client/server, parameter and trigger interfaces, open the AUTOSAR component dictionary.

    An AUTOSAR component dictionary showing Client Server interfaces.

  • The interface dictionary does not support the import of AUTOSAR information from an ARXML.

See Also

| | | | | | | | |

Related Topics