View Stateflow States in the Logic Analyzer

Use the Logic Analyzer app to visualize and measure transitions and states over time. With the Logic Analyzer, you can visualize:

  • Leaf chart activity

  • Child chart activity

  • Child state activity

  • Self state activity

  • Leaf state activity

The Logic Analyzer allows you to measure the output over time and add triggers to identify the output values at specified events.

Note

To use the Logic Analyzer, you must have DSP System Toolbox™ or SoC Blockset™ license.

To follow along with this tutorial, open the sf_car model. In this model, you can visualize the behavior of the engine, the gear state, and the vehicle speed.

Model diagram for the sf_car model.

Add Signals and States for Logging

To view a signal in the Logic Analyzer, you must mark the signal or state for logging.

  1. Open the shift_logic chart.

  2. Select the gear_logic state.

  3. On the toolbar, in the Simulation tab, click Log Child Activity.

    You will see the logging badge in the corner of the state.

  4. Return to the Simulink® canvas. Click on the vehicle speed signal, and in the signal tab, select the Log Signals button.

    .

  5. Repeat step 4 for the transmission speed and Engine RPM signals.

    You will see the logging badge above these signals.

View Logged Output in Logic Analyzer

  1. In Simulink, on the Simulation tab, open the Review Results app library and select the Logic Analyzer. logic analyzer button

  2. To run the simulation, in the Logic Analyzer window, select the Run button.

    Simulation output as displayed in the Logic Analyzer

  3. Drag the yellow cursor to different points in the output to see the different signal values. You can see the reaction of the engine RPMs as the car gears change.

See Also

(DSP System Toolbox)

Related Topics