Main Content

Generate ASAP2 and CDF Data Definition Files

This example shows how to export ASAP2 and Calibration Data Format (CDF) files for data measurement and calibration using the Generate Calibration Files tool.

ASAP2 standard defines the description format of the internal electronic control unit (ECU) variables used in measurement and calibration and ASAM CDF standard defines the data for storing the ECU parameter values and the associated meta data. These standards are proposed by the Association for Standardization of Automation and Measuring Systems (ASAM). For more information about ASAM MCD-2 MC and ASAM CDF standards, refer to www.asam.net.

This example uses ASAP2Demo.slx and ASAP2DemoModelRef.slx models.

Build ASAP2Demo Model

Open the ASAP2Demo model.

open_system("ASAP2Demo");

Build the model to generate C Code for both the parent model ASAP2Demo and the child model ASAP2DemoModelRef.

slbuild("ASAP2Demo");

Open "Generate Calibration Files" Tool

On the C code tab, select Share > Generate Calibration Files to open the Generate Calibration Files tool.

You can customize the calibration file generation settings such as filename, the destination folder, include or exclude comments in the file.

Generate ASAP2 File

Follow these steps to generate the ASAP2 file for the model.

  1. Move the Generate ASAP2 switch to On position. By default, the Generate ASAP2 switch is in the On position.

  2. Specify a name in the File name field to change the name of the file from ASAP2Demo.

  3. Specify the path for the A2L file in the Folder path field. By default, the A2L file is generated in the build directory.

  4. Provide a symbol file associated with the application executable in the Symbol file field, to replace ECU addresses in the A2L file. Otherwise, uncheck the Address replacement field. The tool supports an ELF, PDB, DWARF file as a symbol file to replace the ECU addresses.

  5. Set Version option to the required version of the A2L file to be generated. The default version is 1.71.

  6. Uncheck Include comments option to exclude comments in the A2L file.

  7. Uncheck Include referenced models option to exclude referenced model data elements in the A2L file.

  8. Click Generate.

To generate the A2L file programmatically, use this command.

coder.asap2.export("ASAP2Demo");

Generate CDF File

Follow these steps to generate the CDF file for the model.

  1. Move the Generate CDF switch to the On position. By default, the Generate CDF switch is in the On position.

  2. Specify a name in the File name field to change the name of the file from ASAP2Demo.

  3. Specify the folder path for the CDF file in the Folder path field. By default, the CDF File is generated in the build directory.

  4. Choose the Schema type field as XML Schema Definition (XSD) or Document Type Definition (DTD). By default it is set to DTD schema type.

  5. Click Generate.

To generate the CDF file programmatically, use this command.

coder.cdf.export("ASAP2Demo");

You can verify that the calibration files are generated in the specified folder. Now, you can use these calibration files for calibration and measurement of the application.