IEC 61131-3 and Programming

Development of the Standard Has Positive Impact on Control Capability and Programming Efficiency

2 of 2 1 | 2 > View on one page

Ladder is very effective to describe digital logic in a form that's understandable to technicians and electricians, says Todd Walter, senior product manager, general industrial and embedded products for National Instruments (www.ni.com). "That's really its greatest strength," he states. "However, it's fairly cumbersome if you try to do complex algorithms, process control or complex sequencing."

Statement list is a text version of ladder. In Europe, this is commonly referred to as instruction list and is the European counterpart to ladder diagram, which originated in the U.S. and is a graphical representation of ladder.
The relatively higher-level languages in the standard are structured control language (SCL)/structured text, sequential function charts (SFC) and function block diagram (FBD).

SCL is similar to Pascal and allows higher-level logical constructs using math functions such as looping—running a section of code a set number of times or until a condition is met. Structured text is a high-level language with roots in Ada, Pascal and C, is used to define complex function blocks and is compatible with other IEC 61131-3 languages.

"If you're trying to describe the kinematics of a robot arm or a long, drawn-out algebraic formula, or if you've got some looping constructs and you want to iterate something through a database, structured text is the way to go," says Morse.

With SCL, you're doing things outside of just reading inputs and running outputs, adds Eric Kaczor of Siemens' (www.usa.siemens.com/industry) Simatic product marketing. "You're doing comparisons, looping, complex math statements—things that aren't easy to do inside ladder logic," he says.

Sequential function chart (SFC) is flowchart-oriented and describes the sequential behavior of a control program. "SFC is good for assembly-type applications, processes that are sequential in nature and when the same things happen over and over," states Kaczor.

It's very logical, adds Matthew Thornton, Simatic product marketing manager. "You can see it as it goes through its transitions with each block of code and the robot tries to go through each block and, if it doesn't, maybe that's an interrupt or an error," he says.

Function block diagram uses graphical representation of encapsulated logic and expresses the behavior of functions, function blocks and programs as a set of interconnected graphical blocks akin to electronic circuit diagrams. "For describing things that have a data flow, it's considered a good data flow diagram programming paradigm," says Morse.

Walter indicates that the more advanced IEC 61131-3 languages are better-suited to more complex machine functions than text-oriented languages in some situations. "Encapsulation means I can build reusable sets of logic or algorithms of subroutines in a fashion that's easy to debug them, validate them and use them again throughout one program or across many different programs," he says. "Text-based languages struggle to represent the logic in a way that's understandable to both the programmer and whoever is responsible for both debugging and maintaining it. Languages such as function block or SFC are far more flexible because it's much easier to understand the flow of a machine."

Function blocks illustrate the efficiency benefits of IEC 61131-3 languages, notes Tim Jager, project manager for DMC (www.dmcinfo.com). He provides a side-by-side comparison of machine controls programming in the pre-PLC environment vs. the use of IEC 61131-3 languages in Table I.

Programming Languages
A comparison of applications that are the "best fits" for IEC 61131-3
programming languages

Languages as Building Blocks

The software that controls the plastic-sheet thermoforming machines manufactured by Thermoforming Systems uses object-oriented programming elements not unlike FBD and a flowchart concept much like SFC. "As flowchart programs are created, geometric shapes referred to as 'blocks,' each with a general predefined functionality, are selected, the flow path is laid out, and the blocks are labeled and customized," says Ben Orchard, sales engineer at Opto 22 (www.opto22.com). "This method makes documentation of the control program an actual part of the design process, rather than the afterthought it is with many other types of programming."

Orchard says instructions are expressed simply, so novice programmers can quickly understand a flowcharted control strategy. "It's very empowering for users to be able to make changes on the fly themselves and not have to depend on those who created or are familiar with the program," adds Orchard.

Siemens' Kaczor says leveraging the efficiencies of function blocks might be just the beginning. "Take the idea one step further and, instead of a device as an object, how about an entire machine as an object?" he asks. "Think of a bottling machine where you have a filler, a labeler and a palletizer. These all have separate programs that have been programmed with relay ladder logic or any other languages. These are all complete systems. When these things get to the machine floor, they need to talk to each other somehow to make the line work."

NI's LabView software for PACs is loosely tied to the IEC 61131-3 standard and combines the use of programming tools similar to function blocks with object-oriented programming. "We also have the ability to create statecharts, which are similar to sequential function charts," says NI's Walter.

The software also provides the ability to develop proportional-integral-derivative (PID) algorithms, adds Walter. "PID is a very basic function, and what customers really do is build up custom routines or algorithms and reuse them," he says. "We call programs 'VIs'—virtual instruments—and we have a submenu called a 'subVI,' where you can take any VI you build and make it into a block of code that's reusable with inputs, outputs and its own memory space."


Don Talend of Write Results, Dundee, Illinois, is a freelancer specializing in innovation and technology.

2 of 2 1 | 2 > View on one page
Show Comments
Hide Comments

Join the discussion

We welcome your thoughtful comments.
All comments will display your user name.

Want to participate in the discussion?

Register for free

Log in for complete access.

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments