| Stateflow User's Guide | ![]() |
Creating Parallel States
In Creating Exclusive States, you learn about exclusive states, the default state of Stateflow, the type of state that you have been creating in all the previous material of this Getting Started guide. In this topic, you learn about parallel states, the only other type of state in Stateflow.
Parallel states have dashed borders and are sometimes referred to as AND states. You create them by assigning the parent of the states parallel decomposition. The distinguishing feature about parallel states is that all brother and sister parallel states are active at the same time. You could say that these states are actively concurrent with each other.
In this topic, you create parallel states to provide control over two individual control objects in the following steps:
SFcontrol3 you save in Adding a Sensor to the Model and save it as SFcontrol8.
temp to 130.
Notice that both states have numbers in their upper-right corner. These numbers give the priority of one parallel state over another. Even though parallel states have concurrent behavior, they are not completely concurrent. They are executed according to their priority number.
Priority numbers are assigned to parallel states automatically by Stateflow based on the position of the state. Parallel states that have a higher position in the Stateflow diagram editor receive a higher priority. Parallel states on the left have priority over states on the right with the same vertical position.
in(FAN1.On) checks if the On state in FAN1 is active before the transition is taken. This use of the built-in function in is referred to as an implicit event. In this case, if the state Off in FAN2 is active and the state On in FAN1 is active, in(FAN1.On) is true and the transition from Off to On in FAN2 is taken.
| Creating Exclusive States | Simulating Parallel States | ![]() |
© 1994-2005 The MathWorks, Inc.