Stateflow User's Guide Previous page   Next Page

Setting Test Points for Stateflow States and Local Data with Model Explorer

You can explicitly set individual states or local data as test points through the Model Explorer. Use the example you create in the following procedure to learn how to set individual test points for Stateflow states and data.

  1. Create the following model:

  1. The model consists of a single Stateflow block named Chart1, which is triggered by a signal from a Sine Wave block through the input trigger event tic. In the Stateflow diagram, the state A and its substate X are entered for the first tic event. State A and substate X stay active until 10 tic events have taken place and then state B is entered. On the following event, state A and substate X are entered and the cycle continues.

    The data x is added to the state X. The entry and during actions for substate X increment x while X is active for 10 tic events. When state B is entered, x is reinitialized to zero, and the cycle repeats.

  1. At the MATLAB Command Window prompt, type
  2. Start the Model Explorer. In the Simulink model, select View -> Model Explorer.
  1. The Model Explorer is displayed.

  1. In the Model Explorer, expand myModel.
  2. Expand Chart1, then select A.
  3. In the right-most pane, State A, select the Test point check box. Click Apply.
  1. This creates a test point for the A state.

    Alternatively, you can access a test point through the middle pane. By default, the Model Explorer displays event and data child objects in the Contents pane for the selected object in the Model Hierarchy pane. You can set the test point for the A state through this pane by selecting the parent of A. If the states are not listed in the middle pane, select the States/Functions/Boxes/Etc. check box in the View -> List View Options for All Stateflow Objects.

  1. Repeat step 6 for state X. Click Apply.
  2. Select X again. Select the local data x in the Contents pane.
  3. In the right-most pane for that data, select the Value Attributes tab, then select the Test point check box. Click Apply.
  4. Repeat step 6 for state B. Click Apply and save the model.

You can now log these test points. See Logging Data Values and State Activity.


Previous page  Monitoring Stateflow Test Points Logging Data Values and State Activity Next page

© 1994-2005 The MathWorks, Inc.