value-delay
Description
The value-delay block delays forwarding changes received on its input. Each input value is stored for the configured amount of time and then forwarded to the block's only output.
The block has one input and one output. It supports all logic value types.
Configuration parameters
| Parameter name | Value |
|---|---|
Name (name) |
Name displayed on the block in the editor. Leaving the field empty displays value-delay. |
Delay (ms) (delay_milliseconds) |
Required delay time in milliseconds. Allowed range: from 100 ms to 600000 ms (10 minutes). |
Max queued messages (max_queued_messages) |
Required maximum size of the queue of pending messages. Allowed range: from 1 to 100. |
Queue overflow mode (queue_overflow_mode) |
Required behavior when the queue becomes full. Allowed values: drop, replace_oldest, replace_newest. |
Input handling
The block accepts every change sent to its input, regardless of the value type. Each received change is placed in the queue and gets its scheduled emission time calculated from the “Delay (ms)” parameter.
If multiple changes are to be emitted at the same moment, the block preserves the order in which they originally arrived.
When the queue is full, the block reacts according to “Queue overflow mode”:
drop: the new change is ignoredreplace_oldest: the oldest pending message is removed before the new message is addedreplace_newest: the new message replaces the most recent pending message
If no other block is connected to the block input, the block reports the Input disconnected. error.
Block outputs
The block has one output. After the configured time has elapsed, the same change that previously arrived at the input is emitted at the output, only delayed.
The description visible below the block informs about the current queue state, and after the first successful emission also about the last value that was sent:
queue emptymeans the queue is emptyqueued: Nmeans thatNmessages are currently waiting in the queuequeue empty, last: Xmeans the queue is empty andXwas the last value emitted by the blockqueued: N, last: Xmeans thatNmessages are currently waiting in the queue andXwas the last value emitted by the block
The last: X part is not shown before the first successful queue emission.
Errors visible to the user
The block can display the following error messages:
| Error code | Error description |
|---|---|
Invalid delay_milliseconds configuration. |
The “Delay (ms)” parameter is outside the allowed range or is not a valid number. |
Invalid max_queued_messages configuration. |
The “Max queued messages” parameter is outside the allowed range of 1 to 100 or is not a valid number. |
Invalid queue_overflow_mode configuration. |
The “Queue overflow mode” parameter has a value other than drop, replace_oldest, or replace_newest. |
Input disconnected. |
No other block is connected to the block input. |
For the Invalid queue overflow mode. message, check the “Queue overflow mode” setting. If the message keeps appearing or a message starting with Failed to ... appears, record its full text and contact technical support.
Examples
- With “Delay (ms)” set to 500, the
false -> truemessage received at the input will be emitted at the output after about 500 ms. - After the first successful emission of the
false -> truemessage, the block description will contain thelast: truefragment. - If three messages enter the queue one after another, all three will be emitted after their delay time in the same order in which they reached the block.
- With “Max queued messages” set to 2 and “Queue overflow mode” set to
drop, the third message received before the first two are emitted will be ignored. - With “Max queued messages” set to 2 and “Queue overflow mode” set to
replace_oldest, the third message will remove the oldest pending message from the queue and then be added as the new last message in the queue. - With “Max queued messages” set to 2 and “Queue overflow mode” set to
replace_newest, the third message will remove the most recent pending message from the queue and take its place.