Luke_Eck

Count Occurrences of a Tag Value Exceeding A Given Set Point

Discussion created by Luke_Eck on Sep 2, 2020
Latest reply on Sep 4, 2020 by Luke_Eck

Hi,

What I am trying to accomplish here is to write an expression that will give me the number of times that the value of my tag goes above a certain value, in a singular cell.  What I am working with is many temperature sensors in electrical rooms and as a tool to help standardize alarm points and to also diagnose the health of our rooms I want to be able to go back in time, say the last year, and determine how often the temperature in the room exceeds a threshold, say 85 degrees Fahrenheit.  I would prefer my output to be in a single cell and not include any time stamps, I want a simple and bare bones output that tells me only how many times this tag value was greater than 85 in the last year.  I have the rest of my data collected for determining new alarm points for these tags but I want to be able to see how many times this alarm point would have been reached last year so that we can hopefully avoid having nuisance alarms that will be dismissed by the operators.  I have tried many means of achieving this to no avail including PIAdvCalclData, event-weighted, with the filter expression of tagval('tag','*') >= 85 and prevval('tag','*') < 85 and many variations of this.  Not sure if my syntax is incorrect, if I'm missing a nuance, or if I'm just going about this all wrong.  I have viewed similar threads regarding counting machine trips but I am still unable to find a solution that works.  I am frequently getting "0", "6309", "7404", or "31622400" as an output and it does not seem to matter which tags I am using.  These outputs seem pretty consistent irregardless of the data and just vary depending what variation of the filter expression that I use, not sure if this represents a sort of generic error code or is the result of some sort of conversion factor??  Any help would be greatly appreciated.  Thanks

Outcomes