Hi guys, I have a script that captures the last value stored in the historian. Most of the time it works fine, but sometimes it goes out of phase and starts returning not the last value, but an older one.
tagPaths = "[default]xx/DB_statusTags/minute_write"
ds = system.tag.queryTagHistory(paths=[tagPaths], returnSize=1, noInterpolation=True,aggregationMode="LastValue")
value= ds.getValueAt(0, 1) # Get the value at row i, column j
paths = ["[default]xx/DB_statusTags/minute_read"]
system.tag.writeBlocking(paths, value)
Just a guess, but it sounds like a timing issue. For example, your script runs just before a tag value is logged, so it was the last value when the script ran, but not after the last history log.
I think the Historian documentation is lacking in detail about how it works. When there's an analog deadband, for example, when does the new entry get saved? Is the current value saved and updated periodically if we're still in-band or does nothing get saved until we go out of band?
This, and the lack of interpolation and extrapolation at date-range boundaries makes the historian of limited use for many applications.
the script run every 1 minute, the value change every one minute, they go out of fase for 20-30 minutes. When they are different for 3 minutes I trigger the alarm. Most of the time the system run fine, but its failing a random times during the night.