A Programmable Logic Controller

My father-in-law made a career of repairing the heavy machinery of the local plywood and paper mills in the lumber and farming community of LaGrande, Oregon. Large machines such as high speed saws, conveyors, process tanks and more. One evening he was working with something I did not recognize and I made the mistake of asking what it was.

Ladder Logic
A snippet of the Keck 1 local controls ladder logic
Over the kitchen table were spread the printouts of an arcane programming language, what I learned was called ladder logic. This sort of programming is a throwback to a day when control systems were built from dozens, or even hundreds, of electromechanical relays wired together to perform complex tasks. The relays are gone, replaced by a microcontroller, the programming language remains. It really does look like a ladder, drawn the same as the wiring diagrams used for those banks of relays. Each function, or rung, is filled with symbols for relay contacts and coils.

As a computer engineering student I was appalled that anyone would program this way, I could not conceive of using such a backwards seeming technology. Why not just use a simple programming language like C to build the functions? Ladder logic was the worst sort of programming language, no abstraction, no compartmentalization, prone to building hard to understand spaghetti code.

Keck 2 Dome PLC
An Allen-Bradley PLC-2 that controls the Keck 2 dome and shutters
The ladder logic program is downloaded to a device called a PLC, or programmable logic controller. Usually a rack of cards with a controller at one end and a set of input/output modules filling the remainder of the rack. The PLC takes the code and executes it, scanning the inputs and following the rules set in the logic to switch the outputs. connected the the various push-buttons, limit switches, motors and lights, the PLC can control a huge range of industrial equipment. These devices are the workhorses of entire factories, and often observatories.

Jumping ahead more than a decade… I now find myself using this same technology and programming in ladder logic. Many of the critical systems at Keck use PLC’s for control. The dome controllers, local controls and various safety systems use PLC’s to accomplish the task. Some of these systems are over two decades old, and for the most part spares can still be purchased.

The technology is not dead, far from it. The new telescope control systems currently being designed will feature modern ControlLogix PLC’s to implement the critical safety functions. There are dozens of interlocks throughout the telescope, switches that detect the condition of the system and prevent bad things from happening. If a lock pin is not installed, if a drawbridge is down or a crane not stowed properly, the telescope does not move.

Never mind me, I am just reading a twenty year old user manual, learning how to set the serial communications on a PLC-5.