Main Content

View Stateflow States in the Logic Analyzer

Use the Logic Analyzer (DSP System Toolbox) to visualize and measure transitions and states over time. With the Logic Analyzer, you can visualize:

  • Output data from your chart

  • Child and leaf state activity for your chart

  • Self, child, and leaf state activity for your states

You can 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™, SoC Blockset™, or HDL Verifier™.

Add Signals and States for Logging

In this example, you use the Logic Analyzer to visualize the behavior of the engine RPM, the transmission and vehicle speed, and the gear state in the model sf_car.

  1. Open the model sf_car.

    openExample("sf_car")

    Model diagram for the sf_car model.

  2. In the Simulink® Editor, click the engine RPM signal. Then, in the Simulation tab, select Log Signals.

    Logging badge on the output signal engine RPM.

    The logging badge appears above the signal to indicate that the data from the signal is logged when you run the model.

  3. Repeat the previous step for the transmission speed and vehicle speed signals.

  4. Open the shift_logic chart by clicking the arrow in the bottom-left corner of the block.

    Stateflow chart shift_logic in the model sf_car.

  5. Select the state gear_state. Then, in the Simulation tab, click Log Child Activity. The logging badge appears in the corner of the state.

View Logged Output in Logic Analyzer

  1. Simulate the model.

  2. In the Simulation tab, under Review Results, select Logic Analyzer . When you simulate the model, the icon is highlighted to indicate that the Logic Analyzer has new simulation data.

  3. In the Logic Analyzer window, drag the yellow cursor to see the signal values at different points in the simulation. For example, you can see the reaction of the engine RPM as the car gears change. For more information, see Inspect and Measure Transitions Using the Logic Analyzer (DSP System Toolbox).

    Simulation output as displayed in the Logic Analyzer

See Also

(DSP System Toolbox)

Related Topics