Programming PLCs: Keep the documentation clear and simple

Poor programmable logic controller documentation and housekeeping can lead to unnecessary troubleshooting and downtime. Keep it simple in order to avoid the possible risks and confusion.

05/20/2014


Different rules and programming methods are needed based on the hardware and software being used. Programming in a Siemens programmable logic controller (PLC) is not identical to programming in an Allen-Bradley PLC. There are general good practices that should be followed in any programming. The obvious is to have the program function and control as desired. Maintaining good documentation and housekeeping are good general practices in programming. Code should be easily read and understood by programming colleagues and customers. Poor documentation and housekeeping can add unnecessary time to troubleshooting, downtime, and programming. Programming structure and how complicated it may or may not be is another variable that will affect how easily the code is deciphered. I suggest following the KISS principle: “Keep it simple, stupid.” Avoid unnecessary complexity and keep it simple and straightforward.

Easy living through documentation

Good documentation will make your programming life easier. Adding rung comments and descriptions to tags greatly helps understand the code and the process that the code is controlling. Typically, if a programmer has an allotted schedule to program, documentation is not a problem. It might become a problem when time is running out and code needs to be cranked out, with the mind-set that the programmer will add the documentation at a later time—but that later time may or may not come.

Keeping up with documentation while commissioning code can prove difficult; at the time of commissioning, the priority is ensuring the code is functional and meets customer processing needs. Having multiple programmers on the same PLC program might also cause some distress with documentation. Communication and coordination between the programmers will help minimize the loss of documentation.

Document unto others, as...

Documentation is critical in that it helps the customer/programmer understand more easily what is going on or the code’s intent. I suggest to program with the mind-set that you, the programmer, will need to maintain it. Typically, we program and walk away from a site and might not return to the site for a long period of time. It will be nice if you return to the site to add code for a new process or enhancing their process and you can easily understand what you wrote several years before with little to no effort. The same goes with other programmers within your company or other subcontractors that the customer might hire. Sure, we can easily determine that we can write the code in the most complex way and have little to no documentation to make the other guy depend on you to make any programming updates or changes. While this might sound good for job security, it is not good practice. Customers will not appreciate relying on the one guy. Customers typically want off-the-shelf parts to ease maintenance and downtime; the same concept can be applied to programming. Customers typically steer away from custom software and would rather move to something that has an open source code and good software support—whatever makes sense to minimize possible future downtime and future upgrades, enhancements, and additions.

Code: Keep it clean

With documentation, another good practice is housekeeping: keeping the code clean and removing tags and code that simply go nowhere and are not needed. As programmers we typically take our best practices to new projects, especially if the new project has no predetermined code structure standard. After all, why reinvent the wheel? But while doing so, we need to remove whatever code we carried over from our copy-and-paste that is not needed—cut the fat. As a programmer, it’s not easy going into a program that has little or no documentation; and it doesn’t help that after reverse engineering the code, you discover that a percentage of the code is bogus and unneeded. After a few choice words, the first question you ask yourself is, who wrote this? Don’t be that programmer.

 

Good documentation and housekeeping are good programming practices. I’m sure we all have run into a program that had little to no documentation; many hours were required to reverse engineer what the program is doing. Even if the program documentation is written in a language foreign to your own, at least there is documentation. Google Translate to the rescue.

This post was written by Miguel Guiterrez. Miguel is a Senior Control System Specialist at MAVERICK Technologies, a leading automation solutions provider offering industrial automation, strategic manufacturing, and enterprise integration services for the process industries. MAVERICK delivers expertise and consulting in a wide variety of areas including industrial automation controls, distributed control systems, manufacturing execution systems, operational strategy, business process optimization and more. 



David , TX, United States, 05/21/14 02:45 PM:

Good article. Very relevant.
ED , OH, United States, 06/03/14 12:24 PM:

This is preached over and over, yet some still don't get it. Undocumented code is unfinished work! Programmers need to be held accountable. Thank you for this article. I hope some will change because they read this.
ZYGMUNT , CA, United States, 06/03/14 04:52 PM:

Let us use PLC programming patterns http://easyplc.org
The flow chart doc can be converted into the PLC program (Ladder logic + Function Blocks + Structured Text).
ALAN , NY, United States, 06/03/14 04:58 PM:

What's the easiest program to learn for a PLC?
DINESH , NY, India, 06/21/14 04:20 AM:

Good article. Very relevant. some time observed that some of vendor-programmer make programme so complicated that client is unable to understand.
Don - PLC Training , MO, United States, 07/11/14 12:39 PM:

Excellent advice Miguel. this is the best practices we teach in our PLC training.
The Top Plant program honors outstanding manufacturing facilities in North America. View the 2015 Top Plant.
The Product of the Year program recognizes products newly released in the manufacturing industries.
The Engineering Leaders Under 40 program identifies and gives recognition to young engineers who...
Hannover Messe 2016: Taking hold of the future - Partner Country status spotlights U.S. manufacturing; Honoring manufacturing excellence: The 2015 Product of the Year Winners
Inside IIoT: How technology, strategy can improve your operation; Dry media or web scrubber?; Six steps to design a PM program
World-class manufacturing: A recipe for success: Finding the right mix for a salad dressing line; 2015 Salary Survey: Manufacturing slump dims enthusiasm
Getting to the bottom of subsea repairs: Older pipelines need more attention, and operators need a repair strategy; OTC preview; Offshore production difficult - and crucial
Digital oilfields: Integrated HMI/SCADA systems enable smarter data acquisition; Real-world impact of simulation; Electric actuator technology prospers in production fields
Special report: U.S. natural gas; LNG transport technologies evolve to meet market demand; Understanding new methane regulations; Predictive maintenance for gas pipeline compressors
Warehouse winter comfort: The HTHV solution; Cooling with natural gas; Plastics industry booming
Managing automation upgrades, retrofits; Making technical, business sense; Ensuring network cyber security
Designing generator systems; Using online commissioning tools; Selective coordination best practices

Annual Salary Survey

Before the calendar turned, 2016 already had the makings of a pivotal year for manufacturing, and for the world.

There were the big events for the year, including the United States as Partner Country at Hannover Messe in April and the 2016 International Manufacturing Technology Show in Chicago in September. There's also the matter of the U.S. presidential elections in November, which promise to shape policy in manufacturing for years to come.

But the year started with global economic turmoil, as a slowdown in Chinese manufacturing triggered a worldwide stock hiccup that sent values plummeting. The continued plunge in world oil prices has resulted in a slowdown in exploration and, by extension, the manufacture of exploration equipment.

Read more: 2015 Salary Survey

Maintenance and reliability tips and best practices from the maintenance and reliability coaches at Allied Reliability Group.
The One Voice for Manufacturing blog reports on federal public policy issues impacting the manufacturing sector. One Voice is a joint effort by the National Tooling and Machining...
The Society for Maintenance and Reliability Professionals an organization devoted...
Join this ongoing discussion of machine guarding topics, including solutions assessments, regulatory compliance, gap analysis...
IMS Research, recently acquired by IHS Inc., is a leading independent supplier of market research and consultancy to the global electronics industry.
Maintenance is not optional in manufacturing. It’s a profit center, driving productivity and uptime while reducing overall repair costs.
The Lachance on CMMS blog is about current maintenance topics. Blogger Paul Lachance is president and chief technology officer for Smartware Group.
This article collection contains several articles on the vital role that compressed air plays in manufacturing plants.
This article collection contains several articles on the Industrial Internet of Things (IIoT) and how it is transforming manufacturing.
click me