Number of events, chart executions, or time since state became active
temporalCount(
increments by 1 and returns a
positive integer value for each occurrence of the base event E
)E
that takes
place after activation of the associated state. Otherwise, the operator returns a value of
0.
In a chart with no input events, temporalCount(tick)
returns the
number of times that the chart has woken up since activation of the associated state.
The temporalCount
operator resets the counter for
E
to 0 each time the associated state reactivates.
Use of temporalCount
as an event-based temporal logic operator is not
supported in charts for execution as MATLAB® objects.
temporalCount(
counts and returns
the number of units of time that have elapsed since activation of the associated state.
Specify time_unit
)time_unit
as seconds (sec
), milliseconds
(msec
), or microseconds (usec
).
The temporalCount
operator resets the counter for
sec
, msec
and usec
to 0 each time
the associated state reactivates.
You can use quotation marks to enclose the keywords 'tick'
,
'sec'
, 'msec'
, and 'usec'
. For
example, temporalCount('tick')
is equivalent to
temporalCount(tick)
.
The timing for absolute-time temporal logic operators depends on the type of Stateflow® chart:
Charts in a Simulink® model define temporal logic in terms of simulation time.
Standalone charts in MATLAB define temporal logic in terms of wall-clock time.
The difference in timing can affect the behavior of a chart. For example,
suppose that this chart is executing the entry
action of state
A
.
In a Simulink model, the function call to f
executes in a single
time step and does not contribute to the simulation time. After calling the function
f
, the chart assigns a value of zero to
y
.
In a standalone chart, the function call to f
can take
several seconds of wall-clock time to complete. After calling the function
f
, the chart assigns the nonzero time that has elapsed since
state A
became active to y
.