Different results for PrevVal in debug and runmode

Discussion created by dorj on Jun 3, 2010
Latest reply on Jun 8, 2010 by Asle Frantzen

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,