# Design Compensator for Plant Model with Time Delays

This example shows how to design a compensator for a plant with time delays using Control System Designer.

### Analysis and Design of Feedback Systems with Time Delays

When working with time delay systems it is advantageous to work with analysis and design tools that directly support time delays so that performance and stability can be evaluated exactly. However, many control design techniques and algorithms cannot directly handle time delays. A common workaround consists of replacing delays by their Pade approximations (all-pass filters). Because this approximation is only valid at low frequencies, it is important to choose the right approximation order and check the approximation validity.

Control System Designer provides a variety of design and analysis tools. Some of these tools support time delays exactly while others support time delays indirectly through approximations. Use these tools to design compensators for your control system and visualize the compromises made when using approximations.

### Plant Model

For this example, which uses a unity feedback configuration, the plant model has a time delay:

`$G\left(s\right)={e}^{-0.5s}\frac{1}{s+1}$`

Create the plant model.

`G = tf(1,[1,1],'InputDelay',0.5);`

### Tools that Support Time Delays

In the app, the following tools support time delays directly:

• Bode and Nichols Editors

• Time Response Plots

• Frequency Response Plots

Open Control System Designer, importing the plant model and using a Bode editor configuration.

```controlSystemDesigner({'bode'},G) ```

The phase response of the Bode plot shows the roll-off effect from the exact representation of the delay. The beginning of the step response shows an exact representation of the 0.5 second delay.

Open a Nyquist plot of the open-loop response. In the Data Browser, right-click `LoopTransfer_C`, and select Plot > nyquist.

The Nyquist response wrapping around the origin in a spiral fashion is the result of the exact representation of the time delay.

### Tools that Approximate Time Delays

In the app, the following tools approximate time delays:

• Root Locus Editor

• Pole/Zero Plots

• Many of the automated tuning methods

When using approximations, the results are not exact and depend on the validity of the approximation. Each tool in Control System Designer provides a warning pane to indicate when time-delays are approximated.

Open a root locus editor plot for the open-loop response. Click Tuning Methods, and select Root Locus Editor. In the Select Response to Edit dialog box, click Plot.

### Change Approximation Settings

To change the approximation settings, click the hyperlink in the notification. In the Control System Designer Preferences dialog box, on the Time Delays tab, specify a Pade order of `4`. Alternatively, you can set the bandwidth over which you want the approximation to be accurate.

The higher-order Pade approximation adds poles and zeros to the root locus plot.