Control systems and dynamics

From Tibsfox/gsd-skill-creator · View interactive version

Control systems and dynamics is an AI agent skill from the GitHub repository Tibsfox/gsd-skill-creator. Classical control and system dynamics for engineered systems — feedback and closed-loop control, transfer functions and block diagrams, poles/zeros and stability, time-domain response (rise time, overshoot, settling time), PID controllers and tuning, and frequency response (Bode plots, gain and phas

How to use this skill

Skill file

Control Systems and Dynamics

Control systems and dynamics is the study of how engineered systems respond over time and how feedback shapes that response. Where structural analysis asks whether a system can bear its loads, control asks whether a system will settle to the state we want, how fast it gets there, and whether it stays stable while doing so. This skill covers the classical toolkit -- transfer functions, block diagrams, pole placement, time-domain and frequency-domain response, and PID control -- and traces the whole discipline back to its historical root: the mechanical governor that regulated steam engines.

Agent affinity: watt (mechanical/thermal dynamics, the governor lineage), johnson-k (aerospace guidance, feedback, and systems verification)

Concept IDs: engr-feedback-control, engr-transfer-functions, engr-stability, engr-pid-tuning

The Control Systems Toolbox

| # | Topic | Key question |

|---|---|---|

| 1 | Feedback and closed-loop control | How does a system correct its own error? |

| 2 | Transfer functions and block diagrams | How do we model input-to-output behavior? |

| 3 | Poles, zeros, and stability | Will the system settle or blow up? |

| 4 | Time-domain response | How fast and how cleanly does it respond? |

| 5 | PID controllers and tuning | How do we shape the response with a controller? |

| 6 | Frequency response and margins | How much disturbance can the loop tolerate? |

| 7 | The governor -- historical root | Where did feedback control begin? |

Topic 1 -- Feedback and Closed-Loop Control

The central idea of control is feedback: measure the actual output, compare it to the desired output (the setpoint or reference), and drive the difference -- the error -- toward zero.

Open loop vs. closed loop.

The canonical loop. Reference r enters a summing junction, which computes error e = r - y (where y is the measured output). The controller C acts on e to produce a control signal u. The plant G (the physical system) responds to u, producing output y. A sensor feeds y back to the summing junction. Negative feedback -- subtracting the measurement -- is what makes the loop self-correcting.

Why negative feedback. Negative feedback reduces sensitivity to plant variations, rejects disturbances, and can stabilize an otherwise sluggish or drifting system. Positive feedback, by contrast, amplifies error and is used deliberately only in oscillators and latches, never for regulation.

Topic 2 -- Transfer Functions and Block Diagrams

To analyze a loop we need a model. The classical model is the transfer function.

Transfer function. For a linear time-invariant (LTI) system, the transfer function G(s) is the ratio of the Laplace transform of the output to the Laplace transform of the input, assuming zero initial conditions:

G(s) = Y(s) / U(s)

The variable s is the complex frequency (s = sigma + j*omega). A transfer function is a ratio of two polynomials in s: G(s) = N(s) / D(s). The Laplace transform converts differential equations into algebra -- differentiation becomes multiplication by s, integration becomes division by s.

Standard first-order system: G(s) = K / (tau*s + 1), where K is the DC gain and tau is the time constant.

Standard second-order system: G(s) = omega_n^2 / (s^2 + 2zetaomega_n*s + omega_n^2), where omega_n is the natural frequency and zeta (zeta) is the damping ratio. Almost every transient-response concept below is expressed in terms of omega_n and zeta.

Block diagrams are the graphical algebra of control. Blocks represent transfer functions; arrows represent signals; summing junctions add or subtract.

Closed-loop transfer function. For a plant G(s) with controller C(s) and unity feedback, the closed-loop transfer function is:

T(s) = C(s)G(s) / (1 + C(s)G(s))

The product C(s)G(s) is the loop gain (open-loop transfer function). The denominator term 1 + C(s)G(s) is the heart of stability analysis. Setting it to zero gives the characteristic equation, whose roots are the closed-loop poles.

Topic 3 -- Poles, Zeros, and Stability

Poles are the roots of the denominator D(s) -- the values of s where the transfer function goes to infinity. Zeros are the roots of the numerator N(s). Poles govern the shape and stability of the natural response; zeros shape how strongly each mode is excited.

The stability rule. An LTI system is stable if and only if every pole of the closed-loop transfer function lies in the left half of the complex s-plane (negative real part). A pole at s = a + jb contributes a term proportional to e^(at). If a < 0 the term decays; if a > 0 it grows without bound; if a = 0 it neither grows nor decays (marginal stability, sustained oscillation).

| Pole location | Behavior |

|---|---|

| Left half-plane (real part < 0) | Stable -- response decays |

| Right half-plane (real part > 0) | Unstable -- response diverges |

| On imaginary axis (real part = 0) | Marginally stable -- sustained oscillation |

Complex pole pairs. A pair of complex-conjugate poles at -zetaomega_n +/- jomega_n*sqrt(1 - zeta^2) produces a damped oscillation. The real part sets the decay rate; the imaginary part sets the oscillation frequency (the damped frequency omega_d).

Stability tests without solving for roots. The Routh-Hurwitz criterion determines how many poles lie in the right half-plane directly from the coefficients of the characteristic polynomial, without factoring it. The root locus plots how the closed-loop poles migrate through the s-plane as a gain is varied, showing at a glance the gain at which poles cross into instability.

Topic 4 -- Time-Domain Response

The step response -- the output when the reference jumps from 0 to 1 -- is the standard way to characterize transient behavior. For a second-order system these metrics matter:

| Metric | Symbol | Meaning |

|---|---|---|

| Rise time | t_r | Time to go from 10% to 90% of the final value |

| Peak time | t_p | Time to reach the first peak |

| Overshoot | M_p | How far the response exceeds the final value, as a percent |

| Settling time | t_s | Time to enter and stay within a band (typically +/- 2%) of final value |

| Steady-state error | e_ss | Residual error after the transient dies out |

Damping ratio governs the character of the response:

Key formulas (second-order, underdamped):

The fundamental trade-off. Increasing controller gain usually speeds up the response (shorter rise time) but increases overshoot and can push poles toward instability. Faster, cleaner, and stable pull against one another -- control design is the art of balancing them.

Steady-state error and system type. The number of pure integrators (poles at s = 0) in the loop -- the system "type" -- determines which reference signals can be tracked with zero steady-state error. A type-0 system has finite error to a step; a type-1 system tracks a step with zero error but has finite error to a ramp. Adding integral action raises the system type.

Topic 5 -- PID Controllers and Tuning

The PID controller -- Proportional, Integral, Derivative -- is the workhorse of industrial control. Its control law is:

u(t) = Kpe(t) + Ki integral of e(t) dt + Kd * de(t)/dt

Equivalently, in transfer-function form: C(s) = Kp + Ki/s + Kd*s.

| Term | Acts on | Effect | Watch out for |

|---|---|---|---|

| Proportional (Kp) | Present error | Faster response, reduces (not eliminates) steady-state error | Too high -> overshoot and oscillation |

| Integral (Ki) | Accumulated past error | Eliminates steady-state error | Adds phase lag, can cause overshoot and integral windup |

| Derivative (Kd) | Rate of change of error | Adds damping, anticipates error, reduces overshoot | Amplifies measurement noise |

Integral windup occurs when the actuator saturates while the integral term keeps accumulating; the controller then over-corrects when the error finally reverses. Anti-windup schemes (clamping or back-calculation) prevent this and are essential in any real PID implementation.

Tuning methods.

PID variants. Many loops use only PI (most process control -- derivative is skipped because of noise) or PD (motion and servo systems needing added damping). Full PID is used where both zero steady-state error and strong damping are required.

Topic 6 -- Frequency Response and Margins

Frequency response describes how a system responds to sinusoidal inputs across a range of frequencies. It is obtained by evaluating the transfer function along the imaginary axis, G(j*omega).

Bode plot. Two plots versus frequency (log scale): magnitude in decibels and phase in degrees. The Bode plot reveals bandwidth, resonance, and -- most importantly -- stability margins of the closed loop from the open-loop response.

Stability margins quantify how close the loop is to instability. Instability occurs when the loop gain is 1 (0 dB) with 180 degrees of phase lag, because negative feedback then becomes positive feedback.

| Margin | Definition | Healthy value |

|---|---|---|

| Gain margin | How much the gain can increase before instability, measured at the phase-crossover frequency (phase = -180 degrees) | > 6 dB (factor of 2) |

| Phase margin | Additional phase lag tolerable before instability, measured at the gain-crossover frequency (magnitude = 0 dB) | 30 to 60 degrees |

Phase margin and damping. Phase margin correlates directly with the closed-loop damping ratio: roughly, zeta is approximately (phase margin in degrees) / 100 for typical second-order-like loops. A phase margin near 60 degrees gives a well-damped response with modest overshoot; a small phase margin means a ringy, near-unstable loop.

Nyquist criterion. The Nyquist plot maps the loop gain around a contour in the s-plane; the number of encirclements of the -1 point predicts closed-loop stability even for systems with right-half-plane poles or time delay, where Bode-margin intuition can mislead.

Topic 7 -- The Governor: The Historical Root of Feedback Control

Feedback control did not begin with electronics or computers. Its defining engineering milestone was the flyball (centrifugal) governor that James Watt applied to the steam engine in 1788.

How it works. Two heavy balls spin on hinged arms driven by the engine's output shaft. As the engine speeds up, centrifugal force lifts the balls outward and upward. That motion is linked mechanically to the steam throttle valve: rising balls close the valve, cutting steam and slowing the engine; falling balls open it. The governor thus holds engine speed near a setpoint automatically -- a purely mechanical closed loop, with no human in the loop.

Why it is the root. The governor is a complete feedback system in miniature: the spinning balls are the sensor, the setpoint is the balance point of the linkage, the error is the deviation of speed from that balance, and the throttle valve is the actuator. Every concept above -- reference, error, actuation, and the risk of instability -- is present in this brass-and-iron mechanism.

The birth of control theory. In 1868 James Clerk Maxwell analyzed the governor mathematically in his paper "On Governors," deriving the differential equations of the loop and showing that some governor designs would hunt -- oscillate unstably -- rather than settle. Maxwell's stability analysis, tying oscillation to the roots of the characteristic equation, is regarded as the founding work of control theory and the direct ancestor of the pole-location stability rule in Topic 3.

Lesson. More feedback is not always better: a governor with too much gain or too little damping hunts around its setpoint instead of holding it. The same trade-off between responsiveness and stability that Maxwell found in the governor is the trade-off every PID tuner still balances today.

Cross-References

References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.