# PID Controller

Cuthbert Nyack
The control system is represented by the following diagram. G1(s) is the transfer function of the controller and G2(s) is the transfer function of the system. Consider first the case with a PD controller. For the PD controller the transfer functions for G1(s) is given by the following equation with K being the proportional gain and Td the Derivative time. This transfer function has a zero at -1/Td. The system is a second order type 0 system consisting of 2 first orders in series. Its transfer function G2(s) has 2 poles at -1/T1 and -1/T2 and is given by the following expression. Combining the above equations gives the following overall transfer function. The applet below shows the step response (red curve) of the system with a PD controller. The response has oscillations and is offset from the input (magenta curve). Increasing Td damps the oscillations and increasing K reduces the offset but cannot remove it. From the above equations the steady state response is K/(1 + K) which is offset from the input by 1/(K + 1). In the applet, the horizontal axis goes from 0 to 4 when Hg = 1.

For PI control only the overall transfer function is. and the response is shown below. I control removes the offset but introduces additional phase lag which may make the loop unstable if Ti is made too small.

The transfer function for a PID controller is. and the following overall loop transfer function. Examining the above expression(set s to 0) shows that the steady state response is one with zero offset. The step response of the system with a PID controller is shown in the applet below. The input is in magenta and the response is in red. With Hg = 1 the horizontal axis goes from 0 to 4. To simplify the usage of PID controllers, it is common to start with Ti = 4 Td. In this case the open loop system has 3 poles at 0, -1/T1, -1/T2 and 2 zeros at -1/(2Td).

## In summary, the rise time can be reduced with P control, D control can be used to damp out any transient oscillations and I control can be used to remove any steady state error between input and output.

The above applet shows the root locus(interface of red and blue regions) of the system. If Ti > 4Td then both zeros are on the real axis and if Ti < 4Td the zeros become complex conjugate off the real axis. A suitable set of parameters might be T1 = T2 = 0.5, Ti = 0.8, Td = 0.2, K = 5. These parameters can be set in both applets to show the step response and closed loop poles. However depending on the values chosen the system can become unstable. An example is T1 = T2 = 1.0, Ti = Td = 0.2. For these parameters the applet shows that a portion of the root locus lies to the right of the imaginary axis. Changing K( the loci now start at the closed loop poles) shows that the system is stable for K < 0.8 and > 13 (approximately). These numbers can be verified with the applet for the step response.

The above applet shows the Bode plot of the PID system shown above. Changing the parameters shows how the Bode plot corresponds with the transient and root locus information shown above. The Integrator increases the low frequency gain to reduce the offset but introduces a 90º phase lag which can make the system unstable. The D controller is added to reduce the phase lag and improve the stability and transient behaviour of the system.

The same information is shown in the Nyquist plot above for P, PD, PI and PID controllers.

The above applet shows the Routh Hurwitz criterion applied to the PID system. As for the Bode plot, this is consistent with the other analyses. Gif image below show how 1 of the applets should appear. 