Main Content

autosar.dictionary.ARClassicPlatformMapping

Manage AUTOSARClassic platform attributes for dictionary elements such as interfaces

    Description

    The autosar.dictionary.ARClassicPlatformMapping object provides methods that help you manage the platform properties.

    Creation

    To create an autosar.dictionary.ARClassicPlatformMapping object, use the addPlatformMapping function.

    % after creating a Simulink.interface.dictionary object, dictAPI,
    % you can create a platformMapping object 
    platformMapping = dictAPI.addPlatformMapping('AUTOSARClassic');

    Object Functions

    exportDictionaryExport an interface dictionary in AUTOSAR Classic platform mapping
    getPlatformPropertiesGet AUTOSAR Classic platform properties for interface dictionary
    getPlatformPropertyGet an AUTOSAR Classic platform property for interface dictionary
    setPlatformPropertySet a platform property for Simulink Interface Dictionary in AUTOSAR Classic platform mapping

    Examples

    collapse all

    This example creates a Simulink.interface.dictionary object and configures the dictionary contents. This example also shows how to manage AUTOSAR Classic platform-related elements.

    Create interface dictionary.

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

    Add data types.

    %% Alias Types
    myAliasType1 = addAliasType(dictAPI, 'aliasType', BaseType='single');
    myAliasType1.Name = 'myAliasType1';
    myAliasType1.BaseType = 'fixdt(1,32,16)';
     
    myAliasType2 = addAliasType(dictAPI, 'myAliasType2');
    % can also use interface dict type objs
    myAliasType2.BaseType = myAliasType1;
     
    %% Enum Types
    myEnumType1 = addEnumType(dictAPI,'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 = addAliasType(dictAPI, 'myAliasType3');
    myAliasType3.BaseType = myEnumType1;
     
    %% ValueType
    myValueType1 = addValueType(dictAPI, '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 = addStructType(dictAPI, '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 = addStructType(dictAPI, 'myStructType2');
    myStructType2.Description = 'I am a nested structure';
    structElement = myStructType2.addElement('Element');
    structElement.Dimensions = '5';
    structElement.Type = myStructType1;
    % or
    structElement.Type = 'Bus: myStructType1';

    Add some interfaces, configure design data on data elements.

    dataInterface1 = addDataInterface(dictAPI, 'DataInterface');
     
    dataElm1 = addElement(dataInterface1, 'DE1');
    dataElm1.Type = myValueType1;
     
    dataElm2 = addElement(dataInterface1, '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 = addElement(dataInterface1, 'DE3');
    dataElm3.Type.DataType = 'single';
    dataElm3.Type.Dimensions = '10';
    dataElm3.Type.Minimum = '-5';
     
    dataInterface2 = addDataInterface(dictAPI,'DataInterface2');

    Add AUTOSAR Classic mapping.

    platformMapping = addPlatformMapping(dictAPI, 'AUTOSARClassic');

    Set platform properties.

    setPlatformProperty(platformMapping, dataInterface1,...
        'Package', '/Interface2', 'InterfaceKind', 'NvDataInterface');

    Get the platform properties.

    [pNames, pValues] = getPlatformProperties(platformMapping, dataInterface1);

    Export dictionary content to code and ARXML.

    exportDictionary(platformMapping);

    Manage AUTOSAR Classic platform related elements. These element do not have mapping to Simulink.

    arObj = autosar.api.getAUTOSARProperties(dictName);
    addPackageableElement(arObj,'SwAddrMethod', ... 
        '/SwAddressMethods', 'VAR1', 'SectionType', 'Var');
    setPlatformProperty(platformMapping, dataElm1, ...
        'SwAddrMethod', 'VAR1', 'SwCalibrationAccess', ... 
        'ReadWrite', 'DisplayFormat', '%.3f');

    Version History

    Introduced in R2022b