Fundamentals / Mechanical engineering / Control engineering / Notebooks

Why one sample of latency can change the stability margin

The controller samples a first-order plant and holds its command until the next sample. Compare immediate application with the same calculation arriving exactly one sample late. Predict which gain produces oscillation before running the notebook.

Interactive calculation · Sample delay motion

Vary the notebook inputs and compare both plotted observables. The same equations generate the browser curves and the notebook reference; fixed material, geometry and model assumptions are stated in the readout.

Download the editable notebook for this example

Interactive calculation · Sample delay poles

Vary the notebook inputs and compare both plotted observables. The same equations generate the browser curves and the notebook reference; fixed material, geometry and model assumptions are stated in the readout.

Download the editable notebook for this example

Save notebook (.ipynb)

Python runs on this device. The first run loads the scientific libraries.

Derive the homogeneous sampled recurrences

For regulation to zero the direct controller gives x[k+1] = (a - bK)x[k]. With delay the coefficient multiplies x[k-1] instead. Initialise the remembered reading to zero, so the first delayed command is zero.

Locate the damping and stability limits

The two controllers use identical numerical coefficients and the same plant. Compare the absolute value of the largest pole with the sequence of sampled displacements.

Set the gain between the two limits and compare the traces. Reduce the sample period by half while leaving the physical time constant unchanged; recompute the gain limits instead of simply reusing the original values. What would change if the delay were fixed in seconds rather than in samples?