Quantcast

Documentation Center

  • Trial Software
  • Product Updates

Control Chart Execution in the Debugger

Start Simulation in the Debugger

To debug the charts in a model, you start simulation in the debugger:

  1. Click the Start button.

    A debugging simulation session starts. When simulation reaches a breakpoint that you set, the Stateflow® debugger appears as follows:

At the breakpoint, the following status items appear in the upper portion of the Debugger window:

  • Stopped — Displays the step executed just prior to breaking execution.

  • Executing — Displays the currently executing chart.

  • Current Event — Displays the event that the chart is processing.

  • Simulink Time — Displays the current simulation time.

During simulation, the chart is in read-only mode. The toolbar and menus change so that object creation is not possible. In this read-only mode, the chart is iced.

Control Execution Rate in the Debugger

When the chart reaches a breakpoint, you can control the execution rate using single-step mode or continuous execution until the chart reaches another breakpoint. Use the following buttons in the Stateflow debugger to control the execution rate:

  • Continue — After simulation starts and the chart reaches a breakpoint, the Start button becomes Continue. Click Continue to continue simulation.

  • Step In — Run the next execution step, and suspend the simulation.

  • Step Over — Skip the entire execution of a function call, and suspend the simulation.

  • Step Out — Skip the rest of the execution for a function call, and suspend the simulation.

  • Break — Suspend the simulation and transfer control to the debugger.

  • Stop Simulation — Stop simulation and relinquish debugging control. When simulation stops, the Stateflow Editor toolbar and menus return to their normal appearance and operation so that object creation is again possible.

During single-step mode, the debugger does not zoom automatically to the chart object that is executing. Instead, the debugger opens the subviewer that contains that object. This behavior minimizes visual disruptions as you step through your analysis of a simulation.

Error Checking in the Debugger

The options in the Error checking options section of the Stateflow debugger insert generated code in the simulation target to provide breakpoints to catch different types of errors that might occur during simulation. Select any of the following error checking options:

  • Transition Conflict — Check whether there are two equally valid transition paths from the same source at any step in the simulation. This option is only valid with C charts that have an implicit transition execution order. See Conflicting Transitions in a Chart for a complete description and example.

  • Data Range — Check whether the minimum and maximum values you specified for a data in its properties dialog box are exceeded. Also check whether fixed-point data overflows its base word size. See Data Range Violations in a Chart for a complete description and example.

  • Detect Cycles — Check whether a step or sequence of steps indefinitely repeats itself. See Cyclic Behavior in a Chart for a complete description and example.

To include the supporting code designated for these debugging options in the simulation application, select the Enable debugging/animation check box in the Simulation Target pane of the Model Configuration Parameters dialog box. This option is described in Speed Up Simulation.

    Note:   You must rebuild the target for any changes to the settings referenced above to take effect.

Control Chart Animation

You can enable animation of the chart to show which states and transitions execute during a particular time step. Use the following controls:

  • Animation — Select Enabled to turn on animation for the chart.

  • Delay — Enter the speed of animation for the chart: 0 for fastest animation and 1 for slowest animation.

  • Maintain Highlighting — Select this check box to maintain highlighting of active states at the end of chart simulation.

The options for Delay and Maintain Highlighting are available only when you enable animation. For more information, see Animate Stateflow Charts.

Control the Output Display Pane

During simulation, the debugger monitors several execution indicators in the output display in the bottom pane of the debugger. You select the contents of this display with the following pull-down menus, which are available only after chart execution reaches a breakpoint.

  • Breakpoints — Display a list of the set breakpoints. You can set breakpoints in the debugger and in the properties dialog boxes of individual objects such as states, transitions, and functions. See Set Breakpoints to Debug Charts for details. This option lists breakpoints for the currently executing chart or for all charts in the model.

  • Browse Data — Display the current values of defined data objects. This pull-down list lets you filter displayed data between all data and watched data. Watched data has the Data property Watch in Debugger enabled for it. Each of these categories is further filtered by data for the currently executing chart, or all charts in the model. For more details see Watch Data in the Stateflow Debugger.

  • Active States — Display a list of active states in the display area. Double-clicking any state causes the Stateflow Editor to display that state. This pull-down menu lets you display active states in the current chart, or active states for all charts in the model.

  • Call Stack — Display a sequential list of the Stopped and Current Event status items that occur with each single-step through the simulation.

After you make a selection, the pull-down menu for the current display appears highlighted. When you select an output display button, that type of output appears until you choose a different display type. You can clear the display by selecting File > Clear Display in the Stateflow debugger.

Was this topic helpful?