Jump to content

Finding maximum value during the current time duration in a trend

Go to solution Solved by Kelly Kolotka,

Recommended Posts

I'm looking to find the maximum value in a trend during the current time duration.  So, for instance, in an osculating trend of 6 hours, what would the maximum value be?  I also want to be able to use that value in a formula with another signal.  Right now, I am able to find the max value, but it says that it's scalar and can't be used in a formula.  I tired the .toSignal(), but that gives an error.

Link to comment
Share on other sites

  • Seeq Team
  • Solution

Hi Trevor,

There are multiple formulas you can write to accomplish this, but it will depend on the time duration you would like to find the maximum for. In the photo, I have found the maximum of my signal Temperature over 2 different time ranges. In this case, the dashed line is due to uncertainty in the calculation, but both formulas result in Signals. 

1. max of 6 hour periods: This formula will find the maximum point in every 6 hour window: $t.aggregate(maxValue(), periods(6hours), durationkey())

2. max of the last 6 hours: This will use now() so that the maximum is calculated for the past 6 hours relative to current time: $t.aggregate(maxValue(), condition(6h, capsule(now()-6h, now())), durationkey())


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