One of my tag (let's call this "Distance") has a big fluctuation in reading, and my ultimate goal is to trigger an alarm based on a tag when it reaches an average value below certain point.
Idea I had is to create historian into a database (using Transaction Groups), then call up last 1 hour value using SQL in Named Queries.
I've been looking, but how would I be able to write a script that runs whenever the fluctuating tag value changes, and when it runs, it will calculate the average of the queries found from the Named Queries, output the value to another tag (let's call this one "Avg_Distance")?
Or is there much more efficient way to do this?