How PLCs Work

How PLCs Work
A programmable logic controller is a specialized computer used to control machines and processes.  It therefore shares common terms with typical PCs like central processing unit, memory, software and communications.  Unlike a personal computer though the PLC is designed to survive in a rugged industrial atmosphere and to be very flexible in how it interfaces with inputs and outputs to the real world.
The components that make a PLC work can be divided into three core areas.
The power supply and rack
The central processing unit (CPU)
The input/output (I/O) section
PLCs come in many shapes and sizes.  They can be so small as to fit in your shirt pocket while more involved controls systems require large PLC racks.  Smaller PLCs (a.k.a. “bricks”) are typically designed with fixed I/O points.  For our consideration, we’ll look at the more modular rack based systems.  It’s called “modular” because the rack can accept many different types of I/O modules that simply slide into the rack and plug in.



The Power Supply and Rack
So let’s start off by removing all our modules which leaves us with a naked PLC with only the power supply and the rack.




The rack is the component that holds everything together.  Depending on the needs of the control system it can be ordered in different sizes to hold more modules.  Like a human spine the rack has a backplane at the rear which allows the cards to communicate with the CPU.  The power supply plugs into the rack as well and supplies a regulated DC power to other modules that plug into the rack.  The most popular power supplies work with 120 VAC or 24 VDC sources.
The CPU
The brain of the whole PLC is the CPU module.  This module typically lives in the slot beside the power supply.  Manufacturers offer different types of CPUs based on the complexity needed for the system.
The CPU consists of a microprocessor, memory chip and other integrated circuits to control logic, monitoring and communications.  The CPU has different operating modes.  In programming mode it accepts the downloaded logic from a PC.  The CPU is then placed in run mode so that it can execute the program and operate the process.




Since a PLC is a dedicated controller it will only process this one program over and over again.  One cycle through the program is called a scan time and involves reading the inputs from the other modules, executing the logic based on these inputs and then updated the outputs accordingly.  The scan time happens very quickly (in the range of 1/1000th of a second).  The memory in the CPU stores the program while also holding the status of the I/O and providing a means to store values.




I/O System
The I/O system provides the physical connection between the equipment and the PLC.  Opening the doors on an I/O card reveals a terminal strip where the devices connect.




There are many different kinds of I/O cards which serve to condition the type of input or output so the CPU can use it for it’s logic.  It's simply a matter of determining what inputs and outputs are needed, filling the rack with the appropriate cards and then addressing them correctly in the CPUs program.




Inputs
Input devices can consist of digital or analog devices.  A digital input card handles discrete devices which give a signal that is either on or off such as a pushbutton, limit switch, sensors or selector switches.  An analog input card converts a voltage or current (e.g. a signal that can be anywhere from 0 to 20mA) into a digitally equivalent number that can be understood by the CPU.  Examples of analog devices are pressure transducers, flow meters and thermocouples for temperature readings
Outputs
Output devices can also consist of digital or analog types.  A digital output card either turns a device on or off such as lights, LEDs, small motors, and relays.  An analog output card will convert a digital number sent by the CPU to it’s real world voltage or current.  Typical outputs signals can range from 0-10 VDC or 4-20mA and are used to drive mass flow controllers, pressure regulators and position controls.
Programming a PLC
In these modern times a PC with specially dedicated software from the PLC manufacturer is used to program a PLC.  The most widely used form of programming is called ladder logic.  Ladder logic uses symbols, instead of words, to emulate the real world relay logic control, which is a relic from the PLC's history.  These symbols are interconnected by lines to indicate the flow of current through relay like contacts and coils.  Over the years the number of symbols has increased to provide a high level of functionality.
The completed program looks like a ladder but in actuality it represents an electrical circuit.  The left and right rails indicate the positive and ground of a power supply.  The rungs represent the wiring between the different components which in the case of a PLC are all in the virtual world of the CPU.  So if you can understand how basic electrical circuits work then you can understand ladder logic.
In this simplest of examples a digital input (like a button connected to the first position on the card) when it is pressed turns on an output which energizes an indicator light.




The completed program is downloaded from the PC to the PLC using a special cable that’s connected to the front of the CPU.  The CPU is then put into run mode so that it can start scanning the logic and controlling the outputs.
‹ Definition of a PLCupThe Birth of the PLC ›


Printer-friendly version
Add new comment

PLC Components
PLC Operation
PLC Programming

The PLC, being a microprocessor based device, has a similar internal structure to many embedded controllers and computers. They consist of the CPU, Memory and I/O devices. These components are integral to the PLC controller. Additionally the PLC has a connection for the Programming and Monitoring Unit, Printer and Program Recorder.
This is shown in a block diagram below:
Depending on the type of the PLC system i.e. small, medium or large the component parts are all housed in one compact unit (small PLC) or distributed. The distributed system has the CPU/memory module, I/O racks and remote I/O units which may be hundreds of meters away from the main PLC module. Larger PLC units may also have analog input/output units and provision for more complex control programs that support arithmetic and other complex operations not originally present in relay logic controllers.
The main differences between PLCs and other microprocessor based devices are that PLC are units of rugged design for an industrial setting and are shielded for improved electrical noise immunity. Further they are modular, allowing easy replacement and addition of units. They support standardized I/O connections and signal levels and are designed for the ease of programming, to allow personnel unfamiliar with computer languages to program the PLCs in-plant.
Some of the capabilities of the PLC systems not present in earlier relay logic systems are the analog I/O, PID control and interfaces to a central PLC or a controlling computer.
PLC Components
The CPU used in PLC system is a standard CPU present in many other microprocessor controlled systems. The choice of the CPU depends on the process to be controlled. Generally 8 or 16 bit CPUs fulfill the requirements adequately.
Memory in a PLC system is divided into the program memory which is usually stored in EPROM/ROM, and the operating memory. The RAM memory is necessary for the operation of the program and the temporary storage of input and output data. Typical memory sizes of PLC systems are around 1kb for small PLCs, few kb for medium sizes and greater than 10-20 kb for larger PLC depending on the requirements. Many PLC would support easy memory upgrades.
Input/Output units are the interfaces between the internal PLC systems and the external processes to be monitored and controlled. Since the PLC is a logic based device with a typical operating voltage of 5 volts and the external processes usually demand higher powers and currents, the I/O modules are optically or otherwise isolated. The typical I/O operating voltages are 5V - 240 V dc (or ac) and currents from 0.1A up to several amperes. The I/O modules are designed in this way to minimize or eliminate the need for any intermediate circuitry between the PLC and the process to be controlled. Small PLC units would have around 40 I/O connections with larger ones having more than 128 with either local or remote connections and extensive upgrade capabilities.
Programming units are essential components of the PLC systems. Since they are used only in the development/testing stage of a PLC program, they are not permanently attached to the PLC. The program in a ladder diagram or other form can be designed and usually tested before downloading to the PLC. The Programming unit can be a dedicated device or a personal computer. It allows the graphical display of the program (ladder diagram). The unit, once connected to the PLC can download the program and allows for the real time monitoring of its operation to assist debugging. Once the program is found to operate as required the Programming Unit is disconnected from the PLC which continues the operation.

PLC Operation
The PLC operates internally in a way very similar to computers. The inputs are continuously monitored and copied from the I/O module into RAM memory which is divided into the input and output sections. The CPU steps through the control program in another section of the memory and fetches the input variables from the input RAM. Depending on the program and the state of inputs, the output RAM is filled with the control variables which are then copied into the I/O module where they control the processes.

PLC Programming
One of the main advantages of the PLC controller is that it is a programmable device, which makes it possible, unlike in the relay logic, to easily design and modify the control program or process without any changes in the wiring (no hardware modifications). To make the programming of the PLC systems easy and efficient, industry standards defining the programming approach and the programming languages used were adopted. This reduces the need for personell training by making a set of languages standard for all PLC platforms on the market. Knowing the PLC programming languages and programming standards is thus one of the most important considerations for anyone involved in the PLC area.