The Sampled PID Equation: Term Bookkeeping and Saturation

Ada re-derives the chapter’s sampled PID equation, keeping each term’s error sample and the actuator bound explicit

foundations
math-foundations
pid-control
reference-architectures
advanced
Ada ADA · CALCULATION AUDIT

The Sampled PID Equation: Term Bookkeeping and Saturation

A controller trace is trustworthy only when the math records which error sample fed each term and the physics records whether the actuator, sensor, and sample interval could support that command.

A PID controller does not begin with three gains but with a measured gap: temperature below a setpoint, tank level above a limit, or motor speed drifting from target. The chapter sums proportional, integral, and derivative action on that error, then warns that the equation is not complete until the loop record also names the sample interval, output limits, integral limit, and derivative filtering. This audit asks the question that warning invites: can the chapter’s PID equation be trusted as written, or only once each term’s error sample and the actuator bound are made explicit?

Companion to the chapter PID Control Theory — every number here comes from that chapter.

Start with the measured error

1. Start with the measured error. The chapter already defines error as setpoint minus process variable, so the sampled version at time step k is:

e[k] = setpoint - process_variable[k]

Preserve the sample interval before adding integral or derivative action

2. Preserve the sample interval before adding integral or derivative action. Integral action accumulates error over time; derivative action divides the error change by time. Without the same sample interval in both records, the units do not match the physical loop.

error_sum[k] = clamp(error_sum[k-1] + e[k] * dt, integral_min, integral_max)
error_rate[k] = (e[k] - e[k-1]) / dt

Then compute the bounded actuator request

3. Then compute the bounded actuator request. This is the chapter's PID equation with the missing implementation guardrails made explicit.

raw_output[k] = Kp * e[k] + Ki * error_sum[k] + Kd * error_rate[k]
output[k] = clamp(raw_output[k], output_min, output_max)
Audit item Formula check What it proves
Proportional term P[k] = Kp * e[k] The immediate command is proportional to the current measured gap only.
Integral term I[k] = Ki * clamp(error_sum[k-1] + e[k] * dt) Persistent error is accumulated in time units and bounded before it can wind up.
Derivative term D[k] = Kd * (e[k] - e[k-1]) / dt Damping uses the error trend, so noisy measurements and slow sampling must be filtered or justified.
Actuator physics output[k] = clamp(P[k] + I[k] + D[k]) The command sent to the device respects real actuator limits instead of assuming unlimited correction.

No numeric tuning claim is made here: this chapter supplies the PID equation and required records, but not measured gains, traces, sample periods, or actuator limits. A numeric panel would need those values from a real loop before it could claim a stable setting.

Every expression above is taken from the chapter’s own PID equation and required records, and re-derived step by step.