sequence-detector
The sequence-detector block is used to detect a sequence of rising edges occurring one after another on inputs labeled using tag blocks. After the full sequence is detected successfully, the block emits a logical pulse true -> false on its output and shows a completion message for 1 second. The block can be used, for example, to detect the direction of movement of a person passing by several sensors one after another.
Configuration parameters
| Parameter name | Value |
|---|---|
Maximum sequence duration (time_limit) |
Numeric field specifying the maximum time within which the full tag1, tag2, ..., tagN sequence must be detected. The minimum value is 0.1 seconds and the maximum value is 64800 seconds (that is, 18 hours). Step: 0.1 seconds. |
Input handling
The sequence-detector block supports only inputs labeled using tag blocks. The inputs must be configured as a sequence of consecutive tags starting from tag1. At least two tags and at most twenty tags must be connected to the block.
Valid input configuration examples:
tag1, tag2tag1, tag2, tag3tag1, tag2, ..., tag20
Invalid input configuration examples:
- only
tag1 tag2, tag3tag1, tag3- at least one block other than
tagis connected to the block
The block reacts only to rising edges. In the idle state, it waits for a rising edge on tag1. After detecting it, the block starts counting the time specified by the time_limit parameter and then waits for rising edges on tag2, tag3, and so on up to the last configured tag.
Operating rules:
- A rising edge on tag1 always starts a new sequence and restarts the sequence timer.
- Repeating the most recently accepted tag is ignored.
- If a rising edge appears on a tag other than the expected next tag, the current sequence detection attempt is canceled.
- If the full sequence is not detected within the time specified by time_limit, the block returns to the idle state.
- After the full sequence is detected, the block emits a logical pulse on the output and shows the
Sequence completed.message for 1 second. - While the
Sequence completed.message is displayed, a rising edge on tag1 interrupts that state and immediately starts counting a new sequence. - While the
Sequence completed.message is displayed, all rising edges on inputs other than tag1 are ignored.
The table below describes the meaning of the inputs:
| Input number and name | Description |
|---|---|
tag1: First element of the sequence. |
A rising edge on the tag1 input starts a new sequence and starts counting the time specified by the time_limit parameter. If the block is currently displaying the Sequence completed. message or counting the time of the current attempt, such an event interrupts the previous state and immediately starts a new sequence. |
tag2 ... tagN: Subsequent elements of the sequence. |
Rising edges on subsequent inputs must occur in the correct order. Repeating the most recently accepted tag is ignored. If a tag other than the expected next tag appears, the current sequence detection attempt is canceled. |
Block outputs
The block has one logical output that emits a pulse after a full valid sequence has been detected:
- rising edge false -> true
- immediately followed by falling edge true -> false
The description visible below the block reflects its current state:
Waiting for tagX.means waiting for the next tag in the sequenceSequence completed.means the 1-second message shown after a full valid sequence has been detected
Errors returned by the block
The sequence-detector block can return the following errors:
| Error code | Error description |
|---|---|
Invalid time_limit configuration. |
The time_limit parameter is invalid. Set a positive numeric value with a 0.1 second step, not greater than 64800 seconds. |
Too many tagX connections. |
More than one tag block with the same number X has been connected to the block. |
Missing required tag connections. |
Fewer than two consecutive tags starting from tag1 have been connected to the block. |
Non-tag block connected. |
A block of a type other than tag has been connected to the block input. |
Missing tagX connection. |
There is a gap in the tag numbering in the input configuration and the next expected tag X is missing. |
Invalid project. |
An internal problem occurred while accessing the logic project during block initialization. |
Examples
Assuming that tag1, tag2, and tag3 are connected to the block:
- The sequence
tag1, tag2, tag3detected in less time than time_limit emits an output pulse and shows theSequence completed.message for 1 second. - The sequence
tag1, tag3does not emit an output pulse because tag2 was skipped. - The sequence
tag1, tag2, tag2, tag3emits an output pulse because repeating the most recently accepted tag is ignored. - The sequence
tag1, tag2, tag1, tag3does not emit an output pulse because a new tag1 starts a new sequence and cancels the previous attempt.