Skip to main content

Safe To Advance To (STAT)

Apart from logical time, each node also maintains a Safe To Advance To(STAT) time value. STAT acts as a safeguard for the increase of logical time: the node's logical time is only allowed to advance to t<STATt \lt \text{STAT}. For eager reactions, the bound is relaxed to tSTATt \leq \text{STAT}.

By default, STAT is set to forever, meaning that the logical time can grow whenever it wants. Consider a reaction triggered by two input ports A and B. If A receives a message with logical time tAt_A, the node will immediately advance to tAt_A since tA<STAT=forevert_A \lt \text{STAT}=\text{forever}. Now the node receives another message with logical time tBtAt_B \leq t_A and this will cause a problem since we now have to go backwards in time to process the new message.

This can be solved with STAT. If we know tBt_B in advance and set STAT to tBt_B, since tBtAt_B \leq t_A, when we receive the message on port A, we know that we cannot process it yet since we have to wait for the message from tBt_B.

Configuring STAT

A STAT can be set for each output port when sending a message. The API is

self.output_port(<value>, STAT=<Time>)

Note that STAT is an interval instead of absolute time. The current logical time will be automatically added when sending STAT. One rule of thumb for setting STAT is to set it to the timestamp of the earliest next message (ENT, earliest next timestamp). This will ensure that the downstream will not advance its logical time past the ENT, essentially waiting for this message before advancing to that logical time.