6 Replies Latest reply on Jun 7, 2017 6:31 PM by MPetro

    Tagavg showing bias

    MPetro

      Hi everyone!

       

      I am having an unexpected result from the Tagavg function. The average is lower than the raw data. Does anyone know what the cause might be?

       

      Configuration:

      Attribute1: Value from PI point

      Attribute2: Value from a Table

      Analysis: Tagavg('Attribute1','*-5m','*')*'Attribute2'*24

                     Scheduling: every 5 minutesAttribute3: Output from Analysis saved in PI Point

       

       

      PI SE 2016 R2 SP1

        • Re: Tagavg showing bias
          pmartin

          Hi Mauricio,

           

          What are the values that you are getting for Attribute2?  I just want to make sure it's not the easy solution .

            • Re: Tagavg showing bias
              skwan

              Can you execute the analysis in "Preview" and see what the table of numbers look like?  Do the numbers make sense?

              You can also right-click on attribute 1 and attribute 2 to bring up the Time Series Data dialog box and check to see if the data make sense.

              Let us know what you find.

              --

              Steve Kwan

                • Re: Tagavg showing bias
                  MPetro

                  Funny thing. The dummy configuration presented is slightly different from the original. Just as a last attempt, I changed the configuration to the one I showed here. It seems that it is working fine now.

                   

                  The original configuration uses DR formula to do the multiplication. Than the average uses the formula result as input.

                   

                  Attribute1: Value from PI point

                  Attribute2: Value from a Table

                  DR Formula: Attribute3 = Attribute1 * Attribute2

                  Analysis: Tagavg('Attribute3','*-5m','*')  Scheduling: every 5 minutes

                  Attribute4: Output from Analysis saved in PI Point

                   

                  So now the question is: what does Tagavg do if the input is a DR formula? I have several other configurations done this way.

                    • Re: Tagavg showing bias
                      MPetro

                      Speculating possible reasons...

                       

                      The DR formula is

                      A=.|Attribute1;B=.|Attribute2;[A*B*24];DefaultAllowed=1

                      Default value = 0

                       

                      I realised that the last value in a Processbook graph shows the default value (why? I don't know! Not always, but it is fairly common to see that). If the Tagavg includes the default value, in this case zero, it will always average a lower value.

                       

                      Is this correct?

                  • Re: Tagavg showing bias
                    MPetro

                    The Table Lookup gets a constant to make unit convertion.

                  • Re: Tagavg showing bias
                    MPetro

                    Here what I got after some testing.

                     

                    Formula DR with DefaultAllowed=1

                    The average function Tagavg() consider the default value in the calculation. In my case, zero, causing a bias to a lower value. Since my average is for 20 or so value, I usually get 4-5% bias.

                     

                    Formula DR

                    The average works fine. But the result does not match exactly the average done in Excel Datalink. So it is a new kind of problem...