3 Replies Latest reply on Sep 23, 2016 8:47 PM by Rick Davin

    How does streams/{webId}/plot work?

    rachelmad

      I guess this is a two part question:

       

      1. I have a PI Web API query that uses GET streams/{webId}/plot. When I run it on a time range that has no data, I receive 2 points. My theory is that because the underlying AF SDK is getting interpolated data, I am receiving the next value before and after the time range. Can anyone confirm this? Moreover, how do I receive null values when querying a time range with no data while receiving interpolated data when querying a time range that has data.

       

      2. Can anyone explain how the call itself works? Especially the intervals parameter? The explanation on the documentation isn't very clear. If I send in an interval of 300, does that automatically mean PI responds with 300 data points? What if there are more than 300 points in the selected time range? Does it do averages? If there are less than 300 data points, does it add extra points?

       

      I know these are a lot of questions. I just want to understand the calls I'm making a bit better. Thank you!

        • Re: How does streams/{webId}/plot work?
          Rick Davin

          Here's a link to the online help:

          https://techsupport.osisoft.com/Documentation/PI-Web-API/help/controllers/stream/actions/getplot.html

           

          The section on intervals states:

          The number of intervals to plot over. Typically, this would be the number of horizontal pixels in the trend. The default is '24'. For each interval, the data available is examined and significant values are returned. Each interval can produce up to 5 values if they are unique, the first value in the interval, the last value, the highest value, the lowest value and at most one exceptional point (bad status or digital state).

          What if there are more than 300 points when you only asked for 300?  Each X-axis plot pixel has a timestamp associated with it.  If a value is found exactly at that pixel's timestamp, it will be returned.  If a value is not found, then it will be interpolated using the next value before and after that timestamp.  The whole reason to use Plot is because it will be faster and more efficient.  It makes little sense to retrieve 300,000 values when your plot only has 300 pixels.  So instead Plot will only grab the 300 pixels.

           

          As for your hunch that you are getting interpolated data, which does look at the value before and after a timestamp.  For a time range, the Start and End time would be 2 such timestamps.

           

          Your question of how to get no values when receiving interpolated data can't be done.  It's like asking for an odd number divisible by 2.  Because you want interpolated data for a time range, you will at least have a value returned for the time range Start and End times.  Those values might be recorded value or interpolated because that's what you asked for by virtue of using a Plot stream.  If you want to receive only recorded value, that would required a Recorded value stream using a BoundaryType of Inside.  However, if there are 300,000 values in the time range, you will get all 300,000 returned which may be a waste if your plot has 300 pixels on its X-axis.

          1 of 1 people found this helpful