The Basics of Control Theory

Running a technical process — holding a chemical reactor at temperature, keeping a bank balance in the black, steering a spacecraft along a planned trajectory — combines three activities. The first is planning: forming a conception of the process and defining the target state we want it to reach. The other two are about actually getting there, and they are not the same thing. There is usually more than one way to drive a process toward its target, and choosing between them is a genuine modeling decision that shapes everything downstream.

Non-feedback control (also called open-loop control) strives for the target state by adjusting the control variables ahead of time, according to a fixed plan, without checking the actual result.

Example: switch on additional cooling every day at noon, on the assumption that noon is when it gets hot — regardless of what the temperature actually turns out to be.

Feedback control (also called closed-loop control) constantly monitors the process and minimizes the difference between the target state and the actual state, correcting as it goes. It is a real-time task: the decision of what to do next is made on the spot, from the current measurement.

Example: keep a reactor temperature constant by measuring it continuously and reacting immediately to any drift.

The distinction is the one between a strategy fixed in advance and a strategy that responds to what is actually happening. The rest of this page is about the second kind.

Outer and inner control loops

Feedback control comes in two flavors, separated by how fast the loop has to react and how much deviation it can tolerate.

  • outer loop: slow reaction, a larger deviation from the target is allowed, and the loop can be implemented in software. A bank giro (current) account is a typical example — the balance may drift well away from where we want it before any correction is made, and the correction itself is a leisurely, software-mediated transaction.
  • inner loop: time-critical, only small deviations are allowed, and a hardware implementation is necessary because software would be too slow. Holding the temperatures inside a chemical reactor constant is the standard example — a runaway there develops in moments, so the correction must be immediate and physical.

Notation: the feedback loop

A feedback controller is drawn as a loop of signals flowing through a few standard blocks. The reference value enters on the left, the difference between reference and measurement is formed at a summing junction, that difference drives a controller, the controller acts on the controlled system, and the system’s measured output is fed back to the summing junction — closing the loop.

The signals carry the following meanings:

  • reference value w(t)w(t): the value we want — for a heating loop, the target temperature we would like the system to sit at.
  • deviation (error) e(t)e(t): how far the current measured value is from the reference, formed at the summing junction. This error is what the controller actually sees.
  • control variable u(t)u(t): the controller’s action. If the temperature is above the reference, the controller might respond by opening a valve to release cooling liquid.
  • disturbance z(t)z(t): an external disturbance (noise) acting on the controlled system from outside the loop. In the simple treatment here it is left out of the model.
  • measured value y(t)y(t): what we measure at the system’s output. It is fed back to the summing junction, where it is subtracted from w(t)w(t) to form the next error — and the loop repeats.

The aim is to choose the control variable uu so that the target/actual difference stays as small as possible. What “small” should mean is itself a choice, and different processes call for different optimization criteria:

  • deviation tends to zero as fast as possible: every bit of sustained error is unacceptable, so the loop drives it out as quickly as it can. Typical of medical applications, where a drifting controlled quantity is dangerous.
  • deviation stays within a certain band: we accept any error inside a tolerance and only act when it leaves the band — no need for constant real-time correction.
  • statistical average of the deviation is zero: the error may be large in either direction at any moment, as long as it averages out over time. A bank account fits this — a long stretch in the negative is fine provided a long stretch in the positive balances it out.
  • cost of control as small as possible: tracking the reference matters less than the energy spent adjusting the control variables. On a spacecraft, where every maneuver burns a limited fuel budget, conserving that budget can outweigh holding the reference tightly.

Important types of controllers

The simplest controller reacts to the error in direct proportion to its size.

A P controller (proportional controller) contains only a proportional element: the control variable is proportional to the target/actual deviation,

uΔy=ytargetyactual.u \sim \Delta y = y_\text{target} - y_\text{actual}.

A large deviation produces a large action and a small deviation a small action. Its weakness is that a permanent deviation Δy0\Delta y \neq 0 can remain.

The permanent deviation is structural, not a tuning mistake. A pure proportional element produces an action only when the error is non-zero, so against a constant load the loop settles at whatever small but non-zero error is just large enough to hold the system in place. It removes most of the deviation but never quite the last of it. Fixing this — and a few other shortcomings — is what motivates the more capable controller below.

A PID controller (proportional–integral–differential controller) is more powerful: alongside the proportional element it adds an integral element and a differential element. Discretized at discrete points tit_i, with step Δti=titi1\Delta t_i = t_i - t_{i-1}, its action is

u(ti)=KPΔyi  +  KIΔtijΔyj  +  KDΔyiΔyi1Δti,u(t_i) = K_P\,\Delta y_i \;+\; K_I\,\Delta t_i \sum_j \Delta y_j \;+\; K_D\,\frac{\Delta y_i - \Delta y_{i-1}}{\Delta t_i},

where Δyi=ytarget(ti)yactual(ti)\Delta y_i = y_\text{target}(t_i) - y_\text{actual}(t_i) is the deviation at step tit_i.

Each of the three elements does a qualitatively different job, and the cleanest way to see the controller is by what each term fights:

  • proportional element (KPK_P): the action is geared to the current deviation, so it counteracts whatever is going wrong right now. This is the term that fights the present error.
  • integral element (KIK_I): the action is geared to the sum of all deviations accumulated so far (the jΔyj\sum_j \Delta y_j term), so it counteracts deviation in the long run. This is the term that fights the history of error — and because it keeps building as long as any error persists, it is what guarantees the deviation vanishes, Δy0\Delta y \to 0, curing the permanent offset a pure P controller leaves behind.
  • differential element (KDK_D): the action is geared to the change of deviation from one step to the next (the difference quotient ΔyiΔyi1Δti\frac{\Delta y_i - \Delta y_{i-1}}{\Delta t_i}), so it reacts to how fast the error is moving. This is the term that fights escalations and oscillations, damping the loop before it overshoots.

So a natural question is whether all three elements are really needed. What is clear already is that the hard part is not writing the controller down but dimensioning it: choosing the parameters KPK_P, KIK_I, KDK_D is the actual modeling problem, and it is complex. The example below makes both points concrete.

Example: linear feedback control

To turn the loop into something we can analyze, model the process to be controlled as a homogeneous system of linear ordinary differential equations (homogeneous meaning there is no constant forcing term — the right-hand side is purely the state acted on by a matrix, with nothing added). The ingredients are:

  • a state vector x(t)Rnx(t) \in \mathbb{R}^n describing the process;
  • a time-invariant coefficient matrix ARn×nA \in \mathbb{R}^{n \times n};
  • a control-variable vector u(t)Rmu(t) \in \mathbb{R}^m;
  • a time-invariant control-coefficient matrix BRn×mB \in \mathbb{R}^{n \times m}.

Without any control loop, the process simply evolves on its own — call this version I:

x˙(t)=Ax(t).\dot{x}(t) = A\,x(t).

This is the same shape as the arms race of two superpowers seen earlier, which carried an extra constant term, x˙(t)=Ax(t)+c\dot{x}(t) = A\,x(t) + c. As there, the basic question is whether the trajectory settles down: starting from some state xx, we do not know in advance whether Ax(t)A\,x(t) drives the system toward a limit or away from it. Ensuring that it does approach a stable limit is exactly what we want the control loop to enforce. So we add control variables — version II:

x˙(t)=Ax(t)+Bu(t).\dot{x}(t) = A\,x(t) + B\,u(t).

The control variables are produced by measuring the system and converting that observation from the nn-dimensional state space into the mm-dimensional space of control actions. The simplest such conversion is a linear one.

In linear feedback control the control variables uu depend linearly on the state xx, through a time-invariant feedback matrix KRm×nK \in \mathbb{R}^{m \times n}:

u=Kx.u = -K\,x.

Substituting this into version II turns the controlled process back into a homogeneous linear ODE system, but with a new system matrix:

x˙(t)=Ax(t)+B(Kx(t))=(ABK)x(t).\dot{x}(t) = A\,x(t) + B\,(-K\,x(t)) = (A - BK)\,x(t).

The task is to determine KK so that the control target and any constraints are met. It helps to see who owns which matrix. The matrix AA is given — it is fixed by whoever built the system, and we have no influence over it; it may have good properties or bad ones. The matrix BB is likewise part of the given plant: it describes how the control variables feed into the system. The one matrix we actually get to design is KK — how we build the control variable from an observation of the system. The whole job is, for whatever AA and BB we are handed, to determine KK so that the resulting closed-loop matrix ABKA - BK has good properties. The payoff is that with the right KK, the system converges to a stable limit no matter where the state xx starts. The aim is precisely such a stationary limit state — one where the derivative is zero — and without loss of generality we can take that target to be the origin. What “good properties” means exactly is settled by solving the system.

Solution of the ODE system

We now solve the closed-loop system

x˙(t)=Mx,M=ABK,x(0)=x0.\dot{x}(t) = M\,x, \qquad M = A - BK, \qquad x(0) = x_0.

The standard procedure for a homogeneous linear ODE starts from an ansatz (an educated guess for the form of the solution, to be confirmed by substitution): assume

x(t)=veλt,x(t) = \mathbf{v}\,e^{\lambda t},

with vRn\mathbf{v} \in \mathbb{R}^n a constant vector and λ\lambda a scalar. Differentiating, the left-hand side becomes x˙(t)=λveλt\dot{x}(t) = \lambda\,\mathbf{v}\,e^{\lambda t}, while the right-hand side is Mx(t)=MveλtM\,x(t) = M\,\mathbf{v}\,e^{\lambda t}. Since the scalar factor eλte^{\lambda t} is never zero, it can be cancelled from both sides, leaving

Mv=λv.M\,\mathbf{v} = \lambda\,\mathbf{v}.

This is the eigenvalue equation: the ansatz solves the ODE exactly when λ\lambda is an eigenvalue of MM and v\mathbf{v} a corresponding eigenvector. So λ\lambda and v\mathbf{v} are not arbitrary; chosen as an eigenpair of MM, the guessed form always works.

One thing is still missing: the initial condition. Setting t=0t = 0 in the ansatz gives x(0)=vx(0) = \mathbf{v}, so a single eigenpair only satisfies x(0)=x0x(0) = x_0 in the lucky case where v\mathbf{v} happens to equal x0x_0. To hit an arbitrary x0x_0 we combine eigenpairs. If MM has nn linearly independent eigenvectors — guaranteed, for instance, when MM is symmetric or has nn distinct eigenvalues — then those eigenvectors form a basis of Rn\mathbb{R}^n, so the initial vector x0x_0 can be written as a unique linear combination of them. Folding those coefficients into the eigenvectors, the solution is

x(t)=i=1nvieλit,withx0=i=1nvi.x(t) = \sum_{i=1}^{n} \mathbf{v}_i\,e^{\lambda_i t}, \qquad \text{with} \quad x_0 = \sum_{i=1}^{n} \mathbf{v}_i.

This works for two reasons at once. Because the ODE is linear, a sum of solutions is again a solution, and each term vieλit\mathbf{v}_i\,e^{\lambda_i t} solves it on its own (each (λi,vi)(\lambda_i, \mathbf{v}_i) is an eigenpair). And it respects the initial condition: at t=0t = 0 every exponential collapses to 11, so the sum reduces to ivi\sum_i \mathbf{v}_i, which we arranged to equal x0x_0. If MM does not have a full set of independent eigenvectors the situation is more involved, but the matrix exponential

x(t)=etMx0x(t) = e^{t\,M}\,x_0

always works.

The eigenvalues control the long-term behavior directly, because each mode carries the factor eλite^{\lambda_i t}. Writing a complex eigenvalue as λ=a+bi\lambda = a + b\,i, Euler’s formula (the identity eiθ=cosθ+isinθe^{i\theta} = \cos\theta + i\sin\theta) splits its exponential into eλt=eat(cosbt+isinbt)e^{\lambda t} = e^{a t}\,(\cos b t + i \sin b t): the real part aa sets the growth or decay, while a non-zero imaginary part bb produces the oscillating cos\cos and sin\sin. Reading the eigenvalues of MM then tells us, at a glance, which regime the solution is in — this is the substance of linear stability analysis:

  • all real parts negative: every mode decays, so the solution is stable, stationary, and tends to zero. This is the regime we are aiming for.
  • at least one positive real part: that mode grows without bound, giving an exponentially growing component — unstable.
  • all real parts zero: the modes neither grow nor decay, leaving a periodically oscillating solution.
  • all real parts negative and all imaginary parts zero: the ideal case — pure decay to zero with no oscillation at all.

Dimensioning of the controller (matrix )

With the solution understood, “control” now has a precise meaning: determine the feedback matrix KK so that the closed-loop matrix M=ABKM = A - BK becomes better than AA — that is, so its eigenvalues sit where we want them. Three goals, in order:

  • real parts of all eigenvalues as negative as possible — impact: decay. Negative real parts are what make the solution return to the target at all.
  • absolute value of those real parts as large as possible — impact: fast decay. A real part of 100-100 is far better than 5-5, because e100te^{-100\,t} collapses to zero much faster than e5te^{-5\,t}; for convergence, more negative is better.
  • absolute value of the imaginary parts as small as possible — impact: no high-frequency oscillations. Small imaginary parts mean low oscillation frequencies; high frequencies are not just unpleasant but physically damaging, the way opening and closing a valve too rapidly to chase the temperature would wear out the hardware.

One caveat sits underneath all of this. Stability ought to survive small disturbances too — the controller should still hold up when the process is nudged off course. But the linear feedback model as written does not allow for that, because it contains no disturbance term at all (the z(t)z(t) from the loop diagram was dropped when we wrote the model down). Accounting for disturbances needs a more complicated model.

A concrete realization of everything above is a PID controller acting on a linear ODE system: the proportional, integral, and differential elements are exactly the tools for pushing the eigenvalues of ABKA - BK where the three goals want them, which also answers the earlier question of whether all three elements are needed.