Rule Library
On change only
Checking measurements when they has changed.
SELECT changed_col(true, `wheel-count`) AS v FROM asset_5758 WHERE v % 20 = 0;
With the CHANGED_COL() function rules are only processed when there were a change in the value.
Crossing threshold
When a measurment crosses a threshold.
SELECT variable AS var FROM asset_12891 WHERE CHANGED_COL(true, var > 15);
With this rule the variable is checked whether it changed from less than 15 to greater. Above 15 it will not be triggerd.
Prediction Rule
If you want to get informed when a threshold of cycles will be exceded in the near future. So we need:
the piece counter values (named: PieceCounter). Which is an constantly increasing value.
the end of live value (EoL). In this case a constant.
the pre warning time (pwt). How long before the EoL is reached the ticket shall be created.
and the asset where the data come from.
The check duration shall be rather small against the pwt.
SELECT
// getting the last value in the time range.
collect(`PieceCounter`)[cardinality(collect(`PieceCounter`))-1] as ACT,
// getting the first value in the time range.
collect(`PieceCounter`)[0] as START
FROM asset_xxx
// the collection window contains data of 24h.
group by TumblingWindow(HH, 24)
HAVING ACT < 'EoL' // checking actual value is lower EoL
AND (ACT - START) > 0 // checking gradient of the cycles is increasing and not 0.
AND ('EoL' - ACT)/(ACT - START) < 7; // the actual gradient leads to EoL in less than 7 days.
In this example we have a check duration of 24h because we want to get informed 7 days before the EoL is exceeded.
A ticket will be created when:
the PieceCounter are lower than the EoL.
the gradient is increasing and not 0. (avoid division by zero)
the gradient over 7 days exceeds the EoL.
Time based Tickets
For the machine there should be a ticket created after a certain amount of time. Like the regular notification for an oil change at a car.
Possible intervalls:
DD - Days
HH - Hours
MI - Minutes
SS - Seconds
MS - Milli seconds