- get ECU description object - https://www.mathworks.com/help/rtw/ref/coder.asap2.getecudescriptions.html
- add - https://www.mathworks.com/help/rtw/ref/coder.asap2.getecudescriptions.add.html
- find - https://www.mathworks.com/help/rtw/ref/coder.asap2.getecudescriptions.find.html
- set - https://www.mathworks.com/help/rtw/ref/coder.asap2.getecudescriptions.set.html
- export - https://www.mathworks.com/help/rtw/ref/coder.asap2.export.html
How to get unit into A2L for a signal?
11 views (last 30 days)
Show older comments
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
0 Comments
Answers (1)
Paras Gupta
on 20 Jun 2024
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.
0 Comments
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!