If you’re going to be working with Programmable Logic Controllers (PLCs), it is important to know the ins and outs and the benefits and weaknesses of the different programming languages that are commonly used. Like buying a car, each programming language is designed to serve a specific function.
In this article, we’ll explore the most commonly used PLC programming languages and their respective advantages and disadvantages.
Is There a “Most Popular” PLC Programming Language?
Labeling a PLC programming language as “the most popular” isn’t something that can be done very easily. In fact, getting the international programming community to agree on a “superior” programming language has been a point of contention for many years.
Having said that, many PLC programmers will concede that Ladder Logic has generally been the language that is most utilized in the day-to-day programming of PLCs. Three very important characteristics of Ladder Logic are responsible for widely held belief; first, this language is highly flexible. Second, it is easy to learn and to become proficient in. Lastly, it is particularly easy for electricians who’ve worked with similarly formatted schematics to read.
Reading this, you might then believe that Ladder Logic is indeed the most popular PLC programming language. While that argument can be made, the emergence of a new generation of programmers is quickly turning that argument on its head, and the reason is pretty interesting.
These up-and-coming programmers learned to code using programming languages like Python and Java, two languages that bear a resemblance to Structured Text programming (a PLC programming language that we’ll explore below). It should then come as no surprise that Structured Text has begun vying for the most used PLC programing language,
It is worth noting that certain industries may favor one programming language over the next. So, while Structured Text may be more popular in one industry, Ladder Logic may still be the programming language of choice in the next.
The Advantages and Disadvantages of Ladder Logic
As mentioned above, Ladder Logic is generally viewed as a PLC programming language that is easy to learn and use. This of course should not be interpreted that Ladder Logic is somehow limited in its application.
The reason why so many programmers agree that this language is simpler than others is because it was developed to look and feel like the relay-based circuit schematics that technicians were already so familiar with. This familiarity really helped Ladder Logic take off as the programming language for many applications and industries. Now if ease of use and simplicity aren’t advantageous enough, here are a few more benefits:
- Ladder Logic, being the visual language that it is, provides a confirmation of statuses for most of the programmed instructions. This makes it easy for someone with little experience or knowledge of the process to understand the logic that is used, which in turn makes it easier to troubleshoot programming errors.
- Ladder Logic programming resembles the rungs of a ladder. When new code needs to be added or old code needs to be removed, the format of Ladder Logic makes it easy to add/remove code by adding/removing a “rung” of conditional logic.
- Very easy to debug a code that uses Ladder Logic with the right debugging tool. These tools can simulate “power flow” through the diagram which ultimately allows the user to quickly locate any faults within the program.
Ladder Logic, like anything else, is not without its disadvantages.
- Despite its relatively simple design, Ladder Logic can pose a significant learning curve for programmers who have a background in more contemporary programming tools like C, C++, Python and Java.
- While the visual nature of Ladder Logic makes it easy to understand the flow of logic-based commands of a particular process, it is slower than other languages to program which in turn could result in longer lead time to deployments.
- Ladder Logic can be less than intuitive for more complicated applications that involve things like flow control and feedback loops.
- If programs using Ladder Logic do not use accompanying function blocks, not only is the code exceptionally long, but it also cannot be encapsulated for reuse.
The Advantages and Disadvantages of Structured Text
It was stated earlier that Structured Text is becoming more widely used because of programmers that have experience using modern programming languages. With this type of programming language, the user simply enters lines of code that will execute the programmed functions in sequential order (among other functions). One of the primary advantages of Structured Text is, unlike Ladder Logic, changes to the code can be implemented swiftly using text processors. Additional benefits include:
- For programmers that are looking to transition into writing PLC code, Structured Text softens the transition due to its similarity to modern programming languages.
- Structured Text programming is standardized among the various PLC systems meaning that it is easy to share between platforms.
- Structured Text is generally one of the easier programming languages to edit and debug (though debugging and compiling the code will require additional software, e.g. RSLogix).
Unfortunately, some of the characteristics that make Ladder Logic so appealing make Structured Text more difficult to work with.
- Because Structured Text does not rely on visual cues or aides, troubleshooting errors can be difficult and time consuming.
- Errors are common using Structured Text. To be fair, error frequency is a by-product of the flexibility of this programming language. A programmer using Structured Text to write code is best served if they adhere to software engineering best practices to identify any calamitous errors before deploying the software to site.
- Though Structured Text may provide an easy transition for programmers with a background in Python, Java, etc., it can be very difficult for those who don’t share that background to learn. In fact, the general rule of thumb is that if you don’t have a background in one of the programming languages referenced, you’re better off getting your feet wet in PLC programming by learning Ladder Logic first.
The Advantages and Disadvantages of Function Block Diagrams
Function Block Diagram, or FBD is a programming language that was developed for processes that deal with the flow and movement of chemicals. FBD programming is a largely visual undertaking which allows the user to visually articulate a chemical process flow. Though perhaps more limited in application compared to the other programming languages we have looked at so far, FBD programming does offer the following advantages:
- Editing FBDs is made easy courtesy of the user-friendly interface. Elements can be dragged and dropped as required.
- FBDs are often a more succinct method of programming a process. For example, what might require several rungs of programming using Ladder Logic, the same can be accomplished on a single page of Function Block Diagram programming.
Some of the characteristics that make FBDs a poignant choice, can also be viewed as disadvantages.
- The flexibility in programming process flows afforded by FBDs make programs written in this language very difficult to standardize. The flow of information is not always intuitive to subsequent users of the code.
- FBD programming excels primarily in coding smaller processes. Many programmers feel that Function Block Diagrams are difficult to scale for larger operations.
The Advantages and Disadvantages of Sequential Function Charts
Sequential Function Charts or SFCs are aptly named because they excel when used to program code that deals with subsequent processes. For example, you might expect to use SFCs when programming code for a manufacturer that produces finished products from raw materials; put more simply, Sequential Function Charts are used when there are numerous operational states to a manufacturing process.
This brings us to the most compelling reason to utilize this programming language. SFCs help programmers reduce the complexity of large processes by breaking the code down into smaller, more manageable pieces. Depending on the process being programmed, a programmer can combine Sequential Function Charts with Structured Text when advanced logic flows are required.
When it comes to the limitations of an SFC, some are perhaps more obvious than others. For example, if the process being programmed does not contain sequential steps, SFC as a programming language should not be used. Additionally, coding parallel flows can be very difficult to manage. While coding SFCs for a singular flow works well for many processes, processes that invariably require the branching of additional processes off the main path can be very difficult to implement and maintain.
The Advantages and Disadvantages of Instruction Lists
If you aren’t familiar with PLC programming languages and come across both Instruction List and Structured Text programming languages, you might get the impression that they are one and the same. In fact, there are some similarities between them; their editors are similar to one another, as is the flow inherent in both programming languages.
Where Instruction List programming takes things to the next level is in addition to a line of code that includes the programming instruction, the conditions and outcomes are also explicitly included.
Since all variables, conditions, and instructions are included, this programming language is generally pretty easy to understand. Ultimately, the instruction of the process and logic used will be clear to anyone viewing the code. Where Instruction Lists fall short is its lack of availability on most of the popular PLC platforms.
PLC Languages Aren’t Necessarily One Size Fits All
These methods of programming are available on most platforms. However, certain PLCs will restrict user access to certain languages unless the user pays a premium. We recommend that every PLC programmer starts with ladder logic as this method is most common in the industry. That being said, as the person is exposed to advanced programming methodologies, it’s important to learn the other languages that may provide an easier way to implement specific processes.
If you’d like to learn more about Programmable Logic Controllers or the programming languages that drive them, be sure to contact George Brown College today.