Ladder Logic and Programmable Logic Controllers (PLC’s): How do they work?
Programmable Logic Controller (PLC)
A programmable logic controller (or PLC) is a type of multi-purpose computer used in various industrial and commercial control applications. PLC’s monitor inputs and other variables to perform a function or automate a process.
Example of what a PLC might physically look like.
PLC’s are comprised of input points and output points. A central processing unit (CPU) monitors these inputs and deliver outputs according to programming logic programmed within the PLC. Inputs and outputs are evaluated by the CPU and stored programs are executed according to these values. Input modules convert incoming signals into logic which can be understood by the CPU. Output modules convert these signals into analog or digital signals which can be interpreted by other devices.
PLC’s are capable of performing the same tasks and functions as hard-wired logic, all while saving space and reducing maintenance requirements. Hard-wired solutions are susceptible to wiring errors, require extensive work by an electrician to implement any changes, and are much more complicated. A PLC enables the same functionality, with the benefits smaller physical size, ease of program modification, availability of historical data and diagnostics, and the ability to easy duplicate programs or information.
Types of Signals and Information Processing
A PLC is a computer, and thereby stores information in the form of bits. This means information is stored and processed in the form of a 0 or 1.
A sensor converts a physical condition into an electrical signal, whereas an actuator converts an electrical signal (from a PLC or otherwise). These devices enable communication with a PLC.
Discrete signals or discrete inputs and outputs, also referred to as digital inputs and outputs, are either on or off (logic 1 or logic 0). Some examples of discrete signals include pushbuttons or switches; these devices are either in the “on” state (i.e. pushed on, or switched on) or in the “off” state. In contrast, analog signals (or analog inputs and outputs) are continuous, non-discrete signals. Typical analog signals vary from 0 to 20 milliamps, 4 to 20 milliamps, or 0 to 10 volts. These signals are used to communicate information that can occur within a range, for example the speed of a motor (e.g. a VFD-controlled motor which is running anywhere between 0 RPM up to 3600RPM)
PLC’s are commonly programmed with a programming logic called ladder logic, which involves graphically programming functions with symbols representing hard-wired control diagrams.
Upon first glance, a ladder logic diagram is very similar to the ladder diagrams used in motor control schematics. Like ladder diagrams, they are read from left to right, and top to bottom. Below is an example of a ladder logic diagram.
The program is executed through PLC scans. In simple terms, the PLC’s processor reads the status of given inputs, executes its program per the ladder logic diagram, and updates the status of relevant outputs. This PLC scan process is then repeated.
Other PLC programming methods include statement list instructions (STL) and function block diagrams (FBD).
Ladder Logic Symbols
A ladder logic diagram is very similar to the ladder diagrams used in motor control schematics. Like ladder diagrams, they are read from left to right, and top to bottom.
The normally open (NO) contact and the normally closed (NC) contact are the basic building blocks of programming PLC functions. These contacts open and close per the input or output which they are controlled by. They perform nearly identical to the contact-coil pairs found in the ladder diagrams of motor control schematics. Power flows through these contacts when they are in a closed state.
The coil is another building block of programming PLC functions. When a coil is energized, it creates an output which is used to control the state of other devices, such as a contact. For example, consider if the coil below were paired with a normally open (NO) contact. Upon energizing the coil, an output would be created and sent to to the paired normally open (NO) contact, thereby closing the contact.
Various digital logic functions or instructions can be represented within ladder logic diagrams, such as SR Flip-Flops, and more.
Each rung on a ladder logic diagram can represent a logic operation. For example, you can implement simple AND operations as well as OR operations, and any other digital logic operation. Consider the diagrams and truth tables below and try to determine the functions they represent.
Upon inspection, you can see that the top diagram represent an AND function, and the bottom represents an OR function. With these building blocks, one can define many various functions and programs.
A Simple Example
Consider the very basic PLC setup below. There are various external devices providing signals to the input points on the PLC input module (i.e. the NO start pushbutton, the NC stop pushbutton, and the “OL” contact). The input points receive signals depending on the status of the external devices. Remember that like ladder diagrams, they are read from left to right, and top to bottom, and current/power flows from left to right.
- Input point 10.1 is energized since the stop pushbutton is closed and power flows to the input point. This means the corresponding contact 10.1 in the ladder logic diagram is now closed.
- Input point 10.2 is energized since the “OL” contact is closed and power flows to the input point. This means the corresponding contact 10.2 in the ladder logic diagram is now closed.
- At this point in time, the start pushbutton is then pushed (closed) and thus power flows to input point 10.1 and the input point is energized. This means the corresponding contact 10.0 in the ladder logic diagram is now closed.
- All input points are energized now, meaning that power can flow to output point Q0.0, which then sends a signal to the connected motor starter, thereby starting a connected motor.
- Because output point Q0.0 was energized, the associated contact Q0.0 closed. This means power can now bypass contact 10.0 and flow to Q0.0. The start pushbutton can be depressed and output point Q0.0 will stay energized.