Controller Forms, Units, and Sample Time

Use this reference when moving a tune between controllers. The integral lesson and derivative lesson explain the terms through experiments; this page focuses on interpreting their parameters.

Independent gains and gain-and-time parameters

This site uses independent Kp, Ki, and Kd. With temperature in °C, time in seconds, and CV in percent output, the heating-direction form is:

CV = Kp × error + Ki × accumulated error − Kd × rate of change of PV, before the output limits.

Another form factors out Kp and uses an integral time Ti and derivative time Td. For matching signal units, time units, and derivative placement, Ki = Kp / Ti and Kd = Kp × Td. Thus Ti = Kp / Ki and Td = Kd / Kp, when those divisions are defined.

Try Kp = 2% output per °C, Ki = 0.1% output per (°C·s), and Kd = 0.5% output·s per °C. Inspect Ti and Td, then halve Ki while keeping Kp fixed. Also try Ki = 0 and Kp = 0 to see why those cases need explicit handling.

On this site, Ki = 0 disables integral action. A time-parameter controller may have a different disable convention; entering a zero integral time is not the same mathematical operation as entering zero Ki.

Seconds, minutes, and per-scan coefficients

For the starting values, Ti is 20 s, or about 0.333 min, and Td is 0.25 s. Copying 20 into a field expecting minutes would create a different controller. Read the units beside each parameter.

This site's integral update uses Ki × error × Δt, with Δt in seconds. Its derivative uses −Kd × change in PV / Δt. The table shows the corresponding per-scan multipliers for the chosen interval; those multipliers are not the continuous gains themselves.

For a 100 ms interval, Δt = 0.1 s. Changing to 1 s changes the per-scan multipliers even if Kp, Ki, and Kd retain their continuous-time meanings. A controller must use the correct elapsed time; simply copying a per-scan coefficient into a differently timed loop changes the action.

Compare execution intervals on one physical process

The process starts at 30 °C and targets 60 °C, with 4 s lag, 1.5 s dead time, and 0–100% output. The gains stay fixed at P = 0.4% output per °C, I = 0.1% output per (°C·s), D = 0.

Run the 100 ms controller for 90 simulated seconds and save the trace. Restart, select a longer Controller interval, and run again. Predict what happens while the actuator holds its last command between controller executions.

The physical model always integrates in 100 ms steps here. Only the controller update interval changes: CV is held between updates. Simulator speed changes display playback, so it is a separate control.

Longer intervals can change the measured response even when gains are expressed per second. Keeping the time units correct does not guarantee that a coarse execution interval is suitable for the process. Compare the peak, settling, and held output steps in your finished runs.

Observed comparison after running

With the stated tune, a 100 ms interval gives a peak near 60.5 °C. At 1000 ms it is about 63.4 °C, and at 5000 ms about 77.6 °C. The physical lag and dead time did not change; the controller held each command for longer.

For a concrete comparison, the CODESYS Util PID documentation uses KP, TN, and TV, with TN and TV in seconds. It specifies TN greater than zero for calculation and applies D to error, whereas this site applies D to measurement. Matching gain coefficients therefore does not guarantee identical setpoint-change behavior.

The CODESYS PID_FIXCYCLE documentation defines CYCLE in seconds between calls. Check the exact block version, action, signal scaling, derivative/filter behavior, time units, and actual execution period before transferring a tune. Proportional-band settings also need their stated PV and output scaling before conversion.

Enable JavaScript to run the embedded simulator and complete the interactive exercises.