How to get unit into A2L for a signal?

11 次查看(过去 30 天)
Hi,
I have a question regarding how a signal UNIT should be outputted into the A2L file when the code is generated for a AUTOSAR complaint model.
How could I set so my signals get a specific conversion method of my signal. In this example I want to get degC as a Unit of my signal via a COMPU_METHOD declaration in the A2L.
Ex:
/begin MEASUREMENT
/* Name */ NewSigInDegrees
/* Long identifier */ "My information about NewSig"
/* Data type */ FLOAT32_IEEE
/* Conversion method */ CM_degC
/* Resolution (Not used) */ 0
/* Accuracy (Not used) */ 0
/* Lower limit */ -100
/* Upper limit */ 2000
ECU_ADDRESS 0x0000 /* @ECU_Address@NewSigInDegrees@ */
/end MEASUREMENT
/begin COMPU_METHOD
CM_degC /* Name */
"" /* LongIdentifier */
RAT_FUNC /* ConversionType */
"%12.6" /* Format */
"deg C" /* Unit */
COEFFS 0 1 0 0 0 1
/end COMPU_METHOD
Best Regards

回答(1 个)

Paras Gupta
Paras Gupta 2024-6-20
Hi Ulf,
I understand that you're looking to ensure that your signals are represented with a different unit via COMPU_METHOD declaration in an A2L file for an AUTOSAR-compliant model in MATLAB R2019b.
Note that MATLAB R2019b does not provide the option to create a custom definition of 'CompuMethod' and associate that with a measurement/characteristic.
However, as of MATLAB R2022b, you can use the 'coder.asap2.getEcuDescriptions' object to create an information object for your model ans customize it by creating a new 'CompuMethod' and setting it for your desired signals. Please refer to the "Customize an ASAP2 File" example given in the following documentation for more information on the same:
The following links can be useful to learn more about ASAP2 Customization:
Hope this helps.

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

产品


版本

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by