It’s 2 a.m. Sunday—Can You Troubleshoot Your PLC Code?

Nov. 5, 2018
Let’s help the maintenance technicians and control engineers who get hauled out of bed in the middle of the night by creating code that is easier to troubleshoot.

I’m writing this blog on behalf of the maintenance technicians and control engineers who get called in the middle of the night to figure out why the line won’t run. They didn’t write the code. They have had no need to study it closely. Now the line is down, people are standing around, the plant manager is getting impatient, and they need to figure out what’s wrong.

Here are some tips on how we can help them out when we are creating the programmable logic controller (PLC) code:

  • Organization—Take the time to lay out the tasks, programs and routines in a logical manner that is easy for someone else to follow.
    • Lay out program files to match process areas. Order them to match the process flow.
    • Create separate routines to capture separate functions. Don’t try to cram everything into one routine.
    • Lay out your routines in a logical manner to group similar functions together.
    • When writing your logic, try to develop your timers before you use the results of the timers. Try to keep your latches and unlatches in the same area. Try to use a rung for only a single function.
  • Terminology—Use terminology that matches what the plant is using. It will be easier to support if you use the same name for the equipment that the technician uses.
  • Documentation—Document everything. Rung comments and tag descriptions can be amazingly helpful when you write them properly. Explain what is going on in the rung, especially when you are doing anything that might be complicated or confusing. If you need to do a calculation, explain why. Explaining why and how can go a long way.
  • Structure—There are often several ways to get something done. You can use ladder logic, sequence flow charts or structured text. Within ladder logic, there might be different ways to accomplish your intent. Some are more efficient to program; some are more efficient when executing. Consider using a method that is most efficient to troubleshoot.

Let’s help out the folks who get called in the middle of the night and want to get back into their warm beds as quickly as possible.

What other tips do you have?

Scott Baker is the business unit director/principal engineer at Avanceon, a certified member of the Control System Integrators Association (CSIA). For more information about Avanceon, visit its profile on the Industrial Automation Exchange.

Sponsored Recommendations

MSD-SLC16G

CLICK industrial memory card, 16GB microSD. For use with all products with microSD memory card slot.

C0-12DRE-D

CLICK Ethernet Analog PLC, 24 VDC required, Ethernet and serial ports, Discrete Input: 4-point, DC, Analog Input: 2-channel, current/voltage, Discrete Output: 4-point, relay, ...

C2-FILL

CLICK PLUS option slot cover.

USB-CBL-AMICB6

AutomationDirect programming cable, USB A to microB-USB, 6ft cable length. For use with Productivity1000 and Productivity2000 CPUs and most USB devices.