Chart Execution by Using Temporal Logic

2 ビュー (過去 30 日間)
Paul Anderson
Paul Anderson 2021 年 5 月 19 日
回答済み: Pavan Guntha 2021 年 9 月 3 日
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?

回答 (1 件)

Pavan Guntha
Pavan Guntha 2021 年 9 月 3 日
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!

カテゴリ

Help Center および File ExchangeStateflow についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by