7 Replies Latest reply on Jun 30, 2011 11:30 AM by andreas

    PI SDK 1.4 & Buffering

    PIAdminUnison

      Hi all,

       

       

       

      I am testing out the CTP of PI SDK 1.4 and I am getting an error I don't expect.  I connect to the PI server and then disable my network card to test the buffering.  When I do an "UpdateValues" call for a tag I get the following error:

       

      Failed to retrieve events from server.  [-10722] PINET:Timeout on PI RPC or System Call.

       

      The next time I do an UpdateValues I get:

       

      Connection to the server lost.  [-10723] PINET: No Connection.

       

       Now when I enable the network card and send a value I get a value placed into the PI tag, but the two previous values never show up.  I have the buffer Subsystem logged in as myself who has read/write rights to the tags.  Following is my basic code:

       
                           'Get the PI Point and add the value to the the tag
                          tmpPIPoint = svrPIServer.PIPoints(tmpPITagDataRow("TagName"))
      
                          tmpNamedValueAttributes = New NamedValues
                          If strAnnotation.Length > 0 Then tmpNamedValueAttributes.Add("Annotation", strAnnotation)
                          If boolQuestionable = True Then tmpNamedValueAttributes.Add("Questionable", boolQuestionable)
      
                          tmpPIValues = New PIValues
                          tmpPIValues.ReadOnly = False
                          tmpPIValue = tmpPIValues.Add(strDate, strValue, tmpNamedValueAttributes)
                          tmpPIValues.ReadOnly = True
      
                          'Update PI Point with value
      
                          tmpPIPoint.Data.UpdateValues(tmpPIValues, DataMergeConstants.dmErrorDuplicates)
      

       

       

      Any ideas?

       

       

       

      Thanks,

       

      Jimmy

        • Re: PI SDK 1.4 & Buffering
          hanyong

          Hi Jimmy,

           

          Is the connection from the application to the PI server established before you disable the network card? To me the error seems to suggest that the connection to the PI server failed, without more information, I would guess the error is from the call when you are getting the instance of the PIPoint from the server's PI Point database.

           

           

            • Re: PI SDK 1.4 & Buffering
              PIAdminUnison

              Hi Han,

               

              Yes I connect to the PI server first and open a connection.  I then disable the network card before setting my pipoint.  Should I be doing this after I set the pipoint?  If this is the case, because I have many pipoints I could be using, I would need to have then as a collection I keep in memory, so I don't have to go back to the server for them each time?

               

              Thanks,

               

              Jimmy

                • Re: PI SDK 1.4 & Buffering
                  Ahmad Fattahi

                  Hi Jimmy,

                   

                  Yes please give that a shot. I would just start from a single point; I would set the PIPoint while the connections is still good. I would suggest even send a value or two with the connection to make sure everything is fine before killing the connection. This way we would have a much better idea of what are the requirements and if everything else is working as expected.

                    • Re: PI SDK 1.4 & Buffering
                      PIAdminUnison

                      Hi Guys,

                       

                      Well I kind of got it working.  The code above doesn't work with the current  "DataMergeConstants.dmErrorDuplicates".  It did work when I changed it to "InsertDuplicates".  I tried " ErrorDuplicatesSilent" and it also didn't work.  I also took Ahmad suggestion and placed my PIPoints in a collection, so once I lost my connection to the server, I didn't have to go back to the server if the PIPoint changed.

                       

                      Has anyone else run into the problem of only InsertDuplicates working with buffering?

                       

                      Thanks for pointing me in the right direction.

                       

                      Cheers,

                       

                      Jimmy

                        • Re: PI SDK 1.4 & Buffering
                          hanyong

                          Hi Jimmy,

                           

                          I've given it a try in my test environment, and it seems like the use of dmErrorDuplicates mode gives and an error in your case because it tries to perform a data read from the PI Server before attempting to write the value. 

                           

                          PI SDK Programming Reference

                          The dmReplaceOnlyDuplicates and dmErrorDuplicates modes require an additional call to the PI server to verify the presence or absence of events at the passed time.  Therefore, use of these modes may return errors from either the retrieval or placement of the value.  Also, the additional server call may affect the performance of the UpdateValue call relative to the use UpdateValues with other MergeType modes.

                           

                          I've looked at this for a while, I don't think there is a way to go around this behaviour when using the dmErrorDuplicates mode.

                            • Re: PI SDK 1.4 & Buffering
                              andreas

                              From the webinar about the PI SDK CTP:

                               

                              PIData.UpdateValue and UpdateValues

                              • InsertDuplicates, ErrorDuplicates, ErrorDuplicatesSilent modes only
                                • ReplaceDuplicates mode is not supported in CTP

                               so we need to check...

                                • Re: PI SDK 1.4 & Buffering
                                  andreas

                                  Checking the documentation and a brief test with a newer build than the CTP showed that this has been resolved.

                                   

                                  PISDK Help

                                  For example, calling UpdateValue(s) using DataMergeConstants that claim to return an error, (dmErrorDuplicates) when buffering is active will not return errors to the caller based on values on the server.