Jump to content

Rolling 'training window' for reference profile etc


Ruben
 Share

Recommended Posts

I am interested in creating a reference profile based on a rolling 'training window'. For example, I want to create a reference profile for a boundary based on the last 7 days of data, or the data for the same month last year. How would I go about doing this?

Thanks

Link to comment
Share on other sites

  • Administrators

Hi Ruben-

Are you referring to the Training Window in the Reference Profile tool?  If so, the Reference Profile tool is designed to create a static profile, so it is not possible to define a dynamic Training Window (like the last 7 days).

However, the latest version of Seeq (R21.0.41) introduced the now() operator in Formula, which may be used to compute dynamic, single-value boundaries.  Here is an example of how this may be used.

Given a temperature signal, lets create upper and lower boundaries as the (avg )+/- (2*std. dev.) of the past 7 days.  The now() operator us used to define the time period over which the average and standard deviation are calculated

1. First, lets calculate the average of the temperature signal over the past 7 days:

image.png

2. Next calculate the standard deviation of the temperature signal over the past 7 days:

image.png

3. Now create the upper and lower limits:

image.png

 

Please let me know if you have any additional questions.

 

Thanks,

Lindsey

Edited by Lindsey.Wilcox
Link to comment
Share on other sites

  • 2 weeks later...

Hi Ruben,

maybe you can use a rolling training window in the following way. For this demo I want to create a reference profile for the Compressor Power when the stage of the compressor is != OFF. The rolling training window shall be the last 7 days as you said.

1. Add the data to the display pane
image.thumb.png.a1cc17c4b69b109310aef73cee164a25.png

2. Create a new signal for the compressor power, that takes the data of the last 7 days and moves this data to some fixed date range (e.g. 01/01/2019):
image.png.184e0fac240825bcf86d9c18f5f2a807.png

3. Repeat this step for compressor stage signal:
image.png.3ec781ce365b9df5109f917e03206a00.png

4. Create a condition that identifies the times when the compressor is on during training window:
image.png.1a7b3ecfba6033582949433b86c7f97f.png

Your display now should look like this when you move to 01/01/2019:
image.thumb.png.f6eee2d798778e83b31a135dd94ef2d2.png

5. Create a condition that identifies the times when the compressor is on (NOT during training). We will use this for the reference profile to be applied to:

image.png.e8f3368db1056f10318974d3de071583.png

6. Create the reference profile based on the training window. I had to shorten the training window by two minutes at end due to an error message ( Training window for reference table must be certain at 'captureReferenceSlice',).

image.png.7836c5b805c554ce2589345ca8887323.png

The result looks like this:

image.thumb.png.2088970a5942a4ed85a9be6b05b9540d.png

 

 

To simulate a change of time you can modify the formulas for the training data like this image.png.317920ae32491f644f6b1343f89c644e.png You can see that the shape of the profile changes:

image.thumb.png.ea20fa32c7e913b04874039b54305634.png

 

I am not sure if this workaround may cause problems in some situations, as it seems the error message in step 6 is thrown because there is no sample at the end of the training window. Therefore this solutions has to be adjusted to your needs.

 

Regards,

Thorsten

 

Link to comment
Share on other sites

  • Seeq Team

This is a creative solution, but I wouldn't depend on it. It's exposed a bug in the delay() function regarding uncertainty. The offset that is being passed to delay() is "uncertain". That means it's possible the value could change. But delay() is not reflecting the uncertainty of the offset in its output properly (the whole signal should be uncertain), which makes it possible to use the delayed signal in the reference profile.

You'll see the negative effects of this after a few days - the portion of the signal that was cached using an older training window won't get updated to reflect the more recent training window.

Link to comment
Share on other sites

Hello Ben,

does "uncertain" in this context mean the values could change because of getting the data dynamically by using now()?

If I change the code from my example above without using now() and changing to a fixed capsule the visualization changes (2. lane):

image.png.4bb1ac2c3cff90eabfbca6f33f04153b.png

 

image.thumb.png.6c26ebb3be2a3eb7fc4e654c91c682ac.png

Is there any way to get around this issue?

Regards,

Thorsten

Link to comment
Share on other sites

  • Seeq Team

Yes. It may seem odd to call now() "uncertain" - don't we have accurate clocks? It really means that the value will change, and any computation using that value is likely to get get different results in the future so it shouldn't be cached. 

The reference series feature is really designed to create static profiles - the performance impact of having to recompute the profile every time that it is used was considered too great. So I don't think there's a workaround.

Perhaps you could describe your use case where a dynamic profile has significant value over the static profile? Are the profiles expected to change significantly over time such that recent behavior is more relevant than a training window(s) that was identified as the "golden batch"? If there are interesting use cases, perhaps it's worth filing a feature request as a result.

Link to comment
Share on other sites

In case of the reference profile I don't have a use case.But I would like to know if this uncertainty resulting in using now() is a problem for predicting a signal into the future? In my case I have a signal that depends on two other signals. In Seeq example data I created a demo that creates a model of the "Temperature" signal by using "Wet Bulb" and "Relative Humidity". To get predicted values for the forecast of  5 days I take the values of the humidity for the last 24hs and repeat it the next 5 days. I then use the values of Wet Bulb from the last 24hs and repeat them also over the next 5 days with rising them by 1°C per day:
image.png.73d65b8aa861d3ad84bf05a1c71dcae2.png

image.png.b0ca2b2f834c535362451049e4c96b3d.png

The prediction for the temperature signal is build upon this two signals:

image.thumb.png.5e15d99fca43217138191ae986af5983.png

Link to comment
Share on other sites

  • Seeq Team

Predicting into the future is a great use of now(), and it's uncertainty is a key part of keeping the predicted data from polluting the cache.

I'm sure you're working toward your own use case, but here's a different approach that's a bit more concise (and uses some newer functions). I'm sure we agree that yesterday's temperature has no prediction value for future, but that's just the demo data. It seems you're just looking for a golden batch to repeat with some adjustment into the future

// extract a single good day to repeat, then repeat it every day
$repeatShape = referenceTable(5min)
  .addRow($temp, capsule("2019-05-15"))
  .repeatOver(days(), ReferenceTableStat.Average)
// this is 5F/day rise since now
$slopeLine = timeSince(now(), 1d).setUnits('F') * 5
// stitch known with future
$temp.forecastSplice($repeatShape + $slopeLine )

image.png

Edited by Ben Johnson
Link to comment
Share on other sites

  • Morgan Bowling changed the title to Rolling 'training window' for reference profile etc

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
 Share

×
×
  • Create New...