Totalizer (TOT)

This information applies to the
CompactLogix
5370,
ControlLogix
5570,
Compact GuardLogix
5370,
GuardLogix
5570,
Compact GuardLogix
5380,
CompactLogix
5380,
CompactLogix
5480,
ControlLogix
5580, and
GuardLogix
5580 controllers.
The Totalizer (TOT) instruction provides a time-scaled accumulation of an analog input value.
Available Languages
Ladder Diagram
This instruction is not available in ladder diagram logic.
Function Block
TOT_FB_avail_v31
Structured Text
TOT(TOT_tag)
Operands
Function Block
Operand
Type
Format
Description
TOT tag
TOTALIZER
Structure
TOT structure
Structured Text
Operand
Type
Format
Description
TOT tag
TOTALIZER
Structure
TOT structure
See
Structured Text Syntax
for more information on the syntax of expressions within structured text.
TOTALIZER Structure
Input Parameter
Data Type
Description
EnableIn
BOOL
Enable input. If false, the instruction does not execute and outputs are not updated.
Default is true.
In
REAL
The analog signal input to the instruction.
Valid = any float
Default = 0.0
InFault
BOOL
Bad health indicator of In. If true, it indicates the input signal has an error, the instruction sets the appropriate bit in Status, the control algorithm is not executed, and Total is not updated.
Default is false.
TimeBase
DINT
The timebase input. The time base of the totalization based on the In engineering units.
0 = Seconds
1 = Minutes
2 = Hours
3 = Days
For example, use TimeBase = minutes if In has units of gal/min. If this value is invalid, the instruction sets the appropriate bit in Status and does not update the Total.
For more information about timing modes, see Function Block Attributes.
Valid = 0 to 3
Default = 0
Gain
REAL
The multiplier of the incremental totalized value. The user can use the Gain to convert the units of totalization. For example, use the Gain to convert gal/min to a total in barrels.
Valid = any float
Default = 1.0
ResetValue
REAL
The reset value input. The reset value of Total when OperResetReq or ProgResetReq transitions from false to true.
Valid = any float
Default = 0.0
Target
REAL
The target value for the totalized In.
Valid = any float
Default = 0.0
TargetDev1
REAL
The large deviation pre-target value of the Total compared to the Target. This value is expressed as a deviation from the Target.
Valid = any float
Default = 0.0
TargetDev2
REAL
The small deviation pre-target value of the Total compared to the Target. This value is expressed as a deviation from the Target.
Valid = any float
Default = 0.0
LowInCutoff
REAL
The instruction low input cutoff input. When the In is at or below the LowInCutoff value, totalization ceases.
Valid = any float
Default = 0.0
ProgProgReq
BOOL
Program program request. Set to true to request Program control. Ignored if ProgOperReq is true. Holding this true and ProgOperReq false locks the instruction in Program control.
Default is false.
ProgOperReq
BOOL
Program operator request. Set to true to request Operator control. Holding this true locks the instruction in Operator control.
Default is false.
ProgStartReq
BOOL
The program start request input. Set to true to request totalization to start.
Default is false.
ProgStopReq
BOOL
The program stop request input. Set to true to request totalization to stop.
Default is false.
ProgResetReq
BOOL
The program reset request input. Set to true to request the Total to reset to the ResetValue.
Default is false.
OperProgReq
BOOL
Operator program request. Set to true by the operator interface to request Program control. The instruction clears this input to false.
Default is false.
OperOperReq
BOOL
Operator operator request. Set to true by the operator interface to request Operator control. The instruction clears this input to false.
Default is false.
OperStartReq
BOOL
The operator start request input. Set to true by the operator interface to request totalization to start. The instruction clears this input to false.
Default is false.
OperStopReq
BOOL
The operator stop request input. Set to true by the operator interface to request totalization to stop. The instruction clears this input to false.
Default is false.
OperResetReq
BOOL
The operator reset request input. Set to true by the operator interface to request totalization to reset. The instruction clears this input to false. Default is false.
ProgValueReset
BOOL
Reset program control values. When true, clear all the program request inputs to false at each execution of the instruction.
Default is false.
TimingMode
DINT
Selects timing execution mode.
0 = Period mode
1 = Oversample mode
2 = Real time sampling mode
For more information about timing modes, see Function Block Attributes.
Valid = 0 to 2
Default = 0
OversampleDT
REAL
Execution time for oversample mode.
Valid = 0 to 4194.303 seconds
Default = 0
RTSTime
DINT
Module update period for real time sampling mode
Valid = 1 to 32,767ms
Default = 1
RTSTimeStamp
DINT
Module time stamp value for real time sampling mode.
Valid = 0 to 32,767ms
Default = 0
Output Parameter
Data Type
Description
EnableOut
BOOL
Indicates if instruction is enabled. Cleared to false if Total overflows.
Total
REAL
The totalized value if In.
OldTotal
REAL
The value of the total before a reset occurred. You can monitor this value to read the exact total just before the last reset.
ProgOper
BOOL
Program/operator control indicator. True when in Program control. False when in Operator control.
RunStop
BOOL
The indicator of the operational state of the totalizer. True when the TOT instruction is running. False when the TOT instruction is stopped.
ProgResetDone
BOOL
The indicator that the TOT instruction has completed a program reset request. Set to true when the instruction resets as a result of ProgResetReq. You can monitor this to determine that a reset successfully completed. Cleared to false when ProgResetReq is false.
TargetFlag
BOOL
The flag for Total. Set to true when Total Greater than or equal to Target.
TargetDev1Flag
BOOL
The flag for TargetDev1. Set to true when Total Greater than or equal to Target - TargetDev1.
TargetDev2Flag
BOOL
The flag for TargetDev2. Set to true when Total Greater than or equal to Target - TargetDev2.
LowInCutoffFlag
BOOL
The instruction low input cutoff flag output. Set to true when
In £ LowInCutoff.
DeltaT
REAL
Elapsed time between updates. This is the elapsed time in seconds used by the control algorithm to calculate the process output.
Status
DINT
Status of the function block.
InstructFault (Status.0)
BOOL
The instruction detected one of the following execution errors. This is not a minor or major controller error. Check the remaining status bits to determine what occurred.
InFaulted (Status.1)
BOOL
In value faulted.
TimeBaseInv (Status.2)
BOOL
Invalid TimeBase value.
TimingModeInv (Status.27)
BOOL
Invalid TimingMode value.
RTSMissed (Status.28)
BOOL
Only used in real time sampling mode. Set to true when
ABS(DeltaT – RTSTime) > 1 millisecond.
RTSTimeInv (Status.29)
BOOL
Invalid RTSTime value.
RTSTimeStampInv (Status.30)
BOOL
Invalid RTSTimeStamp value.
DeltaTInv (Status.31)
BOOL
Invalid DeltaT value. This can occur if OversampleDT is invalid in oversample timing mode.
Description
This instruction typically totals the amount of a material added over time, based on a flow signal.
The TOT instruction supports:
  • Time base selectable as seconds, minutes, hours, or days.
  • You can specify a target value and up to two pre-target values. Pre-target values are typically used to switch to a slower feed rate. Digital flags announce the reaching of the target or pre-target values.
  • A low flow input cutoff that you can use to eliminate negative totalization due to slight flow meter calibration inaccuracies when the flow is shut off.
  • Operator or program capability to start/stop/reset.
  • A user defined reset value.
  • Trapezoidal-rule numerical integration to improve accuracy.
  • The internal totalization is done with double precision math to improve accuracy.
Monitoring the TOT Instruction
There is an operator faceplate available for the TOT instruction.
Affects Math Status Flags
No
Major/Minor Faults
None specific to this instruction. See
Common Attributes
for operand-related faults.
Execution
Function Block
Condition/State
Action Taken
Prescan
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is false
EnableIn and EnableOut bits are cleared to false.
Tag.EnableIn is true
EnableIn and EnableOut bits are set to true.
The instruction executes.
Instruction first run
Total is set to ResetValue.
OldTotal is cleared to 0.0.
ProgOper is cleared to false.
Instruction first scan
All operator request inputs are cleared to false. If ProgValueReset is true then all program request inputs are cleared to false.
Postscan
EnableIn and EnableOut bits are cleared to false.
Structured Text
Condition/State
Action Taken
Prescan
See Prescan in the Function Block table.
Normal Execution
See Tag.EnableIn is true in the Function Block table.
Postscan
See Postscan in the Function Block table.
Check for Low Input Cutoff
If (In <= LowInCutoff), the instruction sets LowInCutoffFlag to true and makes In(n-1) = 0.0.
Otherwise, the instruction clears LowInCutoffFlag to false.
When the LowInCutoffFlag is true, the operation mode is determined but totalization ceases.
When LowInCutoffFlag is false, totalization continues that scan.
Operating Modes
The following diagram shows how the TOT instruction changes between Program control and Operator control.
TOT instruction changes.png
(1) The instruction remains in operator control mode when ProgOperReq is true.
The following diagram shows how the TOT instruction changes between Run and Stop modes.
TOT changes between Run amd Stop modes
(1) The stop requests take precedence over start requests
(2) The first scan in run after a stop, the totalization is not evaluated, but in
n-1
is updated.
During the next scan, totalization resumes.
All operator request inputs are cleared to false at the end of each scan. If ProgValueReset is true, all program request inputs are cleared to false at the end of each scan.
Resetting the TOT Instruction
When ProgResetReq transitions to true while ProgOper is true, the following happens:
  • OldTotal = Total
  • Total = ResetValue
  • ProgResetDone is set to true
If ProgResetReq is false and ProgResetDone is true then ProgResetDone is cleared to false
When OperResetReq transitions to true while ProgOper is false, the following happens:
  • OldTotal = Total
  • Total = ResetValue
Calculating the Totalization
When RunStop is true and LowInCutoffFlag is false, the following equation performs the totalization calculation.
TOT Calculating the Totalization
where TimeBase is:
Value
Condition
1
TimeBase = 0 (seconds)
60
TimeBase = 1 (minutes)
3600
TimeBase = 2 (hours)
86400
TimeBase = 3 (days)
Determining if Target Values Have Been Reached
Once the totalization has been calculated, these rules determine whether the target or pre-target values have been reached:
  • TargetFlag is true when Total Greater than or equal toTarget
  • TargetDev1Flag is true when Total Greater than or equal to (Target - TargetDev1)
  • TargetDev2Flag is true when Total Greater than or equal to (Target - TargetDev2)
Example
In this example, the TOT instruction meters a target quantity of water into a tank and shuts off the flow once the proper amount of water has been added. When the AddWater pushbutton is pressed, the TOT instruction resets and starts totalizing the amount of water flowing into the tank. Once the Target value is reached, the TOT instruction sets the TargetFlag output, which causes the solenoid valve to close. For this example, the TOT instruction was "locked" into Program Run by setting the ProgProgReq and ProgStartReq inputs. This is done for this example because the operator never needs to directly control the TOT instruction.
Function Block
L5K_TOT_FB_ex_v32
Structured Text
TotalWaterFlow.In := WaterFlowRate;
TotalWaterFlow.ProgProgReq := 1;
TotalWaterFlow.ProgStartReq := 1;
TotalWaterFlow.ProgResetReq := AddWater;
TOT(TotalWaterFlow);
RESD_01.Set := AddWater;
RESD_01.Reset := TotalWaterFlow.TargetFlag;
RESD(RESD_01);
WaterSolenoidValve := RESD_01.Out;
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.