TOT on a ControlLogix: Totalising a Flow Without the Drift
TimeBase on a TOT instruction defaults to 0, which means seconds, and the magmeter arriving on the 1756-IF8 channel next to it reads gal/min. Leave the default and the total comes out 60 times too large. That one is at least obvious. The four ways a TOT drifts quietly are the subject of this page, and not one of them sets a status bit, a minor fault or anything else a maintenance technician could find. So: put the TOT in a periodic task, set TimeBase to match the units of In, set LowInCutoff above whatever the meter reads with the valve shut, and reset the total often enough that the REAL output still has digits left. One more thing before any of that: TOT is function block and structured text only — 1756-RM006P says it is not available in ladder diagram logic, so the block is called as TOT(TOT_tag) from ST or wired into an FBD routine, and a ladder-only plant standard has to bend before this instruction can be used at all.

TimeBase and LowInCutoff are highlighted because between them they decide the magnitude of the answer and whether it creeps when nothing is flowing. Neither is obviously a calibration setting, and both are.
The instruction is an integrator, so when it runs is part of the arithmetic
The totalisation is a trapezoidal integration: 1756-RM006P lists it as a feature, along with the internal totalisation being done in double precision.
What it integrates over is DeltaT, and DeltaT comes from TimingMode.
That is the same machinery every process block in this family shares, and the classic ladder PID is where it gets worked through properly, because the PID does not even have a DeltaT to look at. TOT does. In periodic mode inside a periodic task, DeltaT is the task period. In periodic mode inside a continuous or event task, it is the elapsed time since the previous execution, which moves with controller load. In oversample mode it is whatever you wrote into OversampleDT, which is a promise rather than a measurement. In real-time sampling mode it is the difference between two timestamps read off the input module, and the block will tell you when that goes wrong: RTSMissed, Status bit 28, is set when the absolute difference between DeltaT and the configured RTSTime exceeds one millisecond.
Bit 28 is the only honest self-check in the whole instruction. It only exists in mode 2.
The failure that costs real money is not a varying DeltaT anyway.
It is an execution that does not happen. A TOT behind a conditional rung, or inside a routine called from a JSR that is skipped on some scans, or in a continuous task whose loop time doubles when a report generator runs, simply misses increments.
There is no accumulator of missed time anywhere in the instruction. The block adds up what it was asked to add up, and nothing in the controller compares that against a clock, which is why a totaliser that is six percent light reads as a perfectly ordinary batch for months.

Same flow signal, same TimeBase, same GainLowInCutoff at the default and loses 720 gallons an hour while the line sits idle.
LowInCutoff, and why it exists at all
A magmeter with a wet but stationary pipe does not read zero, and neither does a DP cell with a 0.3% zero shift on a 0-600 gal/min range. LowInCutoff is 1756-RM006P’s answer, and the manual is unusually direct about why it is there: a low flow input cutoff that you can use to eliminate negative totalisation due to slight flow meter calibration inaccuracies when the flow is shut off. When In is at or below the cutoff, LowInCutoffFlag is set and totalisation ceases, while the operating mode is still worked out normally — so the block stays in Run, the faceplate still says running, and the number stops moving. When In climbs back above it, totalisation resumes on the same scan.
Set it, and set it above the meter’s real zero rather than at zero.
The number to use is not a guess. Watch the raw flow signal with the isolation valve shut for ten minutes and take the worst reading, then put the cutoff a little above it. On a line that idles for ten and a half hours out of twelve, a meter reading -12 gal/min while shut costs 7,740 gallons a day, which on a custody transfer is an argument and on a recipe is a batch that is out of spec for no visible reason. Getting the raw end of that signal right in the first place is a separate job and reading a 4-20 mA transmitter into a 1756-IF8 covers it.
The total is a REAL, and a REAL runs out of digits
This is the one that surprises people who know the internal maths is double precision.

At 482.6 gal/min in a 200 ms task the block adds 1.609 gallons per execution. Past 8,388,608 gallons that increment can no longer be represented exactly, and past 16,777,216 it is smaller than half the gap between neighbouring REALs.
Total and OldTotal are both REAL, which is IEEE-754 single precision with a 24-bit significand. The totalisation happening inside the block is double, so the block itself keeps its digits — but the number that leaves it does not. At 1,384 gallons the gap between neighbouring REALs is 0.000122 gallons and a 1.609 gallon increment lands exactly. At 8,388,608 the gap is one gallon, so every increment is rounded to one or two. At 16,777,216 the gap is two gallons and the increment is below half of it, so each addition rounds straight back to where it started.
Twenty-four days at this flow rate is all it takes to get there.
What actually breaks is rarely the totalisation. It is everything downstream: a rate calculation that differences Total between scans and gets zero, a batch counter built on a delta, an OPC client logging a value that has stopped changing while the pipe is clearly running. The fix is a reset discipline rather than a bigger data type, and TOT gives you one — OldTotal holds the value from immediately before the last reset, and ProgResetDone goes true when a program reset has actually landed, so a daily or per-shift reset can be logged with the previous total captured, with no window where the number is lost.
Targets, pre-targets, and the scan after a stop
Three flags do the batching, and the two deviation values are deviations rather than absolute numbers.
TargetFlag sets when Total reaches Target. TargetDev1Flag sets at Target minus TargetDev1 and TargetDev2Flag at Target minus TargetDev2, which the manual describes as the large and small pre-targets, typically used to switch to a slower feed rate. So on a 21,700 gallon transfer with TargetDev1 at 1,200 and TargetDev2 at 250, the first flag comes up at 20,500 gallons and the second at 21,450, which is where you close the main valve and where you trim. Enter the pre-targets as absolute totals by mistake — 20,500 and 21,450, the numbers you just worked out — and both flags are true from the first gallon, because Total minus a Target of 21,700 is already past Target minus 20,500.
One more, buried in the mode diagram’s footnotes and worth knowing.
On the first scan in Run after a stop, the totalisation is not evaluated — the block only updates its In(n-1) term, and totalisation resumes on the next scan.
That is deliberate and correct, because a trapezoidal step needs two samples and the one held from before the stop is stale. It also means a TOT that is started and stopped rapidly by logic, once per pulse of something, loses one interval every time it starts. If you are counting discrete additions rather than integrating a continuous flow, TOT is the wrong instruction and a counter is the right one.
The block itself costs 2.293 µs on a ControlLogix 5580, per LOGIX-RM002B. Cheap enough that the periodic task is never the thing you are saving.
What to check on a totaliser that is already running
Open the tag and read four members in order: TimingMode, TimeBase, LowInCutoff and DeltaT.
If DeltaT is not the number you expect and steady, the task is wrong before anything else is worth looking at. If TimeBase does not match the units printed on the meter’s nameplate, the total has been wrong since commissioning and the factor will be exactly 60, 3600 or 86400 rather than something that looks like drift.
Then go and shut the isolation valve, and leave a trend running on the meter.
Watch In for ten minutes with a trend — PLC trend chart settings and monitoring covers logging it at a useful rate. Whatever the worst reading is, LowInCutoff goes above it. If the loop feeding this totaliser is also doing flow control, the scaling at the other end of that chain is an analogue output that drives a valve, and the input scaling that both depend on is scaling an analogue input — different controller, same arithmetic, and the mistake is the same one.