—KK = 1offoffG(s)1/s(s+1)(s+2)—feedbackω 1.00
0.0010.010.1110-40-20020406080ω (rad/s)dBBODE MAGNITUDEK·GleadlagLKv = 10ωc 2.43ωc 3.96ωc 1.0022.0 dB0.0010.010.1110-270-180-900ω (rad/s)degBODE PHASE (colours as above)−180°−28.1°−29.5°+49.8°+36.9° at 1−5.3° at 1051015202500.511.52t (s)outputCLOSED LOOP: UNIT STEPK onlylead-lag21% overslow lag tail
Lit wire with moving dashes: a signal is flowing along itBlocks: source, compare junction, gain K, lead, lag, plant, meter, feedback switchPill on the wires: the test frequency, or with the loop closed the output (step) or the error (ramp)Plots: Bode magnitude and phase (K·G, lead, lag, and their sum L) and closed-loop step responses, computed from the modelA unity-feedback loop: gain K = 20, a lead block, a lag block and the plant G(s) = 1/(s(s + 1)(s + 2)). With the feedback switch open, sine tests measure the open loop L; with it closed, a step or a ramp tests the closed loop. The Bode magnitude and phase (gain alone, the lead, the lag, and their sum L) and the closed-loop step responses are computed from the model as the steps play. Placing the lag zero a decade below the new crossover keeps its phase cost small (here 5.3°). The lead was sized for 55°: its extra 5° or so pays for the lag's 5.3°, and the 50° that is left gives 5° over the 45° spec. A first design rarely lands on the spec, so you always check the margins afterwards.

Gain is not enough

  1. The plant is G(s) = 1/(s(s + 1)(s + 2)). We want two things at once: follow a ramp with an error of only 0.1, so Kv = 10, and a phase margin of at least 45°, so the step response stays calm.

Two tools

The design

What is happening

# step 1/10 · specs
# about: Plant G(s)

plant   G(s) = 1 / ( s (s + 1)(s + 2) )

spec 1  Kv = lim s·L(s) = 10   (s → 0)
        ramp error = 1/Kv = 0.1
spec 2  phase margin ≥ 45°

Kv is set by the LOW end of the Bode plot,
the phase margin by the MIDDLE (crossover).

The plant G(s) = 1/(s(s + 1)(s + 2)) is a textbook-style example with illustrative numbers. Every curve in the figure is computed from it: the Bode plots from L(jω), the step and ramp responses by integrating the closed-loop equation (RK4, 2 ms steps). The Python is plain Python 3 with the math module. python-control gives the same margins: control.margin(L) returns the gain margin, phase margin and both crossover frequencies.