Jump to content

Creating Manual Limits in Seeq


Recommended Posts

  • Seeq Team

Often times, limits are added manually in Seeq as a simple scalar value using formula:

image.png

However, it is sometimes useful to be able to add limits manually, where the limit value may change over time. This can also be done using Seeq formula. 

The approach is to use the sample() function to specify the timestamp and value of the limit, and then to add new samples with a timestamp of when the limit changed and the new value. These samples will be inputs to a signal that can be displayed in Seeq. Keep in mind that the maximum interpolation will need to be set to an interval large enough to interpolate between limit value changes. In the below example, this is set for 10 days:

signal(InterpolationMethod.Step, 10d,
    sample('2020-09-23T00:00:00Z', 80),
    sample('2020-09-24T00:00:00Z', 90),
    sample('2020-09-30T00:00:00Z', 95))

In order to adjust this signal to extend the last limit value (or last sample) to the current time, we will add another sample with a timestamp at now and a value holding the previous sample value:

signal(InterpolationMethod.Step, 10d,
    sample('2020-09-23T00:00:00Z', 80),
    sample('2020-09-24T00:00:00Z', 90),
    sample('2020-09-30T00:00:00Z', 95),
    sample(now(), SCALAR.INVALID))

Finally, we will resample the signal in order to reduce the maximum interpolation of the result. This step can help improve the performance of this signal if it is used in further calculations, particularly if it will be spliced with another signal.

signal(InterpolationMethod.Step, 10d,
    sample('2020-09-23T00:00:00Z', 80),
    sample('2020-09-24T00:00:00Z', 90),
    sample('2020-09-30T00:00:00Z', 95),
    sample(now(), SCALAR.INVALID))
.resample(1d)

Now this code can be commented to ensure ease of future manual updates. These are done by simply adding a new sample with the timestamp and value of the limit change.

image.png

signal(InterpolationMethod.Step, 10d,
    sample('2020-09-23T00:00:00Z', 80),
    sample('2020-09-24T00:00:00Z', 90),
    sample('2020-09-30T00:00:00Z', 95),

//Insert next limit value as a new sample above this line
//Code below extends last limit value to current time and resamples result to improve performance
    sample(now(), SCALAR.INVALID))
.resample(1d)

The result is a limit signal created and updated manually in Seeq!

image.png

 

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...