For controller $G_c$, valve $G_v$, process $G_p$ and sensor $G_m$, the set-point response is
$$\frac{Y}{Y_{sp}} = \frac{G_cG_vG_p}{1 + G_{OL}}, \qquad G_{OL} = G_cG_vG_pG_m$$
The loop is stable if and only if every root of the characteristic equation $1 + G_{OL}(s) = 0$ lies in the left half of the $s$-plane.
Routh–Hurwitz criterion
Write the characteristic polynomial $a_ns^n + \dots + a_0$ and build the Routh array. The number of sign changes in the first column equals the number of unstable roots. It tells us the range of $K_c$ for stability without solving for the roots.
Direct substitution
At the edge of stability a pair of roots sits on the imaginary axis. Put $s = j\omega$ into the characteristic equation and solve the real and imaginary parts for $K_{cu}$ and $\omega_u$. Then $P_u = 2\pi/\omega_u$.
Key lessons
- First- and second-order processes under P control can never go unstable. Third order and higher, or any dead time, can.
- Too much gain or too much integral action destabilises a loop.
In the simulation set $K_i = 0$, $K_d = 0$, $L = 2$ s and increase $K_p$ until the response stops decaying. That is the ultimate gain.