The Case for Ladder Logic
Lately I have seen a lot of posts promoting Structured Text on forums and Linked In. Structured Text is one of the 5 (or 6) standard PLC languages described in IEC 61131-3. While I have used ST in the past ( primarily for iterating over arrays or performing complex calculations), it is not the primary language I use for projects, in fact out of the five primary PLC languages I would put it currently as my number 3 choice.
Here was a comment I recently received on this site about a post on filtering from a few years ago:
“I almost always use OUT = (IN + LAST(N-1))/N
translated into Excel-ese: =(D12*($H$4-1)+C13)/$H$4
or in anachronistic Ladder-ese, with the capability of dynamic filter constant adjustment:
SUBTRACT (N ,1 )-> M
MULT(OUT, M) -> OUTM
ADD(OUTM, IN) -> OUTN
DIV(OUTN,N) -> OUT
unless of course one simply abandons ladder-bullshit and goes directly,
not passing GO, not collecting $200 to IEC61131 Structured Text
in which case GOTO Line 1″
This comment is typical of some of those I see on Linked In disparaging Ladder, “anachronistic” and “ladder expletive”. As if Structured text was some fancy new thing that no one else knew how to use. The fact is most engineering students have to take other programming languages, and I learned Fortran, C, Assembly and Basic in the late 80s. I have also had to keep up with Java, C# and Python, not to mention SQL and various platform appropriate languages.
Here was my somewhat more diplomatic reply:
“Hi *****, I understand your point about ST, so many people are pushing it on forums and Linked In. However…
Many platforms, including RSLogix500 and Automation Direct’s DL250 series (which the person this article was targeted to has), don’t have Structured text. And ST costs more if you want it on Siemens S7 or Allen-Bradley ControlLogix.
I use ST when needed, but in my opinion the reason so many people are jumping on the ST bandwagon is that they took high-level coding classes in college and liked it. There ARE no good ladder classes in college, the only people who know ladder well are people who have used it extensively in industry. And they don’t teach or write books.
I have written code for many multi-million dollar machines entirely in Ladder. AB Logix5000 lends itself to ladder, and many plants require it. Templates are written that way, and machine builders in the US have standardized on it. When using Siemens I use a lot of STL also, again, standards.
I am probably going to write a nice controversial post on this soon, I’m sure it will get a lot of comments!“
As I mentioned in my reply, when I have done work for some of the largest machine builders and customers in the world, I use their standards and best practices, which is primarily still ladder. Also RSLogix5000, though it has ST, is geared toward rapid code development using ladder logic.
For the past 7 years I have also done a lot of teaching in plants across North America. I also teach all 5 languages, and make extensive use of Statement List in Siemens.
The other reason I use ladder is that I am an expert in it and very comfortable with all kinds of tricks and shortcuts. I really do believe that the reason people tend to promote ST over ladder is that they never really learned ladder well. As I mentioned above, There ARE no good ladder classes in college, the only people who know ladder well are people who have used it extensively in industry. And they don’t teach or write books.
I bought Tom Mejer Antonsens’s book on Structured Text, it is really very good. I also wrote a book myself primarily covering Ladder, and am proud of it also, it shows a lot of the structural formatting and little tricks I have used for years. All languages have their places and purpose, but as I mentioned in my reply above, if you are using Micrologix/Logix500, DirectLogic, or several other platforms you better know ladder. Your customer also may either A. not have the added ST package or B. not allow it in their standards.
So go ahead, pile on! But until plants and manufacturers change their platforms and procedures, you had better learn Ladder Logic also!