Years ago, all industrial automation was done with huge banks of electromagnetic relays. Sensors, switches, and buttons would engage some relays, and those relays would engage other relays, sending electrical signals through the system until at last they would power up a motor, turn on a light, open a valve, or perform other such actions.
It worked, but it was inefficient. Relays require a lot of power to run, increasing the overall electricity consumption of the system significantly. Relays also have moving parts which fail, coils that burn out, and springs that break. Finding the single damaged relay causing a problem in a bank of several dozen can be time consuming and frustrating. Additionally, reprogramming the system means rewiring it by hand. Depending on complexity, this can involve dozens or hundreds of wires and leaves a lot of room for mistakes.
Fortunately, transistor electronics and the declining price of computers offered an option: the Programmable Logic Controller. Essentially a small computer, the PLC replaced these huge banks of electromechanical relays with software, consuming much less power and floor space and greatly simplifying the process of reprogramming and debugging.
PLCs typically have a number of input and output modules to accept signals from buttons and sensors and provide signals to motors and valves. While these signals can be at relatively high voltages (usually from 12VDC to 240VAC), the transistor logic in the PLC that is processing these signals runs at very low voltages (5VDC or less). This represents a huge drop in power requirements. Wiring is also simplified because the only physical wiring required is to and from the input and output cards - very straightforward. The complex logic wiring is replaced with software which can be changed with a few keystrokes rather than a screwdriver. Logic changes made while the system is running are made safer as well, since there are no physical wires to short circuit while being moved from one location to another.
When PLCs were first developed, they were designed for technicians, not computer programmers. Because of this, they are not programmed with a programming language such as C++ or Assembly, which would take additional time to learn and require trained people to maintain. Instead, PLCs were (and still are) programmed with a graphical language called ladder logic. Ladder logic was designed to look like circuit diagrams for the relay banks that PLCs were intended to replace, so it was very easy to make the transition from designing these circuits on paper to programming them into a PLC. This is a simple example of ladder logic:
1 2 3 4 5 6 7 8 9 10 11
| |
| |
1+-| |- ----- -|\|-+----- ----- ----- ----- ----- ----- ----- -( )-+
| 101 102 | 001 |
| | |
2+-| |- ----- -----+ +
| 103 |
| |
3+ +
| |
| |
4+-| |- -----+----- ----- ----- ----- ----- ----- ----- ----- -( )-+
| 001 | 002 |
| | |
5+-| |- -----+ +
| 103 |
| |
6+ +
| |
| |
7+-|\|- -|\|- ----- ----- ----- ----- ----- ----- ----- ----- -( )-+
| 001 002 003 |
| |
The symbols -| |- and -|\|- represent input devices and relay contacts, and -( )- represents a relay coil. The numbers are used to reference the contacts and coils to each other. As in real-world relays and contacts, the contacts only pass "power" when closed and the coils are only "turned on" when they have power. There are also a number of specialized graphics that represent other parts of hardware relay logic, such as timers and counters. There are even graphics that do such advanced processing as signal filtering and PID loop control.
Early PLCs were limited to 7 rows and 11 columns in each network, or page of the program, because that is what would fit on one screen of the command line interfaces used to program them at the time. The number of networks that made up the program was only limited by the PLC's memory though. Some newer PLCs have eliminated the 7x11 restriction, allowing networks of arbitrary size. Some also now have the option of allowing text-based programming along with the graphical language.
PLCs can be used for much more than simple on/off processing, as well. With the right modules, analog signals such as 0-10VDC or 4-20mA can act as inputs and outputs as well, providing feedback for things such as water tank levels or temperature, and control for variable frequency drive speeds or gas valve setpoints. A huge variety of digital communication modules are also available, including TCP/IP, Modbus Plus, Profibus, and others. As well as providing another option for communicating with various field devices, digital communication can also tie the PLC together with a Human-Machine Interface and SCADA system.
PLCs have one drawback over hardware control, and that is processor speed. While hardware control all operates at the speed of electricity, and each piece of the whole is independent of the rest as far as the speed of passing signals through is concerned, PLCs are limited by how fast their CPU operates. Very large programs with complex instructions such as PID loops can show significant delay when controlling real-time operations unless the processor is up to the task.