主要内容

autosar.dictionary.ARClassicPlatformMapping

管理映射到 AUTOSAR Classic 平台的数据字典中元素的特定于平台的属性

自 R2022b 起

    说明

    autosar.dictionary.ARClassicPlatformMapping 对象提供帮助您管理映射到 AUTOSAR Classic 平台的数据字典中特定于平台的属性的方法。

    创建对象

    要创建 autosar.dictionary.ARClassicPlatformMapping 对象,请使用 addPlatformMapping 函数。

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

    如果您已有映射到 Classic 平台的数据字典,可以使用 getPlatformMapping 函数来表示 autosar.dictionary.ARClassicPlatformMapping 对象。

    platformMapping = getPlatformMapping(archDataObj,"AUTOSARClassic");

    对象函数

    exportDictionaryExport interface, data type, and platform-specific definitions from Architectural Data section of data dictionary
    getPlatformPropertiesGet AUTOSAR platform properties from data dictionary
    getPlatformProperty从数据字典获取 AUTOSAR 平台属性
    setPlatformPropertySet AUTOSAR properties for data interface or element in data dictionary

    示例

    全部折叠

    此示例创建一个 Simulink.dictionary.ArchitecturalData 对象,配置字典内容,然后添加特定于平台的元素。

    创建数据字典和“架构数据”分区对象。

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

    添加数据类型,包括枚举、别名类型、值类型和结构体。

    % 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";
    

    添加数据接口,并配置数据元素。

    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");

    添加 AUTOSAR Classic 映射。

    platformMapping = addPlatformMapping(archDataObj,"AUTOSARClassic");

    配置经典组件的接口属性,包括包路径和非易失性数据通信。

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

    获取平台属性。

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

    VAR1 软件寻址方法添加到字典,并为数据接口 DataInterface 中的数据元素 DE1 设置 AUTOSAR 平台特定的属性。

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

    版本历史记录

    在 R2022b 中推出