Skip to main content

value-increase-diff

Syntax

- value-increase-diff

Description

The value-increase-diff operation does not take any parameters. It watches a numeric input and calculates the difference between the incoming value and previous value. If the difference is greater than 0, it emits the difference value, followed immediately by a 0 value at the same timestamp, making this operation behave similarly to an event. If the difference is less than or equal 0, it emits a 0 value.

One application of value-increase-diff is to modify a part counter where the count may be increasing by more than one on a given timestamp. The extracted difference can be further modified and processed by a corresponding event like accumulate to reconstruct an accumulating part count.

Examples

  var1:
- source: partcount
- value-increase-diff
- expression: "execution == 'ACTIVE' ? this : 0"
- accumulate
info

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