# How do we decide to use a lag compensation versus a PI compensation?

Although lag and PI compensation apparently have the same objective of improving the steady state response, how does one decide which one to use?

This question has already been well addressed in the discussion What is the difference between a lag filter and “PI” control?.

In brief, a PI controller added to a stable system in the open loop guarantees that for any constant set point of the reference signal, the closed loop system will have zero steady state error. The big advantage of the PI is that is is very robust and you don't actually need very precise knowledge of the system to design it. For instance, in most of the industrial control systems, the PI controller parameters are set by educated guessing by the engineers, since the system is often too complex to model besides being nonlinear. The robustness and simplicity of the PI controller makes it one of the most used controllers even today.

Lag compensation is a specialized controller used in cases in which PI is not possible or desirable. For example set point signals are not constant but ever-changing, such as a time-varying sine wave. A PI controller, due to integrator's phase drop of $$\\frac{\pi}{2}\$$, will introduce phase shift and therefore a tracking error. In this case, lag compensation can be used to augment the low frequency gain value without introducing a frequency drop. It is maybe important to say that lag compensation doesn't guarantee zero following error. But in these spacial cases, the parameters of the compensator can be calculated in a way to bound the tracking error within the allowable limits.

Another interesting aspect is that compensation controllers (lead or lag) can be regarded as a pole and zero transfer function as follows $$G = K\frac{T_zs+1}{T_ps+1}.$$ If $$\T_p > T_z\$$ it is lag compensator and if $$\T_p < T_z\$$ then it is lead compensator. This type of definition is useful in root locus analysis of systems and is perhaps the most used way of designing these controllers. In root locus analysis, they can be easily visualized and tuned simultaneously with the influence of the gain $$\K\$$.