The requirement of my calculation is to find the previous value of a PI tag however, with the prevVal function, I am still getting the latest value. For the input tag, step is ON and I do not want to change the tag configuration. What would be the simplest way to get the correct previous value?
I wonder if this is due to clock drift. You might want to try setting in your ACE code:
PIACEBIFunctions.AdjustClockDrift = False
Also, if you want the last snapshot, and not the last archived value, you should use a module-level variable that is initially set to the current snapshot value. After you do you calculation, you then set the current snapshot value to this variable, such that the next calculation has access to this value.