Jump to content

determine the smallest deviation over a fixed period of time


Go to solution Solved by Dan FR,

Recommended Posts

Hello Dear Seeq users,

I am trying to find a solution to determine the smallest deviation over a fixed period of time (e.g. 4 hours). Preferably between a minimum and maximum value (e.g. between 150 and 320). Basically, I am trying to find a formula to find the most constant time span of a single signal between 2 values.

It would be very nice if someone could help me with this

Yours sincerely, Jan

Link to comment
Share on other sites

  • Seeq Team
  • Solution

Hi Jan, 

I can help you out with this.  Could you provide more details about your goals for this analysis?  You mentioned you want to find the time span where range of your signal within a fixed period is smallest.  Do you just need to identify that period or do you also want to trend or visualize this signal deviation over time?

To get you started, here's some example code for Formula Tool to calculate the range of your signal within a periodic condition. This will output a signal representing the range of your initial signal '$s' within each 4-hour period and whenever the signal is within your specified limits.  

// Condition defining when signal $s is within limits. This can optionally be created using the Value Search tool.
$withinLimits = $s.isBetween(150, 320)

// Periodic condition every 4 hours. This can optionally be created using the Periodic Condition Tool.
$periodic = periods(4h, 4h) 

// Combine the periodic and limit conditions. This can optionally be created using the Composite Condition Tool.
$combined_condition = $withinLimits.intersect($periodic)

// Calculate the signal range over each 4 hour period whenever signal is within limits.
$signalRange = $s.aggregate(range(), $combined_condition, durationKey())

$signalRange

In this example, we use the '.aggregate()' function with 'range()', which computes the difference between the maximum and minimum values of your signal within the associated condition. Alternatively, you can calculate the Standard Deviation by swapping in 'stdDev()' in place of 'range()'.

Depending on your requirements, we could also compute this using rolling 4 hour windows and then search for the specific 4 hour period where your deviation is lowest.

Hope this helps!

Dan

  • Thanks 1
Link to comment
Share on other sites

Thank you for your prompt reply. I am currently validating a distillation column simulation of an existing plant where the feed is rarely constant. So I am trying to find some stable point of the distillation that I can use. So I wanted to find the most stable point in general and the most stable point for higher and lower feed. 
So I combined this custom formula with the value search and was able to filter out some good examples.

Sometimes the formula produces some gaps, despite the signal seems fine. But with the filter function of the value search I was able to ignore them.

Jan

Link to comment
Share on other sites

  • Seeq Team

That sounds interesting and I'm glad to hear you were able to find a good stable period!

It makes sense that there would be gaps in the formula output, as we are only considering data within the 150 and 320 limits. Anytime the signal is outside of the 150 and 320 limits there would be a gap in the calculated signal. 

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