Skip to main content

latch-value

Syntax

- latch-value:
reset: expression
reset-value: constant value
latch-on-change: boolean

Description

The latch-value operation latches, or holds onto, an incoming value whenever the reset expression evaluates true, including the first value seen after the expression evaluates false. The reset expression is tested on every incoming value, and when any variables within the expression itself change.

This operation is a form of state holding, with the reset expression being used to “refresh” the value.

The reset parameter is required. The expression is tested on every incoming value, and when any variables within the expression itself change. Each time the expression evaluates true, the latch is set “open”, so that the operation will latch the next incoming value.

The reset-value parameter is optional. When the reset expression evaluates true, the operation will hold the reset-value, but it will still latch the incoming value the first time it evaluates false again.

The latch-on-change parameter is an optional, and is false by default. When set to true, the behavior of the latch is modified such that an open latch will remain open until the incoming value is different than the incoming value that was present when the reset expression was last true.

Examples

  first-active:
- source: execution == "ACTIVE"
- rising-edge
first-program:
- source: program_name
- latch-value:
reset: first-active
info

In the above example, program_name and execution are identifiers from another part of the adapter script.

  - state:
- TR1: trigger-1
- TR2: trigger-2
- TR3: trigger-3
- TR4: trigger-4
- IDLE: true
- latch-value:
reset: trigger-reset
reset-value: IDLE
latch-on-change: true
info

In the above example, trigger-1 - trigger-4 and trigger-reset are identifiers from another part of the adapter script.