K = 1.411/(s+1)T = 0 s
036912-101t (s)SINE THROUGH THE DELAYinoutsetpoint0102030012t (s)CLOSED-LOOP STEP r = 1no delaywith delay0.1110-40-20020ω (rad/s)dBBODE MAGNITUDE (OPEN LOOP)|L|, same with delaydelay aloneωc = 10.1110-360-270-180-900ω (rad/s)degBODE PHASE (OPEN LOOP)∠Ldelay, T 0.5∠L + delay-3-2-101-2-10ReImNYQUIST L(jω)no delaywith delay−1
Lit wire with moving dashes: a signal is flowing along itBlocks: controller K/s, plant 1/(s+1) and the delay e^(−sT)Beads on the belt: each holds the value it got on with; the belt takes T secondsPlots: sine through the delay, step response, Bode and Nyquist, all computed from the modelA feedback loop whose measurement comes back through a delay: beads on the belt keep the value they got on with and arrive T seconds later. The five plots are computed from the model: a sine through the delay, the closed-loop step, the open-loop Bode magnitude and phase, and the Nyquist plot. A pure time delay (also called dead time or transport lag) has transfer function e^(−sT), from the shifting theorem of the Laplace transform. Its frequency response has magnitude 1 and phase −ωT radians at every frequency, so it is not a rational transfer function and has no finite set of poles and zeros.

The loop and the delay

  1. Our loop: a controller K/s, K = 1.41, drives a plant 1/(s + 1). Its open-loop Bode plot crosses 0 dB at ωc = 1 rad/s, where the phase is −135°. So the phase margin (lesson: Gain margin and phase margin) is 45°.

Delay inside the loop

Two views and a cure

What is happening

# step 1/10 · loop
# about: Controller K/s, Plant 1/(s+1), Bode magnitude, |L(jω)|, Bode phase, ∠L, no delay

open loop  L(s) = K / (s (s + 1)),  K = √2

import math
K = math.sqrt(2)
def mag(w):   return K / (w * math.sqrt(1 + w*w))
def phase(w): return -90 - math.degrees(math.atan(w))
print(mag(1.0))          # 1.000  -> ωc = 1 rad/s
print(phase(1.0))        # -135.0
print(180 + phase(1.0))  # 45.0  phase margin

The loop is a plant 1/(s + 1) under integral control K/s, with K = √2 so that the gain crossover is exactly 1 rad/s. The delay sits in the feedback path. Every curve and number is computed from this model: the Bode and Nyquist curves from L(jω)·e^(−jωT), the step responses by numerical integration from rest. The Python on each step is plain Python 3 (math, cmath, collections). The step responses in the figure use a fourth-order Runge–Kutta step of 1 ms; the simple 1 ms update in the step code gives the same peaks to about two digits. python-control's control.pade(T, n) gives a rational approximation of a delay when a tool needs one.