Anyone an idea how I could retrieve the last numeric value from a PI point through AF analysis?
The number of 'Bad' values can extent as long as the current situation doesn't change.
This is possible and pretty straight-forward although will require an additional tag because of some limitations of the Analysis Data Reference.
The structure of my test:
And then my analysis configuration:
You can use the BadVal function to do your check and if the value is Bad then write NoOutput or write the value of your input. The limitation here is that in order to use the NoOutput() function, you must save the history of your output (ie write to a tag).
If this is a problem for you, then I would vote and comment on the following enhancement request.
NoOutput() function in Asset Analytics – Customer Feedback for OSIsoft & the PI System
I am not sure what the limitations are, but I think it should be possible to do with without introducing another tag.
An expression such as: if BadVal('badvals') then 0 else 1, should be fine to write to a attribute (don't save the history). You find can use the findEQ such as FindEq('status', '*', '*-5d', 1) and run this at a set internal on the newly created attribute. Of course, not writing to an intermediate tag comes at the cost of performance knowing how far to look back.
Using an intermediate tag, will have much better performance, reduce load on the PI System; however, it probably is not that useful to anyone except this simple calculation!
I'd be careful about this solution as you'd be doing your FindEq on the client and not the server, meaning if you do this at any scale you have the potential of really bogging down the analysis service. Also, I don't see a good way of making how far you look back in your FindEq statement dynamic so if your 'Bad' conditions last for a bit of time I would recommend the tag-based solution first. I think this calculation's usefulness is in the eye of the beholder depending on what or who is downstream of this particular value or values
Based on point type and data type you can try PE TagVal('att1',FindGT('att1','*-1d','*',1)) in AF analysis.
Retrieving data ...