Stateflow: how to add a preemptive transition? (No depth first semantic)

조회 수: 5 (최근 30일)
Roberto
Roberto 2024년 7월 18일
답변: Aditya Saikumar 2024년 8월 5일
I want that if the flollowing transitions:
  • From Normal to Fault
  • From Unplugged to Plugged
are either true, the EFSM pass from Normal to Fault and not from Unplugged to Plugged.
I don't want a depth first semantic.
Can you help me? Thanks!

답변 (1개)

Aditya Saikumar
Aditya Saikumar 2024년 8월 5일
Hi Roberto,
It is my understanding that you want the transition from “Normal” to “Fault” to have a higher priority than the transition from “Plugged” to “Unplugged”. By default, this is how Stateflow chart execution works. Please check out the following MATLAB documentation link which contains examples of how the execution works.
So, even if the active substate is “Unplugged”, the transition condition from superstate “Normal” to “Fault” is evaluated first and later the transition condition from “Unplugged” to “Plugged”.
In case you want a transition directly from “Unplugged” to “Fault”, you can achieve that by simply having that transaction with the required condition just like any other transition.
Please keep in mind that the "rand()" function used for the transition from "Normal" to "Fault" will almost certainly give a different value than the "rand()" function used for the transition from "Unplugged" to "Plugged".
I hope this helps!
Thank you,
Aditya

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by