2 Replies Latest reply on Jul 27, 2016 1:46 PM by tmcmanus

    AF Analysis Filtered Time Weighted


      Coming back to the well for help...


      We have some spreadsheets with time weighted filtered expressions and we'd like to replace the spreadsheets with AF analyses.

      The PI-Datalink expression is, essentially: if ('Check Value' > 0) then 'Metered Value' else 0 - time weighted


      The 'Check Value'  and 'Metered Value' can change at any time, so there isn't a nice 'Oh, this is a 10 second value!' that can be applied.


      So, is it possible, in AF, to get a filtered, event weighted total? If so, please provide a working example.


      Thank you.

        • Re: AF Analysis Filtered Time Weighted

          Hi Tim,


          Check out this post on using an Analytic expression to evaluate the event-weighted total for a tag: TagTot as event-weighted. Is it possible? 


          Now, the trickier part here is going to be the filtering. I think the easiest way would be to have essentially two separate Analyses, one performing the filtering, and then one performing the event-weighted total:


          Filter tag:

          IF ('Check Value' > 0) then 'Metered Value' else 0

          Note: We can either choose to write a value of '0', or also a value of NoOutput() which will stifle all outputs during the evaluation. So, we would only get results that are > 0. Which one you choose will depend on the data you want to see at the end


          Weighted Total Tag:

          TagMean('Metered Value', 't', '*') * EventCount('Metered Value', 't', '*')



          Please check out the other PI Square post I referenced for a few drawbacks and warnings with this approach, and then let me know what you think. As mentioned in that post, we have a few WIs in place to integrate this kind of functionality to something such as TagTot or in a new function

          4 of 4 people found this helpful