Siemens and Rockwell Automation are two giants competing in industrial automation technology today. Rockwell (aka Allen-Bradley) seems to be more popular in the US market, but Siemens has a larger international customer base. A cursory Google search will reveal that there is no lack of debate among automation professionals over which one is preferred.
On the higher end of their PLC lines, the programming environments to use are:
- Siemens - Step 7 Simatic Manager for S7-300 and 400 level PLCs
- Allen-Bradley (AB) - RSLogix 5000 for the Control Logix and Compact Logix PLCs
As someone who uses both platforms regularly, I would like to compare one of the key differences between them - function blocks.
What's a function block?
Siemens uses the term Function Block (FB) for program routines that can have internal memory, as opposed to Function Calls (FC) that have only temporary internal memory. Function blocks are a fundamental concept in the Siemens platform, which give them a significant advantage for large, modular applications.
In AB’s RSLogix 5000 version 16 and higher, reusable function blocks are called Add-On Instructions (AOI) and can be defined with interface parameters and local tags. Since this feature was only added in 2007, it is often overlooked and doesn’t fit as seamlessly into the overall environment.
Why use function blocks, you ask? You must read the DMC blog: "IEC 61131-3 Function Blocks - Unleash the Power!"
It is worth mentioning that both platforms adhere to the IEC-61131-3 standard, which means that function blocks are available and can be written in any of the standard's languages.
Interfacing to an instance of a function block
The way you interface to a function block is critical for program efficiency, readability, and development time. The point of a reusable function block is to wrap up complex or repetitive code and make a simple and easy to use interface in order to use that code. For example, when I visit a fast food drive-thru, I don’t need to tell them how to make a burger. They have made billions before mine. I just want to give my order, watch my burger come out the window, and then be on my way.
In AB: Parameters in ladder have to be referenced independently from the function block call
If the function block instance is called in ladder, the input parameters can only be assigned with the block call if they are constants. Variable inputs must be assigned to input parameters in preceding ladder rungs. Outputs must be referenced in ladder rungs following the function block call. If calling the function block instance in FBD (function block diagram), then variables can be directly assigned to input and output parameters.
Disadvantage: More rungs of ladder to maintain. If called in FBD instead, then there are restrictions on instance declaration (see below) and simple Boolean logic is more complicated because you must use the FBD function boxes instead of contacts and coils.
In Siemens: Parameters are directly interfaced in both ladder and FBD
Function block instances that are called in ladder and FBD are essentially the same. Even in ladder, variables can be assigned directly to input parameters. Boolean input parameters can also be assigned to the result of ladder logic operations. Function block outputs can be assigned directly to variables in the same rung of ladder.
Note that function block input and output parameters can also be accessed symbolically from other rungs in ladder logic (just like the AB example above), but Siemens has the additional advantage of directly assigning input and output parameters in the same rung as the function block call.
Advantage: All input and output parameter assignment for a function block instance can be consolidated in one rung and not spread out on separate rungs or throughout the program.
Declaring an instance of a function block
In AB: Limited to program tag file. If using FBD, cannot reside in a UDT
Instances of AOIs are most commonly declared in the “Program Tags” file of a program folder. Even for very modular programs, all function blocks are listed in this one common location. Instances can be declared within UDTs (user-defined types), but not if you want to use them in the FBD environment.
Advantage: Simplicity. One location to look through for each program folder.
In Siemens: Memory resides in an instance data block, but is declared within parent function blocks.
Most program logic, not just reusable logic, is located within function blocks. “Parent” function blocks are assigned an instance data block. All reusable function block instances can be declared within the parent function block’s static memory.
Advantage: Modularity. Instances are declared within the function block that they are called.
In summary, Siemens seems to offer a little more flexibility in how function blocks are interfaced and instantiated. We have seen, however, that both Allen Bradley and Siemens offer solutions for reusable function blocks on their higher-end PLCs. Both Function Blocks in Siemens and Add-On Instructions in Allen Bradley will enhance the modularity and maintainability of your PLC program.