Skip to content
attrip.Make things to explore your curiosity
MenuClose

Loop Engineering 2: Error, PID, Delay, and Oscillation

Published · Updated · 7 MIN READ · Notes and discoveries

モーター教材のつまみを慎重に回し、応答を見つめる青年。AI生成イメージ。 / A learner tuning a motor-control teaching setup and observing its response; AI illustration.
RECORD / 2026

Can a stronger correction always reach the target faster? It can also overshoot or oscillate. This lesson asks how much to change and when to observe.

Define the error first

With target r and measurement y, define e = r − y. A target of 24°C and measurement of 22°C give an error of 2°C. This illustrative heating example assumes that positive output increases temperature. Other equipment requires checking the direction of action. Proportional control produces an output proportional to the current error. Its gain needs meaningful units and an understanding of the plant.

What P, I, and D use

P uses current error, I its accumulation over time, and D its rate of change. A representative ideal form is u(t) = Kp e(t) + Ki ∫e(t)dt + Kd de(t)/dt. Practical implementations add details such as filtering and output limits. Source: MathWorks

P uses current error, I accumulated error, and D its rate of change.
P uses current error, I accumulated error, and D its rate of change.

Integral action can address a persistent offset. Derivative action responds to change, rather than perfectly predicting the future. Using all three terms is not automatically better. The University of Michigan's cruise-control tutorial meets its example requirements without a derivative term. It is an educational design, not evidence that every production vehicle uses the same controller. Source: University of Michigan

Delay changes the result

A heater command does not instantly change an entire room. Additional corrections made before earlier effects are observable can accumulate. NI discusses delay and oscillation associated with excessive proportional gain. Source: NI

An action can have a delay before its effect is observed.
An action can have a delay before its effect is observed.

Likewise, editing repeatedly before a test finishes can obscure which change helped. This is a design analogy, not a claim that AI editing follows a thermal differential equation.

A paper model

Use the abstract discrete model y_next = y + 0.5u and u = K(10 − y), starting at y = 0. It omits delay, disturbance, noise, and output limits; it is not a model for configuring a real heater.

For K=1, y goes 0→5→7.5→8.75. For K=3, it goes 0→15→7.5→11.25. For K=5, it goes 0→25→−12.5→43.75. Larger correction can make the error grow. Negative outputs are allowed in this abstract exercise.

The next error is (1 − 0.5K)e. It shrinks for 0 < K < 4. For K > 2 within that interval, its sign alternates; K=2 reaches the target in one step in this model. At K=4, y cycles 0→20→0→20 without damping.

Exercise: draw the response

Plot K=1 and K=3 against a horizontal target line at 10. Identify the monotonic and alternating approaches. Then calculate K=4. These calculations establish properties of this written model only. Real stability requires a model and validation appropriate to the actual plant, constraints, and sampling interval.

Read the five-part series

  1. Loop Engineering 1: Feedback, from Temperature Control to AI
  2. Loop Engineering 2: Error, PID, Delay, and Oscillation (this lesson)
  3. Loop Engineering 3: Design an AI Action–Evaluation Loop
  4. Loop Engineering 4: Failure, Budgets, and Safe Resumption
  5. Loop Engineering 5: Design and Test Your First Small Loop

Leave a thought

Leave your name blank to post as Anonymous.