10 Replies Latest reply on Oct 19, 2016 8:49 PM by John Messinger

    Show AF Attribute with Custom Data Reference in PI Coresight

    Elia

      Hi,

      I've created an AF element with 2 attributes: Attribute1 that refers to a PI Point (type=Single) and Attribute2 (type=Single) that has a Custom Data Reference.

      I want that Attribute2 contains a filtered copy of Attribute1, so I created (using AF sdk) a library class in c# to do this, in which Attribute1 is set as input attribute for Attribute2.

      Although in PI System Explorer I read the correct filtered value in Attribute2, when I try to display it in PI coresight, it shows "No data".

      Anyone can help me?

       

      Thanks

      Elia

        • Re: Show AF Attribute with Custom Data Reference in PI Coresight
          John Messinger

          What AFDataReferenceMethod values have you allowed in your SupportedMethods override, as well as the AFDataMethod values in your SupportedDataMethods override?

            • Re: Show AF Attribute with Custom Data Reference in PI Coresight
              Elia

              Hi John,

              below I report my overrides

              public override AFDataReferenceMethod SupportedMethods

                      {

                          get

                          {

                              return AFDataReferenceMethod.GetValue | AFDataReferenceMethod.GetValues; 

                          }

                      }

                      public override AFDataMethods SupportedDataMethods

                      {

                          get

                          {

                              return this.DefaultSupportedDataMethods;

                          }

                      }

              Have I to add something else?

                • Re: Show AF Attribute with Custom Data Reference in PI Coresight
                  Rick Davin

                  Might be a typo but can you verify that your SupportedDataMethods getter is:

                   

                   

                  return this.DefaultSupportedDataMethods;

                   

                  And not

                   

                  return base.DefaultSupportedDataMethods;

                   

                  It should be base instead of this.

                    • Re: Show AF Attribute with Custom Data Reference in PI Coresight
                      Elia

                      Hi Rick,

                      I turned this in base but I always read "NO DATA" in coresight

                        • Re: Show AF Attribute with Custom Data Reference in PI Coresight
                          Rick Davin

                          I would like to make sure your data reference performs as to be expect in PSE.

                           

                          It helps to understand that the DefaultSupportedDataMethods include:

                          • AFDataMethods.RecordedValue
                          • AFDataMethods.InterpolatedValue
                          • AFDataMethods.RecordedValues
                          • AFDataMethods.RecordedValuesByCount
                          • AFDataMethods.PlotValues
                          • AFDataMethods.Summaries
                          • AFDataMethods.Summary
                          • AFDataMethods.InterpolatedValues
                          • AFDataMethods.InterpolatedValuesAtTimes
                          • AFDataMethods.RecordedValuesAtTimes

                           

                          Which means that your data reference must implement each individual method or else just use the base implementation.  Using the base is normally quite easy and requires no extra lines of code.  What this means then is that every event recorded for the input attributes will result in an output event.

                           

                          The problem I see is in the description of your DR. You say your DR filters the input attribute.  In that case, your output can have fewer values than the input, which means you really shouldn't use the base but instead code your own implementation for the RDA methods.

                           

                          Putting RDA aside for the moment, let's look at simple non-RDA GetValue and GetValues. You say Attribute2 has the correct filtered value when viewed in PSE.  I suspect you have not looked at the Time Series data for Attribute2 with PSE.  I would ask for you to do that.  Navigate to the attribute in question, right-click on it, choose Time Series Data.  When the popup dialog appears, choose Reytrieval Type: Time Range and Boundary Type: Interpolated.  Pick a suitable time range.  This issues a GetValues call.  Review the returned data set and see if that matches what you expect.

                           

                          Turning back to GetValue ... just because it has the right value in PSE doesn't mean your code is right.  It may work perfectly fine for the latest value, i.e. when invoked as GetValue(), but may not work well when a time in passed in, i.e. GetValue(time).  You need to thoroughly test your DR by passing in times.  You may want to try passing in a known input time, as well as passing in a time somewhere between 2 known input times.  I'd even pass in a time before the first ever recorded input time.

                  • Re: Show AF Attribute with Custom Data Reference in PI Coresight
                    Rick Davin

                    What version of Coresight are you using?