22 Replies Latest reply on Sep 22, 2016 9:22 PM by calmandrysdale

    AF Analysis gets completely different results in 'Preview Results'

    calmandrysdale

      Hi,

       

      Not sure if this is the correct forum for this question, however, I have an analysis which runs twice daily. It calls TagTot on two different attributes and adds the results together (I have BadVal error checking in place which gives a zero on bad val).

       

      The data in the archive is as follows for the stored output tag ( left picture); the data from 'Preview Results' with the correct values showing for the analysis is on the right.

       

      The values didnt appear to be correct, so i went and looked at the analyses and found that when i do a 'Preview results' the values are totally different and are actually correct. Running a backfill does not then give the correct answers in the pi tag but leaves them as the incorrect values.

       

       

      I am hoping someone can explain:

       

      1) Why this behaviour is happening?

       

      2) What steps are available to prevent this in the future?

       

      3) How can i backfill such that the numbers in the archive match what i am  seeing  in 'Preview results'?

       

       

       

      Thanks,

       

      Calman

        • Re: AF Analysis gets completely different results in 'Preview Results'
          calmandrysdale

          Hmmm, Update:

          I deleted the data for the time range im testing from the archive for this pi tag. I then ran the backfill again, this time the archive updated with the correct  values.

           

          Is there any way to force the archive to replace current values with new values when running a backfill?

           

          Thanks,

           

          Calman

          • Re: AF Analysis gets completely different results when re-run
            Jerome Lefebvre

            There is a lot of possible reasons for why the "Evaluate" button and the actual numbers that are written to the data archive. A simple one is that the security might be different, if the analysis service has different permissions to the tags than the user that ran the "evaluate" button. The following KB does its best to summarize those different issues.

            KB01335 - Asset analytics "Evaluate" button shows different results from output

            You seem to have two different values written at the same timestamp, so, it may be that you may have two different analyses writing to the same tag. Is this the desired result?

            • Re: AF Analysis gets completely different results in 'Preview Results'
              calmandrysdale

              The Analysis is calculating from the North Mixer and South Mixer elements which are both from the same template. They both have an attribute called 'Cement Mass Flow Rate Running'. This is an Formula Data Reference

              The formula is :

              A=Cement Weigher Running;B=Cement Mass Flow Rate;C=Water Addition;[if B > 1 then F=B else F=0];[if A > 0.1 and C > 1 then F else 0]

               

              PI Tag Configuration

              Both A and B are referencing PI tags on a child element:

              • A = Cement Weigher Running - PI Tag:  .\Cement Weigher|MV
              • B = Cement Mass Flow Rate = PI Tag:  .\Cement Weigher|PV

               

              C = Water Addition - PI Tag: direct pi tag configuration.

               

              All of the tags, referenced and the tags on the child element are configured as follows:

               

               

              Thanks,

               

              C

                • Re: AF Analysis gets completely different results in 'Preview Results'
                  skwan

                  Calman,

                  This may be a shot in the dark, but in AF 2016, we fixed a bug.  I copied and pasted this from the AF 2016 release note:

                   

                  72576 - RecordedValue call and summary calls could fail for calculated data references in cases where an input attribute returned a bad value, such as NoData.

                   

                  Sorry if this is a bit cryptic, but essentially what this mean is that if you have a calculated data reference, such as a formula data reference, in some cases this could fail if one or more of your inputs to the formula data reference returns a bad value such as NoData.  Since formula data reference is evaluated on the client side, if you have a time drift between your client and the PI Data Archive and your PI Data Archive is 2015 or newer, this time drift can cause NoData to be returned if your PI Points are not configured to support future time stamps.  So for example, your machine that's hosting PI Analysis Service is 30 seconds ahead of your machine hosting PI Data Archive.  When PI Analysis Service runs your periodic analyses, it would cause your formula data reference to execute.  The formula data reference would make a data access call to the PI Data Archive with the trigger time stamp.  Due to the time offset, you would be requesting data with future timestamp.  If the PI Points you're querying are not configured to support future time stamps, this would result in NoData.  That would cause a whole chain of events possibly resulting in you getting wrong values from your analyses.  Now when you backfill, you're making historical data calls, so you won't run into this scenario.

                   

                  It's a long shot, but maybe you can check for time drift between your machine running PI Analysis Service and your machine running the PI Data Archive.

                   

                  (You'll probably tell me that either you're running everyone on one machine, which of course would not have a time drift, or you're not using PI Data Archive 2015+.... :-))

                   

                  --

                  Steve Kwan

                  1 of 1 people found this helpful
                    • Re: AF Analysis gets completely different results in 'Preview Results'
                      calmandrysdale

                      Oh man, great answer, I love it.

                      However, our PI server, PI Analysis Service and AF server are on the same machine.... sorry!

                       

                      I do think you are on the money though with the difference between Recorded Value and Snapshot Values... and there maybe being an error in a formula data reference giving bad values.

                       

                      What i have previously seen though is using a PI Point which references another attribute's pi point (e.g. .\Cement Weigher|MV) giving bad values back on queries, then when replaced by a direct pi point configuration it doesnt get the bad values. This was with an AFSDK application though. I am now at the point where i am going to replace all our referenced pi points to be directly pointing at the source PI Point and testing if that fixes it.

                      Will let you know if this sorts me out (these calcs only run each night at 6 so its a bit slow going).

                       

                      Thanks again for all your help .

                       

                       

                       

                       

                       

                       

                        • Re: AF Analysis gets completely different results in 'Preview Results'
                          skwan

                          Calman,

                          One more shot in the dark.  Have you ever done anything that would cause the PI Point names and PI Point IDs to be inconsistent?  For example, have you deleted changed the PI Point name?  Have you deleted a PI Point and then re-created it with the same name?

                          --

                          Steve

                            • Re: AF Analysis gets completely different results in 'Preview Results'
                              calmandrysdale

                              Hey Steve...

                               

                              That is an interesting question. I am working on a client site and i suspect that this may have actually happened... weird! Any idea how to check this?

                               

                              If you are curious I can confirm that over the last couple of days this conversation has been happening I am still consistently seeing incorrect results; deleting them, running the backfill and getting correct results.

                               

                              Thanks,

                               

                              Calman

                                • Re: AF Analysis gets completely different results in 'Preview Results'
                                  skwan

                                  Calman,

                                  Vincent has a good point, you would get much timelier response from tech support on this.  Consider opening a tech support case.

                                   

                                  Having said that, there is a command line tool, default location: \Program Files\PIPC\AF\AFUpdatePlugInConfigurations.exe that would sync up your PI Point names and ID's in your PI Point data references.  From the command line, execute "AFUpdatePluginConfigurations.exe /help" to get the help on the flags.

                                   

                                  A little background on this.  When running analyses online, the we sign up for updates via the AFDataPipe for the inputs and this is used to feed the AFDataCache.  PI Analysis Service reads input data from the cache if possible for higher performance for the calculations.  If the cache doesn't have all the required data, then we would go directly to the PI Data Archive.  There is a bug whereby if you're trying to signup for update via the AFDataPipe, yet the PI Point name and PI PointID of the PI Point Data Reference don't match, we fail to fall back to name resolution when the ID is invalid.

                                   

                                  For backfilling, we don't use the AFDataPipe to fill the cache, but rather go directly to the PI Data Archive to fetch the data and fill the cache.  In this case, we properly fall back to name resolution when the ID is invalid.

                                   

                                  --

                                  Steve Kwan

                                  1 of 1 people found this helpful
                        • Re: AF Analysis gets completely different results in 'Preview Results'
                          vkaufmann

                          I think given the length of this thread and the complexity of the issue, it might be in eveyones best interest to take this into a tech support case and if need be get some of our product specialists looking at it.

                           

                          --Vince

                          1 of 1 people found this helpful