Stateflow User's Guide Previous page   Next Page

Setting Up Diagram Simulation

By default, simulation is enabled in Simulink and Stateflow models. To be sure that it is enabled for the SFcontrol1 model, use the following steps to set up simulation for the Controller Stateflow diagram:

  1. In the Stateflow diagram window, from the Simulation menu, choose Configuration Parameters.
  1. The Configuration Parameters dialog appears as shown.

  1. In the Stop time field, enter inf and click OK to apply the changes and close the dialog.
  1. The stop time value of inf tells Simulink to simulate your model indefinitely until you tell it to stop.

  1. In the Stateflow diagram editor, from the Tools menu, select Open Simulation Target.
  1. The Stateflow Target Builder dialog appears as shown.

  1. In the Stateflow Target Builder dialog, click Coder Options.
  1. The Stateflow sfun Coder Options dialog appears as shown.

  1. Make sure that the check box to Enable debugging/animation is selected, then click OK to apply the change and close the Stateflow sfun Coder Options dialog.
  2. In the remaining Stateflow Target Builder dialog, click OK to close it.
  3. From the Stateflow diagram editor Tools menu, select Debug.
  1. The Stateflow Debugging dialog appears as shown.

  1. In the Animation section, make sure that the Enabled radio button is selected and the Delay (sec) field is set to 0.6.
  1. Entering a larger value in the Delay (sec) field slows down simulation. A smaller value speeds simulation up.

  1. Click Close to apply the change and close the Stateflow Debugging window.

Previous page  Simulating a Stateflow Diagram Simulating a Stateflow Diagram Next page

© 1994-2005 The MathWorks, Inc.