| Stateflow User's Guide | ![]() |
Entering Transition Conditions
Transitions to and from junctions are referred to as transition segments. Transitions, which, by definition, go from state to state, use transition segments to make a complete transition. The transition segments you add in Adding and Connecting Junctions define two possible destinations for the transition from Off: Hi or Lo. To know which of the two destinations to take, you need to provide a logical decision.
Use the following steps to enter conditions on the transition segments from a junction:
on_switch event occurs, the transition segment to the junction is taken. Once the junction becomes active, Stateflow searches for a valid outgoing transition segment. Stateflow always gives higher priority to transitions that have conditions over other transitions that have no conditions. This means that if the temperature of the attic, temp, equals or exceeds 120 degrees, the attic fan enters the Hi state. If not, the attic fan enters the Lo state. Once the Lo or Hi state becomes active, no more transitions are taken in the diagram until another event occurs.
[temp < 120] as shown.
temp_event, which occurs every second.
off_switch as shown.
off_switch event and either the Lo or Hi state is active. The transition from Hi to Off already takes care of part of this requirement. You add a similar transition from the state Lo to the state Off with an off_switch event for the rest of the requirement.
| Adding and Connecting Junctions | Adding a Graphical Function for Convenience | ![]() |
© 1994-2005 The MathWorks, Inc.