pith. sign in

arxiv: 2604.15918 · v2 · submitted 2026-04-17 · 📡 eess.SY · cs.SY

A Practical Guide to PID Controller Implementation

Pith reviewed 2026-05-10 08:02 UTC · model grok-4.3

classification 📡 eess.SY cs.SY
keywords PID controllerpractical implementationpseudo-codeactuator saturationbumpless transfermeasurement noisesampling time variationanti-windup
0
0 comments X

The pith

A reference PID controller implementation accounts for actuator limits, noise, and bumpless transfer that break the basic formula.

A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.

The paper establishes that the core PID equation is computationally cheap and easy to write, yet fails in practice because of actuator saturation, sensor noise, mode switching, and irregular sampling. It supplies a single reference implementation in pseudo-code that folds in standard fixes for these problems along with explicit discussion of the design decisions. Carefully chosen simulations then illustrate the difference between the naive version and the reference version under realistic conditions. A reader who adopts this implementation can expect PID loops to start up, switch modes, and reject noise without ad-hoc patches.

Core claim

The authors supply a reference PID implementation, expressed in pseudo-code, that incorporates handling for actuator limitations, measurement noise, P/PI/PD/PID structures, bumpless transfer, and time-varying sampling. The code is accompanied by explanations of each implementation choice and is exercised on a set of simulation test cases chosen to expose the most common practical failure modes.

What carries the argument

The reference pseudo-code implementation that integrates anti-windup, noise filtering, structure selection, and bumpless-transfer logic into a single PID controller.

If this is right

  • Engineers obtain a ready-to-use PID structure that prevents integrator windup and mode bumps without separate logic.
  • The same code base supports P-only, PI, PD, and full PID forms by simple parameter selection.
  • Varying sampling intervals are accommodated without retuning or loss of stability margins.
  • Simulations demonstrate that the filtered version rejects measurement noise while preserving setpoint tracking.

Where Pith is reading between the lines

These are editorial extensions of the paper, not claims the author makes directly.

  • Adoption of this reference could reduce the frequency of custom PID patches that later cause maintenance problems.
  • The test-case set highlights failure modes that future controller benchmarks might usefully adopt as standard checks.
  • Extensions to multivariable or gain-scheduled PID would follow the same modular structure shown in the pseudo-code.

Load-bearing premise

The chosen set of practical issues, code structure, and test cases is representative enough that most real applications can use the reference with little or no extra customization.

What would settle it

A documented industrial or simulated case in which the supplied reference code produces instability, excessive actuator wear, or loss of performance that is directly traceable to an issue the paper left unaddressed.

Figures

Figures reproduced from arXiv: 2604.15918 by E. Sundstr\"om, J. L. Guzm\'an, K. Soltesz, M. Bauer, T. H\"agglund.

Figure 1
Figure 1. Figure 1: The basic control loop. The parameters of the PID controller in eq. (1) are controller gain K, integral time Ti , and derivative time Td. The equation for the PID controller can be written in several different forms. We have chosen the linear parameterisation of eq. (4), with parameters kp = K, ki = K/Ti , and kd = K Td, since it is more general in the sense that it allows for Ti = 0 in eq. (1) without cau… view at source ↗
Figure 2
Figure 2. Figure 2: : Approximations of the integral and the derivative. [PITH_FULL_IMAGE:figures/full_fig_p004_2.png] view at source ↗
Figure 3
Figure 3. Figure 3: Relationship between control error e(t) and control signal u(t) for a P￾controller. 7 [PITH_FULL_IMAGE:figures/full_fig_p007_3.png] view at source ↗
Figure 4
Figure 4. Figure 4: : Responses resulting from a step change in the setpoint. [PITH_FULL_IMAGE:figures/full_fig_p009_4.png] view at source ↗
Figure 5
Figure 5. Figure 5: : PID controller with feed-forward from load disturbance [PITH_FULL_IMAGE:figures/full_fig_p010_5.png] view at source ↗
Figure 6
Figure 6. Figure 6: : Switching between manual and automatic mode. [PITH_FULL_IMAGE:figures/full_fig_p015_6.png] view at source ↗
Figure 7
Figure 7. Figure 7: : Schematic overview of the combined-form PID controller. Block numbers [PITH_FULL_IMAGE:figures/full_fig_p018_7.png] view at source ↗
Figure 8
Figure 8. Figure 8: : Switching from manual to automatic mode in Example 6.1. [PITH_FULL_IMAGE:figures/full_fig_p026_8.png] view at source ↗
Figure 9
Figure 9. Figure 9: : Switching between PI- and P-control in Example 6.2. [PITH_FULL_IMAGE:figures/full_fig_p027_9.png] view at source ↗
Figure 10
Figure 10. Figure 10: : Rate limitation effect in Example 6.2 for [PITH_FULL_IMAGE:figures/full_fig_p028_10.png] view at source ↗
Figure 11
Figure 11. Figure 11: also shows the effect to the disturbance rejection for a step-like disturbance signal of amplitude 1 entering in the control signal at time t = 10. As expected, identical responses are obtained for any value of b, as the setpoint handling is decoupled of the disturbance rejection problem. For this example, the simulation code is not shown as it is the same code as used in listing 7 skipping the manual par… view at source ↗
Figure 12
Figure 12. Figure 12: : Feed-forward plus saturation in Example 6.4. [PITH_FULL_IMAGE:figures/full_fig_p031_12.png] view at source ↗
Figure 13
Figure 13. Figure 13: : Feed-forward plus saturation in Example 6.4 comparing anti-windup tech [PITH_FULL_IMAGE:figures/full_fig_p032_13.png] view at source ↗
Figure 14
Figure 14. Figure 14: Noise filtering in Example 6.5. 32 [PITH_FULL_IMAGE:figures/full_fig_p032_14.png] view at source ↗
Figure 15
Figure 15. Figure 15: : Gain scheduling control results for the tank level control problem in Example [PITH_FULL_IMAGE:figures/full_fig_p034_15.png] view at source ↗
Figure 16
Figure 16. Figure 16: Selector control scheme This structure is common for handling security constraints. One of the controllers is working in normal operation, but when a certain process variable becomes too small or too large, the other controller takes over, overrides, to ensure that the constraint is not violated. In this example, P1 = P2 and C1 = C2, where we use the process and controller given by eq. (27) and eq. (28). … view at source ↗
Figure 17
Figure 17. Figure 17: : Simulation results for the selector control scheme in Example 6.7 and for [PITH_FULL_IMAGE:figures/full_fig_p036_17.png] view at source ↗
read the original abstract

How difficult can it be to implement a PID controller? The answer is twofold. Implementing the PID control law is simple and computationally inexpensive. However, this basic form will not work in practical applications. The primary reason for this is the various physical limitations of the actuator. Measurement noise, different implementations depending on the various structures (P, PI, PD or PID), bumpless transfer, and varying sampling time also result in problems rendering the basic form inoperable. PID implementation is therefore more difficult than meets the eye. This paper introduces a reference implementation of the PID controller which considers these practical issues. It includes pseudo-code, discussion of the implementation choices and simulation of carefully selected, important test cases.

Editorial analysis

A structured set of objections, weighed in public.

Desk editor's note, referee report, simulated authors' rebuttal, and a circularity audit. Tearing a paper down is the easy half of reading it; the pith above is the substance, this is the friction.

Referee Report

0 major / 3 minor

Summary. The paper claims that while the basic PID control law is simple and inexpensive to implement, practical issues such as actuator saturation, measurement noise, bumpless transfer, variable sampling times, and different controller structures (P/PI/PD/PID) render it inoperable in real applications. It introduces a reference implementation addressing these via pseudo-code, discusses the implementation choices, and validates the approach through simulations of selected test cases.

Significance. If the pseudo-code correctly incorporates the listed practical fixes without internal inconsistencies and the simulations demonstrate their effects on the chosen cases, the work provides a concrete, usable reference that bridges theoretical PID design and deployable code. This could be a helpful resource for control engineers, particularly given the modest, descriptive scope that avoids claiming optimality or universality.

minor comments (3)
  1. [Abstract] Abstract: the phrasing 'this basic form will not work in practical applications' is absolute; consider qualifying it as 'often fails' or 'requires modifications' to better reflect that the issues are common but not universal.
  2. The pseudo-code presentation would benefit from explicit line-by-line annotations or comments highlighting how each practical issue (e.g., saturation, noise filtering) is handled.
  3. [Simulations] Simulations section: clarify the criteria used to select the 'carefully selected, important test cases' and consider adding at least one quantitative metric (e.g., overshoot or settling time) comparing the reference implementation to the basic form.

Simulated Author's Rebuttal

0 responses · 0 unresolved

We thank the referee for their positive assessment of the manuscript and the recommendation for minor revision. The referee summary accurately captures the paper's scope and contributions. No specific major comments were listed in the report.

Circularity Check

0 steps flagged

No significant circularity; self-contained practical reference

full rationale

The paper supplies a descriptive reference implementation of PID control with pseudo-code, implementation choices, and selected test cases for standard practical issues (actuator limits, noise, bumpless transfer, variable sampling). No derivations, fitted parameters, predictions, or equations are present. All content draws on established practices without self-referential reduction, self-citation chains, or renaming of results as new derivations. The central claim is simply that one concrete, workable implementation addressing the listed issues is provided; this holds by direct presentation rather than by construction from its own inputs.

Axiom & Free-Parameter Ledger

0 free parameters · 1 axioms · 0 invented entities

The guide relies on standard PID theory and actuator models without introducing new fitted parameters, axioms beyond domain assumptions, or invented entities.

axioms (1)
  • domain assumption Standard PID control structures and actuator saturation models are taken as known from prior literature.
    The paper builds directly on established control engineering without re-deriving fundamentals.

pith-pipeline@v0.9.0 · 5429 in / 1075 out tokens · 35052 ms · 2026-05-10T08:02:40.230577+00:00 · methodology

discussion (0)

Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.

Reference graph

Works this paper leans on

4 extracted references · 4 canonical work pages

  1. [1]

    (2006).Advanced PID control

    Åström, K., & Hägglund, T. (2006).Advanced PID control. Research Triangle Park, North Carolina, USA: ISA - The Instrumentation, Systems and Automation Society. Åström, K., & Wittenmark, B. (1997).Computer-controlled systems: Theory and design(3rd ed.). Upper Saddle River, New Jersey, USA: Prentice Hall. Åström, K. J., & Hägglund, T. (2001). The future of ...

  2. [2]

    (2010).IEC 60546-1:2010,Controllers with analogue signals for use in industrial-process control systems(Tech

    IEC. (2010).IEC 60546-1:2010,Controllers with analogue signals for use in industrial-process control systems(Tech. Rep.). Geneva, Switzerland: International Electrotechnical Commis- sion. ISA. (2023).ISA-TR5.9-2023, Proportional-Integral-Derivative (PID) Algorithms and Per- formance(Tech. Rep.). Research Triangle Park, NC, USA: International Society of Au...

  3. [3]

    Uzunović, T., Zunic, E., Badnjević, A., Mioković, I., & Konjicija, S. (2010). Implementation of digital PID controller. InThe 33rd international convention MIPRO(pp. 1357–1361). Visioli, A. (2003). Modified anti-windup scheme for PID controllers.IEE Proceedings–control theory and applications,150(1), 49–54. Visioli, A. (2006).Practical PID control. Berlin...

  4. [4]

    MAN"and"TRACK

    functions are orange. They can be set and updated in various ways, such as being passed as arguments (by value or reference) or retrieved from memory within the function. The specific mechanism is left to the implementer. To facilitate readability, block indentation are used, but not strictly needed to avoid ambiguity. Our pseudo-code assumes availability...