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 CenterFile Exchange에서 Stateflow에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by