Control System & PID controller

Control systems, as it is being taught on many universities in the world, regulates the behavior of a system using feedback. Systems may be mechanical, electrical, biological, economical or any other domain. Feedback as in many aspects of life is crucial. A target value r for an essential variable of the system, the process value y, is set. The target value is also referred as setpoint or reference value, whereas the process value is referred as measurement value. The control system calculates the difference between the setpoint and the process value, called the error e of the control system.

From this point we will focus mainly on the structure, design and implementation of the linear feedback controller. The figure below shows the structure of the control system with a linear feedback controller. We neglect any possible source of disturbance.

The linear feedback controller is often the combination a controller and multiple filters. The controller of the control system computes a control value u which is applied to the process and tries to regulate the error e to zero. A filter also often referred as compensator, is tries to improve the characteristics and performance.

The most famous feedback controller is the Proportional–Integral–Derivative (PID) controller is defined by (1). Based on the error it calculates a correction to be applied to the process based on proportional, integral, and derivative terms, respectively. Heuristically, the terms of a PID controller can be interpreted as corresponding to time: the proportional term depends on the present error, the integral term on the accumulation of past errors, and the derivative term is a prediction of future error, based on current rate of change.

(1)   \begin{equation*}  H(s) = K_d \cdot s + K_p + K_i \frac{1}{s} \end{equation*}

Herein, K_d = K_p / (2\pi f_d) and K_i = K_p 2 \pi f_i for which f_d and f_i denote the frequency at which the derivative and integral action start to become active. In addition K_p denotes the proportional gain of the controller. An ideal derivative is not causal – its output depends on future inputs see (2) – therefore, the PID controller is often combined with either a first or a second order low-pass filter (3). This makes the PID controller causal, depending only on past and current inputs but not future inputs.

(2)   \begin{equation*}  \frac{\mathrm{d}f(t)}{\mathrm{d}t} \triangleq \lim_{h \rightarrow 0} \frac{f(t + h) - f(t)}{h} \end{equation*}

(3)   \begin{equation*}  H(s) = \left(K_d \cdot s + K_p + K_i \frac{1}{s}\right) \frac{\omega_{\text{lp}}^2}{s^2 + 2\beta\omega_{\text{lp}}s + \omega_{\text{lp}}^2} = \frac{\left(K_d s^2 + K_p s + K_i\right) \omega_{\text{lp}}^2}{s^3 + 2\beta\omega_{\text{lp}}s^2 + \omega_{\text{lp}}^2s} \end{equation*}

Note that the equation (3) results in a third order polynomial. With some algebra this can be reduced into a first order and second order polynomial. That is to say;

(4)   \begin{equation*} H(s) = \frac{K_i}{s} + \frac{\left(\omega^2_\text{lp} K_d - K_i\right)s + \left(\omega^2_\text{lp} K_p - 2\beta\omega_\text{lp} K_i\right)}{s^2 + 2 \beta \omega_\text{lp} s + \omega_\text{lp}^2}\end{equation*}

As such, the integral action is decomposed from the derivative and gain action along with the second order low-pass filter. With the integrator in parallel, it is possible to perform a saturation or anti-windup on the integrator signal.

Below you see an interactive bode diagram of a PID controller combined with a second order low-pass filter with some typical values. You clearly see the integrator action up to 10 [Hz], followed by the proportional gain action from 10 to 25 [Hz]. The derivative term is visible from 25 to 300 [Hz] and eventually the low-pass filter from 300 [Hz] and further.

Filters in Control Systems

In this blog I want to elaborate on the various types of filters that are being used in Control Systems. These filters are often used in combination with a PI, PD or PID controller to obtain a robust controller. The filters which we will discuss are:

  • Low-Pass filter
  • High-Pass filter
  • Lead-Lag filter
  • Notch filter

Using these four filters we can create other filter types, such as a Band-Stop or Band-Pass filter. The behavior of each filter can be captured by a transfer function in the continuous-time using the Laplace domain s of either first and/or second order. We use the transfer functions to describes the filter H(s) = Y(s) / U(s) and as such the relation between the input U(s) and the output Y(s). Throughout this blog we will write the equations in the form of their angular frequency \omega in [rad/s], also known as radian frequency. However, we will specify filters using their frequency f in [Hz]. Using the radial frequency notation results in a more visual compact formula. Additionally, it is also possible to specify the filters in form of their time constant \tau in [s]. The following relation holds between the angular frequency, frequency and time constant.

    \begin{equation*} \omega \triangleq 2\pi f \triangleq \frac{1}{\tau} \end{equation*}

Many forms are used within literature, one book will use angular frequencies, the other will use time-constants. Finally, for second order filters, the only filter with possibly complex poles or zeros, can be written in various ways. We will specify second order filters in terms of the damping \beta of the corresponding frequency. It is also possible to describe these formulas using the Quality factor Q. Whereas \beta describes how oscillations decay in a system after a disturbance, Q describes how underdamped the system is. The following relation holds between \beta and Q

    \begin{equation*} \beta \triangleq \frac{1}{2Q} \end{equation*}

Low-pass filter

A low-pass filter is used to pass signals with a frequency lower than a certain cut-off frequency f_\text{lp}. Below the formulas for both the first- and second-order low-pass filter is given.

    \begin{equation*} H(s) = K\cdot\frac{\omega_{\text{lp}}}{s + \omega_{\text{lp}}} \quad\quad H(s) = K\cdot\frac{\omega_{\text{lp}}^2}{s^2 + 2\beta\omega_{\text{lp}}s + \omega_{\text{lp}}^2} \end{equation*}

Herein, K denotes the gain, f_\text{lp} denotes the low-pass cut-off frequency and \beta_\text{lp} denotes the damping. Whereas the first-order supresses with 20 [dB/dec], the second-order supresses with 40 [dB/dec]. Low frequent the filter gain is K.

High-pass filter

The complement of a low-pass filter is a high-pass filter. This filter is used to pass signals with a frequency higher than a certain cut-off frequency f_\text{hp}. Below the formulas for both the first- and second-order high-pass filter is given.

    \begin{equation*} H(s) = K\cdot\frac{s}{s + \omega_{\text{hp}}} \quad\quad H(s) = K\cdot\frac{s^2}{s^2 + 2\beta\omega_{\text{hp}}s + \omega_{\text{hp}}^2} \end{equation*}

Herein, K denotes the gain, f_\text{hp} denotes the high-pass cut-off frequency and \beta_\text{hp} denotes the damping. Likewise as the low-pass filter the first-order supresses frequencies with 20 [dB/dec] and the second-order with 40 [dB/dec].

Lead-lag filter

A lead-lag filter, also known as a lead-lag compensator, is often mainly used for phase compensation rather then magnitude. Below the formula for a lead or lag filter is shown.

    \begin{equation*} H(s) = K\cdot\frac{\omega_\text{p}}{\omega_\text{z}}\cdot\frac{s + \omega_\text{z}}{s + \omega_\text{p}} \end{equation*}

Herein, f_\text{p} and f_\text{z} denote the frequency of the pole and zero, respectively. The filter functions as a lead filter if f_\text{p} > f_\text{z}  and otherwise as a lag filter. The filter has its maximum or minimum phase at \sqrt{f_\text{p}f_\text{z}}. Finally, at f = \infty the filter has a gain of Kf_\text{p} / f_\text{z} or Kf_\text{z} / f_\text{p} in case of a lead or lag filter, respectively. Naturally, the filter can be cascaded with itself by which a the filter can be a lead and lag filter simultaneously.

Notch filter

A notch filter is often used to filter undesired resonance peaks. Below the formula for a notch filter is shown.

    \begin{equation*} H(s) = K\cdot\frac{\omega_\text{p}}{\omega_\text{z}}\cdot\frac{s^2 + 2\beta_\text{z}\omega_\text{z}s + \omega_\text{z}^2}{s^2 + 2\beta_\text{p}\omega_\text{p}s + \omega_\text{p}^2} \end{equation*}

Herein, f_\text{p} and f_\text{z} denote the frequency of the pole and zero, respectively. Likewise, \beta_\text{p} and \beta_\text{z} denote the damping of the pole and zero and K is as usual the gain. When f_\text{z} = f_\text{z} the notch will target one specific frequency. The gain at that frequency is given by \beta_\text{z} / \beta_\text{p}. When f_1 \neq f_2 the notch filter is also referred as a skewed notch and the difference between gain at low and high frequencies is given by (f_\text{p} / f_\text{z})^2.