1 Reply Latest reply on Jul 26, 2011 1:06 PM by dtakara

    Algorithm implementation


      Hi everybody this is my first time in this blog and Sistemas Team are developing for us an algorithm inwhich we have some doubts. they are calculating the amount of time under a conditions defined. they are using the time filtered formula and the conditions are been implemented as an expression, the problem that we have is focus on the expression, we need to make an expression  that calcule the average of a number of tags Avg(Tag1, Tag2, ....) but we need calculate this average without negative or cero numbers. We could calutale this average with an ACE logic but at the moment we cannot create a new tags. Please,  could somebody help us to calculate this expression Avg (Tag1, Tag2....) not taking into account negative and cero numbers.


      Thanks in advance...


      José Carlos



        • Re: Algorithm implementation

          Hi José,


          I am trying to get a better understanding of your use case:

          • Since you mentioned "Time Filtered formula", I assume you are using the PI DataLink add-in to Microsoft Excel. Is that correct?
          • Do you want to just calculate the average of some tags (while filtering zeros and negative values) or are you doing further calculation on top of this average?
          • Where do you need to exhibit the results of this calculation?

          In any case, f you want to just filter zeros and negative values in a Performance Equation (be it in PI DataLink, a Performance Equation calculated tag, PI Totalizer Subsystem tag, etc), this expression might be helpful:


          Avg(if('sinusoid'>0) then 'sinusoid' else NoOutput(), if('cdt158'>0) then 'cdt158' else NoOutput())


          This returns the average of tags SINUSOID and CDT158, but filters zeros and negative values.