ceo@instrumentationblog.in
PLC · How It Works

How PLC PID Loop Control Works

Change the gain, the integral time and the loop update time. Watch the PID instruction execute on each update, see the output move in steps and check how the process value follows the setpoint changes.

Live animationAdjustable slidersFormula and example

Quick answer: A PLC runs its PID instruction at a fixed loop update time, not continuously. On every update it reads the scaled process value, calculates the error and changes the analog output by a P step and an I step, so the output trend is a staircase.

What Is a PLC PID Loop Control?

Most PLCs offer a PID instruction or function block that turns a scaled analog input into an analog output. The block itself is standard, but how often it runs and how it is scaled decide how well the loop performs.

The PID block is executed in a timed task or a cyclic interrupt at the loop update time, often called the sample time. Between updates the output is held, so a long update time adds delay to the loop.

Many PLC PID blocks use the velocity form, which calculates a change in output on each update. That form gives bumpless transfer between manual and auto and stops integral windup at the output limits.

Advertisement

How PLC PID Loop Control Works: Interactive Animation

Numbered markers match the parts list below.
P step for a 10 % error step (Kc × Δe)…
I step per update for a 10 % error (Kc × e × Δt ÷ Ti)…
Updates per second and I ramp per second…
Live SP, PV and CV (simulated)…
  1. 1Analog input card: 4 to 20 mA to PV in %
  2. 2Timed task clock: loop update time
  3. 3PID instruction with P and I terms
  4. 4Analog output card: CV to 4 to 20 mA
  5. 5Control valve
  6. 6Process and transmitter
  7. 7Trend: SP, PV and stepped CV

PLC PID Loop Control Working Principle Step by Step

  1. The analog input card converts the 4 to 20 mA signal to a raw count, and the program scales it to the process value in percent or engineering units.
  2. A timed task starts the PID instruction once every loop update time Δt, independent of the main scan.
  3. The block calculates the error e = SP − PV for direct or reverse action as configured.
  4. It adds a proportional step Kc × (e − previous e) and an integral step Kc × e × Δt ÷ Ti to the output, and clamps the result to the output limits.
  5. The new output is scaled to the analog output card, which drives the valve with 4 to 20 mA until the next update.

PLC PID Loop Control Labelled Diagram

Labelled diagram showing how plc pid loop control works
Numbered parts: 1 analog input card: 4 to 20 ma to pv in %; 2 timed task clock: loop update time; 3 pid instruction with p and i terms; 4 analog output card: cv to 4 to 20 ma; 5 control valve; 6 process and transmitter; 7 trend: sp, pv and stepped cv.
Advertisement

PLC PID Loop Control Formula

Velocity form: ΔCV = Kc × [(eₙ − eₙ₋₁) + (Δt ÷ Ti) × eₙ], then CVₙ = CVₙ₋₁ + ΔCV
Position form: CVₙ = Kc × [eₙ + (Δt ÷ Ti) × Σe] + bias
Integral ramp for a constant error = Kc × e ÷ Ti per second, whatever the update time
Rule of thumb: keep Δt at or below one tenth of the process time constant and well below Ti
Example: Kc 1.5, Ti 10 s, Δt 0.5 s, error steps from 0 to 10 %: P step = 1.5 × 10 = 15.0 %, I step = 1.5 × 10 × 0.5 ÷ 10 = 0.75 % per update, so the first update moves CV by 15.75 % and the I ramp is 2 × 0.75 = 1.5 % per second

Main Parts of a PLC PID Loop Control

PartWhat it does
Analog input and scalingRaw counts scaled to PV in percent or engineering units, with a fault check for broken wire
Timed taskRuns the PID instruction at a fixed loop update time
PID instructionHolds gain, integral and derivative settings, action, limits and the manual and auto mode
Analog output and scalingConverts CV in percent to counts for the 4 to 20 mA output card
HMI faceplateLets the operator change SP, mode and manual output and view the trend

Where a PLC PID Loop Control Is Used

Pump speed controlDrive speed trims header pressure or flow in water systems.
Skid temperature controlHeater or steam valve loops on packaged units.
Tank level controlInlet or outlet valve holds a buffer tank level.
Dosing controlChemical pump stroke or speed follows a flow or analyser signal.

Advantages

  • Built into almost every PLC, with no separate controller to buy
  • Velocity form gives bumpless manual to auto transfer and simple anti windup
  • Loop logic, interlocks and alarms live in one program

Limitations

  • A long or irregular update time adds delay and makes the loop less stable
  • Scaling or action errors are easy to make and hard to see
  • Parameter units differ between blocks, so tuning values do not copy directly

PLC PID Loop Control Field Tips and Common Problems

  • Call the PID block from a timed task or cyclic interrupt, not the free running main scan, so Δt is constant.
  • Check the units of Ti: some blocks use seconds, some minutes and some repeats per minute.
  • Set the action correctly: reverse action for a valve that opens to raise the PV, direct action for one that opens to lower it.
  • Initialise the output from the valve position on start up so the loop goes to auto without a bump.
Advertisement

Related Calculators and Tools

Frequently Asked Questions

What is the loop update time in a PLC PID block?

It is the interval at which the PID instruction is executed and the output is recalculated. The block uses it in the integral and derivative terms, so it must match the real task time.

Why does the PLC output move in steps?

The block runs only once per update and holds the output in between. A short update time gives small, frequent steps that look smooth on the trend.

Does a longer update time change the integral action?

The integral ramp per second stays the same because each I step grows with Δt. The extra delay between updates still reduces the stability margin.

What is the difference between velocity and position form?

The position form calculates the full output on each update from the sum of all errors. The velocity form calculates only the change, which makes bumpless transfer and anti windup simpler.

You May Also Like

Learn more on the blog

PLC PID instruction configuration

A practical guide on instrumentationblog.in that goes deeper into this topic with field examples.

Read Full Article

More How It Works

All How It Works animations · Instrumentation glossary · Comparisons

Advertisement