It’s 2am on Sunday Morning – Can You Troubleshoot your PLC Code?

Home / It’s 2am on Sunday Morning – Can You Troubleshoot your PLC Code?

It’s 2am on Sunday Morning – Can You Troubleshoot your PLC Code?

Tips on writing supportable PLC code

 

I’m writing this blog article 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 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.

 

o Lay out program files to match process areas. Order them to match the process flow.
o Create separate routines to capture separate functions. Don’t try to cram everything into one routine.
o Lay out your routines in a logical manner to group similar functions together.
o 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 a lot of ways to get something done. You can use ladder logic, sequence flow charts, or structured text. Within ladder logic, there may 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?
 
 
Image Source: Freepak

Comments

ken balagur

When developing process logic, how to handle safety shutdowns and restoration from an emergency stop are often thought of last. When programming PLC’s they should be programmed first. It leads to much cleaner code and logic and prevents unintended consequences when restarting after an unplanned stoppage.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.