What Is a Programmable Logic Controller and How Does It Work

What Is a Programmable Logic Controller and How Does It Work

A PLC (Programmable Logic Controller) is an industrial-grade digital computer delivering deterministic real-time control of electromechanical processes per IEC 61131-2, with 1–100 ms scan cycles critical for safety interlocks and certified plant operation.

How a PLC Works: Architecture and the Scan Cycle

At its core, a PLC is a ruggedized microcomputer that reads inputs, executes user logic, and writes outputs — repeatedly, deterministically, and without an operating system pause. The whole machine is built around one principle: predictable timing. A desktop PC may finish a task in 5 ms one second and 80 ms the next. That kind of jitter is unacceptable when a press brake has to stop within 12 ms of a light curtain break.

The PLC executes what engineers call the scan cycle. It runs four phases in a fixed loop: input image update, program execution, output image update, and housekeeping (communications, diagnostics, watchdog). On a Siemens S7-1200 with simple ladder logic, a typical scan completes in 1–3 ms. On a heavily loaded modular system like an Allen-Bradley ControlLogix with 4,000 rungs and motion tasks, you might see 15–30 ms.

Scan cycle is defined as the cyclic sequence in which a PLC reads its physical inputs into an internal image table, executes the user program against that image, and writes the resulting output image to physical terminals (per IEC 61131-1 §3.4).

The Four Phases in Practice

In our experience, engineers new to PLCs often write logic as if outputs change instantly. They don't. If you energize an output in rung 5, then check it in rung 6, the physical terminal hasn't switched yet — only the output image. The actual change happens at the end of the scan. This catches people out when they mix PLC logic with real wiring assumptions.

The CPU module is the brain. Modern units like the Siemens S7-1200 CPU 1214C – 6ES7214-1AG40-0XB0 integrate 14 digital inputs, 10 digital outputs, 2 analog inputs, 75 KB of work memory, and a built-in PROFINET port — all in a unit roughly the size of a hardback book. That level of integration would have filled a control cabinet thirty years ago.

The functional and architectural requirements for any modern PLC are formally defined in IEC 61131-2: Programmable Controllers Equipment Requirements.

PLC Hardware: CPU, I/O, Power Supply, and Backplane

A complete PLC system has five hardware elements: the CPU, the power supply, the I/O modules, the chassis or backplane, and the communication interfaces. Each is selectable, and each interacts with the others in ways that catch out procurement teams who buy on price alone.

For a deeper breakdown of every module class, the dedicated guide on PLC System Components: CPU, I/O Modules, Power Supply and Rack Explained walks through each part with sizing examples. Below we cover the engineering essentials.

CPU Selection

The CPU specifies three things that matter for selection: program memory, scan-time-per-instruction, and supported I/O count. A common mistake is sizing memory based on current program size rather than projected growth. We recommend leaving 40% headroom — every brownfield retrofit we've done has expanded the program by at least 25% within two years.

I/O Module Sizing

Digital input modules are usually 24 VDC sinking or sourcing, in groups of 8, 16, or 32 channels. Output modules come in three flavors: relay (general purpose, slow, mechanical wear), transistor (24 VDC, fast, no arc), and triac (AC loads). For switching motor contactors like the Schneider Electric LC1E40M5 Easy TeSys 3-Pole 40A 440V AC Contactor, a relay output rated 2A at 230 VAC works fine — the contactor coil draws around 70 mA inrush. But if you're pulse-width modulating a solenoid at 200 Hz, only a transistor output will survive.

Key takeaway: Match output module type to load behavior, not nameplate current. Relay outputs fail prematurely on high-frequency switching even at 10% of rated current.

Power Supply Sizing

Formula: PLC Power Supply Sizing — Source: IEC 61131-2 Clause 4.3

Ptotal = (Σ Pmodule) × 1.25 + Pfield

Symbol Description Unit
Ptotal Required power supply rating W
Pmodule Backplane current × bus voltage per module W
1.25 Safety factor for inrush and aging
Pfield Sensor and field-loop current draw W

A typical 8-slot rack with one CPU, two 16-channel digital input modules, one 16-channel digital output module, one 8-channel analog input, and one Ethernet module draws around 18 W on the 5 V backplane. Add 24 V field power for sensors — usually 60–100 W more — and you arrive at a 120 W power supply minimum.

Programming Languages: IEC 61131-3 in Practice

The IEC 61131-3 standard defines five PLC programming languages: Ladder Diagram (LD), Function Block Diagram (FBD), Structured Text (ST), Instruction List (IL — deprecated in the 3rd edition), and Sequential Function Chart (SFC). Most engineers use two or three of these on a given project.

Ladder Diagram dominates North American plants because it mirrors relay schematics — maintenance electricians can read it without formal training. In European installations, especially process industries, Function Block Diagram is more common. Structured Text wins for math-heavy logic: PID tuning, recipe management, complex state machines.

Criteria Ladder Diagram Function Block Structured Text
Readability for electricians Excellent Good Poor
Math operations Cumbersome Moderate Native
Loops and arrays Awkward Limited Native
Typical use Discrete logic, interlocks Process control loops Algorithms, data handling
Debug visibility Excellent (live rung state) Excellent Limited (variable watch)

In practice, what we typically see in the field is a mixed-language project: ladder for safety interlocks and motor control, function blocks for analog loops, structured text for batch sequencing. Engineers often overlook that not all PLCs support all five languages. Lower-tier compact PLCs may offer only ladder. Verify before specifying.

PLC Types: Compact, Modular, Rack, and Safety

Industrial PLCs split into four practical categories. Each suits a different scale and risk profile. The full taxonomy with sizing examples lives in the dedicated article on PLC Types and Classification: Compact, Modular, Rack and Safety PLCs, but the short version follows.

Compact PLCs integrate CPU, I/O, and power supply in one housing. Channel counts are fixed — typically 10 to 60 I/O. Ideal for OEM machinery: a packaging line, a small conveyor, a standalone press. The Siemens S7-1200 family and Schneider M221 sit here.

Modular PLCs let you mix and match. CPU on one slot, digital input on another, analog on a third. Channel counts scale from a few dozen to several thousand. This is the dominant class for plant-level automation. Siemens S7-1500, Schneider M580, Allen-Bradley CompactLogix.

Rack PLCs are the heavyweight class — large chassis, hot-swappable cards, redundant CPUs. Used in refineries, power generation, large water treatment plants. Scan times can be optimized below 1 ms for motion-critical tasks.

Safety PLCs are certified to IEC 61508 SIL 2 or SIL 3 and carry redundant internal architecture, diverse processors, and certified function blocks. They cost roughly 2–3× a standard PLC of equivalent I/O count. Don't try to substitute. A standard PLC controlling an emergency stop circuit will fail the next functional safety audit.

Key takeaway: Choose PLC class by required I/O count plus a 40% growth margin, expected scan time, and the highest SIL rating in the safety scope. Mixing safety functions onto a standard PLC is a documented audit failure.

Real-World PLC Application Examples

Motor Control Center Integration

A typical MCC retrofit we delivered last year for a beverage plant tied a Schneider M340 PLC into 28 motor starters. The PLC handled start/stop logic, thermal overload monitoring, and runtime accumulation for predictive maintenance. Each starter used a Schneider Electric LV429434 MT250 Motor Mechanism Module Compact NSX Series for remote racking and a contactor for the actual switching. The PLC sent commands through the breaker's communication module, then verified state through auxiliary contacts wired back to digital inputs. Closed-loop verification is non-negotiable: never trust a command without reading back the actual state.

Switchgear Trip and Close Coordination

In high-current applications — say a 4000 A air circuit breaker on a generator output — the PLC issues close commands through dedicated trip and close circuits. The ABB 1SDA073687R1 YC E1.2..E6.2-XT7M 220-240 VAC/DC Shunt Closing Release is a good example: a coil-operated closing release that the PLC energizes through a relay output. The wiring spec typically calls for a 5 A rated contact, opto-isolated input from the PLC side, and a status feedback signal back into the PLC for sequence verification. Per IEC 60947-2 Clause 8.3, the closing operation must complete within the manufacturer-specified time window — for E1.2 frame breakers, around 70 ms.

Process Control: PID and Analog Loops

For analog control — a tank level loop, a heater temperature, a flow rate — the PLC reads a 4–20 mA signal, runs a PID block, and writes back a 4–20 mA output to a valve positioner. Tuning matters more than people admit. A poorly tuned loop oscillates, wears out the valve, and consumes energy. We've seen plants run with proportional gain at default factory settings for years, accepting the oscillation as "normal." It isn't.

Installation, Wiring, and Troubleshooting

Installation Best Practice

The IEEE 518 guide on noise immunity gives the foundation. Keep PLC signal wiring at least 300 mm from power cables above 480 V. Use shielded cable for analog signals, ground the shield at one end only — typically the PLC end. Twisted pair for differential analog reduces common-mode noise by 40 dB or more.

For panel layout, follow NEMA ICS 1.1: low-voltage logic at the top, control voltage in the middle, power at the bottom. Heat rises; the PLC sits in cooler air. We've seen panels with the PLC mounted directly above a 30 kW VFD — the CPU lasted six months before thermal failures started.

Common Field Faults

The three faults we see most often:

Ground loops on analog inputs. A 4–20 mA signal reads erratic numbers — sometimes negative, sometimes pegged high. Cause: shield grounded at both ends, creating a circulating current. Fix: lift one end of the shield.

Output module failure on inductive loads. Relay outputs welding shut, transistor outputs going short. Cause: missing flyback diode on DC coils, missing RC snubber on AC coils. The contactor coil generates a 600 V spike on de-energize that destroys output stages.

Scan-time overruns. The PLC throws a watchdog fault. Cause: someone added a long FOR loop or a complex string operation in a high-priority task. Fix: move it to a lower-priority cyclic task or break it across multiple scans.

Watchdog timer is defined as a hardware-based supervisory circuit that resets the CPU if the scan cycle fails to complete within a preset time, typically 100–500 ms (per IEC 61131-2 §6.3.5).
Key takeaway: 80% of PLC field failures trace to wiring, grounding, or environmental issues — not the PLC itself. Always inspect the panel before suspecting the controller.

PLC Selection Criteria for Procurement

When specifying a PLC for purchase, six criteria drive the decision:

I/O count and growth margin (target 40% spare), scan time requirements (motion control demands sub-millisecond, batch process tolerates 50 ms), communication protocol support (PROFINET, EtherNet/IP, Modbus TCP, OPC UA), required IEC 61131-3 languages, environmental rating (IP20 for cabinet mount versus IP67 for distributed I/O), and lifecycle status — never specify a CPU that the manufacturer has placed on phase-out notice.

In our experience, the cheapest PLC at purchase is rarely the cheapest over a 15-year plant lifecycle. Spare parts availability, programming software licensing, and integrator familiarity all factor in. A plant standardized on Siemens that buys one Allen-Bradley unit because it was 12% cheaper now needs two software licenses, two sets of spare modules, and an electrician who can read both.

Related Reading

Ready to Source Programmable Logic Controller?

Frequently Asked Questions

What is the difference between a PLC and a microcontroller?

A PLC is a packaged industrial controller with isolated I/O, ruggedized housing, deterministic scan cycle, and certification to IEC 61131-2. A microcontroller is a bare chip — you supply the power conditioning, isolation, software framework, and environmental protection. PLCs are designed for 15-to-20-year plant deployments; microcontrollers suit OEM products where you control the entire enclosure design.

How long does a typical PLC scan cycle take?

For compact PLCs running modest ladder programs, scan times of 1–5 ms are typical. Modular mid-range PLCs handling thousands of rungs see 10–30 ms. High-end rack systems with optimization can hit sub-millisecond scans for motion tasks. The actual figure depends on program size, instruction mix, and communication load — always measure under worst-case conditions.

Which programming language should I use for a new PLC project?

Use Ladder Diagram for discrete logic, interlocks, and anything maintenance staff will troubleshoot live. Use Function Block Diagram for analog loops and process control. Use Structured Text for math, recipes, and complex sequencing. Most modern projects mix all three. The dedicated guide on PLC system components covers how language choice interacts with CPU selection.

Can a standard PLC be used for safety functions?

No, not for functions requiring SIL 1 or higher per IEC 61508. Safety functions — emergency stops, light curtains, two-hand controls, safe torque off — must use a certified safety PLC or a dedicated safety relay. Standard PLCs lack the redundant architecture, diverse processors, and certified function blocks required. Audit findings on this point are common and expensive to remediate.

What causes a PLC output module to fail?

The most common cause is switching inductive loads without proper suppression. DC coils need a flyback diode across the coil; AC coils need an RC snubber or MOV. Without suppression, the de-energization spike — often 5 to 10 times the supply voltage — destroys relay contacts or transistor junctions. Other causes include exceeding rated current, ambient temperature above the module spec, and short-circuits from damaged field wiring.

How much spare I/O capacity should I specify?

Plan for 40% spare on every module type — digital inputs, digital outputs, analog inputs, analog outputs. Also leave one or two free slots in modular racks for future module additions. Every retrofit project we've delivered has expanded by at least 25% during commissioning as scope creeps. Specifying tight to current requirements guarantees a chassis swap within three years.

Conclusion

The PLC sits at the heart of every modern industrial process. It reads sensors, runs deterministic logic, drives actuators, and reports state to higher-level systems. Specifying one well requires understanding scan cycles, I/O sizing, language support, and the standards that govern installation — IEC 61131 for the controller itself, IEC 60947 for the switchgear it commands, IEEE 518 for noise immunity, and NEMA ICS 1 for panel layout.

Get those right and a PLC will run for fifteen years with nothing more than periodic battery changes and firmware updates. Get them wrong and you'll be chasing nuisance trips, failed outputs, and watchdog faults until you replace the system. For the full selection methodology including sizing worksheets, brand comparison, and commissioning checklists, see the parent Programmable Logic Controller Guide: Selection, Application, and Maintenance for Engineers.

Comments (0)

    Leave a comment