calculate delta
Last updated
Last updated
Calculates ‘delta’ based on the previous time-series reading and current reading and adds it to the message. Delta calculation is done in scope of the message originator, e.g. device, asset or customer. Useful for smart-metering use case. For example, when the water metering device reports the absolute value of the pulse counter once per day. To find out the consumption for the current day you need to compare value for the previous day with the value for current day.
Delta calculation is done in scope of the message originator, e.g. device, asset or customer.
Input value key (‘pulseCounter’ by default) - specifies the key that will be used to calculate the delta.
Output value key (‘delta’ by default) - specifies the key that will store the delta value in the enriched message.
Decimals - precision of the delta calculation.
Use cache for latest value (‘enabled’ by default) - enables caching of the latest values in memory.
Tell ‘Failure’ if delta is negative (‘enabled’ by default) - forces failure of message processing if delta value is negative.
Add period between messages (‘disabled’ by default) - adds value of the period between current and previous message.
Rule node relations:
The rule node produces message with one of the following relations:
Success - if the key configured via ‘Input value key’ parameter is present in the incoming message;
Other - if the key configured via ‘Input value key’ parameter is not present in the incoming message;
Failure - if the ‘Tell ‘Failure’ if delta is negative’ is set and the delta calculation returns negative value;
Let’s review the rule node behaviour by example. Let’s assume the following configuration:
Let’s assume next messages originated by the same device and arrive to the rule node in the sequence they are listed:
The output will be the following: