The Demise of Ladder Logic and the Blue Relay

As Mark Twain once said, the news of my demise is greatly exaggerated.

For years, people have been saying Ladder Logic (LL) for the Programmable Logic Controller (PLC) is obsolete. The argument is that higher level languages, many of which are derived from C, will replace LL.

The high cost of downtime

Let’s start with the Bottom Line Up Front (BLUF). The PLC is an industrial computer commonly used for machine and process control in a wide range of industrial environments. This automation is an essential money-saving feature. Without exaggeration, we can argue that PLC based automation is critical infrastructures upon which society runs. This includes our clean water, factories, marine industry, heating, ventilation, and sanitary systems.

This is good news, yet we must recognize that things can and will go wrong. The PLC and its associated system will break, and we depend on an army of technicians to restore these PLC systems to full functionality.

BLUF: Downtime is incredibly expensive. It is measured in hundreds of dollars per minute for a small business with cost upwards of tens of thousands of dollars per minute for large complex processes. It is therefore vital that equipment be designed and programmed to facilitate troubleshooting and quick repair. To do otherwise is to have an idle workforce, loss of company standing in the eyes of its customers (reputation), wasted material, and payout of overtime to get back on target.

What is ladder logic?

Ladder logic is a graphical form of programming for the PLC with a rich history that can be traced back to the earliest electrical circuits. We can think of ladder logic as an analogy that mimics the relay contacts and coils that have been in existence since the days of the telegraph. Use of familiar symbols makes the transition into and out of the PLC easier. With ladder logic, the internal operation of the PLC is like the control relays found outside of the PLC.

Ladder logic is one of the IEC 61131-3 languages which also includes function block diagram, structured text, sequential function chart, and instruction list. Most PLCs may be programmed in more than one of the languages. For example, a programmer may code algebra-based programs such as a tank volume calculation in function block, the state machine in sequential function chart, with the basis I/O logic in ladder logic. Sometimes all three languages may be operating simultaneously on a single PLC. This can be advantageous as the strength of each language is leveraged for the given task such as outlined in this paragraph.

What is the technician’s skillset?

Understand that the PLC is a small but essential part of an industrial control system. This “small component” assertion is supported by the fact that PLC software malfunctions are relatively rare when compared to all the other things that can and do go wrong. For a properly commissioned machine, there is low, but not zero, chance of the program being the problem; if the broken machine had previously worked for many months, it’s not a software fault.

This raises the question for the need of technicians to know and understand ladder logic.

While that is indeed a valid question, it’s backwards from our BLUF. Understand that technicians already know ladder logic because they are trained to repair the sensors, actuators, control relays, and motor starters associated with the PLC. They can follow the line diagrams to quickly diagnose the problem.

The reason for ladder logic’s popularity is the technician’s ability to seamlessly continue their troubleshooting. Without skipping a beat, they can continue their relay-based thinking from outside the PLC to the inside.

To illustrate, please allow me to share my experience as a technician. My first assignment was in Kodiak Alaska where I was charged with the maintenance and repair of a vacuum tube radio transmitter. This machine was the size of small bedroom and included water cooled vacuum tubes nearly the size of a 5-gallon bucket. The transmitter’s controls were relay based with a sequential start up: water, fans, filament, time delay, bias, 21.5 kV plate, and then signal. It also included a cam-based three-strike shutdown circuit. If you are curious, a picture of the vacuum tube is included at the end of this note as Figure 2.

A decade later I was assigned to teach technicians how to troubleshoot this monstrous transmitter. It wasn’t easy, because the tech manual was 3 inches thick, and the wire diagrams often spanned many pages. At one point we came upon the idea of presenting the control circuitry using ladder logic format with rails and rungs. When we finished, there were about 120 rungs on the diagram.

As we finished the diagram, we had an epiphany. It was a simple idea, why not color code the relays that could be observed? And so, we did. If the state of the relay could be visually observed, we color-coded it blue and included the little text box shown in Figure 1.

Figure 1: The status of blue-colored control relays and contactors can be safely observed while the machine is in operation.

I’ll never forget the first batch of students who used the new material; it was near the end of the two-week class when had just inserted one of the most difficult problems. We cut the coil leg off of a postage stamp relay. Normally, it took the better part of a day for the students to weave their way through the technical manual as the symptom and solution were separated by a dozen pages.

Not anymore!

It took about 20 minutes for them to hand us the “defective” control relay. When accused of “easter egging” their way through the process, they demonstrated a near perfect logical explanation. Knowing that the blue relays could be observed was the key. They knew exactly were to look and were able to isolate the problem to a single rung and then with a few voltage measurements they found the problem.

That is the power of graphical representation. It is also the power of ladder logic as your technicians will use the observable – the plc electronic equivalent of the blue relay – to isolate a problem.

Ladder logic limitations

We have defined ladder logic as a PLC programing language as defined under IEC 61131-3. We have also loosely used the term to describe ladder logic as the control relays, sensors, and actuators found outside of the PLC. Finally, we have introduced a “blue relay” way of thinking that says the two definitions are inseparable. The consequence is that ladder logic will be with us forever. It will remain so for as long as the PLC is connected to the physical world.

Do not misunderstand, in no way am I making the argument that ladder logic is the only method. Instead, I’m making the argument that the program must be written like those blue colored relays in my narrative. Code for clarity and consider how the technician will use the information to restore the machine to full operation. This is especially important when we consider your programming time relative to future system downtime.

As previously implied, function block diagram is useful for analog signals. For example, consider a Tank Level Indicator (TLI) with a 4-20 mA output. In my opinion, it’s easier to read and interpret the function block diagram version than the same program written in ladder logic. This is especially true when we consider the live debug information where the values are displayed next to the block inputs and outputs.

Likewise, sequential function chart can be useful for state-based machines. In some cases, they can be easier read. This is especially true for programs with many states as the sequential function chart provides a compact representation. This is advantageous over ladder logic in which even simple states span many rungs.

Tech Tip: For analog signals, consider an intermediate conversion where the values are placed into a human readable formal. For example, convert the ADC values into a type float with values from 4.0 to 20.0. Follow this with the conversion to human readable values such as tank height. This will allow a technician to physically insert a process meter into the sensor loop and then verify the PLC values match the meter reading. It’s a “blue relay” solution that can quickly verify the sensor loop and sensor are operating as expected. For most PLCs function block diagram is the preferred method as the live debug values are displayed next to the respective block. Also, there is no need for intermediate memory locations such as when using ladder logic.

No discussion would be complete without the mention of the User Defined Function Block (UDFB). This is a double edge sword. On the one hand, the hierarchical design makes the program easier to read. On the other hand, too much abstraction can complicate the troubleshooting process.

Conclusion

Ladder logic encompasses the code inside the PLC as well as the maze of control relays and field devices external to the PLC. Without question, technicians will be called upon to troubleshoot the physical world upon which the PLC rests. Ladder logic concepts are baked into this process. We would do well to write PLC programs using signposts that allow the equipment operation to be easily understood and quickly restored.

In many cases, ladder logic is this blue relay of your success.

The truth is that my opinion matters little. Instead, it is important that the technicians with their associated training be able to quickly diagnose and restore a machine to full operational status. It’s something to think about at $100 to $10,000 or even more a minute.

Best Wishes,

APDahlen

About the author

Aaron Dahlen, LCDR USCG (Ret.), serves as an application engineer at DigiKey. He has a unique electronics and automation foundation built over a 27-year military career as a technician and engineer which was further enhanced by 12 years of teaching (interwoven). With an MSEE degree from Minnesota State University, Mankato, Dahlen has taught in an ABET accredited EE program, served as the program coordinator for an EET program, and taught component-level repair to military electronics technicians. Dahlen has returned to his Northern Minnesota home and thoroughly enjoys researching and writing articles such as this.

Figure 2: A collection of vacuum tubes being rebuilt. The type F1086 is prominently displayed in the foreground.

Return to the Industrial Control and Automation Index