# Chapter 25 notebook: Control Theory: Performance, Robustness, and Implementation Reality

**Goal:** Translate implementation constraints into a delay and sampling budget before tuning a controller.

**Start with:** Rules 25.2.1, 25.3.1, 25.3.2. Use a calculator or the optional Python lab. Programming is optional for the workbook; the Jupyter version requires a Python 3 kernel. All lab numbers are constructed practice inputs, not observed data.

**Source:** [Finished Chapter 25](../skills/math-thumb-control-theory/references/chapter.md) from *Mathematical Rules of Thumb*. Numbered rules, classifications, and the decision path come from the book. The lab, exercises, answer key, and worksheet prompts are companion additions.

## 1. Frame your decision

Write a question in which an answer would change something you do. Gather: Plant and loop structure; bandwidth/crossover conventions; delays; sample rate; actuator limits; noise; robustness and time-response targets.

- My question and intended decision:
- Known inputs and units:
- Required accuracy or threshold:
- What I expect before calculating:
- What I still need to find out:

Use the lab as a worked starting point if you do not yet have your own problem. For notation or prerequisites, ask the chapter skill to explain only the concept blocking the next step.

## 2. Choose a route

- **Is the requirement stated in time units?** Translate it into a bandwidth interval, then verify the full step response rather than trusting one constant.
- **Is the persistent disturbance approximately constant?** Add integral structure only if the loop can remain stable and the actuator has enough authority.
- **Will a reduced model guide tuning?** Compare pole decay, residues, zeros, and full-versus-reduced responses in every important channel.
- **Is the loop ordinary SISO with a clear crossover?** Use phase and gain margins as starting screens, then inspect peak sensitivity.
- **Are there multiple crossovers, unstable poles, or MIMO coupling?** Escalate from classical margins to Nyquist, disk, or structured robustness analysis.
- **What latency is unavoidable?** Convert every component to phase at crossover before raising bandwidth.
- **Will the design run digitally?** Include sample, hold, computation, jitter, filtering, and quantization in the implemented model.
- **Can the actuator saturate or the derivative see noise?** Add anti-windup and derivative filtering before nonlinear simulation or hardware tests.

**Chapter-specific stop check:** State Hz versus rad/s and identify the actual crossover. Classical margins and sampling ratios are design screens, not permission to deploy a controller without model and implementation checks.

## 3. Work the lab

A loop crosses over at 5 Hz and has pure delay 0.01 s. Angular crossover is 2 × pi × 5 rad/s, so delay adds 2 × pi × 5 × 0.01=0.314159 rad=18 degrees of phase lag. A nominal 60-degree phase margin would be roughly 42 degrees if crossover stayed fixed and delay were the only change. That fixed-crossover calculation is a screen, not a full stability certificate. For a separately specified closed-loop bandwidth of 5 Hz, the ten-times-bandwidth sampling starting point is 50 Hz; actual hold, computation, jitter and noise may demand more.

Predict the sign and scale before running the code. Then change one input and explain why the result moves. The code checks the constructed example; it does not prove the rule for every possible input. Code assertions may describe the example's chosen regime, so inspect them before changing that regime.

```python
import math
crossover_hz, delay_seconds, nominal_margin_degrees = 5.0, 0.01, 60.0
closed_loop_bandwidth_hz = 5.0  # A separate model input, not an identity with crossover.
assert crossover_hz > 0 and delay_seconds >= 0 and closed_loop_bandwidth_hz > 0
angular_crossover = 2*math.pi*crossover_hz
lag_degrees = math.degrees(angular_crossover*delay_seconds)
print(f"Delay lag at fixed crossover: {lag_degrees:.3f} degrees")
print(f"Illustrative remaining margin: {nominal_margin_degrees-lag_degrees:.3f} degrees")
print(f"Ten-times-bandwidth starting sample rate: {10*closed_loop_bandwidth_hz:.1f} Hz")
```

**My prediction, observed result, and explanation:**

_Record your work here._

## 4. Practise without the answers

### Exercise 1

At 10 Hz crossover, how much pure delay corresponds to 30 degrees of phase lag?

**My approach, assumptions, calculation, and check:**

_Write your attempt here._

### Exercise 2

A PID actuator saturates while its integral term keeps growing. What failure and remedy should be examined?

**My approach, assumptions, calculation, and check:**

_Write your attempt here._

### Exercise 3

A SISO design has a quoted 50-degree margin but several crossovers and an unstable open-loop pole. Is that one number enough?

**My approach, assumptions, calculation, and check:**

_Write your attempt here._

**Coaching prompt:** “Use the Chapter 25 skill to help me with Exercise 2. Ask for my attempt, give one useful hint if I need it, and help me check the assumptions before showing the answer.”

## 5. Answer key and reasoning

Read this after attempting the exercises, or use it immediately if you prefer a complete walkthrough. An answer is complete only when its assumptions and stopping point are clear.

### Answer 1

T=(30 × pi/180)/(2 × pi × 10)=1/120≈0.008333 s, or 8.333 ms.

### Answer 2

Integrator windup can cause slow recovery or overshoot. Add suitable anti-windup logic and test the actual saturation and recovery behavior in the implemented loop.

### Answer 3

No. Analyze the complete loop, including Nyquist encirclements and all relevant crossovers, and verify the implemented dynamics. A classical margin target is only a starting screen.

## 6. Build the complete chapter toolkit

The new lab samples the chapter; the following checklist covers all 10 rules. Study one thematic group at a time. A large group can take several sessions.

- **Translate Desired Behavior Into Loop Structure:** work with rules 25.1.1, 25.1.2, 25.1.3.
- **Protect Robustness at Crossover:** work with rules 25.2.1, 25.2.2, 25.2.3.
- **Pay the Delay, Sampling, Saturation, and Noise Costs:** work with rules 25.3.1, 25.3.2, 25.3.3, 25.3.4.

For each selected rule, read its equation, explanation, and worked use in the source. Reproduce that example; change one input; then change one assumption so the rule is no longer justified. Record the result and what check catches the failure. Historical examples remain labeled and qualified as in the source.

Read each complete numbered profile in the [chapter reference](../skills/math-thumb-control-theory/references/chapter.md) before applying it. The cues below abbreviate the graph metadata; they are not complete conditions. Change the status only after doing the practice described below.

| Rule | Book role | First assumptions to inspect | Practice status |
|---|---|---|---|
| 25.1.1: Estimate rise time from closed-loop bandwidth | Independent | model fidelity;  closed loop stability | new |
| 25.1.2: Add integral action for zero steady-state error to constant disturbances | Workflow | model fidelity;  closed loop stability | new |
| 25.1.3: Trust a dominant-pole approximation only with clear separation | Workflow | model fidelity;  closed loop stability | new |
| 25.2.1: Start loop shaping near 45 to 60 degrees phase margin | Workflow | model fidelity;  closed loop stability | new |
| 25.2.2: Seek at least about 6 dB classical gain margin | Workflow | model fidelity;  closed loop stability | new |
| 25.2.3: Keep peak sensitivity near or below two when feasible | Workflow | model fidelity;  closed loop stability | new |
| 25.3.1: Convert every delay into phase lag at crossover | Workflow | model fidelity;  closed loop stability | new |
| 25.3.2: Sample a digital control loop at least ten times faster than bandwidth | Workflow | model fidelity;  closed loop stability | new |
| 25.3.3: Add anti-windup whenever integral control can saturate | Specialized | model fidelity;  closed loop stability | new |
| 25.3.4: Always filter derivative action | Specialized | model fidelity;  closed loop stability | new |

For a completed row, record: **rule number / my new input / mathematical claim type / verified assumptions / calculation / check / valid use / rejected use / next step**. “Practised” means you worked an example. “Demonstrated” means you can explain a valid use, transfer it, and reject a misuse without the answer key.

## 7. Apply it to your own problem

Return to your opening question. Choose the smallest rule set that can settle it. Use the book's independent/workflow/specialized classification separately from the claim type (exact, approximate, bound, diagnostic, or heuristic).

- Selected rule number(s) and reason:
- Assumptions that hold, fail, or remain uncertain:
- Substitution with units:
- Result and error, uncertainty, or bound:
- Independent check or limiting case:
- Decision this supports:
- Stop here, do a named next calculation, or gather missing information:

## 8. Transfer and continue

Useful nearby chapters: Chapter 3: trigonometry; Chapter 22: ode; Chapter 24: signal processing. Bring the question, units, assumptions, result type, and uncertainty to the next chapter. Choose a bridge only when it supplies an operation you actually need.

**Completion check:** Explain this chapter's lab in your own words; solve one changed-input exercise; reject one invalid use; and produce a decision record for your own problem. If one check fails, revisit that part of the chapter rather than marking every rule complete.
