Hi!
I am having the following dilemma: I am trying to record an average of tag values from tag history for the last twelve hours. The average mass balance over the 12 hours. I have a separate gateway timer event script to do the mass balance ever hour. I have this in a tag value changed event script:
endTime = system.date.now()
startTime = system.date.addHours(endTime,-13)
dataSet = system.tag.queryTagHistory(paths=['[default]New Configuration of Application/GENESIS/Final Mass Balance/Current Total Mass Balance'], startDate=startTime, endDate=endTime, noInterpolation=True, ignoreBadQuality=True)
system.tag.write('[default]New Configuration of Application/GENESIS/Final Mass Balance/Mass Balance History Storage',dataSet)
This is pushing the values to a dataset tag. This dataset however wont include duplicate values, for example:
T_stamp | Value |
---|---|
3 PM | 1 |
4 PM | 2 |
5 PM | 3 |
6 PM | 4 |
7 PM | 5 |
8 PM | 5 |
is only showing in the ignition dataset tag as
T_stamp | Value |
---|---|
3 PM | 1 |
4 PM | 2 |
5 PM | 3 |
6 PM | 4 |
8 PM | 5 |
The tag still shows that its writing a new value so its still executing the tag event change script just fine. However, for whatever reason it wont keep the older duplicate values with different timestamps. I know its been writing the old value to the database before it duplicates before the next run/change. It just disppears once the script is run again. There is no deadband on the tags.
The non-duplicate values it works fine for. If anyone can think of anything and let me know, I would appreciate it! Stuck on this for awhile.