What is a programmable logic controller (PLC)?
If you’ve read some of our articles on control systems, then you know their three basic components, right? If not, then repeat after me: measuring devices, controllers, and actuators.
The programmable logic controller (PLC), as the name suggests, falls into the controller category. You can find other controllers and control systems out there, like Arduino or Raspberry Pie. These devices are rising in popularity with all the Internet of Things (IoT) and home automation hype. For a bigger, more complex process, you might opt for a distributed control system (DCS) over a PLC. Nevertheless, more people use the PLC than any other controller in the industry.
A PLC is an industrial solid-state computer which monitors input devices and makes logic-based decisions to control output devices. In other words, it stores all your programmable logic. This logic will receive your process values (PVs) from your field instruments via input. Then it analyzes how close they are to your setpoints (SP). If a PV falls outside its range, then the PLC sends electronic signals to your final control elements via outputs, so that the actuators can bring your PV closer to your SP.
To understand how PLCs work, we should look at why they came into existence and the system they needed to replace. So let’s have a look back in history real quick.
History of the PLC
Before the PLC, you had to control your machinery using relay logic. A relay is basically a device with a coil inside. When energized, the coil creates a magnetic force that changes a switch state from ON to OFF or vice versa. With that, you could control some parts of your process.
Suppose you have a water tank with two level switches, one at the top and one at the bottom of your tank. A simple level control would use relay logic to turn on the water pump when both switches are on the OFF state and turn off the pump when both reach the ON state.
For simple applications like this, relay logic works great. However, when your application gets more complex and has more variables, the relay logic can get difficult. You have to physically change the wiring on relay panels to make changes in the logic, which makes troubleshooting hard as well.
To improve the logic system, General Motors requested Dick Morley’s company, Bedford and Associates at that time, to create a “standard machine controller” to replace the relay system. According to PLCDEV.com, GM had a few requirements for this device to meet:
- A solid-state system, flexible like a computer but priced competitively to a similar relay logic system
- Easy maintainance and programming in line with standard ladder logic
- The ability to work in an industrial environment despite its dirt, moisture, electromagnetism, and vibration
- A modular nature to allow for easy exchange of components and expandability
After winning the contract to develop this new device, Richard Morley founded a new company called MODICON, an acronym for Modular Digital Control, and started working on the project. In June 1969, the first viable PLC came out, the 084, the 84th project since MODICON started.
Now that we know how, why, and when PLCs were created, let’s talk about how they work. To make it easier, we’ll start with the three parts of a PLC: the power supply and rack, the control processing unit (CPU), and the I/O modules. Some PLCs come with fixed I/O modules, but for this explanation, we’ll focus on PLCs with interchangeable modules.
Rack and power supply
The rack with the power supply comprises the body of the PLC. The rack holds the cards and modules of the PLC together. The different types of PLC cards include I/O cards, communication protocol cards, and more. The number of cards supported by your PLC will depend on the model, as vendors make various PLC sizes for various processes.
If the rack is the body of the PLC, the CPU module is the brain. This small computer has a microprocessor, memory chips, and integrated circuits to control logic, monitoring, and communications. Your programming will live and run here. You usually can’t do both at the same time though. PLCs work in two modes, programming mode and run mode. In programming mode, you can download and upload the stored program and make changes if necessary. But in run mode, the CPU only runs the control logic it has stored in its memory.
Last but not least, we have the I/O modules. These connect your PLC with your sensors, actuators, indicators, transmitters, etc. Through these modules, the PLC gathers data on your process values and sends signals to the final control elements.
How a PLC works
Now let’s understand how all the parts come together to control your process. As a dedicated controller, the PLC will run the same program or control logic over and over again. We call this time the scan time, and it usually only takes a couple of milliseconds.
Even in this tiny amount of time, the PLC performs a couple of actions. First, it receives and reads all the PVs coming through your input modules. With this data, the PLC executes its control logic to check for matches with the SPs. If it finds mismatches, then the CPU executes the program logic to command your output modules to change the process so that your PVs match your SPs once again.
Once the PLC has completed its operating cycle, it starts all over, again and again. This way it continually makes sure your process values stay close to your setpoints.
PLC programming languages
When PLCs first came out in the late 60s, we used the ladder diagram (LD) language to program them. This language resembles the old relay diagram, which made it easier for technicians and engineers to switch between the two systems.
As the years went by, other programming languages came up. If you know anything about coding, you know how many programming languages currently exist – way too many! Luckily, in 1993 the International Electrotechnical Commission (IEC) 61131-3 standardized PLC programming languages to just a few:
- Instruction list (IL)
- Ladder diagram (LD)
- Function block diagram (FBD)
- Structured text (ST)
- Sequential function chart (SFC)
If you want to know more about them, then check out our article on PLC programming languages.