Monitor Test Points in Stateflow Charts
This example shows how to specify data or states as test points that you can plot using a Floating Scope and Scope Viewer (Simulink) block during simulation. You can designate states or data with these properties as test points:
Scope — Output or local
Size — Scalar, one-dimensional, or two-dimensional
Type — Any data type except
Location — Descendant of a Stateflow chart
For more information about using test points in Simulink®, see Configure Signals as Test Points (Simulink).
Alternatively, you can log values for local, output, and active state data and view this logged output by using the Simulation Data Inspector or the Logic Analyzer. For more information, see Log Simulation Output for States and Data.
Set Test Points for Stateflow States and Data with the Property Inspector
1. Open the model.
In the Stateflow chart, state
A and its substate
X become active on the first
tic event. After 10
tic events, state
B becomes active. On the next event, state
A and substate
X become active again and the cycle repeats.
X is the parent of the local data
data is equal to zero. While
X is active, the
during actions increment
data. After 10
tic events, when state
B becomes active,
data mantains a value of
10. Then, when state
A and substate
X become active again, the value of
X reinitializes to zero and the cycle repeats.
2. Open the Property Inspector. In the Modeling tab, select Property Inspector.
3. Select state
A. In the Logging section of the Property Inspector, select Test Point.
4. Repeat step 3 for state
5. Open the Symbols pane. In the Modeling tab, select Symbols Pane.
6. In the Symbols pane, under states
X, select the local data
data. Then, in the Logging section of the Property Inspector, select Test Point.
Monitor Data Values and State Self Activity Using a Floating Scope
1. In the Simulink model, open the Floating Scope block and select Simulation > Signal Selector.
2. Open the Stateflow chart.
3. Open the Signal Selector by clicking and dragging a box around the chart.
4. In the Signal Selector, select the state or data to connect to the Floating Scope block. In this example, the states
A.X and the local data
data are already selected in the Signal Selector.
5. Click the X button in the upper-right corner of the canvas.
6. Simulate the model.
Floating Scope and Scope Viewer (Simulink)