7 Replies Latest reply on Apr 4, 2014 6:41 PM by plac88

    Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference

    plac88

      Hi everyone

       

       

       

      We are developing a custom Data Reference for AF using the .NET 3.5 AFSDK as our client requires it to work with ProcessBook and DataLink. It works well in PB but in DataLink it keeps returning the message "No more values" after querying multiple values. Querying one value with "Current Value" and "Archive Value" returns the correct value. Debugging Excel while querying multiple values calls the GetValue with the following time context (for start time: *-8h, and end time: *):

       

      8764.erroVSPIAF.png

       

      The same thing happens on PI System Explorer while debugging it and selecting the option to display the Time Series Data window. The attribute value is displayed correctly. The following figure display the Time Series Data window with the invalid data.

       

      7723.erroPSE.png

       

      The No Data error is also caused by the invalid time context.

       

       

       

      How the Data Reference should handle this?

       

       

       

      Thanks for the help

        • Re: Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference
          mhamel

          @Pedro: PI DataLink makes use of several RDA methods. Make sure you have implemented definitions within your AF DR. PI ProcessBook utilizes most of the time the GetValue method.

           

          Can you share witch methods you have implemented in your DR?

           

          I suggestto take a look at this white paper on DR.

            • Re: Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference
              plac88

              Mathieu Hamel

              @Pedro: PI DataLink makes use of several RDA methods. Make sure you have implemented definitions within your AF DR. PI ProcessBook utilizes most of the time the GetValue method.

               

              Can you share witch methods you have implemented in your DR?

               

              I suggestto take a look at this white paper on DR.

               

               

              Thanks for the answer

               

               

               

              We can't implement these methods because our DR uses the .NET 3.5 version of AFSDK. But, as seen in the white paper you posted, the default implementation of the RDA methods calls the GetValue and GetValues methods.

               

              I can't post the source of our DR but we are implementing the following methods from AFDataReference:

               
              public override AFDataReferenceContext SupportedContexts
              public override AFDataReferenceMethod SupportedMethods
              public override AFDataMethods SupportedDataMethods
              public override string ConfigString
              public override Type EditorType
              public override bool Step
              public override AFValue GetValue(object context, object timeContext, AFAttributeList inputAttributes, AFValues inputValues)
              public override AFValues GetValues(object context, AFTimeRange timeContext, int numberOfValues, AFAttributeList inputAttributes, AFValues[] inputValues)
              

               The SupportedDataMethods property is returning the this.DefaultSupportedDataMethods values.

                • Re: Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference
                  plac88

                  I changed the project to use the .NET 4.0 version of AFSDK and implemented the method RecordedValue for testing. This method will only call the base implementation, which will call the GetValue method.

                   

                  The RecordedValue method is called by the Time Series Data window and the timestamp passed is valid and is the same that was configured in the window. But, on the GetValue method, the timestamp passed become invalid again.

                   

                  We are using the AFSDK version 2.5.2.5396

                   

                   

                   

                  Edit: The InterpoledValue from DR is also implemented. The same problem happens when this method is called by the default implementation of InterpoledValuesByCount.

                    • Re: Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference
                      mhamel

                      @Pedro: Unfortunately, without having more information how these methods are handling the time and other details it would be difficult.

                       

                      Have you tried to do in-line debugging with PI System Explorer by attaching your code to it? This could reveal what is going on.

                        • Re: Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference
                          plac88

                          Like I said, the AFSDK is passing these invalid timestamps while calling the GetValue and GetValues methods from the RDA methods. To test this we changed the AFSDK to the .NET 4.0 version and implemented the RecordedValues method. This implementation only calls the base implementation of it.

                           

                          While debugging the PI System Explorer, we triggered the call of the RecordedValues method by opening the Time Series Data window. Also, we put a breakpoint before the call of method's base implementation. This is what VS displays when the program hits the breakpoint:

                           

                          1321.recordedValuesCall.png

                           

                          After this, we continue the execution of the program and wait it to hit another breakpoint, placed at the first line of both GetValue and GetValues methods. The program stops at breakpoint placed in GetValue method and displays the following timestamp:

                           

                          1856.getValueCall.png

                           

                          There is no code before the breakpoint. The call stack at this breakpoint:

                           

                          0741.callStack.png

                           

                          Our Data Reference class is almost the same that the Rollup example available at library here in vCampus. Except that we implement the SupportedDataMethods property and added the ZeroAndSpan in SupportedMethods property.

                           

                          We really don't know what might be the problem.

                           

                           

                           

                          Thanks for the help

                            • Re: Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference
                              moklingfung

                              Hi Petro:

                               

                              Most likely, your DataReference is returning null (or attributelist of zero count) in the DR.GetInput method.

                               

                              RDA methods are extension of GetValue and GetValues. They don't directly map to GetValue and GetValues. For example, recordedValues has boundary type of inside/outside which cannot be handled in GetValues. If the custom data reference is getting data from system of record, they should override the base class RDA methods and provide their own implementation. If the data reference is like a calculation (e.g. formulaDR), then it should report the input attributes used in the calculation so that AFSDK can gather the input data and call the DR getValue method properly. in this second scenario, AFSDK will generate the proper timestamp based on the input attributes and the RDA method calling arguements (e.g. boundary types in recordedValues or AFRetrieval mode in recordedValue).

                               

                              If the DR reports no input attributes, AFSDK will handle the RDA call like a static attribute (attribute with no data reference) with the effective time of the attribute to generate the time series events. There is a bug that we fixed in AFSDK 2.6 where for interpolatedValue/s/AtTimes, we are passing the effective time of the attribute to the DR.getvalue instead of the timestamp argument. We probably can create a WI to do the same thing for recrodedValues boundary type of interpolated.

                               

                              For your data reference, you have two options:

                               

                              1) you can remove the logic of getting the input values from the data reference and report the list of input attribute in the GetInputs method so that AFSDK can get the data for you (and compute the proper timestamps to use for various boundary type and retrieval mode).

                               

                              2) you can change the supportedDataMethod to only support InterpolatedValue/InterpolatedValues/InterpolatedValuesAtTimes. The DR could still have problem with AF2.5 but should work properly with AF2.6.

                               

                              Ling

                                • Re: Error in data displayed in Time Series Data window in PI System Explorer and DataLink 2013 with attribute configured using custom Data Reference
                                  plac88

                                  Ling Fung Mok

                                  Hi Petro:

                                   

                                  Most likely, your DataReference is returning null (or attributelist of zero count) in the DR.GetInput method.

                                   

                                  RDA methods are extension of GetValue and GetValues. They don't directly map to GetValue and GetValues. For example, recordedValues has boundary type of inside/outside which cannot be handled in GetValues. If the custom data reference is getting data from system of record, they should override the base class RDA methods and provide their own implementation. If the data reference is like a calculation (e.g. formulaDR), then it should report the input attributes used in the calculation so that AFSDK can gather the input data and call the DR getValue method properly. in this second scenario, AFSDK will generate the proper timestamp based on the input attributes and the RDA method calling arguements (e.g. boundary types in recordedValues or AFRetrieval mode in recordedValue).

                                   

                                  If the DR reports no input attributes, AFSDK will handle the RDA call like a static attribute (attribute with no data reference) with the effective time of the attribute to generate the time series events. There is a bug that we fixed in AFSDK 2.6 where for interpolatedValue/s/AtTimes, we are passing the effective time of the attribute to the DR.getvalue instead of the timestamp argument. We probably can create a WI to do the same thing for recrodedValues boundary type of interpolated.

                                   

                                  For your data reference, you have two options:

                                   

                                  1) you can remove the logic of getting the input values from the data reference and report the list of input attribute in the GetInputs method so that AFSDK can get the data for you (and compute the proper timestamps to use for various boundary type and retrieval mode).

                                   

                                  2) you can change the supportedDataMethod to only support InterpolatedValue/InterpolatedValues/InterpolatedValuesAtTimes. The DR could still have problem with AF2.5 but should work properly with AF2.6.

                                   

                                  Ling

                                   

                                   

                                  Our DR is a calculation type and have no inputs (so we don't implement the GetInputs method).

                                   

                                  We managed to find a workaround for this problem by building two versions of the same DR (one with .NET 3.5 and another with .NET 4.0) and implementing the RDA methods in the .NET 4.0 version. The AF Server works with both versions and uses the right version for each client (ex. ProcessBook uses the .NET 3.5).

                                   

                                   

                                   

                                  Thanks a lot for the help :D