December 24, 2024

Introduction to Disturbance Observers and Disturbance Rejection Using Disturbance Observers


In this control theory and control engineering tutorial, we provide a brief introduction to disturbance observers and controllers that are based on disturbance observers. The field of disturbance observers is well-developed and it is challenging and time-consuming to explain all the caveats of disturbance observers. Instead, in this tutorial, we provide an intuitive explanation of disturbance observers that can serve as a starting point for a deeper study of disturbance observers. We briefly explain the mathematics behind disturbance observers and why disturbance observers work in practice. In the YouTube tutorials we explain how to implement disturbance observers in MATLAB and Simulink. The YouTube tutorials are given below.

Copyright Notice and Code License

Copyright notice and code license: this tutorial, webpage, video lesson, developed code files, and documents should not be copied, redistributed, or posted on public or private websites, public or private code repositories, or social media platforms. This lesson and all the provided study materials are strictly for personal use. Without the permission of the author, this lesson and the provided material should not be used for commercial purposes and for training of engineers working in companies or in government or privately owned entities or institutions. This lesson and the provided material should not be used as lecture materials on online learning platforms and in university courses. This lesson and the provided material should not be used to train an AI algorithm or a large language model. Without the permission of the author, the provided code should not be used for academic research or for commercial purposes.

What are Disturbances in Control Engineering?

There are a large number of disturbances that can affect the dynamics of the system. Consequently, there are different classifications of disturbances. In this tutorial, we focus on the input disturbances in the context of presenting the main ideas of the disturbance observers. That is, we focus on the disturbances that affect the plant dynamics through the input signals. There are also disturbances that affect the output of the system. Finally, we also have disturbances that do not affect inputs and outputs, but instead, that affect some other signals in a feedback control system.

Let us first define external input disturbances.

Definition of external input disturbances: External input disturbances are external inputs that affect the dynamics of the system (plant dynamics) and that are not created by the controller. That is, external input disturbances are inputs to the plant that are different from the control inputs. The external input disturbances are usually not known or we only have limited knowledge about certain aspects of external input disturbances. We are not able to actively control external input disturbances at their source.

Let us now give a practical example of the external input disturbances. Consider a mass-spring-damper system shown below.

Figure 1: Mass-spring damper system.

In this figure, k_{s} and k_{d} are spring and damping constants, respectively, F(t) is the control force (control input) calculated by the controller, y is the displacement of the mass from its equilibrium point, and D(t) is the disturbance force (external input disturbance) that acts on the system dynamics. F(t) and D(t) are functions of time t. The disturbance D(t) has a unit of force and it can originate from a number of external sources. D(t) can be a stochastic force acting on the plant dynamics or can be a deterministic force. In addition, D(t) can be a combination of stochastic and deterministic components, such as harmonic (periodic) force perturbed by a random signal.

In this particular example, the control objective can be to control the displacement y, despite the effect of the external input disturbances D(t). That is, the goal is to control the position of the mass despite the effect of external disturbance forces.

Besides external input disturbances, we also have internal input disturbances. Next, we provide an explanation and definition of internal input disturbances. For that purpose, let us write a model of the mass-spring-damper system. From Newton’s second law, we obtain an ordinary differential equation describing the dynamics of the system:

(1)   \begin{align*}m\ddot{y}+k_{d}\dot{y}+k_{s}y=F(t)-D(t)\end{align*}

where \dot{y} and \ddot{y} are the first and second time derivatives of the displacement y. Let us now assume that a modeler and a control designer think that the model of the system looks like this:

(2)   \begin{align*}m\ddot{y}+k_{s}y=F(t)-D(t)\end{align*}

That is, the system modeler and control designer think that the damping is not affecting the system. That is why they have omitted the damping in their model given by equation (2). However, in reality, the damping is affecting the model. After several model validation steps in which they compared the model with the experimental data, they came to the conclusion that something was missing in their model. To overcome this fact, they have included the damping term as an input disturbance. Namely, from (1), we have

(3)   \begin{align*}m\ddot{y}+k_{s}y=F(t)-D(t)-k_{d}\dot{y}\end{align*}

The last equation can be written like this:

(4)   \begin{align*}& m\ddot{y}+k_{s}y=F(t)+\bar{D}(t)-D(t),\\& \bar{D}(t)=-k_{d}\dot{y}\end{align*}

where \bar{D}(t) is the internal input disturbance. Note that this input disturbance is actually dependent on the control signal. This is because the term \bar{D}(t)=-k_{d}\dot{y} depends on the first derivative of the displacement, and displacement is controlled by the force F that is determined by the control disturbance. This form of input disturbance comes from the lack of knowledge of the model structure. Model structure is the mathematical form of the model that includes all the terms, derivatives, and constants.

However, there are also internal input disturbances that originate from the lack of knowledge of model parameters. To explain this, consider this scenario. Let us assume that our modelers and control engineers only know the nominal values of the model parameters. That is, let us assume the following

(5)   \begin{align*}m& = \bar{m}+\Delta m \\k_{s}&=\bar{k}_{s}+\Delta k_{s} \\k_{d}&=\bar{k}_{d}+\Delta k_{d}\end{align*}

where

  • m, k_{s}, and k_{d} are the exact values of the model parameters that match the physical reality perfectly. These values are called true model parameters. The true model parameters define the true model of the system which is almost never known exactly.
  • \bar{m}, \bar{k}_{s}, and \bar{k}_{d} are the values of the model parameters that are used by the modeler and control designer. These parameters are usually called nominal parameters. The nominal model is determined by the nominal parameter values. That is, the nominal model is the model that is known to the system modeler and control engineer, and the nominal model is used to design a control algorithm. In fact, the true model is never known exactly!
  • \Delta m, \Delta k_{s}, and \Delta k_{d} are model uncertainties. That is, these variables represent a mismatch between the true and nominal model parameters, that is, they represent the mismatch between the true and nominal models.

By substituting (5) in (1), we obtain

(6)   \begin{align*}(\bar{m}+\Delta m )\ddot{y}+(\bar{k}_{d}+\Delta k_{d})\dot{y}+(\bar{k}_{s}+\Delta k_{s} )y=F(t)-D(t)\end{align*}

After rearranging the last equation, we obtain

(7)   \begin{align*}\bar{m}\ddot{y}+\bar{k}_{d}\dot{y}+\bar{k}_{s}y=F(t)-D(t)-\Delta m \ddot{y}-\Delta k_{d}\dot{y}-\Delta k_{s}y\end{align*}

Next, we can define the internal input disturbance \bar{D}

(8)   \begin{align*}\bar{D}(t)=-\Delta m \ddot{y}-\Delta k_{d}\dot{y}-\Delta k_{s}y\end{align*}

Consequently, our dynamics can be written in the compact nominal form

(9)   \begin{align*}\bar{m}\ddot{y}+\bar{k}_{d}\dot{y}+\bar{k}_{s}y=F(t)-D(t)+\bar{D}(t)\end{align*}

The system modeler and control engineer can now work with the nominal model parameters \bar{m}, \bar{k}_{d}, and \bar{k}_{s} and they can consider the model uncertainties as disturbances. This is a very important technique and control-design philosophy in control engineering that is the basis of robust and data-driven control approaches.

From the previous example, we can conclude that internal input disturbances can also originate from the lack of knowledge of the values of system parameters and not only from the lack of knowledge of the system structure. Another important thing to observe is that the internal input disturbances affect the nominal plant dynamics! That is, they are not physically present in our system, they originate from our modeling approach and the simplifications of the system dynamics. In fact, one can argue that every model is not an exact model, and that is why it is a good idea to include disturbances in our model to take into account unmodeled dynamics.

Definition of the internal input disturbances: the internal input disturbances are inputs that affect the nominal plant dynamics and that take into account our lack of knowledge of the numerical values of the model parameters and the lack of knowledge of the model structure.

Disturbance Observers – Basic Idea

The main motivation for introducing disturbance observers: Consider the control structure shown in the figure below.

Figure 2: Basic structure of the feedback control algorithm.

In the figure above:

  • Y(s), D(s), and F(s) are Laplace transforms of the system output (displacement) y(t), input disturbance D(t), and control input force F(t), respectively.
  • P(s) is the transfer function of the true system model (plant).
  • C(s) is the transfer function of the control algorithm.
  • R(s) is the Laplace transform of the reference signal r(t). The control objective is to make sure that the output y(t) tracks the reference signal.
  • E(s)=R(s)-Y(s) is the control error in the Laplace domain. In the time domain, the error is e(t)=r(t)-y(t).

Let us assume that the controller C(s) is a PID controller, that the plant is a second-order stable system, and that the disturbance is a constant signal. Then, due to the integral term, the PID controller will be able to suppress the constant disturbance. However, let us now assume that the disturbance is a harmonic signal, such as a sinusoidal signal. The PID controller cannot achieve a complete rejection and attenuation of this type of disturbance. This motivates us to introduce a disturbance observer. The disturbance observer will be able to estimate the disturbance and suppress it. Let us introduce a concrete example that illustrates the limitations of the PID controller for suppressing non-constant disturbances. Consider the following system

(10)   \begin{align*}P(s)=\frac{25}{s^{2}+3s+25}\end{align*}

with the PID controller with the following parameters: proportional gain K_{p}=5, integral gain K_{I}=4, and the derivative gain K_{D}=0.5. Let us assume a constant disturbance signal D=2 and a reference signal R=1. The Simulink block diagram is shown below.

Figure 3: Simulink block diagram of the control system for suppressing constant disturbances using a PID control algorithm.

The control results are shown below. The figure below shows the controlled output y(t) as a function of time t. We can observe that the controller is able to suppress constant disturbances.

Now, let us change the configuration of the system, and let us introduce harmonic disturbances having the following form D(t)=\sin(4t). The modified Simulink block diagram is shown below.

Figure 5: Simulink block diagram of the system affected by the harmonic disturbance.

The control results are shown in the figure below. This figure shows y(t) as the function of time t. As can clearly be observed from the figure below, the pure PID control algorithm is not able to reject the harmonic disturbances.

Figure 6: Control results of suppressing harmonic disturbances using a PID controller.

The previous discussion and the example motivate us to introduce the disturbance observer. The main idea of the disturbance observer is graphically illustrated in the figure below.

Figure 7: Basic idea of the disturbance observer.

In the above figure, Q is a transfer function of a low-pass filter that is a design parameter and selected by the user. P^{-1} is an inverse of the transfer function P. The main idea of the disturbance observer is to introduce a feedforward disturbance compensation loop that will cancel the disturbance D(s). This is achieved by estimating the disturbance. The estimate of the disturbance is denoted by \hat{D}(s). In the sequel, we explain how disturbance observer works.

First of all, the filter Q(s) should be selected as a low-pass filter that satisfies the following property:

(11)   \begin{align*}\lim_{\omega\rightarrow 0} Q(j\omega)=1\end{align*}

where Q(j\omega) is obtained by substituting s by s=j\omega in Q(s).

Then, the filter Q should be selected such that the relative degree should be greater than or equal to the relative degree of the nominal transfer function P_{n}(s). The relative degree of a transfer function is a difference between the order of the polynomial in the denominator and the order of the polynomial in the numerator of the transfer function. For example, the model in (10) has the relative degree of 2. This means that the relative degree of the Q filter should be at least 2. The reason for this is to make sure that the transfer function product

(12)   \begin{align*}QP_{n}^{-1}\end{align*}

is a proper transfer function. That is, this transfer function product should be realizable. See the example at the end of this tutorial to see the form of the filter Q for the second-order system.

Due to (11), for small (radial) frequencies \omega, the above block diagram and the control system essentially looks like this:

Figure 8: Disturbance observer loops for small frequencies.

Let us assume that \hat{D}(s)=D(s), that is, let us assume that the disturbance is accurately estimated. Then, from the last figure, we obtain the following diagram

Figure 9: Disturbance observer loops with signals.

By inverting the plant transfer function P, and by feeding the output of the system Y(s) to the inverted plant, we obtain the control input F(s). This control input is then added to the term -(F(s)-D(s)). In this way, we obtain D(s). Then D(s) is sent as a feedforward signal and added to the control input F(s) that is calculated by the controller C. The result is F(s)-D(s). This signal directly cancels the disturbance D(s). Consequently, we only have the control input F(s) that affects the plant. In this way, we reject the disturbances.

However, the figure above is an idealization of the real block diagram. The estimate \hat{D} is almost never exactly equal to the true value of disturbance. Also, in the above block diagrams, we assumed that the model of the plant is known accurately. In fact, we only know the nominal model and the nominal transfer function, which is denoted by P_{n}. The complete feedback control algorithm is given below.

Figure 10: Feedback control system with the disturbance observer.

Our goal is to derive the transfer functions of the model that provide more insights into how the disturbance observer works in practice. From the above figure, we have

(13)   \begin{align*}Y&=P\big(D+F-\hat{D} \big) \\F&=CE \\E&=R-Y \\F&=C(R-Y)\\\hat{D}&=-Q\big(F-\hat{D} \big)+QP_{n}^{-1}Y\end{align*}

From the last set of equations, we have

(14)   \begin{align*}\hat{D}=\frac{QP_{n}^{-1}}{1-Q}Y-\frac{Q}{1-Q}F\end{align*}

From the equations in (13) and from (14), we obtain

(15)   \begin{align*}Y(s)=W_{D}(s)D(s)+W_{R}(s)R(s)\end{align*}

where the input-to-output transfer function W_{R} and disturbance-to-output transfer function W_{D} have the following forms

(16)   \begin{align*}W_{D} & =\frac{P_{n}P(1-Q)}{P_{n}(1+PC)+Q(P-P_{n})} \\W_{R} & =\frac{P_{n}PC}{P_{n}(1+PC)+Q(P-P_{n})} \end{align*}

The filter Q is selected as a low-pass filter with the following property

(17)   \begin{align*}\lim_{\omega \rightarrow 0 } Q(j\omega) =1\end{align*}

Taking into account this property, we have

(18)   \begin{align*}\lim_{\omega \rightarrow 0 } W_{R} & =\lim_{\omega \rightarrow 0 } \frac{P_{n}PC}{P_{n}(1+PC)+Q(P-P_{n})}  \\& =\lim_{\omega \rightarrow 0 } \frac{P_{n}PC}{P_{n}+P_{n}PC+P-P_{n}} \\& =\lim_{\omega \rightarrow 0 } \frac{P_{n}PC}{P_{n}PC+P} \\& =\lim_{\omega \rightarrow 0 } \frac{P_{n}C}{1+P_{n}C} \end{align*}

On the other hand,

(19)   \begin{align*}\lim_{\omega \rightarrow 0 } W_{D} & =\lim_{\omega \rightarrow 0 } \frac{P_{n}P(1-Q)}{P_{n}(1+PC)+Q(P-P_{n})} =0\end{align*}

Consequently, we conclude

  1. From (18) it follows that for low frequencies or asymptotically the closed-loop system with the disturbance observer behaves like a closed-loop system formed on the basis of the nominal plant. This is because the closed-loop transfer function from the reference signal to the output for the nominal plant is:

    (20)   \begin{align*}\frac{P_{n}C}{1+P_{n}C}\end{align*}


    In this way, we are able to control the system accurately despite the presence of the model mismatch between the nominal model and the true model. That is, if the controller C is designed on the basis of the nominal model P_{n}, then for low frequencies or asymptotically this controller will be able to control the true system represented by the transfer function P as accurately as controlling the nominal model.
  2. From (19) we conclude that for low frequencies or asymptotically, the disturbance observer is able to attenuate the effects of disturbances.

A disturbance observer can estimate disturbances accurately if disturbance frequencies are in the bandwidth range of the low-pass Q filter. Consequently, the bandwidth of the Q-filter should be set as high as possible. This is not always possible and can produce negative effects in the presence of strong measurement noise.

Example of Controlling the System Using Disturbance Observer

We have created a video tutorial explaining how to simulate the disturbance observer in Simulink. The tutorial is given below.

For comparison with a pure PID control approach, let us use the previous example that is used to illustrate the limitations of a pure PID control algorithm. The true model is given by

(21)   \begin{align*}P(s)=\frac{25}{s^{2}+3s+25}\end{align*}

The controller is a PID controller with the following parameters: proportional gain K_{p}=5, integral gain K_{I}=4, and the derivative gain K_{D}=0.5. Let us assume a harmonic disturbance signal D(t)=\sin(4t) and a constant reference signal R=1 that we want to track. To make the simulation realistic, we assume the nominal model that is different from the true model. That is, we assume that we do not know the true model exactly. The nominal transfer function is given by

(22)   \begin{align*}P_{n}(s)=\frac{49}{s^{2}+2.8s+49}\end{align*}

The Q filter is given by

(23)   \begin{align*}Q(s)=\frac{40000}{s^{2}+360s+40000}\end{align*}

The product Q\cdot P_{n}^{-1} is

(24)   \begin{align*}Q\cdot P_{n}^{-1}=\frac{816.3s^{2}+2286s+40000}{s^{2}+360s+40000}\end{align*}

Consequently, this product is a proper function and thus realizable.

The Bode diagram of the Q filter is given below.

Figure 11: Bode plot of the Q filter.

The Simulink block diagram of the disturbance observer and the control algorithm is shown below.

Figure 12: Block diagram of the closed-loop system with the disturbance observer.

The control results are shown below. The figure below shows the controlled output y(t) of the system as a function of time.

From the above figure, we can see that the disturbance observer together with the PID controller is capable of almost completely rejecting the harmonic disturbances. By comparing these results with the results shown in Fig. 6 that show the performance of the pure PID controller, we can clearly observe the advantages of disturbance observer compared to pure PID control algorithm.