Examples

Our rule configurator often provides the possibility to get to your goal in different ways. This page shows examples on how you can combine the different functions and operations to write a rule.

SUBSETS

Subsets are often used to select a certain time period from a timeseries.

For example, we want to send a message if the minimum of the newest two entries of a time series of 5 days in Grid Power Consumption is greater than the minimum of the remaining time series.

As described on the SUBSET chapter of the Functions page, we simply can add the number of entries we want to extract from a vector, as long as they are at the beginning or end of the vector. As we want the most recent entries, we must precede that value with a minus sign.

MIN(SUBSET($GridPowerConsumption5d, -2))

We now have a snippet of the two newest entries from the original time series. By adding the MIN function, we end up with the lower value of those two.

Alternatively, we can also take the newest entries in a certain time period. Here we want to get the minimum of all registered Grid Power Consumption events from the last 30 minutes until now.

Now is always defined as the newest entry and is included in the subset, but the start time is excluded. So we would need to add an additional minute (or at least some seconds) to include the event that occurred exactly 30 minutes ago.

MIN(SUBSET($GridPowerConsumption5d, now-31min, now)) 

Let us continue with the first version. We now want to compare this minimum value with the minimum of the rest of the time series.

The beginning of this snippet is therefore the first value of the vector at position 0 up to and including the third most recent event. As before, we can get the minimum by applying a MIN function to the resulting subset.

MIN(SUBSET($GridPowerConsumption5d, 0, -3))

Finally, we simply have to combine the two parts for our condition by adding a Greater operator between them:

MIN(SUBSET($GridPowerConsumption5d, -2)) > MIN(SUBSET($GridPowerConsumption5d, 0, -3))

Last updated

© 2023 MOOST AG