Main Content

Measurement Interfaces

Some components require interface support for viewing and analyzing signal and state data during program execution. For example, you might use the Simulation Data Inspector to produce plots and maps of the data for comparing run results that show model behavior.

To represent signal and state data in a component model and configure the signals and states for measurement in generated code:

  1. Set up the signal and state data for the model design.

  2. In the Embedded Coder app, open the Code Mappings editor. In the C Code tab, select Code Interface > Individual Code Mappings. The Code Mappings editor opens to the Functions tab.

  3. Click the Signals/States tab.

  4. Add the signal lines that you want to measure to the model code mappings.

    1. In the component model, select the signal.

    2. Pause on the ellipsis that appears above or below the signal line to open the action bar. Click the Add Signal button.

      In the Code Mappings editor, on the Signals/States tab, the Signals node expands and lists the signal that you added.

  5. In the Code Mappings editor or by using the code mappings programming interface, configure the code interface for the model states and the signal lines that you added. At a minimum, set these properties:

    • Storage Class, which controls the appearance and placement of the state or signal data in the generated code

    • Identifier, which names the model element in the generated code.

    For a list of storage classes supported by Embedded Coder®, see Choose Storage Class for Controlling Data Representation in Generated Code.

Alternatively, you can use these programming interfaces to visualize and analyze signal and state data without using external mode:

  • C application programming interface (API)

  • Target Language Compiler programming interface

After you configure the signal and state interfaces, you can:

  • Set up and run external mode simulations that use a communication channel between Simulink® on your development computer (host) and your generated program executable that runs on the target platform by using the Run on Custom Hardware app

  • Generate and customize an ASAP2 file and a Calibration Data Format (CDF) file by using the Generate Calibration Files tool.

Related Topics