AnsweredAssumed Answered

Duplicate timestamps after call to AFValues.GetValueArray?

Question asked by PhilKnight on Oct 17, 2017
Latest reply on Oct 18, 2017 by ekuwana

I am watching the following code find duplicate timestamps at random times:

 

object[] values;
AFValueStatus[] flags;
DateTime [] timestamps;
afvals.GetValueArrays(out values, out timestamps, out flags);
for (int i = 0; i < timestamps.Length - 1; i++)
{
     if (timestamps[i] == timestamps[i+1])
     { 
          _logger.Error($"Duplicate for tag {afvals.PIPoint.Name} at index {i}, timestamp {timestamps[i]}");
     }
}

 

 

I inspect the array and sure enough there are duplicates.  I run the code again, same tag, same timerange, but no error/duplicate.  Of course initial thought was race condition with recordedvalues / pipagingconfiguration, but that doesn't make much sense...  Surely that would be felt by many others..

 

Second thought is time range is last 24 hours, AND the datastream to this PI server is not good and pushes out tons of out of order and duplicate events (not in my ability to fix right now).  Will PI pull these into recordedvalues api call? I don't have any problems with the call (hundreds repeat calls) when I back off the time range to 48 to 24 hours.

 

Thanks in advance for any words of advice! Phil

Outcomes