5 Replies Latest reply on Jan 25, 2018 1:42 PM by lgferrao

    Plotting values from Data Reference of type Formula

    lgferrao

      Dear,
      I'm going through an unexpected situation that I can not solve.

      Here's my case:
      I have two AF attributes configured in a Database.
      The 'A' attribute with Value Type: Double and Data Reference: PI Point, is pointing to a PI Tag.

      The 'B' attribute with Value Type: OffOn and Data Reference: Formula. This attribute uses the 'A' attribute to define whether the value will be Off or On. Formula: V = A; [if (V <2.5) then 1 else 0]

      The attribute 'A' has readings in intervals of very small times, arriving to have 19 thousand values in an interval of 8 hours. Thus the 'B' attribute follows the same pattern of quantity values.

      When performing a search of the historical values of attribute 'A' using PlotValues in a period of 8 hours, a small amount of values is always returned, which is normal behavior!

      However, when using the PlotValues for attribute 'B', which is of Formula type, also in the period of 8 hours, all the values recorded are returned. That is, the 19 thousand values.
      Apparently, when trying to use the PlotValues for the 'B' attribute, internally it is using the RecordedValues.

      Is there a problem using PlotValues for attributes with Data Reference of type Formula?

       

      I'm using AF SDK 2.7.5.7166.

       

      Thanks!

        • Re: Plotting values from Data Reference of type Formula
          smehrens

          Hi Luis.

           

          Would you mind sharing your code, please? I'd like to make sure that I understand what you are talking about. I tried reproducing this with a newer version of AF SDK but was unable to do so, so I'd like to make sure that I attempted the same thing that you are describing.

           

          Stuart

          • Re: Plotting values from Data Reference of type Formula
            John Messinger

            I don't think the Formula DR supports the AFDataMethod.PlotValues option. Each DR will have an override of the AFDataReference base class SupportedDataMethods property. I suspect that the Formula DR either just returns the base class implementation, or it's override doesn't include the PlotValues AFDataMethod enumeration.

            1 of 1 people found this helpful
              • Re: Plotting values from Data Reference of type Formula
                smehrens

                I'm not sure that this is entirely correct. If I find an AF attribute that is a Formula DR and then look that the SupportedDataMethods property, I can see that PlotValues is a supported data method. Also, looking at the help documentation for PI System Explorer under Retrieval of asset information > View time series data > Restrictions on viewing time series data, there is a chart for DR's that indicates that a calculation-based DR with time-series inputs supports the PlotValues data method. The PI Server documentation also contains this table that I am referencing.

                  • Re: Plotting values from Data Reference of type Formula
                    John Messinger

                    Undoubtedly - it was just a guestimate, as I no longer have access to the source code for those projects

                     

                    The reference table is interesting, as I haven't seen that before.

                     

                    This now goes back to Luis Gustavo Ferrão's original question as to why the Plot Values data call using the Formula DR in AF 2.7.5.7166 doesn't seem to behave as expected. I believe then that it is most likely due to the configuration in the Time series Data dialog - what is the value of your Number of Intervals setting?

                     

                     

                    The default value on my PSE client was 640, which returned the same number of values as the Archive (Recorded Values) option. Decreasing the interval count will decrease the values returned for Plot Values. Remember that the documentation for the PlotValues method states that it "Retrieves values over the specified time range suitable for plotting over the number of intervals (typically represents pixels)".

                     

                     

                    So I believe that you are seeing the correct behaviour, you will just need to adjust the interval count for the time range in order to see a lower count of values than the RecordedValues count.

                     

                    John

                • Re: Plotting values from Data Reference of type Formula
                  lgferrao

                  Hi Everybody !

                   

                  We reviewed our code and found some mistakes. After this, the code is working as expected. The PlotValues works fine to our formula's attributes.

                   

                  Thank you for your attention and help !

                  Luis Ferrão.