Why temporal logic is ignored in my Stateflow chart?

6 visualizzazioni (ultimi 30 giorni)
In my Stateflow chart, there is a subchart which I would like to check for changes every 0.2 seconds. I have implemented it with a self-transition [after(0.2,sec)]. Instead, the check is done at every time step, which means that my system doesn't have the time to settle, and is therefore unstable.
Should I implement it elsehow?

Risposte (1)

Shivang Menon
Shivang Menon il 3 Nov 2016
The stateflow chart (and as a result, the subchart) will execute at every time step. If the time step is less than 0.2 sec, and if the subchart is active, then it will be checked at every time step instead of when "after" is true. You need to transition out of the chart if you want the "after" command to take precedence. Consider the chart below:
Assuming the time step to be 0.1, The simulink engine enters the subchart at time 0, but transitions to the "state that does nothing" at time 0.1. So, if you want the subchart to be checked every 0.2 seconds, you need to change the transition from the state to the subchart to transition after 0.1 sec (instead of 0.2).
Hope this helps !

Categorie

Scopri di più su Decision Logic in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by