In this article I'll introduce you to the basics of a ControlLogix Function Block Routine Totalizer Instruction.
If you have ever used any Allen-Bradley software, you are familiar with their ladder logic programming. In many of the earlier systems such as PLC-5 or SLC 500, you only had ladder logic to work with.
While many programming scenarios are efficient in ladder, the introduction of Function Block, Sequential Flow Charts and Structured Text programming in ControlLogix made the software much more versatile and friendly for programmers of many different backgrounds.
We all have our own preferences we like to use, or we may use all types of programming depending on what we are trying to accomplish. I tend to be one to use whatever works best for me with what I am trying to accomplish.
Suppose you have a goal with a given water flow to measure the total amount of water that has passed the flowmeter.
To me, the most efficient choice would be to use a “Totalizer” (TOT) Instruction in a Function Block Routine.
As shown in the following screenshot, you connect the incoming water flowmeter signal to the “.In” parameter of the TOT instruction.
TOT Parameter Review:
As with any Function Block Instruction, the most important things to learn is what the instruction does and how to accomplish it given the parameters that it contains.
Learning the parameters of each instruction that you use will make you a better programmer. Here are a few that are important with the TOT instruction
.ProgProgReq – Program Mode
Turn this bit “ON” if you want to have the totalizer start/stop controlled from within the PLC program. This is generally more commonly used than ProgOperReq.
.ProgOperReq – Operator Mode
Turn this bit “ON” if you want an operator or manual start/stop of the TOT instruction from an HMI.
.ProgStartReq –Start Request
If you are starting and stopping the TOT instruction in program mode (aka .ProgProgReq = ON), then use this bit to Start the TOT counting
.ProgStopReq –Stop Request
If you are starting and stopping the TOT instruction in program mode (aka .ProgProgReq = ON), then use this bit to Stop the TOT from counting
.ProgResetReq – Reset Request
If you are starting and stopping the TOT instruction in program mode (aka .ProgProgReq = ON), then use this bit to Reset the TOT .Total value and move the .Total value to .OldTotal
.TimeBase – Time Base
For your totalized value to be accurate, the .TimeBase parameter must be set correctly. 0=Seconds, 1 = Minutes, 2 = Hours. For example, if your flowmeter is in gal/min, then you will set the .TimeBase parameter to “1” for minutes.
There is also a parameter .Gain where you can use a multiplier for converting between units of measure. Most of the time it is set to 1.0, but if you are converting gallons to some other unit of measure, then you could do that with the .Gain parameter.
.Target – Target
Giving the totalizer a .Target Value allows the instruction to set a flag (.TargetFlag) when the totalized value (.Total) >= .Target value
Displaying Parameters and Finding Descriptions:
To expose or display one of the many TOT parameters on the instruction itself, start by clicking on the ellipsis (three dots) on the instruction to open its properties.
Then find the parameters you'd like to be visible, and click on the Vis (Visibility) box next to those parameters so that they will be displayed with connectors on the Function Block:
And to learn more about any parameter, hver over its description with your mouse to see the entire description in a popup window:
While just one very small piece of a programming option, if you are new to Function Block Programming in ControlLogix, hopefully you have picked up a tip or two here.
If you take the time to learn each instruction, their parameters and use, then you will be setting yourself up for success in your automation and controls career.
Written by Brandon Cooper
Senior Controls Engineer and Freelance Writer
- Converting a VMware VMX file for use in VirtualBox - February 26, 2021
- Creating a Virtual Machine out of a Windows 2000 system - February 23, 2021
- ControlLogix Redundancy v33: Six Things You Need To Know - February 18, 2021