Ray Posted July 17, 2022 Share Posted July 17, 2022 I'm trying to identify any +/- anomalies in tank level on an hourly basis. For example, if the tank level typically increases 2 feet an hour, but then suddenly swings up to say +4 feet on any given hour, I'd like to have that unusual swing captured/archived. So for instance, I'd want "current value + 4ft" in said hour to be highlighted. Would a capsule be the best way to accomplish this? How? Link to comment Share on other sites More sharing options...

Seeq Team Shamus Cunningham Posted July 27, 2022 Seeq Team Share Posted July 27, 2022 Ray, There are probably two ways to approach this and I would try each out and see what works best to capture what you are looking for Method 1 Use derivative to find instantaneous rate of change. Then search for period when that instantaneous value is high for an extended period of time. Step 1 Create derivative signal - you may also want to optionally apply some simple signal smoothing to your raw signal to accommodate for any spikes in the data. In the example below I am using 2 min smoothing and the AgileFilter function but this should be tuned to your data. You could also add the abs() function to the end of this formula if you are interested in any types of rate of change events not just positive increases. $TankLevel.agilefilter(2min).derivative('h') Step 2 Use value search to find period when derivative is above your target value of 4 for a specified period of time (30 minutes in the demo below) Method 2 Directly calculate the rate of change over an hour at a specified sampling rate. The formula below calculated the delta between the signal at a point in time and in 1 hour. The second line periods() function sets up the sampling interval where this will be evaluated every 10 minutes. The startkey() parameter places the value for the difference between value at the start of the 1 hours period. This could be adjusted to the endkey() or middlekey() depending on your needs. Finally, the toStep() function makes this a step interpolated signal but you could remove this line if you would like a lineally interpolated value. For this example the step interpolation helps tell the story of the delta evaluation at distinct moments in time. Finding period of high rate of change would be the same as the ValueSearch step above in method 1 $TankLevel.aggregate(delta(), periods(1hour,10min), startKey()) .toStep() Link to comment Share on other sites More sharing options...

## Recommended Posts

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