Understanding Absolute and Relative Time in Timed Structures

A designated timing source governs timed structure execution. However, not all timed structure configuration options refer to the absolute value of the timing source. In Timed Loops with frames and Timed Sequence structures with frames, some configuration options are relative to the timing of the previous frame or the current frame. Options that refer to the start or finish of a frame execution use relative time, while options that refer to the timing source use absolute time.

In timed structures, the offset is governed by absolute time, and outputs like Expected Start, Expected End, Actual Start, and Actual End are calculated in units of absolute time for frame and iteration timing. The start time, deadline, and timeout for each frame are governed by relative time. The start time and timeout are relative to the beginning of the previous frame execution, the deadline is relative to the beginning of the current frame.

In the following block diagram, a Timed Loop with frames governed by a 1 kHz clock has a period of 1000 ms and an offset of 100 ms. The offset is governed by absolute time, so the loop iterates when the timing source clock reaches 100 ms, 1100 ms, 2100 ms, 3100 ms, and so on, until the loop execution completes.

Note A Timed Loop that is late can use absolute or relative time, depending on the mode of the Timed Loop.

1 Offset Absolute time—refers to loop timing source
2 Deadline Relative time—refers to start of second frame
3 Start Relative time—refers to start of first frame
4 Timeout Relative time—refers to start of end frame

The second frame of the Timed Loop has a start time of 75 ms. Since the start time is relative to the beginning of the execution of the previous frame, the frame execution can start no earlier than 75 ms after the first frame begins to execute. According to absolute time maintained by the timing source, the start time for the second frame is 175 ms in the first iteration, since the second frame executes no earlier than 75 ms after the first frame begins at 100 ms on the timing source clock.

The frame also has a timeout input of 2000 ms. The timeout establishes a maximum wait for the start of one frame after the beginning of the execution of the previous frame. If the second frame does not begin to execute within 2000 ms of the beginning of the execution of the first frame, LabVIEW executes the rest of the iteration untimed and returns Timeout in the Wakeup Reason output on the Left Data node. If the second frame does begin to execute before the 2000 ms for the timeout passes, the deadline of 150 ms then places a limit on the amount of time the frame can spend executing. From the point in time when the second frame begins to execute, 150 ms can pass before the frame will output a TRUE value in the Finished Late indicator.

Timed Structures Home