| Stateflow | ![]() |
Stateflow Adds Flow Diagrams to the State Machine
While states and transitions are the basic building blocks of a state machine, Stateflow also adds the feature of flow diagrams that provide decision points in transitions. Stateflow implements flow diagrams with junctions, round objects that provide an alternative path for transitions.
In the following example, a junction has been added to the preceding diagram that checks to see if the outside temperature is less than 30 degrees. If it is, the Off state is reentered and the fan stays off. If not, the transition to the On state is taken and the fan is turned on.
In the preceding example, outside temperature is represented by temp, an example of Stateflow data. Stateflow data are variables or constants that you define for Stateflow diagrams that apply locally or outside the diagram. The following diagram shows that the value for temp is set in Simulink, where you can change the value any time you want by switching between two constant values.
| Stateflow Is a Finite State Machine | Stateflow Simulates its State Machine | ![]() |
| © 1994-2009 The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |