Things to Consider When Developing a Well Written PLC Program
Determine Your Scope-
As a PLC programmer, one of the most important tasks in the development process is to determine your scope based off of a specification that is provided to you for a specific application. Communication is key in this part of the process, to ensure that the outcome of the project successful. There are many tools out there that can assist you with determining your scope in a programming project, such as cause and effect diagrams, logic diagrams, and flow charts that provide you as a programmer the key elements of a control system. Utilizing these types of tools is a must, and should not be overlooked, even in a smaller scoped project.
Thoughtful Layout Strategy for the System-
Once you have determined scope, now it is time to develop a layout strategy for your program that would make sense to read and troubleshoot by other programmers or troubleshooting technicians. No technician wants to go online with a PLC for the first time and see a thousand rungs of ladder logic in the same routine. As a programmer, you should visualize a logical separation for each part of the process. Refer back to the sequence of operations from the scope. For example, in a water treatment system the logic required to run the influent process could be entirely different from the logic required to run the effluent process. If there is a clear and concise separation from these two parts of the process in your program by placing each process in its own routine, it allows for much easier program navigation.`
Use the Tools Provided-
Depending on your PLC programming software of choice, there are many tools at your disposal. These software tools are necessary to make a programmer’s life easier. In large scoped projects, keep in mind that the use of Add-On-Instructions, User-Defined Function Blocks, and User-Defined Datatypes will give you the ability to write modular code. This means you can use the same code and datatypes in multiple places within your program. This reduces programming time and makes troubleshooting easier by modularizing the code. For example, let’s say that there is an application that requires twenty VFD controlled pumps. Instead of developing logic for each pump individually, this is a perfect application to utilize a User-Defined Datatype to build a pump object in your software, and an Add-On-Instruction to run similar logic in multiple locations of your code for each pump. Writing modular code can be very useful, and pairing this functionality with a logical layout strategy for your system will definitely be a game-changer.
As PLC software has progressed throughout the years, different programming languages have been developed for different types of applications. As a PLC programmer, do not limit yourself to utilizing one or two languages. The key is to determine when and where a language should be used in your application. There are four main languages that a PLC programmer will see, Ladder Logic, Structured Text, Function Block, and Sequential Function Chart. Each of these languages were developed for specific use cases. Ladder Logic, the most popular language, is often the primary language used in a systems control logic. This is because of the ease of reading and troubleshooting in the language. Structured Text is a higher-level language that is commonly used for embedded math functions or advanced loop control. This language is very similar to Pascal, the language that it was based off of. Function Block Diagram is a graphical programming language that is typically used for process control functions like PID Loop control or Totalizer control that require embedded functions. Function Block Diagrams provide a graphical representation of the process logic, which can provide a better understanding of the key elements in a process. Sequential Function Chart is a language derived from Grafcet, another graphical language that utilizes transitions and outputs that are triggered from each transition. This language is used for applications that requires advanced sequencing and step logic to complete a certain task.
Grow with the Technology-
One obstacle as a PLC programmer is the continuation of technological advances in the industry. Programmers must grow their knowledge with these advances, or ultimately become a bottleneck to their own abilities as a PLC programming professional. There are programmers out there with twenty years of experience that have never learned Structured Text or used an Add-On-Instruction, and there are programmers with two years of experience that are constantly finding new intuitive ways to implement their code. This industry is becoming more and more aligned with embedded software development, and now is the time to broaden your knowledge and think outside of the box.