Quick & Simple PLC Programming

April 1, 2006
The major benefits of using function blocks include ease of use and reduced training requirements, as well as reuseability.

THE use of function blocks for programming of programmable logic controllers (PLCs) is gaining wider acceptance. Rather than the classic “contact and coil” representation of ladder diagram or relay ladder logic programming, function blocks present a graphical image to the programmer with underlying algorithms already defined. The programmer simply completes needed information within the “block” to complete that phase of the program.

The dual benefits of reduced downtime, and ease of use and training, have quickened the adoption of function blocks and the use of libraries of function block components. The adoption of function blocks has also been encouraged by the development of standards that make their use easier. The Internatiional Electrotechnical Commission’s IEC 61131 makes it easier to use function blocks, though some say the standard has reached the end of its useful life. Many manufacturers have turned to IEC 61499, which builds on its predecessor by providing an open architecture for distributed control systems.

The result is that function blocks are becoming widely used and simple enough for a non-programmer to use. Even so, some detractors claim that function blocks can sometimes slow down production development when the blocks allow developers to move ahead without thinking through the process completely.


Function block technology actually goes back a few decades, but the process control industry was slow to pick it up because of an initial lack of standards and because the manufacturing industry typically doesn’t move quickly. Unlike most areas of technology, plant automation moves at a slow pace. “The controls industry is very, very risk averse. The attitude is, ‘If it isn’t broken, don’t fix it,’ ” says Ron Bliss, software manager of Logix, for Rockwell Automation Inc., of Milwaukee. “I never got fired for keeping things the way they were.”

Bliss notes that the slow pace of advancement in controls programming matches the long lifetime of plant equipment. “If you put in a piece of production equipment, it will be there for 20 years, and those things around it will be there for a long time as well,” says Bliss. “So when you have something there for a long time and you don’t have large budgets, and you have to train someone on new technology, you’re going to push back against that new technology.”

That attitude began to change as manufacturers faced globalization. With international competition becoming increasingly intense, fewer companies today view the status quo as acceptable. They are becoming interested in achieving “continuous process improvement.” While that’s an overused phrase, the concept does represent a shift in attitude at manufacturers, and that shift has encouraged the adoption of new technology.

The controls industry has also seen a shift from the concept of hard wire to flowcharts. Function blocks have been part of that transition. “One of the reason function blocks have begun to take over is that they replace the relay ladder logic that has been around for 40 years,” says Greg Dixson, product manager for Automation Worx at Phoenix Contact, in Middletown, Pa. Ladder logic mimics hard wire. According to Dixson, ladder logic is being replaced by flow logic. “When we think in yeses and noes, we’re thinking in flowcharts. It’s much easier to understand.” Dixson notes that young programmers take much more quickly to flow logic and that it is much more adaptable to personal computers (PCs).

For many plant operators, the continual pressure to improve operations while reducing downtime is partly solved by the use of function blocks for PLC programming. “Function blocks give you time savings and code portability,” says David Stall, electrical engineer at Grob Systems Inc., in Bluffton, Ohio. “Once you have a working function block and test it on a project, you can take it to the next project.”

While function blocks don’t eliminate the need to write code, they do significantly reduce the need to rewrite code. “Function blocks help because any time I have a piece of code, I throw it into a function block and I only have to write it one time,” says Stall. “Any time I have to interface into another piece of equipment, I do it with the function block.”

In some cases, the function blocks can represent actual pieces of equipment. “With a functional block, you’re encapsulating your process; you’re putting an object wrapper around a whole machine with its inputs and outputs,” says Bob Nelson, manager of PLC and I/O (input/output) products in the Discrete Automation Business at Siemens Energy & Automation Inc., in Norcross, Ga. “You can easily tie together pieces of equipment, and the end user doesn’t need to know what’s happening in the machine.”

That makes integration simple, because the function blocks can be put together like physical equipment. “We have customers who are building code that has a physical relationship to hardware architectures. You have a physical representation and code representation,” says Barney Keeton, business development executive at Schneider Electric, in Palatine, Ill. “You may have an OEM (original equipment manufacturer) who builds conveyors with barcode readers at transfer stations. The company could build a directive function block that matches how it links the conveyers together.” So, when the OEM puts the function blocks in the same connective arrangement as the conveyers, the conveyers are connected by software just as they are physically.

One of the biggest advantages of using function blocks is that they are quick, easy to use, and easy to learn. “The benefits of blocks include a more efficient use of time. They are easy to understand, easy to troubleshoot and easy to train people on,” says Dave Woll, vice president of consulting at ARC Advisory Group Inc., in Dedham, Mass.

Function blocks also appeal because they are stable, they reduce complexity, and they are reusable. As for stability, function blocks do not change significantly. In many cases, programmers can use the same function blocks in a wide range of applications.

Function blocks can greatly reduce complexity. A programmer can work with a function block without understanding how it works internally. Some manufacturers have marveled that you don’t need a programmer to make use of function blocks.

Function blocks are also popular because they are reusable. This attribute comes in handy whether a manufacturer is changing a product or migrating production from one plant to another. Once a function block has been developed and tested, it can become part of the manufacturer’s library of functions. “The directive function blocks are reusable from project to project,” says Schneider’s Keeton.

Legacy integration

A benefit not often mentioned in discussions of function blocks is the ability to integrate legacy equipment. “We’ve used function blocks to integrate legacy products in an open network,” says Joe Biondo, e-business manager at Bosch Rexroth Corp., in Hoffman Estates, Ill. “We build a software library that tells our software how to handle this legacy product.”

Not everyone believes function blocks are the answer to more efficient controls programming. ARC’s Woll notes that function blocks can sometimes create more problems than they solve, by designing automation incorrectly. “The biggest problem process manufacturers in North America have is operational failure. That comes from operators doing the wrong thing, or from automation designed the wrong way,” says Woll. “One thing I’m seeing is a trend toward state logic control and away from block-oriented languages.” He notes that with state logic control, engineers are “forced to give a lot of thought to the process and the control it needs.”

Some companies specifically avoid using function blocks, according to Woll, because it is more precise than using function blocks. “At Dow Chemical, they do their programming using state logic, and Boeing does the same thing,” says Woll. “It’s to ensure precision in the design and operation. It’s been a philosophy they’ve had for a long time.”

Other drawbacks to function blocks include the manual effort involved in copying and pasting code, the difficulty in either copying each tag individually or creating new ones from scratch, the need to rewrite code to utilize new tags, and the need to edit the new tags to contain the appropriate preset values.

Even with these limitations, it’s clear that for most manufacturers, the time-savings that comes from using function blocks far outweighs their drawbacks. The trend is still weighed heavily in favor of adopting function blocks and building libraries of this object-oriented code that can be used and reused with little time and effort.

For more information, search keyword "function blocks" at www.automationworld.com.

To read the sidebar to this story, titled "IEC 61131 And IEC 61499 Standards", please click here.