Hand Calculations logo Hand Calculations All help pages ▾

Pid Controller⚠ unverified

Aerospace / Controls · Compute the output of a simple PID controller

Parameters

InputSymbolUnitDefaultDescription
kpkp1.0Proportional ga
kiki1.0Integral ga
kdkd1.0Derivative ga
errorerror1.0Current error signal, in the controlled variable's units
integralintegral1.0Accumulated integral of the error, in the controlled variable's units times seconds
derivativederivative1.0Time derivative of the error, in the controlled variable's units per second
OutputSymbolUnitDescription
resultuController output, in the actuator's command units

The science & history

Understanding the Parameters

Derivation (Approaching a Proof)

PID is a designed control law rather than a derived physical law, but each term has a clear rationale from feedback theory. Let the error be the difference between the desired setpoint $r$ and the measured output $y$:

$$e(t) = r(t) - y(t).$$

The goal is to choose the actuator command $u(t)$ so that $e \to 0$ with good transient behaviour. PID builds $u$ from three functionals of the error:

$$u(t) = \underbrace{k_p\,e(t)}_{\text{present}} + \underbrace{k_i\int_0^t e(\tau)\,d\tau}_{\text{past (removes offset)}} + \underbrace{k_d\,\frac{de(t)}{dt}}_{\text{future (adds damping)}}.$$

Why each term. In the Laplace domain the controller transfer function is $C(s) = k_p + k_i/s + k_d s$. The integrator's $1/s$ pole forces zero steady-state error for step commands (infinite DC gain), the derivative's $s$ zero adds phase lead (damping) to stabilise the loop, and the proportional term sets the overall loop gain and response speed. Placed in a feedback loop with the plant $G(s)$, the closed-loop response is shaped by tuning $k_p, k_i, k_d$ to place the poles for the desired damping and speed. The registry evaluates the time-domain sum at one instant:

$$u = k_p\,e + k_i\,I + k_d\,D, \qquad I = \int e\,dt,\; D = \frac{de}{dt}. \qquad\blacksquare$$

Dimensional check. Each term is a gain times an error functional; for the sum to be a consistent command, $k_p$ carries [command]/[error], $k_i$ carries [command]/([error]·s), and $k_d$ carries [command]·s/[error], so all three products share the command's units ✓. (The registry labels everything dimensionless, folding the units into the gains.)

History and Development

Related Concepts: Pid Output, Autopilot Heading Hold, Damping Ratio, Peak Overshoot, Settling Time 2%, Phase Margin, Rise Time, Bode Magnitude

Notes: The three-term feedback law $u=k_p e+k_i\!\int e\,dt+k_d\dot e$ — present/past/future of the error (P sets speed but leaves offset; I removes steady-state error but can overshoot/wind up; D damps but is noise- sensitive). Near-duplicate of Pid Output (Physics/Controls). This calc sums pre-computed e, ∫e, de/dt (does not itself integrate/differentiate). Tuning trades speed vs stability vs accuracy; often gain-scheduled. Gains carry the units; defaults ⇒ $u=3$.

← Back to the workspace  ·  All help pages  ·  Getting started