temporalCount

Control chart execution with the temporalCount operator

Syntax

temporalCount(E)
temporalCount(time_unit)

Description

temporalCount(E) increments by 1 and returns a positive integer value for each occurrence of the base event 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) or temporalCount(wakeup) 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.

example

temporalCount(time_unit) counts and returns the number of units simulation time that have elapsed since activation of the associated state. Specify 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.

Examples

expand all

This action counts and returns the integer number of ticks that have elapsed since activation of the state. Then, the action assigns to the variable y the value of the mm array whose index is the value that the temporalCount operator returns.

du: y = mm[temporalCount(tick)];

This action counts and returns the number of seconds of simulation time that pass between activation and deactivation of the state.

ex: y = temporalCount(sec);

Tips

  • You can use quotation marks to enclose the keywords 'tick', 'wakeup', 'sec', 'msec', and 'usec'. For example, temporalCount('tick') is equivalent to temporalCount(tick).

Introduced in R2008a