Main Content

Configure Model Data Elements for ASAP2 File Generation

When you generate an ASAP2 file from a model, the ASAP2 file includes information about the data elements in your model such as characteristics and measurement variables. Each data element is described by information such as the memory address, storage structure, data types and conversion rules. In Simulink® you can now customize how the data elements are described in an ASAP2 file. You can choose only those characteristics and measurements that you are interested in exporting into ASAP2 file.

To configure data elements for ASAP2 file generation in the Code Mappings editor display, use the tabs:

  • Inports

  • Outports

  • Parameters

  • Data Stores

  • Signals/States

View Calibration Attributes

  1. Open a model with multiple data elements.

    open_system('rtwdemo_configrpinterface')

  2. Open the Simulink Coder™ app. On the C Code tab, select Code Interface + Individual Element Code Mappings.

Configure Inport for ASAP2 File Generation

  1. On the Inports tab, select an inport and click the icon.

  2. Specify the measurement property fields for the inport.

  3. Alternatively, at the command line, you can enter these commands:

    cm = coder.mapping.api.get('rtwdemo_configrpinterface');
    setInport(cm,'In1','CalibrationAccess','Calibration');
    setInport(cm,'In1','CompuMethod','CM_Inport');
    setInport(cm,'In1','DisplayIdentifier','inport_display_name');
    setInport(cm,'In1','Format','%4.2');

  4. Build the model.

  5. Generate the ASAP2 file by using this command:

    coder.asap2.export('rtwdemo_configrpinterface');

  6. Verify the exported inport in the ASAP2 file and verify the fields that you specified are present.

Configure Parameter for ASAP2 File Generation

  1. On the Parameters tab, select a parameter and click the icon.

  2. Specify the calibration property fields for the parameter.

  3. Alternatively, at the command line, you can enter these commands:

    cm = coder.mapping.api.get('rtwdemo_configrpinterface');
    setModelParameter(cm,'LOWER','CalibrationAccess','NoCalibration');
    setModelParameter(cm,'LOWER','CompuMethod','CM_param');
    setModelParameter(cm,'LOWER','DisplayIdentifier','param_lower');
    setModelParameter(cm,'LOWER','Format','%4.2');

  4. Build the model.

  5. Generate the ASAP2 file by using this command:

    coder.asap2.export('rtwdemo_configrpinterface');

  6. Verify the exported parameter in the ASAP2 file and verify the fields that you specified are present.

See Also

| | | | | |

Related Topics