AnsweredAssumed Answered

PI ACE calculation with dependency on other modules' results differ depending on the time of execution

Question asked by KennethVe on Feb 17, 2015
Latest reply on Mar 5, 2015 by dng



I've run across an issue that piqued my interest whilst developing a VB.NET calculation for PI ACE.


In the setup used, PI ACE contains a calculation used by numerous contexts that each calculate a status for the current value of a tag and write the result to another tag. These contexts are scheduled every five minutes and have different offsets on which the calculation is to be run, this offset "cycle" is currently just over 600 seconds (10 minutes). The results that are written by all of the contexts are usede in ProcessBook and another ACE calculation.


For clarification, the tags who's values are used are compressed and stepped tags, compression being on for when the value remains the same.

That other ACE calculation is the one that is developed as new, it's responsibility is counting all of the different statusses that occured for a given timespan (1 hour, 8 hours or 24 hours) using the results written by the ACE calculation explained above. It tries to achieve this by retrieving all the values using the following statement and counting the occuring values in the array (the values written by the other ACE calculation).


    'This method calculates the actual violations and returns a result in the form of a private class

    Public Function CalculateViolations() As Result
        Dim periodEnd As Double
        Dim periodStart As Double
        Dim statusTag As PISDK.PIPoint
        Dim value As PISDK.PIValues
        Dim snapshot As PISDK.PIValue

        Dim result As Result
        result = New Result()

        ' ExecutionTime is the time of execution for the ACE calculation
        periodEnd = ExecutionTime
        periodStart = ExecutionTime - PeriodInSeconds

        For Each ...

                'Retrieve all the values for the required period for the current tag
                values = statusTag.Data.RecordedValues(periodStart, periodEnd, BoundaryTypeConstants.btInterp)
                snapshot = statusTag.Data.Snapshot

                'Implementation is not important for the question. it merely does the counting for a tag.
                CountViolations(result, value, tagModule, snapshot)

        Return result
    End Function


Where it gets tricky, is that the new calculation's results may vary depending on the time of execution. Meaning that for a given timespan (12:00 to 13:00) the results may vary if the calculation is executed on 12:00 exactly or 12:10. It happens in some cases, most of the cases return the correct result and we could not find a certain pattern. Therefore our assumption is that this discrepancy is caused by the fact that the old calculation may still write to the underlying dataset used by this new algorithm.


We've checked numerous possible causes (I.E. correct execution times, possible difference in time between the ACE and PI Servers, call used to the SDK(btOutside, btInside), etc.) and currently devised to shift our time window in the history but I was wondering if anyone has experience with an issue like this?


Thanks in advance.