Effacer les filtres
Effacer les filtres

Chart Execution by Using Temporal Logic

2 vues (au cours des 30 derniers jours)
Paul Anderson
Paul Anderson le 19 Mai 2021
I have a stateflow chart that needs a timer in one of it's transitions. We typically use the after(n,tick) but a new designer has started using after(n,msec). My main question is if this model is running on target hardware how does the code know when after(n,msec) is complete? Is processor time defined anywhere?

Réponses (1)

Pavan Guntha
Pavan Guntha le 3 Sep 2021
Hello Paul,
The generated code for a stateflow chart which has one of the conditions for state transitions as either 'after(n,tick)' or 'after(n,sec)' indicates that in both the cases a counter is implemented to keep track of time. The only thing changes is the condition which depends on how 'sec' and 'tick' are interpretted. The following example illustrates this idea:
Consider the following stateflow chart:
The generated code for this looks as follows:
If the condition in stateflow chart is changed to 'after(n,tick)' format, the generated code looks as follows:
In both the cases, the stepsize is considered to be 0.2 sec. The conditions in the first case considers how many steps of size 0.2 sec are required to complete 1 sec and 2 sec respectively to make a state transition whereas in second case it considers just the number of steps mentioned in the condition itself (that's how 'ticks' are interpretted).
For more information on 'after' command you can have a look at this documentation page.
Hope this helps!

Catégories

En savoir plus sur Stateflow dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by