pull down to refresh

A PLC (Programmable Logic Controller) is a rugged industrial computer that
repeatedly answers one question:

Given the machine’s inputs right now, what should its outputs be?

It is used instead of wiring every control decision permanently with relays.
The field wiring still carries the real signals, but the behavior can be
changed, diagnosed and expanded in software.

The three main partsThe three main parts

  1. Inputs tell the PLC what is happening.
    Examples: pushbuttons, limit switches, photoelectric sensors, motor overload
    contacts, pressure switches, 4–20 mA temperature transmitters and encoder
    pulses.
  2. The CPU and program apply rules to those input values.
    The program may use contacts/coils in Ladder Diagram, function blocks,
    Structured Text, timers, counters, arithmetic and state machines.
  3. Outputs make something happen.
    Examples: contactor coils, solenoid valves, indicator lamps, alarms, analog
    speed references and commands sent to a VFD or robot.

What happens during one scanWhat happens during one scan

A normal PLC repeats a scan in milliseconds:

read inputs → execute program → update outputs → diagnostics/comms → repeat

For example, Siemens documents that its S7-1200 writes the output process
image, reads the physical inputs into an input process image, and then executes
the user program in order. Using an input image gives the program a consistent
snapshot during that scan:

https://cache.industry.siemens.com/dl/files/593/109741593/att_895681/v1/s71200_system_manual_en-US_en-US.pdf

Simple industrial example: filling a tankSimple industrial example: filling a tank

Inputs:

StartPB          operator requests automatic operation
LowLevel         tank needs more liquid
HighLevel        tank is full
MotorOverloadOK  pump protection has not tripped
EStopOK          safety circuit is healthy

Output:

PumpContactor    starts the filling pump

Plain-language logic:

Run the pump when automatic mode is requested and the level is low.
Keep it running until the high-level switch is reached.
Stop immediately on overload, emergency stop or sensor contradiction.

Equivalent simplified Structured Text:

IF NOT EStopOK OR NOT MotorOverloadOK OR (LowLevel AND HighLevel) THEN
    PumpRun := FALSE;
    Fault := TRUE;
ELSIF StartPB AND LowLevel THEN
    PumpRun := TRUE;
ELSIF HighLevel THEN
    PumpRun := FALSE;
END_IF;

PumpContactor := PumpRun AND NOT Fault;

The important engineering detail is that a PLC is not magic and software is not
the whole control system. Sensors must be selected and wired correctly, outputs
need suitable interposing relays/contactors, failures need defined safe states,
and emergency-stop functions normally require safety-rated hardware or a safety
PLC.

That combination—repeatable logic, industrial I/O, diagnostics and safe
interfacing—is why PLCs are used for conveyors, packaging lines, pumps, ovens,
compressors, traffic systems and process plants.