Jump to content

Signal forecasting trained on only the current cycle


Sean T

Recommended Posts

  • Seeq Team

When creating signal forecasts, especially for cyclic signals that degrade, we often use forecastLinear() in formula to easily forecast a signal out into the future to determine when a threshold is met. The methodology is often the same regardless of if we are looking at a filter, a heat exchanger, or any other equipment that fouls overtime or any equipment that needs to go through some periodic maintenance when a KPI threshold is met. 

A question that comes up occasionally from users is how to create a signal forecast that only uses data from the current operation cycle for signal forecasting. The forecastlinear() operator only takes into account a historical training period and does not determine if that data is coming from the current cycle or not (which results in unexpected results). 

Before entering the formula, you will need to define:

  • a condition that identifies the current cycle, here i have called it "$runningCycle"
  • a Signal to do a linear forecast on, i have called it "$signal"

To forecast out into the future based on only the most recent cycle, the following code snippet can be used in formula:
 

$training = $runningCycle.setmaximumduration(10d).toGroup(capsule(now()-2h, now()))
$forecast=$Signal.predict($training, timesince(toTime('2000-01-01T00:00Z')))
$signal.forecastSplice($forecast, 1d)

In this code snippet, there are a few parameters that you might want to change:

.setMaximumDuration(10d): results in a longest cycle duration of 10 days, this should be changed to be longer than the longest cycle you would expect to see

capsule(now-2h, now()): this creates a period during which seeq will look for the most recent cycle. In this case it is any time in the last 2 hours. If you have very frequent data (data comes in every few seconds to minutes) then 2 hours or less will work. If you have infrequent data (data that comes in once a day or less) then extend this so that it covers the last 3-4 data points.

$signal.forecastSplice($forecast, 1d): When using forecastLinear(), there is an option to force the prediction through the last sample point. This date parameter (1 day in this case) does something similar- it blends the last historical data point with the forecast over the given time range. In other words, if the last data point was a value of 5, but my first forecasted datapoint had a value of 10, this parameter is the time frame over which to smooth from the historical data point to the forecast.

 

Here is a screenshot of my formula

image.png

and the formula in action:
image.png

  • Like 4
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...