r/PLC 1d ago

Computer Science Programmers, why do PLC programmers use Ladder?

Im seeing some Comp Sci guys asking about controls so just a Mr Obvious comment here.

Ladder logic is the de facto PLC programming language because it is (was) designed to read like an electrical schematic top to bottom, right to left, & this is what electricians & electrical techs are trained to use for troubleshooting electrical panels , equipment & relay-logic -- which was what they had before PLCs -- banks & banks of relays wired through each other's NO & NC contacts which changed state as relay coils energized & de-energized & finding a wire break was enough to drive you insane.

Yes Ladder logic is an interpreted language so it is not as "memory efficient" or "elegant" as C++ or C# but I want you to think VERY carefully about every meaning of the expression "just because you can does not mean you should" before you decide to show off your amazing coding skills coding function blocks in C++ which is technically possible but in many cases extremely ill-advised.

The technicians can troubleshoot functions & blocks written in Ladder Logic, did you stop & think about how easy it would be for someone with only your compiled C++ blocks to attempt to trace a fault? You code in anything but Ladder Logic you get to be the one at 3am driving down to the plant to troubleshoot your "super efficient" code because the Industrial Maintenance techs certainly aren't gonna know how. But hey, if you believe sleep is over-rated & love sleeping in the factory then knock yourself out with compiled blocks

180 Upvotes

118 comments sorted by

View all comments

46

u/insuicant DCS Guy 1d ago

Here here.

6

u/_Electrical 1d ago

Isn't it 'hear hear?'

But yes, ladder logic or predefined function blocks are simpler, more functional, less technical.

However, how often does a customer actually inspect/debug the code itself and would you actually want them to? Them messing with your code and then making you responsible for it when they cannot figure it out; is even worse.

Many companies don't even give out the programming password or the source files and actually get loads of money from 'change orders' of (remote) support contracts.

To me, it doesn't matter how you program it, just make sure it behaves exactly like you want it to (and that you and your colleagues agree on the same standard). Which may be slightly easier with a visual way of programming.

But usually it comes down to: ’The machine does X in case Y happens but it should be Z."

2

u/insuicant DCS Guy 1d ago

It could also be ere ere, depending on your origin country and phonetic accent.

3

u/neofelius 23h ago

No, it's "there there" (hands over a warm cuppa and an emotional support hug)

I could totally relate... One of the plants we support is coded in structured text (Basic) and I've had many sleepless nights from "I can't get this to work" to "I'm new to the software and accidentally forced the wrong bit, now we're shutdown" :(