AnsweredAssumed Answered

How to count intervals within sample period where tag value over threshold

Question asked by troyh on Sep 3, 2015
Latest reply on Sep 3, 2015 by Dan Fishman



I am using PI DataLink to calculate the % time (within a specified window) a tag is greater than a threshold value.

I have found approaches to this using both the PITimeFilterVal function, and the PIAdvCalcExpFilVal function.


I would now like to perform a similar comparison (tag value to threshold), on an interval basis, but return a count of the intervals where the tag value exceeds the threshold for more than half of the interval (i.e. I would like to return a single value only.


I have managed to calculate the % time exceeded for each interval (using the PIAdvCalcExpFilDat function), but this returns an array (i.e. one value for each interval).


Logically I want something like:


returned value = count of intervals in timespan, where tagvalue > threshold value, for > 50% of interval



Is this kind of query possible?


Thanks in advance.