Delay and delay margin
All physical systems have delays. Although we have ignored them in our analyses so far, they can have a significant impact on the stability and performance of a control system.
Delay¶
All physical systems have delays. Examples include:
Actuation delay: Motors, servos, hydraulic actuators, and other devices that convert control signals into physical actions often have a delay between receiving the control signal and producing the desired output.
Sensing delay: The time it takes for a sensor to measure a quantity and generate the appropriate signal. For example, there may be a delay between a temperature changing occurring and the sensor output reflecting that change.
Plant delay: The inherent delay in the system’s response to an input. For example, in a chemical process, there may be a delay between adding a reactant and observing a change in the output concentration.
Communication delay: The time it takes for information to be transmitted between different components of a control system, such as between a remote sensor and a central controller. Even current flowing in a wire isn’t instantaneous!
Computational delay: The time it takes for the controller to process the sensor data and compute the control action. This can be significant in complex systems or when using advanced algorithms.
Delay as an LTI system¶
A time delay of seconds is an LTI system because it satisfies the properties we learned about: time-invariance, homogeneity, additivity, and causality. In fact, a delay of seconds has a very simple step response:
Figure 1:Step response of a delay of seconds.
There is no ODE that describes a delay, only the equation . Nevertheless, we can derive the transfer function of a delay by taking the Laplace transform of the input-output relationship:
Therefore the transfer function of a delay of seconds is .
Bode plot of delay¶
The frequency response of a delay of seconds is given by evaluating the transfer function at :
This is a complex number in polar form, with magnitude 1 and phase (radians). To make a Bode plot, we convert the magnitude to decibels and the phase to degrees:
We saw that LTI systems have -90° of phase per pole and +90° per zero at high frequencies, but delays are different. The phase lag for a delay increases without bound as . Moreover, the phase lag increases linearly. So on a logarithmic frequency axis, the phase lag will grow exponentially! Here are the Bode plots for different delays.
Figure 2:Bode plots for delays of different lengths. The magnitude is always 0 dB, but the phase lag increases linearly with frequency, which shows up as an exponential increase on the logarithmic frequency axis.
Margin illustration¶
Let’s return to our example from the previous section, but this time, instead of adding gain to reduce the gain margin, let’s add delay to reduce the phase margin:
Figure 3:Standard feedback interconnection of a system with a delay .
Here is the resulting Bode plot for a delay of seconds:
Figure 4:As we increase the delay , the phase plot shifts down, the phase crossover frequency moves to the left, and the gain margin and phase margin are reduced.
We observe the following:
The phase plot shifts down by degrees, but the magnitude plot is unchanged.
The gain crossover frequency is unchanged, but the phase margin is reduced because of the shifted phase curve.
The phase crossover frequency has moved to the left, and the gain margin is reduced because the magnitude plot is increasing as we move to the left. We are still stable, but we have less margin to work with.
Delay margin¶
Delays can occur in many places in a feedback control loop, but if all the components are LTI, then we can aggregate all the delays into a single delay in the feedback path. We can then ask the question: how much delay can we add to the feedback path before the system becomes unstable? The answer to this question is known as the delay margin of the system.
Since adding delay adds phase lag, we will destabilize the closed-loop system if we add more phase lag than the phase margin. We only care about the phase lag at the gain crossover frequency , because that’s where phase margin is measured. If the delay is seconds, this leads us to the equation:
The maximum delay that we can add before instability is called the delay margin , so we have the formula:
If there is no gain crossover frequency (i.e., ), then the delay margin is also infinite, meaning no amount of delay added to the feedback path will cause closed-loop instability.
Example of delay margin¶
Let’s consider a simple first-order system with a 0.2 second delay in the feedback path:
We know that proportional control can move the pole left as far as we like when there is no delay, but what happens when there is a delay? Here is the Bode plot for the undelayed and delayed systems:
Figure 5:Bode plots for a first-order system with and without a delay of 0.2 seconds. The delay causes the phase to shift down, which gives us a finite gain margin.
The system now has a gain margin of about 18.5 dB (magnitude of 8.4), which means we can only use a proportional gain of about before the system becomes unstable. This is a huge difference from the undelayed case, where we had infinite gain margin!
Due to the phase lag explosion caused by delay, and the fact that all feedback loops have some amount of delay, we come to an important conclusion:
Approximating delays (bonus)¶
Delays are difficult to work with because they are not rational transfer functions, and they cause closed-loop systems to have infinitely many poles. Therefore, it is common to use approximations.
Taylor approximations¶
A tempting approximation is the Taylor (Maclaurin) series Applying this to the delay transfer function:
This will not work for us, because we can’t have more zeros than poles, and this approximation has no poles. We could approximate the inverse instead:
This is better, and it has the correct DC gain (both sides are 1 at ). The simplest Taylor approximation is , which is a familiar first-order system. Unfortunately, the gain is only correct at zero frequency. To see why, take a look at the Bode plots for the first few Taylor approximations for a 1-second delay:
Figure 6:Taylor approximations of a 1-second delay. The approximation is only good at low frequencies.
Interestingly, is as far as we can go because for , the Taylor approximation has roots in the RHP, meaning that our approximation in Eq. (11) becomes unstable! Another possibility is to take the ratio of two Taylor approximations, which gives us a rational function with the same number of poles and zeros. For example:
This is much better than the previous approximation because it has the correct magnitude at all frequencies. Here are the updated Bode plots:
Figure 7:Taylor approximations of a 1-second delay using the ratio of two Taylor approximations. This is better than the previous approximation, but can only go up to before it becomes unstable.
Unfortunately, this approximation suffers from the same instability issues as the previous one; namely the poles of Eq. (12) become unstable for .
Padé approximation¶
An even better approximation for the delay is the Padé approximation. The Padé approximation (pronounced “pah-DAY”) named after the French mathematician Henri Padé, is a method for approximating a delay by a rational function. The idea is similar to that of the Taylor series: match as many derivatives as possible at , but do it for the entire function (not the numerator and denominator separately). The first few Padé approximations are:
Note that the coefficients change as we increase , unlike the Taylor series where the coefficients are fixed. This turns out to be a much better approximation than the Taylor series. Critically, it has a Bode magnitude of 0 dB at all frequencies, which is a key property of the delay. It also doesn’t suffer from the instability issues of the Taylor approximation. Here are the Bode plots for the first few Padé approximations for 1-second delay:
Figure 8:Padé approximations of a 1-second delay. The Padé approximation is much better than the Taylor approximation, and it has the correct magnitude of 0 dB at all frequencies.
Comparing Figure 7 and Figure 8, we can see that the Padé approximation does a better job at approximating the phase plot than the Taylor approximation.
The Padé approximation also makes the best use of poles and zeros to maximize phase lag in order to approximate the exponential function. It has stable poles (-90° each) and RHP zeros (another -90° each)[2], so we get of phase lag for an order Padé approximation.
The Padé approximation continues to work for any . In case you are curious, the general formula of order is given by:
Test your knowledge¶
Solution to Exercise 1 #
Our annotated Bode plot is:
Figure 10:Annotated version of the Bode plot in Figure 9.
We have and rad/s, so the delay margin is:
With , the magnitude plot moves up by 20 dB. This causes the gain crossover frequency to move to the right, to rad/s. The phase margin doesn’t change that much since the phase plot is rather flat in this frequency range. We can estimate . Here is the newly annotated Bode plot:
Figure 11:Annotated version of the Bode plot in Figure 10 showing the effect of using instead of .
Therefore, the new delay margin is:
Adding gain has a double effect on delay margin: it tends to increase and reduce , both of which contribute to decreasing the delay margin. In this case, the reduction was substantial!
Solution to Exercise 2 #
Here is the Bode plot:
Figure 12:Bode plot for the system .
The Bode magnitude plot does not cross the 0 dB line, since the DC gain of this system is -6 dB and the magnitude just decreases from there. So there is no gain crossover and therefore an infinite phase and delay margin.
The phase plot starts at 0° at and eventually drops to -270° at high frequency due to the three poles, so there must be a phase crossover. We can calculate it by solving the equation:
Now evaluate the gain at this frequency to find the gain margin:
Therefore, the gain margin is about 24.1 dB, which is finite. However, since there is no gain crossover frequency, no amount of delay will cause instability.
Although delay margin is infinite, adding delay will still decrease the phase crossover frequency and reduce the gain margin. Moreover, if we add enough gain (at least 6 dB, so that we create a gain crossover), then the delay margin will become finite.
The transfer function has what is known as an essential singularity at , which means it does not behave like a normal pole or zero. For example, has a zero at infinity: we have . Likewise, has a pole at infinity: . It doesn’t matter what direction we approach from, the limit is the same. With an essential singularity, that’s not true. (like a zero), (like a pole), and if (along the imaginary axis), then rotates around the unit circle and does not converge to anything!