Clear Filters
Clear Filters

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

8 views (last 30 days)
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!

Answers (1)

Aditya Saikumar
Aditya Saikumar on 5 Aug 2024
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

Categories

Find more on Modeling 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!