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 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');
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:
To direct the trigger to re-arm after the trigger event completes, set Mode to
To select the number of base rate steps for which external mode uploads data after a trigger event, in the Duration box, enter
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.