Is there a nice way to apply offset with raw count for input/output counters?
The issue is if you apply a tag with an offset from last value (in my case I engaged a tag which already had a 2.6 million count from a pervious reading of 0) the first product count = 2.6million instead of 0 which pretty well messes with your numbers.
Since the count tag already extant in my case relates to machine cycles and is useful for prev maintenance the only recourse options currently are A) modify PLC code to provide a count so I can assign it freely to a value (still have to sync with existing count before appyling) B) apply an offset manually in the database to all preceding records which is a bit crude and possibly dangerous.
Whilst this may be an edge condition of commissioning (my case), this kind of thing can occur if you move/loan similar machinery around in your plant.
Since you store raw count in the database you may wish to consider an offset column which allows you to apply an offset to a single record to avoid the need to alter many records. This is typically what I have done for metering logs to manage meter changeovers and find it works well and is very simple to implement.
eg
Raw Count Current count Derivation offset Count With Offset applied
0 0 0 0
263000 263000 -262999 1
263010 10 0 9
Regards
Tarek