Manufacturing Automation

Chapter 4
Industrial Control and PLC Programming

Bachelors Program in Machine Technology
Manufacturing Automation   •   Bachelor

Industrial Control and PLC Programming

Introduction

Manufacturing systems convert raw material into products through coordinated mechanical, electrical, hydraulic, pneumatic, and software operations. Industrial control provides the logic that coordinates these operations, maintains process variables, protects people and equipment, and records production information. A programmable logic controller (PLC) is the dominant control platform for discrete manufacturing because it is deterministic, rugged, maintainable, and designed for industrial input/output (I/O).

This chapter develops the principles required to analyse and implement industrial control systems. It links control theory with Boolean logic, sequence models, IEC 61131-3 programming languages, timers, counters, interlocks, proportional–integral–derivative (PID) control, and fault diagnostics.

Learning Objectives

After studying this chapter, the student should be able to:

  1. Distinguish open-loop, closed-loop, feedback, feedforward, and sequence control.
  2. Represent machine logic using Boolean expressions, relay logic, and state models.
  3. Explain PLC architecture and scan-cycle operation.
  4. Develop PLC programs using IEC 61131-3 languages.
  5. Apply timers, counters, permissives, interlocks, alarms, and safe-stop principles.
  6. Select and configure basic PID control for continuous processes.
  7. Diagnose faults systematically and evaluate control-system performance.

1. Industrial Control Fundamentals

An industrial control system contains a process, sensors, a controller, and actuators. The process is the physical operation: for example, conveying, drilling, heating, filling, or assembling. Sensors measure conditions such as position, temperature, pressure, speed, or presence. The controller evaluates these signals and issues commands. Actuators—motors, valves, cylinders, heaters, and drives—change the process.

Open-loop and closed-loop control

In open-loop control, the controller acts without measuring the result. A conveyor may run for 10 seconds whenever a start command is received. The method is simple, but it assumes that speed, load, and timing remain sufficiently constant.

Closed-loop control measures the controlled variable and compares it with a desired reference (setpoint). The difference is the error:

e(t) = r(t) − y(t)

Here, r(t) is the reference, y(t) is the measured output, and e(t) is the error. All three must represent compatible quantities and units. Feedback is useful when disturbances or changing loads affect the process, but it adds sensors, tuning requirements, failure modes, and possible instability.

A feedforward controller anticipates the effect of a measured disturbance and compensates before the output changes. In practice, feedforward and feedback are often combined: feedforward handles predictable disturbances, while feedback corrects modelling errors and unknown disturbances.

Sequence control

Sequence control directs a machine through ordered steps rather than continuously regulating one process variable. A packaging machine may execute: home axis → load container → fill → cap → inspect → discharge. Each transition should have a defined condition, and abnormal conditions should lead to a safe state rather than an undefined state.

A useful distinction is:

Control typeMain questionTypical example
Open loopWhat command should be issued?Run a motor for a fixed time
Closed loopHow far is the output from the setpoint?Maintain temperature
Sequence controlWhich operation is active next?Filling cycle
Interlock controlIs operation permitted?Prevent a door-open start
Supervisory controlWhat is the overall operating condition?Production monitoring and alarms

2. Boolean Logic and Industrial Interlocks

PLC logic commonly uses binary variables: TRUE/FALSE, 1/0, energized/de-energized, or present/absent. The fundamental operations are AND, OR, and NOT.

For Boolean variables A and B:

  • AND is true only when both A and B are true: Y = A · B.
  • OR is true when at least one input is true: Y = A + B.
  • NOT reverses a value: Y = ¬A.

The symbols above are logical notation, not ordinary arithmetic. De Morgan’s laws are particularly important when converting normally closed contacts and safety conditions:

¬(A · B) = ¬A + ¬B
¬(A + B) = ¬A · ¬B

A motor-start command might require a start request, a safety circuit, an overload-free condition, and a permissive from the upstream machine:

Run = Start · SafetyOK · ¬Overload · UpstreamReady

A seal-in or holding circuit allows a motor to remain enabled after the momentary start button is released. In software, this is normally implemented with a commanded state and explicit reset logic rather than relying on hidden physical assumptions.

Interlocks, permissives, and inhibits

A permissive is a condition that must be true before an operation can begin. An interlock prevents an unsafe or damaging combination of actions. An inhibit suppresses an operation under a specified condition, such as disabling automatic mode during maintenance.

Good interlock design follows four principles:

  1. State the hazard or failure being prevented.
  2. Use independent and credible signals where the risk requires them.
  3. Define what happens when a sensor, wire, or communication link fails.
  4. Provide a clear reset procedure; never allow an automatic restart after a hazardous stop unless the risk assessment explicitly permits it.

A standard PLC program must not be treated as a substitute for a safety-rated emergency-stop system. Emergency stops, guard monitoring, and other safety functions should use appropriate safety relays or safety PLCs designed and validated for the required performance level or safety integrity level.

3. PLC Architecture and Scan Cycle

A PLC generally contains a processor, memory, power supply, communication interfaces, input modules, and output modules. Inputs may be digital or analogue. Outputs may be transistor, relay, triac, analogue, or network-based. Signal conditioning and electrical isolation protect the processor from industrial voltage and noise.

During a normal cyclic scan, the controller:

  1. Reads physical inputs into an input image or process image.
  2. Executes the user program.
  3. Updates physical outputs from the output image.
  4. Performs communication, diagnostics, and operating-system tasks.
  5. Repeats the cycle.

The scan time is the elapsed time for one complete cycle. A short scan time supports rapid response, but response also depends on input filtering, output hardware, task priorities, network delays, and program structure. A brief sensor pulse may be missed if it is shorter than the input update interval; high-speed counters or interrupt tasks may be required.

A PLC program should be deterministic: the same input and internal state should produce the same result under the same execution conditions. Excessive communication, unbounded loops, poorly structured state logic, and very long routines can compromise predictable operation.

4. IEC 61131-3 Programming Languages

IEC 61131-3 defines commonly used PLC programming approaches. Modern implementations may not support every language equally, but the conceptual division remains valuable.

LanguageStrengthSuitable use
Ladder Diagram (LD)Visual relay-style logicInterlocks, discrete machine control
Function Block Diagram (FBD)Graphical function compositionAnalogue control, drives, reusable blocks
Structured Text (ST)Textual, expressive, algorithmicCalculations, loops, data handling, state machines
Sequential Function Chart (SFC)Steps and transitionsOrdered sequences and recipes
Instruction List (IL)Compact low-level notationLegacy systems; generally discouraged for new work

IEC 61131-3 also supports program organisation units: programs, function blocks, and functions. A function normally has no retained internal state beyond its inputs and outputs, whereas a function block can retain state, such as a timer’s elapsed time or a motor-control block’s operating status. Exact data types and library names vary by PLC manufacturer, so implementation must be checked against the target platform’s documentation.

Ladder logic example

A simplified motor rung can be described textually as:

|--[ Start ]--+--[ SafetyOK ]--[/ Overload ]----( Motor )--|
|             |
|             +--[ Motor ]----------------------|

The parallel Motor contact provides the holding path. In a production program, the logic should also distinguish a start request from a maintained run command, implement a defined stop priority, and provide status and fault feedback.

Structured Text example

IF StopRequest OR NOT SafetyOK OR Overload THEN
    MotorCommand := FALSE;
ELSIF StartRequest AND UpstreamReady THEN
    MotorCommand := TRUE;
END_IF;

This example gives stop and safety conditions priority. It does not by itself constitute a safety function, and it assumes that the relevant signals have been validated and mapped correctly.

5. Timers, Counters, and Edge Detection

Timers convert time conditions into control decisions. Common timer behaviours include:

  • On-delay (TON): output becomes true after the input remains true for a preset time.
  • Off-delay (TOF): output remains true for a preset time after the input becomes false.
  • Pulse timer (TP): output remains true for a defined pulse duration.

Timer accuracy depends on task scheduling, timer resolution, implementation, and scan behaviour. A timer preset is not a guarantee of exact physical motion time; it should not replace a position sensor where position is safety- or quality-critical.

Counters increment or decrement when valid events occur. A robust counter must address rising-edge detection, reset behaviour, maximum range, and what happens if pulses arrive faster than the PLC can process them. For example, a product counter should increment on a one-shot rising edge of the inspection signal, not on every scan while the product remains present.

A rising-edge detector can be expressed conceptually as:

RisingEdge := CurrentSignal AND NOT PreviousSignal;
PreviousSignal := CurrentSignal;

The assignment order and storage behaviour matter. The previous value must persist from one scan to the next.

6. State Models and Sequential Machines

A state model represents a machine as a finite set of operating states and transitions. A state defines what outputs are active; a transition defines the condition for leaving that state. A practical state model should include normal, stopping, fault, reset, and maintenance-related states where appropriate.

Example states for an automated press are:

  • Idle: waiting for a valid start.
  • Clamp: clamp actuator commanded until clamp-confirmed is true.
  • Press: press moves down while pressure and position limits remain valid.
  • Retract: press returns to its home position.
  • Complete: cycle result is recorded and the system returns to Idle.
  • Fault: all hazardous motion is removed and diagnostic information is retained.

Only one principal state should control the sequence at a time unless simultaneous activities are deliberately modelled. State transitions should be mutually understandable and testable. A transition based solely on a timer may be acceptable for a noncritical delay, but a physical confirmation is preferable for motion completion.

Sequential Function Chart is well suited to such processes, while Structured Text is useful when states are represented by an enumerated variable and a CASE statement. A state-machine implementation should prevent impossible transitions, define power-up behaviour, and record the reason for a fault.

7. PID Control for Continuous Processes

PID control is used when a process variable must track a setpoint continuously. The ideal continuous-time controller is:

u(t) = Kp e(t) + Ki ∫₀ᵗ e(τ)dτ + Kd de(t)/dt

where u(t) is the controller output, e(t) is setpoint minus measurement, Kp is proportional gain, Ki is integral gain, and Kd is derivative gain. The output and gains must be selected consistently with the engineering units and actuator limits.

The proportional term responds to present error. Integral action accumulates error and can eliminate steady-state offset, but it can cause overshoot and integral windup when the actuator saturates. Derivative action responds to the rate of change of error and may improve damping, but it amplifies measurement noise. Industrial controllers frequently apply derivative action to the measurement, filter it, and include anti-windup logic.

For a digital controller with sample interval Ts, a simple positional approximation is:

uk = Kp ek + Ki Ts ∑i=0k ei + Kd (ek − ek−1)/Ts

Here, subscript k denotes the current sample. This approximation assumes a sufficiently regular sampling interval and requires output limiting, integral management, and suitable filtering in real applications. Many PLC PID function blocks use different parameter conventions—for example, integral time rather than integral gain—so the vendor definition must be verified before commissioning.

A practical tuning procedure is to identify the process response, establish safe output limits, begin with proportional action, add integral action gradually, and add derivative action only when justified by process dynamics and signal quality. Tuning should be performed with the machine in a controlled condition and with independent overtemperature, overpressure, or travel protection active.

8. Fault Diagnostics and Maintenance

Control quality includes the ability to detect and explain faults. A fault diagnostic system should distinguish:

  • Sensor fault: signal out of range, contradictory, missing, or stuck.
  • Actuator fault: command present but expected feedback absent.
  • Sequence fault: a step exceeds its permitted time.
  • Communication fault: a remote station or drive stops responding.
  • Process fault: pressure, temperature, or position violates a limit.
  • Safety fault: a guard, emergency stop, or safety controller reports a trip.

A useful alarm contains the equipment tag, condition, time, severity, operator response, and reset requirement. Alarm floods reduce the value of alarms; related symptoms should be suppressed or prioritised so that the initiating fault is visible.

A systematic diagnostic method is:

  1. Make the equipment safe and follow isolation procedures.
  2. Identify the first credible fault, not merely the latest alarm.
  3. Compare command, output status, feedback, and expected timing.
  4. Check power, wiring, I/O status, communication, and mechanical conditions.
  5. Correct the cause, reset under controlled conditions, and verify normal operation.
  6. Record the event and update preventive measures if recurrence is likely.

For maintainability, use meaningful tag names, modular function blocks, comments that explain purpose rather than syntax, version control, change approval, and a tested backup of the PLC program. Online edits should be controlled because a seemingly minor logic change can alter machine risk.

9. Applied Case: Automated Parts-Press Cell

Background

The following is an illustrative case. A pneumatic press installs a bearing into a housing. The cell contains a two-hand start station, a guard switch, a part-present sensor, clamp and press solenoid valves, home and extended position sensors, and a pressure switch.

Problem

The original machine used fixed timers. Variations in air pressure caused incomplete pressing, and an operator could restart the cycle before the previous part had been removed. Maintenance staff also received only a generic “cycle fault” message.

Analysis

The process requires both sequence control and interlocking. A timer cannot reliably confirm that the press reached position. The cell must verify part presence, guard closure, clamp confirmation, press extension, adequate pressure, and retraction. It must also detect timeout conditions and prevent a second start while the cycle is active.

Approach and solution

The redesigned sequence uses the states Idle, Clamp, Press, Verify, Retract, Complete, and Fault. In Idle, the start request is accepted only if the guard is closed, the emergency-stop circuit is healthy, the part is present, the press is home, and no fault is latched. In Clamp, the clamp valve is energised and a clamp-confirmed sensor must respond within a specified time. In Press, the press valve is energised; the controller waits for the extended sensor and adequate pressure. Failure of either condition causes Fault. Verify checks the pressing result and records a pass or fail. Retract continues until home is confirmed. Complete releases the part-present requirement and waits for removal before permitting another cycle.

The safety-rated circuit independently removes hazardous motion when the guard opens or the emergency stop is operated. The standard PLC receives status information for diagnostics but does not replace the safety system.

Outcome

The state-based design prevents premature restart, detects mechanical and pneumatic faults, and provides specific messages such as “Press extension timeout” or “Pressure not achieved.” Quality improves because completion is based on physical confirmation rather than elapsed time alone. Maintenance improves because the recorded state and fault cause direct troubleshooting.

Learning points

The case demonstrates that reliable automation combines Boolean permissives, state logic, feedback, time supervision, safety engineering, and diagnostic design. A PLC program is not merely a collection of output commands; it is an executable model of the machine’s permitted behaviour.

10. Professional Practice, Safety, and Contemporary Development

Industrial controllers are increasingly connected to drives, robots, manufacturing execution systems, and cloud or edge platforms. This connectivity can improve traceability and predictive maintenance, but it expands the attack surface. Network segmentation, least-privilege access, authenticated changes, secure backups, patch management, event logging, and controlled remote access are essential. Operational technology security must preserve availability and safety as well as confidentiality.

Artificial intelligence can assist with anomaly detection, predictive maintenance, vision inspection, and alarm analysis. It should not be granted uncontrolled authority over safety-critical motion. AI recommendations require validated data, explainable acceptance criteria, cybersecurity controls, and a defined human responsibility for decisions. A deterministic PLC safety function should remain independent of an unvalidated predictive model.

Relevant professional practice includes risk assessment, lockout/tagout or equivalent energy isolation, electrical standards, machine-guarding requirements, functional-safety validation, electromagnetic-compatibility considerations, and documented commissioning tests. Exact legal and regulatory requirements vary by jurisdiction; engineers must consult the applicable standards and authorities.

Chapter Summary

Industrial control combines sensing, decision-making, actuation, and supervision. Open-loop control is simple but cannot correct disturbances; closed-loop control uses feedback to reduce error. Sequence control is best represented through states and transitions, while Boolean logic expresses permissives, interlocks, and operating conditions.

PLCs execute programs cyclically and provide a practical platform for discrete and continuous automation. IEC 61131-3 languages support different types of reasoning: Ladder Diagram for relay-like logic, Function Block Diagram for function composition, Structured Text for algorithms, and Sequential Function Chart for sequences. Timers and counters must be designed with scan behaviour and edge detection in mind.

PID control regulates continuous variables, but tuning, sampling, saturation, noise, and anti-windup must be considered. Effective systems include fault diagnostics, clear alarms, safe-stop functions, documented changes, and systematic commissioning. The press-cell case shows how feedback, state models, interlocks, and diagnostics produce safer and more maintainable automation than timer-only logic.

Key Terms

PLC: Industrial computer that executes a control program and interfaces with sensors and actuators.

Open-loop control: Control without measuring the resulting output.

Closed-loop control: Control that uses feedback to compare output with a reference.

Feedback: Information about process output returned to the controller.

Setpoint: Desired value of a controlled variable.

Error: Difference between reference and measured output.

Sequence control: Control of ordered machine operations.

Boolean logic: Logic using binary values and operations such as AND, OR, and NOT.

Interlock: Condition that prevents an unsafe or impermissible operation.

Permissive: Condition required before an operation is allowed.

Scan cycle: Repeated PLC process of reading inputs, executing logic, and updating outputs.

Ladder Diagram: IEC 61131-3 graphical language resembling relay logic.

Structured Text: IEC 61131-3 textual programming language.

Timer: PLC function that generates a time-dependent condition.

Counter: PLC function that counts qualified events.

State machine: Model consisting of states and transition conditions.

PID controller: Controller using proportional, integral, and derivative actions.

Integral windup: Excessive accumulation of integral action during actuator saturation.

Fault diagnostic: Method for detecting, identifying, and reporting abnormal operation.

Safety function: Function designed and validated to reduce risk to an acceptable level.

Review Questions

Short Answer Questions

  1. What is the principal difference between open-loop and closed-loop control?
  2. Define a PLC scan cycle.
  3. What is the purpose of an interlock?
  4. Name three common IEC 61131-3 programming languages.
  5. What problem can integral windup cause in a PID controller?

Long Answer Questions

  1. Explain how Boolean logic is used to create a motor permissive and discuss why stop conditions should receive priority.
  2. Describe PLC architecture and explain how scan time can affect sensor and actuator response.
  3. Compare Ladder Diagram, Structured Text, Function Block Diagram, and Sequential Function Chart.
  4. Explain the operation and limitations of proportional, integral, and derivative control.
  5. Describe a systematic method for diagnosing a machine that commands a motor but receives no running feedback.

Analytical / Application Questions

  1. Design a state model for a conveyor-based drilling station. Identify at least six states, their outputs, transition conditions, and fault states.
  2. A heating process reaches its setpoint but repeatedly overshoots. Analyse possible proportional, integral, derivative, sensor, and actuator causes, and propose a safe tuning plan.
  3. Develop the permissive and diagnostic strategy for a pneumatic press with guard monitoring, part detection, clamp confirmation, pressure confirmation, and home-position feedback. Explain which functions must be safety-rated independently of the standard PLC program.

Multiple Choice Questions with Answers

Question 1

Which control approach measures the process output and compares it with a desired reference?

A. Open-loop control

B. Closed-loop control

C. Manual control only

D. Sequence control without sensors

Correct Answer: B. Closed-loop control

Question 2

Which Boolean condition is true only when both A and B are true?

A. A + B

B. ¬A

C. A · B

D. A XOR B

Correct Answer: C. A · B

Question 3

What is the normal first major action in a PLC scan cycle?

A. Reading the input image

B. Printing an alarm report

C. Tuning the PID controller

D. Changing the PLC program

Correct Answer: A. Reading the input image

Question 4

Which IEC 61131-3 language is most directly suited to ordered steps and transitions?

A. Sequential Function Chart

B. Instruction List only

C. Assembly language

D. Spreadsheet formulas

Correct Answer: A. Sequential Function Chart

Question 5

What is the principal purpose of a rising-edge detector?

A. To keep a signal permanently TRUE

B. To detect a transition from FALSE to TRUE

C. To filter all analogue noise

D. To convert temperature into pressure

Correct Answer: B. To detect a transition from FALSE to TRUE

Question 6

Which PID term accumulates error over time and can eliminate steady-state offset?

A. Proportional

B. Integral

C. Derivative

D. Feedforward only

Correct Answer: B. Integral

Question 7

Why is a physical position sensor generally preferable to a timer for confirming motion completion?

A. It confirms the actual machine condition

B. It always reduces scan time to zero

C. It eliminates the need for safety circuits

D. It prevents all mechanical failures

Correct Answer: A. It confirms the actual machine condition

Question 8

What should a well-designed fault message identify?

A. Only that the PLC is powered

B. The equipment, condition, severity, and response or reset requirement

C. A random numerical code with no context

D. Only the operator’s name

Correct Answer: B. The equipment, condition, severity, and response or reset requirement

Question 9

Which condition is an example of a permissive for starting a press cycle?

A. Guard closed and safety circuit healthy

B. Known communication failure

C. Press already in an unverified position

D. Active emergency stop

Correct Answer: A. Guard closed and safety circuit healthy

Question 10

What is a major risk of excessive integral action when an actuator is saturated?

A. Integral windup and overshoot

B. Loss of all Boolean operations

C. Automatic elimination of feedback

D. Guaranteed zero error without transients

Correct Answer: A. Integral windup and overshoot

Manufacturing Automation
Chapter 4 of 15