I can't understand this stateflow. please tell me why x, y , z value.
2 views (last 30 days)
Show older comments
I want you to tell me what I misunderstand.
In section of Entering a State by Using Supertransitions
--------------------------------------------------------------------
A supertransition is a transition between different levels in a chart. A supertransition can be between a state in a top-level chart and a state in one of its subcharts, or between states residing in different subcharts at the same or different levels in a chart. You can create supertransitions that span any number of levels in your chart.
When a state is entered through a supertransition, before the entry actions for the final destination are executed, its superstates must be marked active and their entry actions must be executed. In this example, StateB1 has been marked for entry from StateA2. At this point, x = 5, y = 5, and z = 1.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1542222/image.png)
By following the Workflow for Entering a Chart or State until the chart goes to sleep, the execution steps for entering the state StateB1 are in this order:
- StateB1 is the substate of an inactive parent (StateB).
- StateB is marked as active.
- StateB is not the substate of an inactive parent.
- Perform the entry actions for StateB. Now x = 4.
- StateB is not the state that was initially marked for entry.
- Perform the entry actions for StateB1. Now x = 3.
- StateB1 is the state that was initially marked for entry.
- StateB1 has no history junctions.
- StateB1 does not contain any default transitions.
- StateB1 does not contain any single substates.
- The chart goes to sleep.
This completes the entry actions for StateB and StateB1.
------------------------------------------------------------------------------------------------------------------------------------------
I think x, y, z value is
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1542227/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1542232/image.png)
as shown in the table above,I think, x=4, y=5, z=1. but according to that explanation, x=3, y =5, z=1.
please tell me why x, y , z value.
0 Comments
Accepted Answer
JWH
on 17 Nov 2023
차트 진입시 외부 천이 조건을 먼저 검사를 한 후 차트의 코드들이 실행됩니다.
StateA에서 x = 5, y = 3, z = 0일 때 조건 검사먼저 해야되는데
조건검사 안하고 StateA1의 during 동작을 먼저 한다고 생각하셔서 차이가 발생한것 같습니다.
아래 사이트를 참조하면 좋을 것 같습니다.
유효한 천이 없이 차트 실행
0 Comments
More Answers (0)
See Also
Categories
Find more on Syntax for States and Transitions in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!