3.5.39 · D4Guidance, Navigation & Control (GNC)

Exercises — PID tuning — Ziegler-Nichols, loop shaping

2,941 words13 min readBack to topic

Before we start, two symbols and three tools that the whole page leans on. We define the symbols on this page so it stands alone.


Level 1 — Recognition

Problem 1.1

Closed-loop Ziegler–Nichols gives, for a full PID in the standard form, the rules , , . A test found and s. Write down , , and convert to and .

Recall Solution 1.1

WHAT we do: read the table, then convert using and (from the parent note).

  • .
  • s .
  • s .

WHY the conversion: the table speaks in times (, ); your code wants gains (, ). Multiplying/dividing by is the dictionary between the two forms.

Answer: .

Problem 1.2

On a Bode plot the open loop crosses dB (magnitude ) at rad/s, and there . State the phase margin. Is it inside the healthy band?

Recall Solution 1.2

Definition (parent): . lies inside , so yes, healthy.

WHY this formula: instability happens when phase reaches while gain is still . Phase margin measures the leftover angle you have before hitting that cliff. Here you can lose another of phase before the loop sings.


Level 2 — Application

Problem 2.1

A plant (the parent's test plant). Confirm the ultimate frequency, gain and period, then produce the ZN PID gains .

Recall Solution 2.1

Step A — find (phase hits ). Why phase first? The stability edge is defined by phase ; that equation has only in it, so solve it alone. Step B — magnitude there gives . Why is ? At the stability edge we crank up pure P gain until the open loop has magnitude exactly at the frequency where its phase is — that is the "signal fed back inverted and equal in size reinforces itself forever" condition from the parent. Setting and solving for gives : the ultimate gain is precisely the number that lifts the plant's shrunken magnitude back up to . Step C — period. s. Step D — ZN table.

  • .
  • .
  • .

Answer: — matching the parent's example.

Problem 2.2 (open-loop / reaction-curve method)

An open-loop step test on a heater fits a FOPDT model with static gain , time constant s, and dead time s. Recall . Give the ZN open-loop PID parameters and then .

Recall Solution 2.2

Step A — slope parameter. (per second). Step B — ZN open-loop formulas (parent). Step C — gains. , .

WHY these ratios: the dead time is the villain — it is pure phase lag with no gain drop, so more forces a smaller (note ). The integral and derivative times are pinned to because for such plants the natural oscillation period is roughly .

Answer: .


Level 3 — Analysis

Problem 3.1

For the same plant , suppose we use pure P control with (below ). Find the gain margin in dB. Interpret it.

Recall Solution 3.1

WHAT is gain margin: at the frequency where phase , how much more gain until . From 2.1, that frequency is and there . With : . Interpretation: you may double the gain (from up to ) before the loop reaches sustained oscillation — exactly consistent with the ultimate gain being . Where the " dB minimum" comes from: it is a design criterion, not a law of nature. The standard robustness rule of thumb (see Stability margins (gain & phase margin) and the Nyquist stability criterion) asks that gain margin be at least a factor of — i.e. dB — so that ordinary modelling errors and gain drift (component tolerances, temperature) cannot swallow your whole margin and tip the Nyquist curve past the point. So sits exactly at that recommended lower bound: acceptable, but with no room to spare — the reason a designer would back off further.

Problem 3.2

Explain, using phase, why adding integral action to a loop that already had reduces the phase margin — and estimate the loss if the integral corner is placed at .

Recall Solution 3.2

WHAT integral does to phase: the factor contributes exactly ; but a real PI controller contributes only at frequency , because far above its corner the integral term becomes negligible and phase returns toward . Estimate at with : New phase margin . WHY it must be a loss: integral only ever adds lag (never lead), so it can only pull phase down at crossover; the design trick is to push its corner far below so that lag has almost decayed by the time you reach — hence the "" rule keeps the loss to a tolerable few degrees.


Level 4 — Synthesis

Problem 4.1 (lead design by phase margin)

Plant . Design a PD controller so that the gain crossover is at rad/s with phase margin . Find and .

Figure s01 (below) is the geometric heart of Step C. It draws the single complex number as a right triangle: adjacent side (black), opposite side (black), hypotenuse the red arrow. Look at the red arrow — the angle it makes above the horizontal axis IS the phase lead the PD zero donates, and reading "opposite over adjacent" off this triangle is exactly why .

Figure — PID tuning — Ziegler-Nichols, loop shaping
Recall Solution 4.1

Step A — plant phase at . has an integrator ( flat) and one lag (). Step B — how much phase must the controller supply? We want the total open-loop phase at to be , because means . Step C — a PD zero supplies lead (this is the triangle in figure s01). Why arctan again? The factor is the little triangle with vertical side ; its angle above the axis is — positive, i.e. phase lead. Step D — set magnitude to 1 at (that is what "crossover" means).

Answer: s, . Matches the parent example.

Figure s02 (below) makes Step B visible as a phase budget. Each black bar is one factor's phase contribution at ; they stack. Watch the red "total" bar land exactly on the red dotted target line — that is the phase-margin condition being met, and the dashed line above which we must never let the red bar reach is the instability cliff.

Figure — PID tuning — Ziegler-Nichols, loop shaping

Problem 4.2 (build the full PID from that lead design)

Take the , from 4.1 and add integral action with corner rad/s (the rule of thumb). Give , and state by how much this trims the phase margin.

Recall Solution 4.2

Step A — from the corner. . Step B — phase penalty at (as in 3.2): So the phase margin drops from to about — still healthy. Answer: , PM . (In practice you would nudge up slightly to recover the lost .)


Level 5 — Mastery

Problem 5.1 (judge two designs)

For you have two candidate PID controllers:

  • A (raw ZN): (from 2.1).
  • B (detuned): the same reduced by , integral and derivative times unchanged.

Compute B's gains, and argue in one line which you would ship for a position servo that must not overshoot much.

Recall Solution 5.1

Step A — B's . . Step B — keep the times fixed (, ), so: Step C — judgement. Raw ZN aims at quarter-amplitude decay overshoot — too bouncy for a position servo. Detuning by pulls the crossover down, buys phase margin, and cuts overshoot at the cost of a little speed. Ship B.

Answer: .

Problem 5.2 (mastery synthesis: full loop-shaping check)

Combine everything. For the lead-plus-integral controller from 4.2 (, , ) on , verify the final open-loop phase at and confirm the resulting phase margin numerically.

Recall Solution 5.2

Assemble the phases at (everything superposes):

  • Plant integrator: .
  • Plant lag : .
  • Controller lead zero : .
  • Controller integral lag: . Interpretation: exactly the predicted in 4.2. The design is self-consistent — the loss from integral shows up precisely where we expected, and the loop is safely stable with a fast rad/s. To recover the full , raise so the lead becomes .

Answer: , .


Recall Final self-check (hide and answer)
  • ZN closed loop measured , on — where did come from? ::: From , so , the frequency where phase hits .
  • Why is the ultimate gain the reciprocal of ? ::: Because at the edge , so lifts the plant's magnitude back to .
  • Why does a PD zero raise phase margin? ::: It contributes of lead near crossover, pushing away from .
  • What does a dB gain margin literally allow, and why is it the minimum? ::: Doubling the loop gain before oscillation; dB (factor ) is the standard robustness criterion so gain drift cannot erase the margin.
  • Why place ? ::: So the integral's lag costs almost no phase margin while still boosting low-frequency gain.

Related vault notes: PID controller basics · Bode plot & frequency response · Stability margins (gain & phase margin) · Nyquist stability criterion · Integral windup and anti-windup · Root locus method · State-space control & LQR.