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.
openExample("stateflow/AutomaticTransmissionWithActiveStateDataExample")
Add Signals and States for Logging
To view a signal in the Logic Analyzer, you must mark the signal or state for logging.
Open the
shift_logic
chart.Select the
gear_logic
state.On the toolbar, in the Simulation tab, click Log Child Activity.
You will see the logging badge
in the corner of the state.
Return to the Simulink® canvas. Click on the
vehicle speed
signal, and in the signal tab, select the Log Signals buttonRepeat step 4 for the
transmission speed
andEngine RPM
signals.You will see the logging badge above these signals.
View Logged Output in Logic Analyzer
In Simulink, on the Simulation tab, open the Review Results app library and select the Logic Analyzer.
To run the simulation, in the Logic Analyzer window, select the Run button.
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
Logic Analyzer (DSP System Toolbox)