I have a system setup like the sample stateflow:
Condition1
Occurs and we go to Sub1
. If Condition3
then occurs will it bring us back to Test1
? Similarly if we get to sub2
through Condition1
and Condition2
and then Condition4
occurs will we go back to Test1
?
You can test this for yourself, define the ConditionX
variables as local symbols to that Stateflow model, and some variable x
which you can look at while stepping through the Stateflow evaluation. Set a breakpoint where the Condition1
transition is (right click the line, add breakpoint) and then run your model to step through it.
In my screenshots I've shortened the ConditionX
names to cX
.
In short, no you won't re-enter Test1
without a state transition back to it from Super
. Control will be returned to the Super
state (out of the Sub1
state) and then follow the default transition back into Sub1
.
So If c1
and c3
are true, c2
is false.
Test1
, set x=0
.Test1
to Super
because c1
is true.Sub1
, set x=1
.Super
because c2
is false (no transition to Sub2
) but c3
is true.x=1
does not change again.If c2
is true then you transition into Sub2
instead of step 4. above, x=2
.
If c4
is also true then you transition out of Sub2
back into Super
, and follow the default transition back into Sub1
.
If you want to return to Test1
then you need to add a default transition from Super
to Test1
. Note that in this trivial example Condition1
is always true, so it would then immediately transition back into Super
and Sub1
.