I am trying to develop an algorithm in Excel that looks at semi-continuous weight loss on a scale, to calculate the total weight loss over an interval of time for a bag un-loader. However for some intervals, the bag goes completely empty and the operators install a new bag in the middle of the interval This causes the weight to instantaneously increase, but then it starts to decrease again as it drains out. The algorithm is planning to look at the initial weight, the end weight, and also looks for a maximum weight in between the start end time interval which is an indication that a new bag has been installed. If I find a maximum in the middle of the interval I use the data just preceding it as the minimum for the first bag, the max value as the start of the new bag, and the final end time as the end value of the 2nd bag. That is all straight forward until I found out that the weight data occasionally has spurious spikes that are only 2 to 4 seconds long. These spikes, which are not real, become the maximum in the interval range when I use a calculated PI expression. I need to find a way to filter out these spikes. I prefer to do it with a Datalink expression rather than bringing in a bunch of data into Excel and using Excel logic to filter the data. Any ideas on how I could do it?
I need some way to find a maximum value in a time interval, but the maximum value (or the max value plus some tolerance band) needs to be present for more than say 10 seconds to be considered valid. Is there a filter expression for something like this?