7 Replies Latest reply on Jun 15, 2017 12:38 PM by PerErikGransøe

    Missing PIPoint data from PI server collective


      Hi all,


      I'm working on an C# console application for collecting PIPoint data from a PI server collective, and then sending the data to a web service. I'm using the latest AF SDK and the console application is running as a windows service using TopShelf. From the server on which my application is running, I can find the PI server collective like so:


      Server = PIServers.DefaultPIServer;


      And then connect to the server using a NetworkCredential object and the PIUserAuthentication authentication mode. So, I'm not specifying AFConnectionPreference.


      When I have successfully connected to the PI server collective, I'm finding PIPoints using the FindPIPointsAsync method on the PIPoint class. The list of PIPoints is then used to initialize a PIPointList object. Lastly, I'm reading the PIPoint data using the RecordedValues method on the PIPointList object with timeRange = 5 second timespan, boundaryType = Inside, filterExpression = null, includeFilteredValues = false, pagingConfig = { pageType = TagCount, pageSize = 1000 }, and maxCount = 0.

      When the application have read the 5 second timespan, and successfully delivered the data to a consumer, it will progress to the subsequent 5 second timespan.


      This seems to be working as I expect. And the application have been deployed as a windows service on the server from which it can reach the PI server collective. But, after a while (a day or so) the application is no longer receiving any PIPoint data via the RecordedValues method. Then, I added some more logging to the application, configured it to start reading data from the timestamp where it stopped receiving data before, and re-deployed the application to the server. But this time I did receive data from the timestamp where i didn't before.

      I'm not seeing any exceptions in my application and it does not seem to be disconnected at any point.


      So, my question is, what could be the cause of the missing PIPoint data? Could it be a problem with the PI server collective, where a particular collective member does not have data in some timespan, but other members does? Or, is there any configuration I have made, which could cause this problem?


      I hope that someone can shed some light on whats going on here. Thanks in advance

        • Re: Missing PIPoint data from PI server collective
          John Messinger

          Have you been able to verify that data exists in the time range you are querying but getting no apparent values? If there's no evidence of a disconnection from the server, it could be possible there was no data available. Another possibility that comes to mind is that the data could have been temporarily buffered in the event queue before reaching the archive cache, in which case it wouldn't be returned in your first archive query, but would be in a subsequent query for the same time period. As a side note to this, have you looked at the possibility of changing your service's data acquisition strategy from polling the PI server every 5 seconds, to using a DataPipe to subscribe to updates? This can be a more efficient way to capture the data coming into PI, and would probably reduce the likelihood of this type of behaviour occurring as the Update Manager is pushing the data to your DataPipe as it is received.

          2 of 2 people found this helpful
            • Re: Missing PIPoint data from PI server collective

              Hi John,


              Thanks for the quick response.


              We did not verify that any data existed before we tried to read it. We verified that later. But, from looking at the log files, I can see that the application was reading data approx. an hour behind the current time. Could the data be buffered for that long, before reaching the archive?


              Regarding the DataPipe; I need to be able to read historical data from an arbitrary amount of time in the past. As far as I understand, this is not possible with the DataPipe? Are there any alternatives for reading historical data from many PIPoints simultaneously, besides using the RecordedValues method?

                • Re: Missing PIPoint data from PI server collective
                  John Messinger

                  Data normally only buffers in the snapshot event queue if the primary archive is not able to receive data for any reason. In normal operation you might see data buffering there for a few seconds, or even minutes, but I wouldn't expect to see an hour of latency in data being cleared from the queue. This is something you could investigate with the use of some performance counters to see what 'normal' operation of your system looks like. The other thought that comes to mind is the volume of data that your service is retrieving in each call. Do you know what this looks like? Is it possible that over time, your process is 'falling behind', especially if you are transforming large amounts of data to be sent to a web service before making the next data archive call?


                  DataPipes are intended for capturing data updates received by the server - snapshots, or out of order values etc. I suggested this as an option as your RecordedValues time range of 5 seconds seems short enough that establishing a DataPipe and then retrieving your data pipe events at that frequency would be a more effective way of getting your data rather than making high frequency archive calls. Otherwise, your current method of reading historical data in bulk (PIPointList.RecordedValues) is the only option for this requirement.

                    • Re: Missing PIPoint data from PI server collective

                      What kind of performance counters would you suggest I monitor? Before my application stopped receiving values, it was receiving between 1000 - 2000 values per call in a 30 second timespan (instead of the 5 second timespan).


                      Each time I have started the application on the server which can connect to the PI archive, the application have been configured to start reading from two days before the current datetime of the server. When the application have catch up to approx. an hour before the current datetime of the server, it stops receving data. The application is not doing any transformation of the data. It is just reading from the PI archive, and then sending the batch to a web service before reading the next batch.

                      Is there any way to differentiate between when a PIPoint value have been produced and when it have reached the PI archive? Maybe with some tool like the PI System Explorer?

                        • Re: Missing PIPoint data from PI server collective

                          Hello Per Erik,


                          I would suggest to collect Performance Counter data for all members of your PI Data Archive Collective. To see any anomalies in the amount of data received, I suggest looking at the counters from PI Snapshot subsystem and PI Archive Subsystem. E.g. PI Snapshot Subsystem -> Events in Queue will identify issues in processing incoming events. When you look at PI Archive Subsystem -> Archived Events/sec and see differences in the numbers between your Primary Collective member and those for Secondary Collective members, this could be an indication that PI Buffer Subsystem is not properly set up on all data source nodes (Interface nodes) to fan data to all the members of your PI Collective.
                          Assume certain points do not receive updates on a Secondary member and because of a connection issue your application fails over to this Secondary member, this would explain why your application is missing data.

                      • Re: Missing PIPoint data from PI server collective
                        Marcos Vainer Loeff



                        I think you need to create a small application for testing purposes to understand what is going on. I would first test if both members of the collective have received the values by connecting first to the primary then to the secondary. Please refer to the code below:


                        // Get the PIServers collection for the current user and default PIServer.  
                        PIServer myPIServer = new PIServers().DefaultPIServer;  
                        // Secondary  
                        PICollectiveMember myMember = myPIServer.Collective.Members[1]];  


                        Please let us know if the values are actually on both members of the PI Data Archive.

                    • Re: Missing PIPoint data from PI server collective

                      Hi Again,


                      I think I have found the problem, which was an error on my part.


                      The time zone of the server on which my application is running, and the time zone of the PI server, is not the same. So, when I used C# DateTime.UtcNow as reference for my applications progress, it would eventually be reading beyond the PI servers current time. Now I'm using the ServerTime property of the PIServer class as reference instead.


                      Thank you all for your help and suggestions!