I am writing data to PI with 'out of order' timestamps (as this is laboratory data). I need to calculate the difference between the current input and the previous input. In debug mode everything works ok. In runtime mode however I don't calculate on the new value but on the previous value and the value before that, so the calculation is one step behind.
The code looks like:
PreValue = InputTag.PrevVal()
PreTimeStamp = Inputtag.PrevEvent()
PrePreValue = InputTag.PrevVal(PreTimeStamp.UTCSeconds-1)
Outputtag.Value(PreTimeStamp) = PreValue - PrePreValue
I need the outputtag to have the same timestamp as the inputpoint. If I use Value instead of PrevVal() I don't get the same timestamp as the inputtag,