Add, update, filter, find, and remove ECU descriptions in an ASAP2 file.
Open and Build Example Model
Open the example model ASAP2Demo
Build the model.
### Starting serial model reference 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
Code generation targets built:
Model Action Rebuild Reason
======================================================================================
ASAP2DemoModelRef Code generated and compiled. ASAP2DemoModelRef.c does not exist.
Top model targets built:
Model Action Rebuild Reason
===========================================================================================
ASAP2Demo Code generated and compiled. Code generation information file does not exist.
2 of 2 models built (0 models already up to date)
Build duration: 0h 0m 46.784s
Create the ECU description object for the model.
Get the list of available computation methods in the description object.
ans = 1x10 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"
Filter the computation methods and get a list of computation methods that use rpm as the unit.
ans = 1x3 string
"ASAP2DemoModelRef_CM_int16_rpm" "ASAP2Demo_CM_double_rpm" "ASAP2Demo_CM_single_rpm"
Create and Add Custom Computation Method
To add a new computation method to the ASAP2 file, create a custom computation method.
Add the custom computation method to the ECU description object.
Get the properties of the newly added computation method.
ans =
CompuMethod with properties:
Name: 'CompuMethod_1'
LongIdentifier: 'longIdentifierTest'
Format: '%2.3'
Units: 's'
Coefficients: [2 3]
ConversionType: 'LINEAR'
CompuVTabValues: [1x1 struct]
CustomData: ""
To modify a property of the computation method, use set function. Update the LongIdentifier field of the computation method.
Generate the ASAP2 file using the updated ECU description object and verify that the ASAP2 file contains the computation method CompuMethod_1.
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
Delete Computation Method
Remove the newly added computation method from the description object.
Create and Add Custom Characteristic
To add a new characteristic to the ASAP2 file, create a custom characteristic.
Add the custom characteristic to the ECU description object.
Get the properties of the newly added characteristic.
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: [1x1 struct]
SymbolLink: [1x1 struct]
CustomData: ""
To modify a property of the characteristic, use set function. Update the UpperLimit field of the characteristic.
Generate the ASAP2 file using the updated ECU description object and verify that the ASAP2 file contains the characteristic Custom_parameter1.
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
Remove the newly added characteristic from the description object.
Create and Add Custom Measurement
To add a new measurement to the ASAP2 file, create a custom measurement.
Add the custom measurement to the ECU description object.
Get the properties of the newly added measurement.
ans =
Measurement with properties:
Name: 'Custom_signal1'
LongIdentifier: 'longIdentifierSignal'
DataType: 'UBYTE'
EcuAddress: '0x0000'
CompuMethodName: ""
LowerLimit: 0
UpperLimit: 255
Raster: [1x1 struct]
EcuAddressComment: ""
EcuAddressExtension: []
CalibrationAccess: 'NoCalibration'
DisplayIdentifier: ""
Format: ""
BitMask: []
Dimensions: []
Export: 1
MaskData: [1x1 struct]
MaxRefresh: [1x1 struct]
SymbolLink: [1x1 struct]
CustomData: ""
To modify a property of the measurement, use set function. Update the CalibrationAccess field of the measurement.
Generate the ASAP2 file using the updated ECU description object and verify that the ASAP2 file contains the measurement with name Custom_signal1.
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"
Remove the newly added measurement from the description object.
Create and Add Lookup Table Parameter
Add a lookup table parameter.
Create and add axis information to the parameter.
Add the lookup table parameter to the description object.
Generate the ASAP2 file using the updated ECU description object and verify that the ASAP2 file contains the lookup table parameter custom_lookup_table.
Following Characteristics or Measurements with unsupported data types are not exported in ASAP2 file. "ASAP2Demo_DW.ASAP2DemoModelRef_InstanceData"