Why temporal logic is ignored in my Stateflow chart?

4 次查看(过去 30 天)
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?

回答(1 个)

Shivang Menon
Shivang Menon 2016-11-3
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 !

类别

Help CenterFile Exchange 中查找有关 Complex Logic 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by