2 Replies Latest reply on Oct 28, 2016 4:54 PM by dsouzarich

    How to make 'XY-Plot' as Coresight custom symbol

    hzhao

      I'd like to add a custom symbol (XY-plot) into Coresight 2016, however, I didn't find a way to get two sets of data with the same timestamps. Is there a way in Coresight 2016 to do it?

       

      Right now, I'm using:

      DataQueryMode: CS.DataQueryMode.ModePlotValues,

      Interval:100,

       

      According to PI Coresight 2016 Extensibility Documentation  P8, ModePlotValues: Returns data suitable for plotting over a specified number of intervals, intervals typically represent the pixels of the screen width, but from my test, it doesn't return values in evenly spaced intervals.

       

      Attached is my code, If you select sinusoid and sinusoidu, a imperfect circle can be obtained.

       

      Thank you in advance for your help!

        • Re: How to make 'XY-Plot' as Coresight custom symbol
          Marcos Vainer Loeff

          Hello Chandler,

           

          PI Coresight gets data from the PI Data Archive through PI AF SDK. I am pretty sure that under the hood, PIPoint.PlotValues Method is called. In this method, you can define the time range and the interval. The interval of this function might not be the same from the interval defined on the custom symbol.

           

          If you take a look at the documentation, you will read:

           

          Returns an AFValues collection with values that will produce the most accurate plot over the time range while minimizing the amount of data returned.

           

          Remarks

           

          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).

          My point here is that the method PlotValues will get values in order to produce the most accurate plot (using recorded values). What you want to get is interpolated values which has totally different logic under the hood.

           

          I don't think it is possible to get interpolated data through a custom symbol for now. What I would try to do is to get those values through PI Web API, but that task should not be easy because you don't have full control of the application (just the symbol). You might try to inject (you can use Inject property for the tool definition, please refer to the extensibility document) the '$http' service and then try to make HTTP request to get interpolated data.

           

          Finally, if you access data.Data[0].StartTime and data.Data[0].EndTime, you will be able to get the start time and end time used to get the time range of the interpolated data retrieved using PI Web API.

           

          Hope it helps!

          3 of 3 people found this helpful
          • Re: How to make 'XY-Plot' as Coresight custom symbol
            dsouzarich

            Coincidental data is what you ideally need for an XY, so the starting point would be to see if you could manage this from your data source, into your PI System, so force the readings to be taken at the same time, change the frequency. Failing that you could create yourself either one or two pseudo tags, the output would be generated by either AF Analysis or PI PE, where you have an event on one tag that triggers a calculation for the other tags, whether it is taking the last value or some interpolation.