9 Replies Latest reply on Jan 16, 2014 7:38 AM by AKorobochkin

    PI WS PlotValues behaviour

    Bannikov

      Hello.

       

      We're retrieving data with PI Web Services using GetPIArchiveData with the following request

       
      requests[j] = new PIArcDataRequest();
                      requests[j].TimeRange = new TimeRange();
                      requests[j].PIArcManner = new PIArcManner();
                      requests[j].Path = trendPaths[j];
                      requests[j].TimeRange.Start = ((HiChartVWP)Parent).StartTime;
                      requests[j].TimeRange.End = ((HiChartVWP)Parent).EndTime;
                      requests[j].PIArcManner.RetrievalType = PIArcMannerRetrievalType.PlotValues;
                      requests[j].PIArcManner.NumValues = 10;
                      requests[j].PIArcManner.Updates = false;
      

       Even though according to the PI WS manual, the highest number of points we can get in such a case is 50 (i.e. NumValues * 5), we can get a number higher than that (depending on a TimeRange). Hence the question: is our request wrong in some way, or is it PI WS that work in such a manner?

        • Re: PI WS PlotValues behaviour
          Bannikov

          Please, move the topic to the "Web Services and PI" section

            • Re: PI WS PlotValues behaviour
              hanyong

              Hi Sergey,

               

              I think you are right about how PI Web Services should work when you are getting values from GetPIArchiveData call with the PlotValues mode. However from my own testing, it seems like I do not get the same issue. PI Web Services does return me a dataset that is less than 5 * NumValues. There are cases where the time range that I tested with is long enough where the call returns an error "[-11047] Invalid Maximum Count" which probably happens because the PlotValues underlying algo is unable to return a good dataset that is less than or equal to (5 * NumValues) limit. 

               

              Which version of PI Web Services are you working with, in case there is a difference in behavior for a different version. The version that I am working with is PI Web Services 2012 (1.3.0.0).

                • Re: PI WS PlotValues behaviour
                  Bannikov

                  Han,

                   

                  We are using the same version as yours.

                    • Re: PI WS PlotValues behaviour
                      hanyong

                      That is interesting then. I would think it would be worthwhile to pursue this and find out if it is some kind of bug in the system. If you try to query for the same timerange with the same interval setting using other PI System Access products that has the access to the same PlotValue function, would you get the same behaviour? In PI SDK, PIPoint object exposes the PlotValues method as well. And PI OLEDB Classic Provider also exposes piarchive..piplot table that represents extracting data via this PlotValues function as well. 

                       

                      If you can replicate the issue via other products, then we know that this is a bigger issue with how PlotValues function is behaving in your system.

                        • Re: PI WS PlotValues behaviour
                          AKorobochkin

                          Hello. We would like to turn your attention to this topic again, as the problem persists still.

                          Even when querying PI WebServices via some kind of special tool (WCF Storm, for one.) we observe the same behavior (i.e. getting more values than 5*NumValues).
                            • Re: PI WS PlotValues behaviour
                              fzhang

                              Alexander, I think you are referring to this sentence in the PI 2012 Web Services user guide, correct?

                               

                              ◦ When retrieving Plot Values, no truncation is performed and the number of timed values returned can be

                               

                              up to five times the value of NumValues. The minimum value is 1. The default value is 400.

                               

                              Have you been able to test the suggestions Han Yong provided above?

                               

                              Just to be clear, are you seeing the number of returned timed values from PIArcDataRequest exceeding NumValues * 5 or are you just looking at the tag's number of compressed values within TimeRange.Start and TimeRange.End?

                                • Re: PI WS PlotValues behaviour
                                  AKorobochkin

                                  Fred, we haven't really tested the suggestions above.

                                   

                                  As for your second question, we are seeing that the number of timed values returned by the service exceeds NumValues * 5 indeed.

                                    • Re: PI WS PlotValues behaviour
                                      fzhang

                                      I tested the behavior in PI OLEDB Provider with the piplot table as Hanyong suggested and it behaves as expected. The piplot table's intervalcount parameter should behave the same parameter as NumValues in your PI Web Services query since the documentation for PI OLEDB Provider also says the result from the piplot table is <= intervalcount * 5.

                                       

                                      For example, I can limit the number of rows returned by the query below by changing the intervalcount parameter. The number of rows is always less than intervalcount * 5.

                                       

                                      SELECT *

                                       

                                      FROM [piarchive].[piplot]

                                       

                                      WHERE tag = 'cdt158'

                                       

                                      AND intervalcount = 6

                                       

                                      AND time BETWEEN '*-3d' AND '*'

                                       

                                      Since you've also created a techsupport case for this, perhaps we can do a remote support session to see the behavior on your system.

                                        • Re: PI WS PlotValues behaviour
                                          AKorobochkin

                                          I've done the very same thing (i.e. querying PI OLEDB) and found the results to be alright.

                                           

                                          SELECT *

                                           

                                          FROM [piarchive].[piplot]

                                           

                                          WHERE tag = 'SINUSOID_1MIN'

                                           

                                          AND intervalcount = 2

                                           

                                          AND time BETWEEN '*-3d' AND '*'

                                           

                                          I've got 9 rows in return for the query above, so PI OLEDB seems to be working just fine in that matter. PI WebServices though, requires further investigation, and the remote support session would definitely be the best approach to it.