Why do I get different A2L files for same model using different approaches?

10 views (last 30 days)
I am using MATLAB R2022a and previously I used to generate the A2L files using "ctrl+b" to build the model and generate the file by setting "set_param(gcs, 'GenerateASAP2', 'on')". But now the documentation recommends using "coder.asap2.export()" API. But both of these commands are giving different files why is it so?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 8 Dec 2023
The A2L files have the following differences:
  1. The A2l file, generated with the "coder.asap2.export" API, contains the "MEASUREMENT" signals which are not present in the one generated with the build.
  2. The A2l file, generated with the "coder.asap2.export" API,  does not contain "RECORD_LAYOUT" for all datatypes, while the other file contains "RECORD_LAYOUT" for all datatypes. 
The first difference is because we generate the IOs (input/outputs) as "MEASUREMENT" with "coder.asap2.export" API, which was not explicitly done with the A2L generated during the build. However, if you do not want to export the IOs as "MEASUREMENT" you can choose to turn the Export "Off" via the code mappings. You can do that using the following commands:
open_system('MODELNAME');
cm = coder.mapping.api.get('MODELNAME');
setOutport(cm,'Out1','Export',true);
setInport(cm,'In1','Export',true);
You could refer to the "setInport" and "setOutport" function sections in the following documentation:
The second difference is a change we introduced with the "coder.asap2.export" API.  MATLAB only exports the required "RECORD_LAYOUT" to the A2L file using the "coder.asap2.export" API. However, we do have an option to include all record layouts using the "IncludeAllRecordLayouts" parameter. For more details, you can refer to the following documentation:
We recommend using the A2L file generated with "coder.asap2.export" API, as we are going to be deprecating the generation of the A2L file via the build in the future releases.

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!