I’ve been working on monthly report creation to show flow totals and pump run times for some wells.
The PLCs have flow totalizers and pump elapsed run time meters running and are reset daily. The flow totalizer and pump elapsed run time meter tags are being historized.
I have tag historian query data source configured for these tags in the report and am looking for the max values. This data is then populated in a table. I have tried all the sample size methods and various combination of the advanced settings. I get a lot of good, verified data (when compared to the actual tag data where I can still see it).
I also get some odd, patterned erroneous data. When a well was run for a short duration, I get small diminishing flow totals populated in my table for the next several succeeding days and no run time data (0). It’s very patterned across all the wells, like diminishing an even amount each day.
I also get the odd run time data with no flow total data, but that’s pretty uncommon.
Instead of dividing the flow totals by 1,000,000, I populated a test report with gallons to look at the decreasing sequences and did the math. They decrease by exactly the same amount within a sequence, down to a thousandth of a gallon. Each sequence decreases by a unique set amount, but within a sequence, same number.
Sounds like you are trying to totalize with floating point registers. As the absolute value gets larger, the amount of precision when adding small increments greatly diminishes, and you effectively reach the point where the typical increment is indistinguishable from zero (in the floating point range).
The typical, relatively robust, way to avoid this requires two registers--a 32-bit integer for the whole number part of the total, and a 32-bit float for the fractional part, where the latter is constrained to 0.0 ≤ x <1.0. The PLC would multiply time interval and subject rate and add to the float. Then, if ≥ 1.0, add the whole part to the integer and keep just the fraction in the float.
Record the integer part at regular intervals, and never reset it. (Let it roll over like an odometer.)