Are you looking for AF SDK code? I think a few people at your company definitely can help!
If you are looking at analytics, it is pretty simple. For example, you could use this to count the total number of times, and change it to then just output 1 each time over the limit.
if 'attribute' > 20 and PrevVal('breachMeasure','*') <=20 then 1 else 0
From here, you could obtain the total of the tag. I think Event Frames would be better for this!
Thanks for your reply.Actually i am new to AF
I had created analyses like if 'Sourcetag' > 20 and PrevVal('Sourcetag','*') <20 then 1 else 0 in analysis.This calculates only the breach count for now.Can u suggest how i can calculate breach from now to now-24 hrs.I need final attribute which can tell number of counts where my tag breached the limits and time in breach for last 24 hrs
4 of 4 people found this helpful
Run once per day at midnight in AF Analysis:
OR Rolling 24 hour total:
If you create an analysis for "if 'SourceTag' > 20 then 1 else NoOutput()" and output to a tag you'll get a 1 when the condition is met.
Then you can do a once per day count via AF Analysis of:
3 of 3 people found this helpful
Beyond being a fixed versus rolling average, there is a subtle distinction between:
The latter always produces a 24-hour rolling average. The first produces a 24 hour daily average most of time. The exception are days during a DST transition, in which cases the average may be 23 or 25 hours depending upon whether you spring forward or fall back.
I have done something similar to this, so I concur.
Thanks Rhys Kirk
TimeGT('SourceTag','*-24h','*',20) sounds good for Static limit value or limit value doesn't change often.If i have Limit as Tag values changing twice or thrice a day does this option fit?
You are no longer going to be considered new to AF after this!
For the PE equations you can't specify dynamic limits but there are a few workarounds. First, take a look at this KB article: https://techsupport.osisoft.com/Troubleshooting/KB/KB01120. I would recommend following the first solution. Basically, if your tag value is greater than the limit, then tag value else 0. From here, you can than use TimeTG('formulaOutPut', '*-24h', '*', 0). Also, I would recommend turning step to true for the formula data reference.
I agreed with Dan Fishman that it will be easier to do it with Expression in PI Analysis Service. This youtube channel OSIsoft: How to Setup Expression Analyses with PI AF [PI AF 2014- v22.214.171.12443] - YouTube explain how to setup Expression in PI Analysis Service.
Hmm, that is a tricky one. You have functions to count the time a limit was breached: https://livelibrary.osisoft.com/LiveLibrary/content/en/server-v8/GUID-76DFCD59-BECA-4795-B2D4-B69A615A9D89
But the number of times it was breached would require a different approach. You would need to create an analysis that increases a counter based on the value passing the limit value.
To determine the count, you can query the Delta on that PI Point using the PI Point DR: https://livelibrary.osisoft.com/LiveLibrary/content/en/server-v8/GUID-1D8F7BCD-288C-4CA7-82C9-33C63B159867