Main Content

Animate Stateflow Charts with Simulink External Mode

The Simulink® Real-Time™ software supports the animation of Stateflow® charts in your model to provide visual confirmation that your chart behaves as expected. You must be familiar with the use of Stateflow animation. For more information on Stateflow animation, see Animate Stateflow Charts (Stateflow).

You must have already configure the Stateflow states for animation in the model. If you have not, see Animate Stateflow Charts (Stateflow). This example uses model slrt_ex_sf_car. To open the model, in the MATLAB Command Window, type:

open_system(fullfile(matlabroot, 'toolbox', 'slrealtime', ...
'examples', 'slrt_ex_sf_car'))

Open the external mode control panel. In the Simulink Editor, in the Real-Time tab, click Prepare > Control Panel.

Select Signal & Triggering.

In the Trigger section of the External Signal & Triggering window:

  1. To direct the trigger to re-arm after the trigger event completes, set Mode to normal.

  2. To select the number of base rate steps for which external mode uploads data after a trigger event, in the Duration box, enter 5.

  3. To direct data upload to begin immediately after the trigger event, select the Arm when connecting to target check box.

Click Apply. For more information about signal and triggering options, see Configure Host Monitoring of Target Application Signal Data.

Connect to the target computer. On the Real-Time tab, toggle the Disconnected indicator to Connected.

Build and download the model to the target computer. On the Real-Time tab, click Run on Target.

The simulation begins to run. You can observe the animation by opening the Stateflow Editor for your model.

To stop the simulation, on the Real-Time tab, click Stop.

Related Topics