このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
ASAP2 ファイルのカスタマイズ
ASAP2 ファイルで ECU の説明の追加、更新、フィルター処理、検索、および削除を行います。
モデル例を開いて作成
モデル例 "ASAP2Demo" を開きます。
open_system("ASAP2Demo");
モデルをビルドします。
slbuild("ASAP2Demo");
### Searching for referenced models in model 'ASAP2Demo'. ### Total of 2 models to build. ### Starting serial code generation build. ### Successfully updated the model reference code generation target for: ASAP2DemoModelRef ### Starting build procedure for: ASAP2Demo ### Successful completion of build procedure for: ASAP2Demo Build Summary Model reference code generation targets: Model Build Reason Status Build Duration ============================================================================================================ ASAP2DemoModelRef Target (ASAP2DemoModelRef.c) did not exist. Code generated and compiled. 0h 0m 5.8839s Top model targets: Model Build Reason Status Build Duration ============================================================================================================ ASAP2Demo Information cache folder or artifacts were missing. Code generated and compiled. 0h 0m 12.037s 2 of 2 models built (0 models already up to date) Build duration: 0h 0m 18.852s
モデルの ECU 説明オブジェクトを作成します。
descObj = coder.asap2.getEcuDescriptions("ASAP2Demo");
説明オブジェクトで使用可能な計算方法のリストを取得します。
find(descObj,"CompuMethod")
ans = 1×10 string
"ASAP2DemoModelRef_CM_double" "ASAP2DemoModelRef_CM_int16_rpm" "ASAP2Demo_CM_double" "ASAP2Demo_CM_double_m_per__s_2_" "ASAP2Demo_CM_double_rpm" "ASAP2Demo_CM_int32" "ASAP2Demo_CM_single" "ASAP2Demo_CM_single_m_per__s_2_" "ASAP2Demo_CM_single_rpm" "ASAP2Demo_CM_uint8"
計算方法を絞り込み、単位として "rpm" を使用する計算方法のリストを取得します。
find(descObj,"CompuMethod",Units='rpm')
ans = 1×3 string
"ASAP2DemoModelRef_CM_int16_rpm" "ASAP2Demo_CM_double_rpm" "ASAP2Demo_CM_single_rpm"
カスタム計算方法の作成と追加
ASAP2 ファイルに新しい計算方法を追加するには、カスタム計算方法を作成します。
CompuMethod_1 = coder.asap2.CompuMethod; CompuMethod_1.Name = 'CompuMethod_1'; CompuMethod_1.ConversionType = 'LINEAR'; CompuMethod_1.Coefficients = [2 3]; CompuMethod_1.LongIdentifier = 'longIdentifierTest'; CompuMethod_1.Format = '%2.3'; CompuMethod_1.Units = 's';
ECU 説明オブジェクトにカスタム計算方法を追加します。
add(descObj,CompuMethod_1);
新規に追加された計算方法のプロパティを取得します。
get(descObj,"CompuMethod","CompuMethod_1")
ans = CompuMethod with properties: Name: 'CompuMethod_1' LongIdentifier: 'longIdentifierTest' Format: '%2.3' Units: 's' Coefficients: [2 3] ConversionType: 'LINEAR' CompuVTabValues: [1×1 struct] CustomData: ""
計算方法のプロパティを変更するには、関数 "set" を使用します。計算方法の "ConversionType" フィールドを "TAB_VERB" に更新し、"CompuVTabValues" を定義します。
set(descObj,"CompuMethod","CompuMethod_1",ConversionType="TAB_VERB"); set(descObj,"CompuMethod","CompuMethod_1",CompuVTabValues = struct('Literals',["false" "true"],'Values',[0 1]));
プロパティを取得して、変更されたフィールドを確認します。
modifiedprop = get(descObj,"CompuMethod","CompuMethod_1")
modifiedprop = CompuMethod with properties: Name: 'CompuMethod_1' LongIdentifier: 'longIdentifierTest' Format: '%2.3' Units: 's' Coefficients: [2 3] ConversionType: "TAB_VERB" CompuVTabValues: [1×1 struct] CustomData: ""
modifiedprop.CompuVTabValues
ans = struct with fields:
Literals: ["false" "true"]
Values: [0 1]
更新した ECU 説明オブジェクトを使用して ASAP2 ファイルを生成し、ASAP2 ファイルに計算方法 "CompuMethod_1" が含まれていることを確認します。
coder.asap2.export("ASAP2Demo",CustomEcuDescriptions=descObj);
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
計算方法の削除
新規に追加した計算方法を説明オブジェクトから削除します。
delete(descObj,"CompuMethod","CompuMethod_1");
カスタム特性の作成と追加
ASAP2 ファイルに新しい特性を追加するには、カスタム特性を作成します。
Parameter_1 = coder.asap2.Characteristic; Parameter_1.Name = 'Custom_parameter1'; Parameter_1.LongIdentifier = 'longIdentifierParam'; Parameter_1.UpperLimit = 255; Parameter_1.LowerLimit = 0;
カスタム特性を ECU 説明オブジェクトに追加します。
add(descObj,Parameter_1);
新規に追加された特性のプロパティを取得します。
get(descObj,"Characteristic","Custom_parameter1")
ans = Characteristic with properties: Name: 'Custom_parameter1' LongIdentifier: 'longIdentifierParam' Type: 'VALUE' EcuAddress: '0x0000' CompuMethodName: 'NO_COMPU_METHOD' LowerLimit: 0 UpperLimit: 255 EcuAddressComment: "" EcuAddressExtension: [] CalibrationAccess: 'Calibration' DisplayIdentifier: "" Format: "" BitMask: [] AxisInfo: [] RecordLayout: "" Dimensions: [] Export: 1 MaxRefresh: [1×1 struct] SymbolLink: [1×1 struct] CustomData: ""
特性のプロパティを変更するには、関数 "set" を使用します。特性の "UpperLimit" フィールドを更新します。
set(descObj,"Characteristic","Custom_parameter1",UpperLimit=128)
更新した ECU 説明オブジェクトを使用して ASAP2 ファイルを生成し、ASAP2 ファイルに特性 "Custom_parameter1" が含まれていることを確認します。
coder.asap2.export("ASAP2Demo",CustomEcuDescriptions=descObj);
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
新規に追加した特性を説明オブジェクトから削除します。
delete(descObj,"Characteristic","Custom_parameter1");
カスタム測定の作成と追加
ASAP2 ファイルに新しい測定を追加するには、カスタム測定を作成します。
Signal_1 = coder.asap2.Measurement; Signal_1.Name = 'Custom_signal1'; Signal_1.LongIdentifier = 'longIdentifierSignal'; Signal_1.UpperLimit = 255; Signal_1.LowerLimit = 0;
カスタム測定を ECU 説明オブジェクトに追加します。
add(descObj,Signal_1);
新規に追加された測定のプロパティを取得します。
get(descObj,"Measurement","Custom_signal1")
ans = Measurement with properties: Name: 'Custom_signal1' LongIdentifier: 'longIdentifierSignal' DataType: 'UBYTE' EcuAddress: '0x0000' CompuMethodName: "" LowerLimit: 0 UpperLimit: 255 Raster: [1×1 struct] EcuAddressComment: "" EcuAddressExtension: [] CalibrationAccess: 'NoCalibration' DisplayIdentifier: "" Format: "" BitMask: [] Dimensions: [] Export: 1 MaskData: [1×1 struct] MaxRefresh: [1×1 struct] SymbolLink: [1×1 struct] CustomData: ""
測定のプロパティを変更するには、関数 "set" を使用します。測定の "CalibrationAccess" フィールドを更新します。
set(descObj,"Measurement","Custom_signal1",CalibrationAccess='Calibration')
更新した ECU 説明オブジェクトを使用して ASAP2 ファイルを生成し、ASAP2 ファイルに "Custom_signal1" という名前の測定が含まれていることを確認します。
coder.asap2.export("ASAP2Demo",CustomEcuDescriptions=descObj);
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
新規に追加した測定を説明オブジェクトから削除します。
delete(descObj,"Measurement","Custom_signal1");
ルックアップ テーブル パラメーターの作成と追加
ルックアップ テーブル パラメーターを追加します。
LUT_Parameter = coder.asap2.Characteristic; LUT_Parameter.Name = "custom_lookup_table"; LUT_Parameter.Type = "MAP";
軸情報を作成してパラメーターに追加します。
axis_data = coder.asap2.AxisInfo; axis_data(1).Name = 'BP3'; axis_data(2).Name = 'Bp4'; axis_data(1).CompuMethodName = 'ASAP2Demo_CM_double'; axis_data(2).CompuMethodName = 'ASAP2Demo_CM_double'; axis_data(1).MaxAxisPoints = '3'; axis_data(2).MaxAxisPoints = '3'; axis_data(1).AxisType = 'STD_AXIS'; axis_data(2).AxisType = 'STD_AXIS'; LUT_Parameter.AxisInfo = axis_data;
ルックアップ テーブル パラメーターを説明オブジェクトに追加します。
add(descObj,LUT_Parameter)
更新した ECU 説明オブジェクトを使用して ASAP2 ファイルを生成し、ASAP2 ファイルにルックアップ テーブル パラメーター "custom_lookup_table" が含まれていることを確認します。
coder.asap2.export("ASAP2Demo",CustomEcuDescriptions=descObj);
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
参考
coder.asap2.export
| coder.asap2.UserCustomizeBase
(Embedded Coder)
トピック
- 生成された ASAP2 ファイルのカスタマイズ
- Customize Using Base Files (Embedded Coder)