Main Content

autosar.dictionary.ARClassicPlatformMapping

Manage platform-specific properties for elements in data dictionary mapped to AUTOSAR Classic Platform

Since R2022b

    Description

    The autosar.dictionary.ARClassicPlatformMapping object provides methods that help you manage the platform-specific properties in a data dictionary mapped to the AUTOSAR Classic Platform.

    Creation

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

    archDataObj = Simulink.dictionary.archdata.open("MyInterfaces.sldd");
    platformMapping = addPlatformMapping(archDataObj,"AUTOSARClassic");

    If you already have a data dictionary mapped to the Classic Platform, you can represent an autosar.dictionary.ARClassicPlatformMapping object by using the getPlatformMapping function.

    platformMapping = getPlatformMapping(archDataObj,"AUTOSARClassic");

    Object Functions

    exportDictionaryExport interface, data type, and platform-specific definitions from Architectural Data section of data dictionary
    getPlatformPropertiesGet AUTOSAR platform properties from data dictionary
    getPlatformPropertyGet AUTOSAR platform property from data dictionary
    setPlatformPropertySet AUTOSAR properties for data interface or element in data dictionary

    Examples

    collapse all

    This example creates a Simulink.dictionary.ArchitecturalData object, configures the dictionary contents, and then adds platform-specific elements.

    Create data dictionary and the Architectural Data section object.

    dictName = "MyInterfaces.sldd";
    archDataObj = Simulink.dictionary.archdata.create(dictName);

    Add data types, including an enumeration, an alias type, a value type, and a structure.

    % Enum Types
    myEnumType1 = addEnumType(archDataObj,"myColor");
    myEnumType1.addEnumeral("RED","0","Solid Red");
    myEnumType1.addEnumeral("BLUE","1","Solid Blue");
    myEnumType1.StorageType = "int16";
     
    % set base type of an alias type to enum object
    myAliasType1 = addAliasType(archDataObj,"myAliasType1");
    myAliasType1.BaseType = myEnumType1;
     
    % ValueType
    myValueType1 = addValueType(archDataObj,"myValueType1");
    myValueType1.DataType = "int32";
    myValueType1.Dimensions = '[2 3]';
    myValueType1.DataType = myEnumType1; % can also use interface dict type objs
     
    % StructType
    myStructType1 = addStructType(archDataObj,"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";
    

    Add data interfaces, and configure data elements.

    dataInterface1 = addDataInterface(archDataObj,"DataInterface");
     
    dataElm1 = addElement(dataInterface1,"DE1");
    dataElm1.Type = myValueType1;
     
    dataElm2 = addElement(dataInterface1,"DE2");
    dataElm2.Type = myStructType1;
    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(archDataObj,"DataInterface2");

    Add AUTOSAR Classic mapping.

    platformMapping = addPlatformMapping(archDataObj,"AUTOSARClassic");

    Configure interface properties for a classic component, including package path and nonvolatile data communication.

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

    Get the platform properties.

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

    Add VAR1 software address method to the dictionary and set AUTOSAR platform-specific properties for data element DE1 in data interface DataInterface.

    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