Skip to main content

Linearly extrapolating the current trend of a tag to estimate what its value is going to be at some point in the future is the probably the simplest form of predictive analytics, but it can be very effective in some cases.

We can implement such a tag by taking the current value of the tag and adding the increase over the last x time. For example, if a tag currently has a value of 10, and the value 5 minutes ago was 8, then we would extrapolate that the value in 5 minutes will be 10 + (10-8) = 12. An obvious requirement is that the tag behaves somewhat linearly within the scope of our use case. Linear extrapolation will always be a simplification of your process. Of course, should you have a more custom formula can predict future values better you should implement that formula instead.

After creating the predictive tag we will typically want to monitor on those future values to receive early warnings. Some use cases I have seen solved this way include:

  • Monitor whether a tank will be empty in the next hour
  • Predict (and monitor) whether performance will drop below a threshold the coming week

Below is a simple example of a formula predicting the tank level in 4 minutes. Since the level cannot become negative, we set the lower threshold of the formula to 0.

Formula for estimated tank level in 4 minutes.

Note that we use the previous 4m to predict the next 4m. We could play with the shift and a multiply the rate by a certain factor to change what interval we use to estimate the rate and how long into the future we want to calculate our value. Suppose we would want to use the last 15m to predict the next 4m, the shift in our formula would become 15m, and the formula itself would become:
max(current + (4/15)*(current - previous), 0)

Keep in mind that the formula tag we create always plots the expected future value at the current time, as plotting values into the future does not work in TrendMiner.

Rather than the future value, you might also use a similar mechanism to create a time remaining formula tag. To use the rate of the last 4m of our level tag to plot the time remaining (in minutes) until our tank is completely empty, our formula would become something like:
if(current < previous, 4*current/(previous - current), -1)

In the formula above, rather than adding the rate, we divide by it. To normalize our shift of 4m to 1m, we multiply by 4. Finally, to avoid infinite or nonsense negative values, we set our formula tag to a default value of -1 whenever the level of the tank is not decreasing.

If you have any questions or remarks about this type of formulas, let me know in the comments!

It took me some time to realize that this is not really extrapolation (as you are using the current value) nor a prediction (you store a future predicted value at the current time). 

After all you don't know how far back the ‘current’ value is when you extrapolate. If the current value is just 5 seconds ago, the extrapolation would be way off.

 

I think it would make more sense to make this either a trend prediction (we actually calculated the value increases by 2 per 4 minutes). But again unsure if just taking 2 datapoints will create a suitable prediction..

 


Hi ​@Roger Palmen ,

Thanks for leaving a comment! You are right of course that it is not really an extrapolation as at any time you are taking only two points, which indeed may poorly represent the data that is actually in between those points. I will say that in some cases, I have seen this approach being 'good enough' to get an estimate.

What often helps is first smoothing the original tag with a moving average, and then using this approach on the moving average tag rather than the original tag. That way you do take an entire interval into account rather than simply two points, though I could not really say how it holds up to a true extrapolation through linear regression.

The plotting of the prediction values at the current time is more of a technical limitation of TrendMiner, which cannot plot formula points into the future. I agree that it can make use cases like quite confusing.

Wouter


Reply