Prepare ASAP2 Data Description File

This example shows how to configure a Simulink® Real-Time™ model so that the build generates an ASAP2 (A2L) data description file for the real-time application. The real-time application models a damped oscillator that feeds into 1-D and 2-D lookup tables, which invert and rescale the input waveform.

This example uses ex_slrt_cal_osc (open_system(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_cal_osc')))), which requires ex_slrt_cal_osc_data.mat (load(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_cal_osc_data.mat')))).

The goal of calibration is reducing the ringing in signals DampedOsc, L_1D, and L_2D.

Initial Setup

For best results, load the MATLAB® workspace variables before you load the model that uses them.

  1. Load workspace variables for the example model from ex_slrt_cal_osc_data.mat (load(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_cal_osc_data.mat')))).

    The MATLAB workspace variables have the following functions:

    • Kg — Parameter object for the Gain1 block

    • DampedOsc, SignalGenerator, L_1D, L_2D — Signal objects for output signals

    • ydata, zdata — 1-D and 2-D lookup tables respectively

    • xbreak1, xbreak2, ybreak — Indexes into lookup tables

  2. Open ex_slrt_cal_osc (open_system(docpath(fullfile(docroot, 'toolbox', 'xpc', 'examples', 'ex_slrt_cal_osc')))).

Set Up Parameters

Set up global parameter tuning by using Simulink parameter objects.

  1. In ex_slrt_cal_osc, on the Modeling tab, click Design > Model Explorer .

  2. Select Base Workspace in the Model Hierarchy pane.

  3. Check that the Kg parameter object exists and has these properties:

    • Value400

    • Data typedouble

    • Storage classExportedGlobal

  4. If the parameter object does not exist, add it. On the toolbar, click the Add Simulink Parameter button.

  5. Open ex_slrt_cal_osc/Gain1.

  6. Check that you have set the Gain value to the parameter object Kg.

Set Up Signals

As a best practice, set up signal viewing by using Simulink signal objects.

  1. In ex_slrt_cal_osc, on the Modeling tab, click Design > Model Explorer .

  2. Select Base Workspace in the Model Hierarchy pane.

  3. Check that the DampedOsc signal object exists and has these properties:

    • Minimum−10

    • Maximum10

    • Data typedouble

    • Storage classExportedGlobal.

  4. Check that the SignalGenerator signal object exists and has these properties:

    • Minimum−10

    • Maximum10

    • Data typedouble

    • Storage classExportedGlobal.

  5. Check that the L_1D signal object exists and has these properties:

    • Minimum−15

    • Maximum15

    • Data typedouble

    • Storage classExportedGlobal.

  6. Check that the L_2D signal object exists and has these properties:

    • Minimum−15

    • Maximum15

    • Data typedouble

    • Storage classExportedGlobal.

  7. If a signal does not exist, add it. On the toolbar, click the Add Simulink Signal button .

  8. For each signal, open its Properties dialog box.

  9. Check that you selected the Signal name must resolve to Simulink signal object and the Test point check boxes.

Set Up Lookup Tables

The example model contains 1-D and 2-D lookup tables.

  1. Open the block parameters for the 1-D Lookup Table block.

  2. In the Table and Breakpoints pane, check the following settings:

    • Number of table dimensions1

    • Table dataydata

    • Breakpoints specificationExplicit values

    • Breakpoints 1xbreak1

  3. Open the block parameters for the 2-D Lookup Table block.

  4. In the Table and Breakpoints pane, check the following settings:

    • Number of table dimensions2

    • Table datazdata

    • Breakpoints specificationExplicit values

    • Breakpoints 1xbreak2

    • Breakpoints 2ybreak

To view the contents of the lookup tables, click Edit table and breakpoints, and then click Plot > Mesh.

Generate Data Description File

  1. Open the Configuration Parameters. On the Real-Time tab, select Prepare > Hardware Settings.

  2. In the left pane, click the Simulink Real-Time Options node.

  3. In the Miscellaneous options area, select the Generate INCA/CANape extensions (disables the Simulation Data Inspector and Dashboard blocks) check box.

    This option enables real-time applications to generate an ASAP2 (A2L) data description file. You can then use third-party calibration software.

  4. Build the model.

    The build produces a file named ex_slrt_cal_osc_slrt.a2l in the working folder. You can now connect to the target with a third-party calibration tool.

See Also

|

Related Topics

External Websites