IEC 61131-3 and Programming

Aug. 4, 2010
Development of the Standard Has Positive Impact on Control Capability and Programming Efficiency

By Don Talend

The International Electrotechnical Commission (IEC) 61131-3 standard covering programming languages for programmable logic controllers (PLCs)might not yield true practical uniformity in industrial machine control programming, but perhaps that shouldn't be a realistic expectation in the first place.

Some machine controls engineers and software developers indicate the standard is beneficial in terms of machine control design, transferability of knowledge and programming efficiency.

Greater Control Capabilities

Paper Converting Machine (PCMC,, Green Bay, Wisconsin, builds tissue-converting machines for the variety-oriented paper towel and bath tissue markets. Product variations include the number of plies, product strength and absorbency, and smooth or quilted textures. To handle increasingly variable products, the company developed a surface rewinder machine designed for flexibility and speed.

PCMC wanted to design a new model that yielded high output rates, precise handling of fragile tissue web and quick product changeover.

Mark Kralovec, PCMC controls engineer, and the design team used Rockwell Automation's Logix control platform that combines motion and sequential control. A key component of the platform is its power programming, a method based on the ANSI/ISA S88 batch standard. These techniques use standardized programming methods and best practices that allow programmers to reuse codes for greater efficiency.

Kralovec notes that the rewinder's control platform uses elements of object-oriented programming, which made programming easier for the engineering team in Green Bay and at another operation in Italy. "Power programming techniques have user-defined data types for code objects that can be reused," he says. "We made one code object for our standard axis. We made one template for that, and then everyone used that same template. It allows us to basically work independently. People could create specific machine applications on their own and then easily bring that into the master system. By reusing the same template, we can do a lot of testing up front on the first one and know it's going to be the same on the others. Now that we've developed this architecture for overall control of the machine being managed—creating a command position interface down to these equipment modules that interface with our standard position axis control—it's very generic in the sense that about 80–90% of that can be reused on any machine."

Key Features of IEC 61131-3
  • Structured Software - through use of configuration, resource and function blocks
  • Strong Data Typing - through languages that restrict operations to only apply to appropriate types of data
  • Execution Control - through use of tasks
  • Complex Sequential Behavior - through sequential function charts
  • Software Encapsulation - through use of function blocks, structures and complex data types.

The standard allows for the creation of programs that are highly structured, yet flexible. It provides tools for creating programs with complex sequences and promotes the creation of reusable modules, or function blocks.

Source: DMC

PCMC reports the new machine was developed with a 25% shorter lead time with more efficient assembly and testing, and a testing time two-thirds of previous.

Thermoforming Systems (, Union Gap, Washington, a manufacturer of plastic-sheet thermoforming machines that serve the food service industry, uses a hybrid function block/flowchart programming language for machine control. Since 2004 the company has used software from Opto 22, which uses graphical interfaces to represent the control environment. The idea is to represent complex controls with symbols and simple command functions for less-experienced programmers, while devising the process to have a logical flow using a flowchart concept.

"Whenever we create a new function in the control or a new option, we try to make it as modular as possible and integrate it into the main control structure," notes Chuck Phillips, Thermoforming Systems' director of electrical engineering. "The software combines the use of function blocks, which can be used to express instructions via intuitive labeling, with flowcharts that provide a visual instruction sequence. This basic software platform is designed to allow programmers with little experience to use the program, while an additional scripting tool can be used for advanced if-then procedures or complex mathematical functions by programmers familiar with advanced scripting languages such as Visual Basic and C++." Phillips says that, although he had little familiarity with standard PLC/PAC languages or scripting languages before using the program, he uses the scripting tool to make programming changes.

"When that scripting language was introduced some years ago, I wasn't against it," adds Phillips. "I was just accustomed to flowchart. Now, for the past several years, on every new project, I almost exclusively use script blocks in the flowchart. If I have to touch any particular function or spread, I'll change it to a script."

IEC 61131-3 Is the Catalyst

A major catalyst in this evolution of industrial machine control toward greater programming efficiency and more complex functions was the development of the IEC 61131-3 standard, developed in conjunction with the International Organization for Standardization (ISO) for uniformity of PLC control. Five languages are noted in the standard.

Ladder—or relay ladder logic—is the most commonly used PLC programming technique in the U.S. "Ladder logic describes in a very precise way a parallel set of interlocking logical expressions that can be very complex in machine control," says Rick Morse, software business manager for automation and simulation at Rockwell Automation ( "To be able to describe that in a cascading if-then format gets very complex and hard to read."

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 ( "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' ( Simatic product marketing. "You're doing comparisons, looping, complex math statements—things that aren't easy to do inside ladder logic," he says.

Line on Language
The IEC 61131-3 standard offers programmers the possibility of genuine software portability. The question in this  RealAnswers  (Time to Hit the Multivariable Switch?) wonders about that. Tell us all whether it's been a help to your machine-control work at
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 ( 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.

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 ( "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.