メインコンテンツ

Simulink.dictionary.ArchitecturalData

Simulink データ ディクショナリ内のアーキテクチャ データをプログラムで編集する

R2023b 以降

    説明

    Simulink.dictionary.ArchitecturalData オブジェクトは、Simulink® データ ディクショナリの [Architectural Data] セクションを表します。アーキテクチャ データ オブジェクトにより、端子インターフェイス、データ型、システム全体の定数、およびそれらのプラットフォーム プロパティの Simulink およびアーキテクチャ モデル全体における共有定義にプログラムでアクセスできます。アーキテクチャ データ エディターを使用してアーキテクチャ データを管理することもできます。

    作成

    Simulink.dictionary.archdata.create 関数を使用して新しいデータ ディクショナリを作成できます。この関数は Simulink.dictionary.ArchitecturalData オブジェクトを返します。

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

    既にデータ ディクショナリが作成済みの場合は、Simulink.dictionary.archdata.open 関数を使用してアーキテクチャ データ オブジェクトを作成できます。

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

    プロパティ

    すべて展開する

    データ ディクショナリのファイル名。文字ベクトルまたは string スカラーとして指定します。名前には .sldd 拡張子を含める必要があり、有効な MATLAB® 識別子でなければなりません。

    データ ディクショナリの [Architectural Data] セクションで定義されているインターフェイス。プロパティ DescriptionElementsName、および Owner を含む Simulink.dictionary.archdata.DataInterfaceSimulink.dictionary.archdata.ServiceInterface、および Simulink.dictionary.archdata.PhysicalInterface オブジェクトの配列として指定します。

    データ ディクショナリの [Architectural Data] セクションで定義されているデータ型。プロパティ Name および Owner を含む Simulink.dictionary.archdata.DataType オブジェクトの配列として指定します。

    定義されている定数。プロパティ ValueDescriptionDataTypeName、および Owner を含む Simulink.dictionary.archdata.Constant オブジェクトの配列として指定します。

    オブジェクト関数

    addAliasTypeAdd Simulink alias type to Architectural Data section of Simulink data dictionary
    addConstantAdd constant to Architectural Data section of Simulink data dictionary
    addDataInterfaceAdd data interface to Architectural Data section of Simulink data dictionary
    addEnumTypeAdd enumerated type to Architectural Data section of Simulink data dictionary
    addNumericTypeAdd Simulink numeric type to Architectural Data section of Simulink data dictionary
    addPhysicalInterfaceAdd physical interface to Architectural Data section of Simulink data dictionary
    addPlatformMappingAdd AUTOSAR Classic mapping to Architectural Data section of Simulink data dictionary
    addReferenceデータ ディクショナリ参照を Simulink データ ディクショナリの [アーキテクチャ データ] セクションに追加する
    addServiceInterfaceAdd service interface to Architectural Data section of Simulink data dictionary
    addStructTypeAdd structure type to Architectural Data section of Simulink data dictionary
    addValueTypeAdd value type to Architectural Data section of Simulink data dictionary
    closeSimulink データ ディクショナリへの開いている接続を閉じる
    discardChangesDiscard changes to Simulink data dictionary
    findEntryByNameGet object by name in Architectural Data section of Simulink data dictionary
    getConstantGet Simulink.dictionary.archdata.Constant object in Architectural Data section of Simulink data dictionary
    getConstantNamesGet constant names in Architectural Data section of Simulink data dictionary
    getDataTypeGet data type in Architectural Data section of Simulink data dictionary
    getDataTypeNamesGet names of data types in Architectural Data section of Simulink data dictionary
    getInterfaceGet interface object for interface in Architectural Data section of Simulink data dictionary
    getInterfaceNamesGet interface names in Architectural Data section of Simulink data dictionary
    getPlatformMappingGet platform mapping object for platform of Simulink data dictionary
    getReferencesGet full paths of Simulink data dictionaries referenced by another Simulink data dictionary
    importFromBaseWorkspaceImport Simulink object definitions from base workspace to Architectural Data section of Simulink data dictionary
    importFromFileImport Simulink object definitions from file to Architectural Data section of data dictionary
    isDirtyCheck for unsaved changes in Simulink data dictionary
    moveToDesignDataMove interfaces, data types, and constants in Architectural Data section of Simulink data dictionary to design data
    moveToDictionaryMove architectural data of Simulink data dictionary to another data dictionary
    removeConstantRemove constant from Architectural Data section of Simulink data dictionary
    removeDataTypeRemove data type from Architectural Data section of Simulink data dictionary
    removeInterfaceRemove interface from Architectural Data section of Simulink data dictionary
    removeReference別の Simulink データ ディクショナリの Simulink データ ディクショナリ参照を削除する
    removePlatformMappingRemove platform mapping of Architectural Data section of data dictionary
    saveSave changes to Architectural Data section of Simulink data dictionary
    showView architectural data of Simulink data dictionary in Architectural Data Editor
    showChangesView changes to architectural data of Simulink data dictionary in Comparison Tool

    すべて折りたたむ

    Simulink データ ディクショナリを作成し、関連付けられているアーキテクチャ データ オブジェクトを返します。

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

    型固有の関数を使用して、エイリアス タイプおよび列挙をデータ ディクショナリに追加します。

    myAliasType1Obj = addAliasType(archDataObj,"aliasType",BaseType="single");
    myAliasType1Obj.Name = "myAliasType1";
    myAliasType1Obj.BaseType = "fixdt(1,32,16)";
    myAliasType2Obj = addAliasType(archDataObj,"myAliasType2");
    myAliasType2Obj.BaseType = myAliasType1Obj;
    
    myEnumType1Obj = addEnumType(archDataObj,"myColor");
    addEnumeral(myEnumType1Obj,"RED",'0',"Red Sunset");
    addEnumeral(myEnumType1Obj,"BLUE",'1',"Blue Skies");
    myEnumType1Obj.DefaultValue = "BLUE";
    myEnumType1Obj.Description = "I am a Simulink Enumeration";
    myEnumType1Obj.StorageType = 'int16'; 

    作成されたエイリアス タイプの基本型を、作成された列挙データ型 myColor に設定できます。

    myAliasType3Obj = addAliasType(archDataObj,"myAliasType3");
    myAliasType3Obj.BaseType = myEnumType1Obj;
     

    addNumericType 関数を使用して、数値型をデータ ディクショナリに追加します。

    myNumericType1Obj = addNumericType(archDataObj,"myNumericType1");
    myNumericType1Obj.DataTypeMode = "Single";

    addValueType を使用して、値のタイプをデータ ディクショナリに追加します。値のタイプのデータ型を、既存のデータ型または作成された列挙データ型に設定することもできます。

    myValueType1Obj = addValueType(archDataObj,"myValueType1");
    myValueType1Obj.DataType = "int32";
    myValueType1Obj.Dimensions = '[2 3]';
    myValueType1Obj.Description = "I am a Simulink ValueType";

    addStructType 関数を使用して、struct 型をデータ ディクショナリに追加します。

    myStructType1Obj = addStructType(archDataObj,"myStructType1");
    structElement1 = myStructType1Obj.addElement("Element1");
    structElement1.Type.DataType = "single";
    structElement1.Type.Dimensions = "3";
    structElement2 = addElement(myStructType1Obj,"Element2");
    structElement3 = addElement(myStructType1Obj,"Element3");

    struct 要素のデータ型を設定するには、データ型オブジェクトを使用するか、string スカラーまたは文字ベクトルとして指定されたデータ型の名前を使用します。

    structElement2.Type = myValueType1Obj;
    % or
    structElement3.Type = "ValueType: myValueType1";

    addConstant 関数を使用して定数を追加できます。

    myConstantObj = addConstant(archDataObj, "myConst", Value=4);

    Simulink.dictionary.archdata.DataInterface オブジェクトの関数を使用して、通信インターフェイスとそのデータ要素を追加できます。

    dataInterface1Obj = addDataInterface(archDataObj,"DataInterface");
     
    dataElm1 = addElement(dataInterface1Obj,"DE1");
    dataElm1.Type = myValueType1Obj;
     
    dataElm2 = addElement(dataInterface1Obj,"DE2");
    dataElm2.Type = myStructType1Obj;
    dataElm2.Dimensions = "4";
    dataElm2.Description = "I am a data element with datatype = array of struct type";
     
    dataElm3 = addElement(dataInterface1Obj,"DE3");
    dataElm3.Type.DataType = "single";
    dataElm3.Type.Dimensions = "10";
    dataElm3.Type.Minimum = "-5";

    サポートされている製品のプラットフォーム マッピングを、データ ディクショナリの [Architectural Data] セクションに追加できます。たとえば、次のプログラムのステップでは、addPlatformMapping 関数を使用して AUTOSAR Classic マッピングを追加しています。

    platformMapping = addPlatformMapping(archDataObj,"AUTOSARClassic");

    getPlatformProperties (AUTOSAR Blockset) および setPlatformProperty (AUTOSAR Blockset) 関数を使用して、AUTOSAR 通信インターフェイスおよびパッケージ プロパティを取得および設定します。

    setPlatformProperty(platformMapping, dataInterface1Obj,...
        "Package","/Interface2","InterfaceKind","NvDataInterface");
    [pNames, pValues] = getPlatformProperties(platformMapping,dataInterface1Obj);

    データ ディクショナリ コンテンツ用の ARXML コードを生成できるようになりました。

    exportedFolder = exportDictionary(platformMapping);
    Exporting dictionary, please wait...
    Exported dictionary ARXML files are located in: C:\work\MyArchitecturalData.

    AUTOSAR Classic プラットフォーム関連の要素、ソフトウェア アドレス メソッド、およびキャリブレーション プロパティを管理します。これらの要素には Simulink へのマッピングはありません。

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

    バージョン履歴

    R2023b で導入