I joined vCampus some weeks ago and this is my first post.
I am sorry that I am starting here with questions instead of insights, but I have been struggling with a few challenges while implementing and testing recalculations for some ACE calculations and hope you can give me some helpful input. Please see below my 3 questions.
[Question #1] Does anyone know by chance the exact rules that ACE uses to estimate the time ranges required for automatic recalculations? This is what the PI ACE User Guide says about this:
"For automatic recalculations, one specifies recalculation trigger tags as a part of the schedule for an ACE Context. When an archive event for any of the recalculation trigger tags is added/modified/deleted and the event timestamp is before the current execution time for the ACE Context, recalculations are automatically triggered. The recalculation interval is determined by two parameters: how far in the past and how far in the future this archive event affects the calculation results. Consider the following calculation:
MyOutputTag.Value = MyInputTag.Avg("*-1h", "*")
Any "past" archive change to MyInputTag would affect the results of MyOutputTag for the next hour. Thus, the recalculation period for MyInputTag is T to T+1hour where T is the timestamp of the "past" archive event. Once the recalculation interval is determined, the same logics in manual recalculations are used to determine the actual recalculation times."
However, from the tests I've been performing, it does not seem to be as simple as the documentation states. I developed a calculation to be executed with natural scheduling that writes to the output alias C the sum of the values of input alias A from timestamp t1 to t2 (where t1 is the timestamp of the event of input alias B immediately previous to the timestamp of calculation trigger event and t2 is the timestamp of the calculation trigger event).
With no custom recalculation code, the execution timestamps obtained with the ACE automatic recalculation don't seem to be consistent with what the PI ACE User Guide says. I was not able to deduce the rules used by ACE to estimate the time ranges required for automatic recalculations in this particular case, but I am very interested in knowing the rules that apply in all cases (if possible), as this may be useful for me on other ACE calculations that I develop in the future, potentially saving me the effort to implement custom recalculation code.
As the exact rules used by the current ACE version don't fit the recalculation requirements for the calculations I am developing, I am including custom code in my ACE calculation to perform automatic recalculations, in addition to the code to perform the real time calculation.
[Question #2] I am at a point where I need to determine programmatically if a manual recalculation is being executed or not. Does anyone know how to do that? The property mpeqExecutionQueue.IsRecalculating (or MyBase.IsRecalculating in ACE 2.x) informs if a recalculation is being executed or not, but it does not differentiate manual recalculations from automatic recalculations.
Finally, from my tests, it seems like in the current PI ACE version, we cannot make the ActualPerformanceEquations function be executed only for the timestamp of the trigger out-of-order event in automatic recalculations (which would be the best in my case, as my own code is responsible for the recalculation), instead of allowing the ActualPerformanceEquations function to execute for all the timestamps that ACE "thinks" are required (according to the rules I mentioned in my first question). This is forcing me have to include code to ignore the additional execution timestamps estimated by ACE, but it would be more efficient if ACE did not try to estimate the timestamps to be recalculated in this case.
[Question #3] Could someone in the vCampus Team please confirm this and check with the PI ACE developer if an enhancement can be implemented in the next PI ACE version that provides an option to run the ActualPerformanceEquations function (or ACECalculations in ACE 2.x) exclusively for the timestamp that is the same as the out-of-order trigger event in automatic recalculations?