timer (Z.100)

Concrete graphical grammar

.<timer definition> ::=
timer
<timer definition item> {,<timer definition item>}* <end>

<timer definition item> ::=
<timer name> [ <sort list> ] [ := <Duration ground expression> ]

<reset> ::=
reset ( <reset statement> { , <reset statement> }* )

<reset statement> ::=
<timer identifier> [ ( <expression list> ) ]

<set> ::=
set <set statement> { , <set statement> }*

<set statement> ::=
([ <Time expression> , ] <timer identifier> [ ( <expression list>) ] )

A <set statement> may omit <Time expression>, if <timer identifier> denotes a timer which has a <Duration ground expression> in its definition.

ib.<set area> ::=
<task symbol> contains <set>

<reset area> ::=
<task symbol> contains <reset>

Semantics

A timer instance is an object, that can be active or inactive. Two occurrences of a timer identifier followed by an expression list refer to the same timer instance only if the operator "=" applied to all corresponding expressions in the lists yields True (i.e. if the two expression lists have the same values).

When an inactive timer is set, a Time value is associated with the timer. Provided there is no reset or other setting of this timer before the system time reaches this Time value, a signal with the same name as the timer is put in the input port of the process. The same action is taken if the timer is set to a Time value less than or equal to now. After consumption of a timer signal the sender; expression yields the same value as the self; expression. If an expression list is given when the timer is set, the values of these expression(s) are contained in the timer signal in the same order. A timer is active from the moment of setting up to the moment of consumption of the timer signal.

If a sort specified in a timer definition is a syntype, then the range check defined in Z.100, §5.3.19.1 applied to the corresponding expression in a set or reset must be True, otherwise the system is in error and the further behaviour of the system is undefined.

When an inactive timer is reset, it remains inactive.

When an active timer is reset, the association with the Time value is lost, if there is a corresponding retained timer signal in the input port then it is removed, and the timer becomes inactive.

When an active timer is set, this is equivalent to resetting the timer, immediately followed by setting the timer. Between this reset and set the timer remains active.

Before the first setting of a timer instance it is inactive.

The Expressions in a Set-node or Reset-node are evaluated in the order given.

Model

A <set statement> with no <Time expression> is derived syntax for a <set statement> where <Time expression> is "now; + <Duration ground expression>", where <Duration ground expression> is derived from the timer definition.

A <reset> or a <set> may contain several <reset statement>s or <set statement>s respectively. This is derived syntax for specifying a sequence of <reset>s or <set>s, one for each <reset statement> or <set statement> such that the original order in which they were specified in <reset> or <set> is retained. This shorthand is expanded before shorthands in the contained expressions are expanded.