Main Content

Enable Stateflow Chart Animation by Using 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).

  1. 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 and load its related MAT file, in the MATLAB Command Window, type:

    openExample('slrealtime/SlrtCreateUpdateInstPanelForStateflowCarExample');
    open_system('slrt_ex_sf_car');
    load('slrt_ex_user_inputs.mat');
  2. Open the external mode control panel. In the Simulink Editor, in the Real-Time tab, click Prepare > Control Panel.

  3. Select Signal & Triggering.

  4. 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.

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

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

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

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

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

Related Topics