PLC PID Instruction: 7 Practical Setup Steps That Work Well

Share:
PLC
PLC PID Instruction: 7 Practical Setup Steps That Work Well

A control loop in a PLC is only as good as the block that runs it, the timing behind it and the values you feed it. Getting setup, scaling and sample time right gives smooth, stable control without endless trial and error.

PID Compact Cyclic Interrupt Sample Time Auto Tuning

Modern PLCs ship with ready made PID blocks that handle scaling, anti windup and tuning for you. This guide explains how those blocks work and how to configure them correctly on real plants.

Hello everyone, today we are going to learn how a PLC PID instruction works, how to set up PID Compact in TIA Portal and how to calculate the P and I terms by hand.

What Is a PLC PID Instruction?

A PLC PID instruction is a ready made function block that reads a process value, compares it with a setpoint and calculates an output using proportional, integral and derivative action. It saves you from writing the PID algorithm by hand in ladder or structured text.

Every major vendor provides one. Siemens offers PID Compact, PID 3Step and PID Temp, Rockwell offers PID and PIDE, and smaller brands include similar blocks in their instruction sets.

PID instruction block with process variable, setpoint and control variable in Studio 5000 ladder logic
Image credit: Control.com

SolisPLC explains that the Technology folder in TIA Portal groups these blocks under PID Control. Their worked example uses a pressure transmitter ranged 0 to 120 bar as the process value.

Siemens PID Block Types

PID Compact

Continuous controller with analog or PWM output.

Best for: flow, pressure and level loops
General
PID 3Step

Step controller for motorised valves with open and close outputs.

Best for: actuators without positioners
Valves
PID Temp

Heating and cooling controller with two outputs.

Best for: extruders and furnaces
Thermal

Pick the block by the type of final element. A positioner valve or VFD suits PID Compact, while a raise and lower actuator needs PID 3Step.

Why Timing Matters

The block must run at a fixed, known interval, not in the free running main cycle. The normal PLC scan cycle varies with logic load, which would distort integral and derivative action.

SolisPLC notes that TIA Portal places the block inside a cyclic interrupt OB, which defaults to 100 ms. Fast flow loops may need a shorter interval, while slow temperature loops can run every second or more.

Loop TypeTypical Sample TimeNotes
Flow50 to 100 msFast, noisy signal
Pressure100 to 200 msDepends on volume
Level0.5 to 1 sIntegrating process
Temperature1 to 5 sSlow, large lag

7 Practical PLC PID Instruction Setup Steps

1
Add a Cyclic Interrupt OB
Set the interval to suit the loop speed.
2
Insert the Block
Drag PID Compact from Technology into the OB.
3
Select Controller Type
Choose units such as bar, percent or degrees.
4
Scale the Input
Map raw counts to engineering units.
5
Set Limits
Define process value and output limits.
6
Run Pretuning
Let the auto tune step the output safely.
7
Fine Tune
Adjust gain and integral time on the trend.

Input scaling is the most common source of errors. Our guide to analog scaling from raw counts shows how 0 to 27648 maps to a real range.

Check wiring and signal health first, as covered in PLC analog input basics. A noisy input will make any tuning look poor.

Key Parameters Explained

SetpointTarget value in engineering units
InputScaled process value from the transmitter
GainProportional action strength
Integral TimeRemoves steady offset over time
Derivative TimeReacts to rate of change
OutputPercent command to the valve or drive

The meaning of each term is explained in PID tuning parameters. Some vendors use gain, others use proportional band, so always check units.

P and I Term Formula

P term = Kc × Error
I change per sample = Kc × Error × Ts ÷ Ti
Proportional band = 100 ÷ Kc

Example:
Kc = 2, Error = 5 percent, Ts = 0.1 s, Ti = 10 s
P term = 2 × 5 = 10 percent
I change = 2 × 5 × 0.1 ÷ 10 = 0.1 percent per sample
Proportional band = 50 percent, 6 repeats per minute

Repeats per minute equals 60 divided by integral time in seconds. It is the unit many older controllers and some DCS faceplates use.

PID Term Calculator

P and I Contribution
Result
P term 10.00 percent, I adds 0.100 percent per sample, PB 50.0 percent, 6.00 repeats per minute

A negative error drives the output down for a direct acting loop. Reverse acting loops flip the sign, so set the action correctly in the block.

Tuning the Loop

Built in pretuning and fine tuning work well for most loops. For manual methods, see our PID tuning guide and how to tune a PID controller.

Relay feedback and step tests are the basis of most auto tuners, as described in auto tune methods. Always tune with the process near its normal operating point.

Advantages
  • Ready made, tested algorithm.
  • Built in anti windup and limits.
  • Auto tuning and commissioning screens.
  • Manual mode and bumpless transfer.
Limitations
  • Needs a fixed interrupt interval.
  • Vendor units and names differ.
  • Poor scaling breaks the loop.
  • Auto tune can upset sensitive processes.

Common Applications

Pressure Control
Pump VFD speed holds header pressure.
Tank Level
Inlet valve keeps level at setpoint.
Temperature
Heater output tracks a furnace setpoint.
Cascade Loops
Outer loop sets inner loop setpoint.

For two loops working together, read what is cascade control. How you call a PLC PID instruction also depends on the programming language you use.

Siemens PID Compact Manual PDF

PDF
PID Control With PID Compact, S7 1200 and S7 1500
Siemens application example with configuration and commissioning

PID Compact Step by Step Video

PLC PID Instruction FAQ

What does a PLC PID instruction do?
It reads the process value, compares it with the setpoint and calculates an output. The result drives a valve, heater or drive to hold the process steady.
Why use a cyclic interrupt OB?
The block needs a constant sample time for integral and derivative action to be correct. The free running main cycle changes length with logic load.
What is the default cyclic interrupt time?
SolisPLC reports that TIA Portal creates the cyclic interrupt OB with a 100 ms interval. You can change it to suit fast or slow loops.
When should I use PID 3Step?
Use it when the valve actuator only has open and close commands without a positioner. It pulses the outputs to move the valve toward the target.
What is proportional band?
Proportional band is 100 divided by the gain, in percent. A gain of 2 therefore equals a proportional band of 50 percent.
Why does my loop oscillate?
The gain may be too high or the integral time too short for the process. Poor scaling and noisy inputs can also cause cycling.
Is auto tuning safe?
It is usually safe when limits are set and the process is stable near normal conditions. Operators should watch closely and stop it if values move too far.

Related Articles

External References

What We Learn Today

  • A PLC PID instruction runs inside a fixed time cyclic interrupt.
  • Correct scaling and limits matter as much as tuning.
  • Gain, integral time and proportional band convert with simple formulas.
I hope you like above blog. There is no cost associated in sharing the article in your social media. Thanks for reading!! Happy Learning!!

Leave a Reply

Your email address will not be published. Required fields are marked *