Innovation in industrial control processes has always focused on automation, with a progressive elimination of manual operations. The goal is to extract maximum advantages, with an emphasis on higher productivity. A programmable logic controller (PLC) is a computer running an application exclusive to process automation; it executes control functions from program steps and significantly reduces the necessary wiring connected to a conventional relay. The use of PLCs offers higher reliability, high-speed control, accurate defect checks, and network compatibility. PLCs have unique input/output interfaces complete with control, and ladder logic dominates their easy-to-implement program code. This learning module discusses the basics of PLCs, including their hardware structure, programming language, and use cases.
Upon completion of this module, you will be able to:
Programmable Logic Controllers (PLCs) are industrial computers with modular components designed to automate control processes. They find use in factories and industrial plants to control motors, pumps, lights, fans, circuit breakers, and other machinery. Before PLCs, automation took the form of electromechanical relay circuits that magnetically opened or closed their electrical contacts with the energization of the relay coil. However, even the simplest automation was hard to create, due to the huge numbers of relays, spaces, and wires needed. Automating a factory could require thousands of relays. The PLC was specifically designed for effortless programming, and to substitute for the complicated relay circuitry used in industrial manufacturing plants.
The robustness of PLCs is their principal advantage over conventional controllers. The programmability of PLCs also makes them versatile: a single unit can be used for different functions based on its use. Their high fidelity in most industrial ecosystems is another advantage; they are immune to peripherals' generated noise, and make for a reliable automated device where accuracy is crucial. PLCs can also manage numerous digital and analog signal processing input and output ports. They can be programmed using ladder logic designed to imitate control circuit schematics. Figure 1 shows a Proportional, Integral, Derivative (PID) block of the easyE4 nano programmable logic controller that can compare the pressure feedback from the system to a desired setpoint. The output of the PID block can then be set as an analog output using the easyE4 nano PLC. The analog expansion unit has outputs to send a signal to a VFD as a speed reference to control the speed of a fan. As the error between the pressure setpoint and feedback increases and decreases, the speed of the fan will adjust accordingly.
PLCs are solid-state electronic devices which control a machine's process or operation. They utilize programmed logic functions. These functions are inserted into their memory via programming software. PLCs are designed to monitor inputs from pressure sensors, temperature sensors, limit switches, auxiliary contacts, and pilot devices. Based on these inputs' status that may be on/off, voltage value, or amperage value, the PLC runs these inputs through its programming. It executes the program by updating its outputs, such as starting a motor, turning on a pilot light, or changing a conveyor's speed. They are particularly designed for numerous input/output (I/O) arrangements. The major blocks constituting a programmable logic controller are the chassis, power supply, CPU, input module, output module, memory, and communication module. Let’s describe these major blocks in greater detail.
The PLC rack or chassis forms a vital module and functions as a spine to the system. PLCs are manufactured in multiple sizes and shapes, and bigger PLC racks are needed if complex control systems are used. Small-sized PLCs are provisioned with a fixed I/O pin arrangement, and they are generally modular-type rack PLCs. These PLCs accept different I/O modules with fit-in and sliding concepts. The I/O modules sit inside this rack/chassis.
The power supply module provides the controller's required power. It converts the 240V AC/ 120V AC input power to typically the rated 24V DC. The PLC common current rating varies between 2 amps to 10 amps for compact systems, and may extend to 50 amps for bigger, more powerful controllers.
CPU Module and Memory
A CPU module houses a central processor containing a microprocessor, ROM, and RAM. The ROM memory comprises an operating system, application programs, and drivers. RAM stores data and programs. The PLC, which is a microprocessor rooted CPU, substitutes counters, timers, and relays. It incorporates a single-bit processor or word processors. The one-bit processor performs logic functions. In contrast, word processors are used to process text, numerical data, control, and record data. The CPU reads the input data from sensors through the input module, processes it, and finally sends the command to control devices through the output module.
Communication Interface Module
Communication modules are employed to transfer information between the CPU and communication networks. These communication modules connect with other remotely located PLCs and computers.
- 4.1 PLC Programming – Ladder Logic
Relay logic is the origin of ladder logic programming. Traditional relay panels consist of numerous electro-mechanical relays wired together to perform a specific control function in a manufacturing process (e.g., turning on/off a motor). This amalgam of contacts, switches, coils, and relays is termed Relay Logic. Figure 3 displays a logic diagram describing a structured relay. These diagrams illustrate how connections among devices are built on relay panels. These are termed "ladder" diagrams, because their construction appears similar to a ladder. The left positioned positive power rail proceeds to the right placed negative power rail via the rung's linked physical devices. The following figure illustrates a ladder diagram having pushbuttons (PB), indicator lamp (L), a motor (M), and control relays (CR).
Ladder logic is similar to electrical ladder diagrams. The physical contacts and coils are substituted with memory bits. Ladder logic has symbols for contacts and relays, which are called coils in ladder logic. These symbols are the instructions in PLC terms. In Figure 4, the ladder logic duplicates the ladder diagram of the relay logic. Memory locations substitute hard-wired logic. Some memory locations are for internal use, while others are utilized with external outputs and inputs. To supervise and control real-world devices, they need to be wired to I/O modules.
A PLC always starts at the top of ladder logic and then executes its way down. The numbers on each rung are to understand how the PLC hardware executes the ladder logic. The PLC first scans all its inputs and then executes the program to set outputs. Scan time is the time the CPU needs to execute a single pass and return loop to the beginning. Scan time is vital in applications where timing is of the essence. Special purpose I/O modules and subroutines are used to reduce scan time, if required.
The PLC incorporates function blocks with ladder logic. The structure of the program is still a ladder, with the more complex instructions being function blocks. Some of the function blocks are described in the following content:
Timing: Timer instructions can be obtained to permit on-delayed or off-delayed events. When triggered, the timer will switch its associated output ON (on-delay) or OFF (off-delay) after the elapsed set time.
- 4.2 Fundamental Logic Gates with Ladder Logic Instructions
NOT Gate: A NOT Gate also works as an inverter. It takes the input and gives inverted output. This implies that a low input correlates to high output, and vice-versa. Figure 5 shows a truth table, electronic circuit, and ladder logic program for a NOT gate. A NOT gate is implemented using a normally closed contact in the ladder logic program.
Figure 5: NOT Gate circuit, Truth Table, and Ladder Logic Program
AND Gate: In an AND Gate, when both inputs (A and B) are high, then the output (Y) will be high, and if any input is low, output (Y) will be low. This is implemented using two normally open (NO) contact in series, as shown in Figure 6. Therefore, if any of the contacts are open, it will disallow current flow and keep the output low.
Figure 6: AND Gate circuit, Truth Table, and Ladder Logic Program
OR Gate: The OR gate produces a high output (Y) if any input (A or B) is high and produces low if both inputs are low. It is implemented by connecting two normally open (NO) contacts in parallel, as shown in Figure 7. Therefore, if any contact is closed (energized or logic 1), it will flow the current, and output will be high.
Figure 7: OR Gate circuit, Truth Table, and Ladder Logic Program
NAND Gate: A NAND gate is an inverted AND gate, so the output of a NAND gate is high if any input (A and B) is low, and the output will be low if both inputs are high. It is implemented by connecting two normally closed (NC) contacts in parallel, as shown in Figure 8. From the ladder logic program, it is clear that the current will stop flowing only when both contacts are open (energized or logic 1).
Figure 8: NAND Gate circuit, Truth Table, and Ladder Logic Program
NOR Gate: A NOR gate is an inverted OR gate, so when any input is high, the output will be low, and when both inputs are low, the output will be high. The ladder logic is implemented using two normally closed (NC) contacts connecting in series, as shown in Figure 9. The current will stop flowing if any contact is open (energized or logic 1).
Figure 9: NOR Gate circuit, Truth Table, and Ladder Logic Program
EX-OR gate: In an EX-OR gate, If both inputs (A and B) are high or low, the output will become low. For any other input condition, the output will be high. The ladder logic is implemented with two normally open (NO) and two normally closed (NC) contacts, as shown in Figure 10. The output (Y) will be high if one contact is closed and another contact is opened. Therefore, if both contacts are energized (logic 1), one pops open, and the other gets closed. The output turns low.
Figure 10: EX-OR Gate circuit, Truth Table, and Ladder Logic Program
EX-NOR Gate: In an EX-NOR gate, when both inputs (A and B) are high or low, then the output will high, and if any input is high or low, then the output (Y) will become low. The ladder logic implementation is shown in Figure 11 using two NC contacts and two NO contacts. The output (Y) will be high if both contacts (A and B) are open or closed. The lamp (Y) will be low if any one contact (A) is activated and another contact (B) is deactivated.
Figure 11: EX-NOR Gate circuit, Truth Table, and Ladder Logic Program
- 4.3 easyE4 Nano Programmable Logic Controllers
Eaton offers a wide range of PLCs, including the easyE4 series. These PLCs contain 12 I/O with the capability to be expanded to a network of up to 188 I/O points. The XC300 small PLC is scalable utilizing the XN300 modular I/O platform. The XC300 is suited for high-speed applications that require a high degree of programming flexibility. The compact and flexible easyE4 enables efficient control systems independent of the application. Changes to the installation are accomplished through front panel programming, eliminating the need to change the wiring and minimizing downtime.
The following are the core features of easyE4 nano programmable logic controllers:
- 4.4 Programming Software: easySoft
easyE4 nano programmable logic controllers are designed to be programmed using the easySoft 7 programming software. This program has been developed specifically for this series of devices, making it possible to easily integrate available functions into a circuit diagram and use the result as a control program.
easySoft 7 can also be used to:
Existing programs created with the previous series for easy500/700/800 PLCs can be moved to an easyE4 PLC with automatic conversion of visualizations with easySoft 7. It supports four programming languages: Structured Text (ST), Function Block Diagram (FBD), Ladder diagram (LD), and Easy programming language event-driven programming (EDP). They are featured with interrupt function blocks and new function blocks such as Data Logger (DL), Alarm Function (AL), Weekly Timer (WT), and Yearly Timer (YT). Oscilloscope and web server functionality are other features of this series PLC.
PLCs are used in various engineering fields, manufacturing plants, and process industries. We will discuss a few easy4 nano PLC use case applications, with a ladder logic program using some functional blocks.
- 5.1 Controlling Pressure in HVAC Applications with Scaling and Compare Function Blocks
Pressure control is needed in various HVAC applications to maintain the system at a given pressure setpoint, or to prevent disasters from occurring when the system pressure moves outside its design limits. A ventilation system may gain too much pressure when dampers are closed, causing decreased efficiency without pressure control. Conversely, if the ducting pressure is too low, there will be insufficient airflow. Similarly, if the pressure in an air conditioning system is too high or low, the source of the defect can be a leak or a faulty compressor.
The easy4 nano PLC can monitor whether the upper-pressure threshold has been surpassed by monitoring a pressure switch or transducer. The nano PLC can then shut down the system and warn appropriate personnel. Like high-pressure control, low-pressure control works to check if the system's pressure is below the desired threshold. Low-pressure control can also be used to prevent mechanical failures.
An analog or digital pressure sensor can be integrated with the easyE4 nano-PLC. The programmer can write code to compare the sensor feedback against a pressure threshold setpoint. When the feedback surpasses or does not meet certain values, the programmer can turn off the easyE4's outputs to shut down the system. A high- and low-pressure switch is implemented to shut off and enable the equipment. An analog pressure transducer is used to compare the current pressure to the high- and low-pressure thresholds. These signals are then used to disable components in the system that increase or decrease pressure, for example a compressor in a refrigerator.
The output from the analog pressure sensor feeds directly to an analog input of the easyE4 nano PLC. The raw analog signal is scaled to a meaningful value in the program using a value scaling (LS01) function block. easyE4 base devices provide 32 value scaling function blocks, LS01 through LS32. The raw 0-4095 count signal is scaled corresponding to 0-50 PSI in the below program code.
The scaled pressure feedback is compared to the system's low- and high-pressure thresholds using comparator function block CP01 and CP02, as shown in Figure 13. easyE4 base devices provide 32 comparator function blocks, CP01 to CP32. If the pressure limits are exceeded, high- and low-pressure fault bits are set.
Figure 13: Comparing scaled pressure feedback against the low-pressure and high-pressure threshold
In the last stage, the high- and low-pressure fault bits are used in the permissive run logic, as shown in Figure 14. If the pressure fault bits are not active and all other system logic that would enable the system to run are true, the run signal will be set. In this example, if there is no high- or low-pressure fault, and the refrigerator is warmer than the desired temperature, the relay output Q1 of the easyE4 will engage to power the compressor contactor. M33, M33, M34, and Q01 are the memory addresses.
- 5.2 Controlling Flow Within an HVAC System with PID Function Blocks
Variable chilled or heated water systems restrict the flow to loads, such as radiators, to control the surrounding environment's temperature. Such an action affects the flow rate through the chiller or boiler. As shown in Figure 15, a bypass path is built into the system to prevent this scenario, and can then be used to restore the flow rate to its proper level. The control valve is opened and closed to match the change in the flow rate. With the decrease of system flow rate, the valve gets opened further to restore the flow to the correct setpoint, to maintain chiller or boiler flow.
A proportional, integral, derivative (PID) control method can control a valve's position based on flow rate feedback. The error between the setpoint and the feedback from an analog device is fed into a PID function. The output of the PID is then directly controlled to control a valve. The valve position is dynamically adjusted to regulate it automatically with the flow rate fluctuations.
The easyE4 nano PLC allows designers to set up PID (DC01) in its software, as shown in Figure 16. easyE4 base devices provide 32 PID controller function blocks, DC01 to DC32. Gains can be selected by setting EP, EI, or ED; the designer needs to set I1 to be the setpoint and I2 to be the feedback from the system. Additionally, the proportional gain KP is configured directly on the faceplate. This value will have to be determined empirically based on the desired response.
The easyE4 nano PLC calculates the integral and derivative gain slightly differently. The integral gain is KI=KP*TC/TN, where KP is the proportional gain, TC is the scan time of the function block, and TN is the integration time. The integration time parameter (TC) is the value that the user adjusts to increase or decrease the integral gain. Likewise, the derivative gain is KD=KP*TV/TC, where KP and TC are the same parameters and TV is the differential time. The differential time (TV) is the value that should be adjusted to increase or decrease the differential gain.
Similar to proportional gain, the integral and derivative gains need to be determined empirically. However, for valve position control, it is recommended that the derivative term should not be used. The PID output, QV, then directly sets the output to the system, which is the valve position reference.
*Trademark. Eaton is a trademark of Eaton Corp. Other logos, product and/or company names may be trademarks of their respective owners.
Test Your KnowledgeBack to Top
Are you ready to demonstrate your knowledge of PLC and Ladder Logic Programming? Then take a quick 15-question quiz to see how much you've learned.
To earn the Automation IV Badge, read through the module to learn all about industrial power supplies, attain 100% in the quiz at the bottom, leave us some feedback in the comments section, and give the module a star rating.
1) Programmable Logic Controllers (PLCs) are industrial computers with modular components designed to automate control processes.
2) PLCs can manage numerous digital and analog signal processing input and output ports and can be programmed using ___________ designed to imitate control circuit schematics.
3) True or False: PLCs are designed to monitor inputs from pressure sensors, temperature sensors, limit switches, auxiliary contacts, and pilot devices.
4) Which of the following is NOT part of a programmable logic controller?
5) Input and output (I/O) modules convey signals between the CPU and field devices such as sensors and control devices (actuators).
6) The origin of ladder logic programming is _______ logic.
7) True or False: A PLC starts at the top of ladder logic and then executes its way down. The PLC first scans all its inputs and then executes the program to set outputs.
8) The easyE4 PLC contains 12 I/O with the capability to be expanded to a network of up to _____ I/O points.
9) True or False: Timer instructions can be obtained to permit on-delayed or off-delayed events. When triggered, the timer will switch its associated output ON (on-delay) or OFF (off-delay) after the elapsed set time.
10) Which programming language is NOT supported by easySoft 7 programming software?
11) True or False: An OR gate produces a high output (Y) if any input (A or B) is low and produces low if both inputs are high.
12) Which of the following is not a special function of a PLC?
13) True or False: PLC input devices can take the form of stop and start switches or pushbuttons. Electric heaters, valves, and relays are some examples of output devices.
14) The easy4 nano PLC can monitor whether the upper-pressure threshold has been surpassed by monitoring a pressure switch or _________.