I would like to calculate an average flow rate but only when the flow is above a minimum value. This is easily done in DataLink with a filter expression. How do you perform this calculation in AF/Analysis?
There is a KB on how to create filtered calculations with PI Analysis Service. Here you go : KB01120 - Filtered calculations in Asset Analytics
You should be able to do this using 2 statements I believe.
The first one would look something like:
Variable1: If tagval('flowtag', '*') >= 50 THEN 1 Else 0
The second statement could be,
Variable2: If Variable1=1 THEN tagavg('flowtag', '*-2h', '*') Else NoOutput()
Note: you will probably want to create and write the result to an output tag I would think?
Are you using event triggered or periodic? If periodic, I'd probably evaluate the tagavg value of your flow tag over a short or longer period of time dependent on the process characteristics in order to determine and conclude that your flow has been higher than a certain value for a period of time. Using this method, you could configure your analysis as periodic, let's say it would run every 5 or 10 minutes depending on how often you need to write a value to your output tag.
If you can include more specifics around your requirements, I believe we could make more meaningful suggestions to your problem.
This approach definitely works! It requires the creation of an intermediate tag, though. The output of the intermediate analysis would need to be written to a PI tag.
The intermediate tag could be avoided here, since it seems that Todd is looking to calculate a time-weighted average. In this case, you would be able to apply the filter using an AF Formula. See Solution 1 of the KB article that Lok mentioned.
Retrieving data ...