5 Replies Latest reply on Feb 2, 2011 7:52 PM by Ahmad Fattahi

    GetPIArchieveData  vs GetPISnapshotData


      Hi Guys,


      Thank you for discussing and posting relvant information on this forum section.


      Today I again come up with new question :)


      What exactly a difference between GetPIArchieveData with 1 value and GetPISnapshotData?


      In user guide it is mentioned that "GetPIArchieveData with Start Date = *, End = *, Compressed with Outside" is similar to GetPISnapshotData. If this is so then why we need a GetPISnapshotData operation in the service? Also, in terms of performance and data retreival which is best?


      Many Thanks



        • Re: GetPIArchieveData  vs GetPISnapshotData
          Ahmad Fattahi



          As you pointed out this is the remarks under GetPISnapshotData:


          "This method is equivalent to GetPIArchiveData with a PIArcMannerRetrivalType of Compressed and PIArcMannerBoundaries of Outside for the TimeRange that denotes current time; These queries must specify StartTime=* and EndTime=*, since the snapshot is usually before or at current time."


          You can think of GetPIArchiveData as a general method capable of fetching archive and/or snapshot data in different modes and shapes with possibly a time range included. Since the snapshot value of a PI tag is of specific importance you can use GetPISnapshotData method as a shortcut to retrieve the snapshot value.

            • Re: GetPIArchieveData  vs GetPISnapshotData



              If I have same use case, which is the right operation to use?


              If archive operation (with comp, outside, *, *) is same as snapshot than which is best in performance?

                • Re: GetPIArchieveData  vs GetPISnapshotData
                  Ahmad Fattahi

                  For your purpose there is no real difference in performance. The code would be the same either way. As I said before, the main reason is that you wouldn't  need to populate all the arguments of GetPIArchiveData and use GetPISnapshotData as a shortcut in writing.

                    • Re: GetPIArchieveData  vs GetPISnapshotData

                      Hi Ahmad,


                      Thank you for your reply.


                      Here is the use case.


                      Retrieve latest meter read from PI system. So if I pass today's date I should receive current meter read of that tag. Otherwise I should get most recent one (probably yesterdays, or the day before yesterday...( for dalily reads).


                      1. PI systems containes daily meter reads. New value at 11:59:59 per day...


                      2. I want the retreieve latest one using archieve operation..


                      3. I pass start date and end date (can be last two months, one month, 10 days, a week, etc...from current date)


                      4. I pass numvalue=1, compress, + outside.


                      If this is my case than I'll get the most recent value in the specified time range? But, here I'm passing long interval(last 3 months, for instance)...will service "scan" all values and pass the latest one? If this is the case, how performance of snapshot and archive are same?





                        • Re: GetPIArchieveData  vs GetPISnapshotData
                          Ahmad Fattahi

                          If you are looking for values a specific time interval as you describe, then GetPISnapshotData is not the method to consider. GetPISnapshotData is only used as a shortcut when you are only interested in the snapshot value (as opposed to any archived value) of a tag. If you are interested in anything other than that, including a specific time interval as you described, GetPIArchiveData would be the way to go.


                          The two methods are equivalent in performance only when retrieving the snapshot value of a tag.