One technique for compensator design is to work with Bode diagrams of the open-loop response (loop shaping).

Using Bode diagrams, you can

Design to gain and phase margin specifications

Adjust the bandwidth

Add notch filters for disturbance rejection

The following topics use the DC motor example to show how to create a compensator using Bode diagram design techniques. From SISO Example: The DC Motor, the transfer function of the DC motor is

Transfer function: 1.5 ------------------ s^2 + 14 s + 40.02

For this example, the design criteria are as follows:

Rise time of less than 0.5 second

Steady-state error of less than 5%

Overshoot of less than 10%

Gain margin greater than 20 dB

Phase margin greater than 40 degrees

The Linear System Analyzer Showing the Step Response for the DC Motor, shows that the closed-loop step response is too slow. The simplest approach to speeding up the response is to increase the gain of the compensator.

To increase the gain:

Click the

**Compensator Editor**tab to open the**Compensator Editor**page.Select

**C**from the compensator selection list.In the text box to the right of the equal sign in the

**Compensator**area, enter`38`

and press**Enter**.**Adjusting Compensator Gain on the Compensator Editor Page**

The SISO Design Tool calculates the compensator gain, and Bode and root locus graphs in the Graphical Tuning window are updated.

Alternatively, you can set the gain in the Graphical Tuning
window by grabbing the Bode magnitude line and dragging it upward.
The gain and poles change as the closed-loop set point is recomputed,
and the new compensator value is updated in the **Compensator
Editor** page.

Because the design requirements include a 0.5-second rise time, try setting the gain so that the DC crossover frequency is about 3 rad/s. The rationale for setting the bandwidth to 3 rad/s is that, to a first-order approximation, this should correspond to about a 0.33-second time constant.

To make the crossover easier to see, select **Grid** from
the right-click menu. This creates a grid for the Bode magnitude plot.
Left-click the Bode magnitude plot and drag the curve until you see
the curve crossing over the 0 dB line (on the *y* axis)
at 3 rad/s. This changes both the SISO Design Tool display and the
Linear System Analyzer step response.

For a crossover at 3 rad/s, the compensator gain should be about 38. By default, the Graphical Tuning window shows gain and phase margin information in the lower-left corners of the Bode diagrams. In the Bode magnitude plot, it also tells you if your closed-loop system is stable or unstable.

This figure shows the Graphical Tuning window.

**Adjusting Bandwidth in the Graphical Tuning
Window**

This plot shows the associated closed-loop step response in the Linear System Analyzer.

**Closed-Loop Step Response for the DC Motor
with a Compensator Gain = 38**

The step response shows that the steady-state error and rise time have improved somewhat, but you must design a more sophisticated controller to meet all the design specifications, in particular, the steady-state error requirement.

One way to eliminate steady-state error is to add an integrator. To add an integrator:

Click the

**Compensator Editor**tab to open the**Compensator Editor**page.Right-click anywhere in the

**Dynamics**table for the right-click menu, and then select**Add Pole/Zero****>****Integrator**.

The following figures show this process.

**Adding an Integrator in the Dynamics Table**

**Editable Integrator Parameters**

Notice adding the integrator changed the crossover frequency
of the system. Readjust the compensator gain in the **Compensator
Editor** page to bring the crossover back to 3 rad/s; the
gain should be `99`

.

After you have added the integrator and readjusted the compensator gain, the Graphical Tuning window shows a red `x' at the origin of the root locus plot.

**Integrator on the Root Locus Plot**

The following figure shows the closed-loop step response.

**Step Response for the DC Motor with an Integrator
in the Compensator**

Use the right-click menu to show the peak response and rise time (listed under the Characteristics). The step response is settling around 1, which satisfies the steady-state error requirement. This is because the integrator forces the system to zero steady-state error. The figure shows, however, that the peak response is 1.3, or about 30% overshoot, and that the rise time is roughly 0.4 second. So a compensator consisting of an integrator and a gain is not enough to satisfy the design requirements, which require that the overshoot be less than 10%.

Part of the design requirements is a gain margin of 20 dB or greater and a phase margin of 40° or more. In the current compensator design, the gain margin is 11.5 dB and the phase margin is 38.1°, both of which fail to meet the design requirements. The rise time needs to be shortened while improving the stability margins. One approach is to increase the gain to speed up the response, but the system is already underdamped, and increasing the gain will decrease the stability margin as well. You might try experimenting with the compensator gain to verify this. The only option left is to add dynamics to the compensator.

One possible solution is to add a lead network to the compensator. To add the lead network:

Click the

**Compensator Editor**tab to open the**Compensator Editor**page.In the

**Dynamics**table, right-click and then select**Add Pole/Zero > Lead**.

The following figures show the process of adding a lead network to your controller.

**Adding a Lead Network to the DC Motor Compensator
on the Compensator Editor Page**

**Lead Network Added**

Editable fields are shown in the **Edit
Selected Dynamics** group box (right side of page) when an
item in the **Dynamics** table has been
selected, as shown in the following figure.

For this example, change Real Zero to `-7.38`

and
change Real Pole to `-11.1`

.

You can also add a lead network using the Graphical Tuning window.
Right-click in the Bode graph, select **Add Pole/Zero
> Lead**, place the `x' on the plot where you want to
add the lead network, and then left-click to place it. The **Compensator Editor** page is updated to include
the new lead network in the **Dynamics** table.

Your Graphical Tuning window and Linear System Analyzer plots should now look similar to these.

**Root Locus, Bode, and Step Response Plots for the DC Motor
with a Lead Network**

The Step Response plot shows that the rise time is now about 0.4 second and peak response is 1.24 rad/s (i.e., the overshoot is about 25%). Although the rise time meets the requirement, the overshoot is still too large, and the stability margins are still unacceptable, so you must tune the lead parameters.

To improve the response speed, edit the selected dynamics for
the lead network in the **Edit Selected Dynamics** group
box on the **Compensator Editor** page.

Change the value of the lead network zero (Real Zero) to move it closer to the left-most (slowest) pole of the DC motor plant (denoted by a blue `x').

Change the value of the lead network pole (Real Pole) to move it to the right. Notice how the gain margin increases (as shown in the Graphical Tuning window) as you do this.

As you tune these parameters, look at the Linear System Analyzer. You will see the closed-loop step response alter with each parameter change you make. The following figure shows the final values for a design that meets the specifications.

**Graphical Tuning Window with Final Design
Parameters for the DC Motor Compensator**

The values for this final design are as follows:

Poles at 0 and -28

Zero at -4.3

Gain = 84

Enter these values directly in the **Edit
Selected Dynamics** group box in the **Compensator
Editor** page, shown as follows (Integrator is already set
to 0).

**Entering Final Design Parameters on the
Compensator Editor Page**

The following figure shows the step response for the final compensator design.

**Step Response for the Final Compensator
Design**

In the Linear System Analyzer's right-click menu, select **Characteristics** > **Peak Response** and **Characteristics** > **Rise Time** to show the peak
response and rise time, respectively. Hover the mouse over the blue
dots to show the data markers. The step response shows that the rise
time is 0.45 second, and the peak amplitude is 1.03 rad/s, or an overshoot
of 3%. These results meet the design specifications.

If you know that you have disturbances to your system at a particular
frequency, you can use a notch filter to attenuate the gain of the
system at that frequency. To add a notch filter, click the **Compensator Editor** tab to open the **Compensator Editor** page. Right-click in the **Dynamics** table and select **Add
Pole/Zero > Notch**, as shown next.

**Adding a Notch Filter with the Dynamics Right-Click Menu**

Default values for the filter are supplied, as shown next.

**Notch Filter Default Values**

The following figure shows the result in the Graphical Tuning window.

**Notch Filter Added to the DC Motor Compensator**

To see the notch filter parameters in more detail, click the Zoom In

icon on the Graphical Tuning window. In the Open-Loop Bode Editor, press the left mouse button and drag your mouse to draw a box around the notch filter. When you release the mouse, the Graphical Tuning window will zoom in on the selected region.

To understand how adjusting the notch filter parameters affects the filter, consider the notch filter transfer function.

$$\frac{{s}^{2}+2{\xi}_{1}{\omega}_{n}s+{\omega}_{n}^{2}}{{s}^{2}+2{\xi}_{2}{\omega}_{n}s+{\omega}_{n}^{2}}$$

The three adjustable parameters are ξ_{1},
ξ_{2}, and ω_{n}.
The ratio of ξ_{2}/ξ_{1} sets
the depth of the notch, and ω_{n} is the
natural frequency of the notch.

This diagram shows how moving the red ⊗ and black diamonds changes these parameters, and hence the transfer function of the notch filter.

**A Close Look at Notch Filter Parameters**

In the **Dynamics** table on the **Compensator Editor** page, select the row containing
the newly added notch filter. The editable fields appear in the **Edit Selected Dynamics** group box, as shown
next.

**Editing Notch Filter Parameters**

You can use the SISO Design Tool to modify the prefilter in your design. Typical prefilter applications include:

Achieving (near) feedforward tracking to reduce load on the feedback loop (when stability margins are poor)

Filtering out high frequency content in the command (reference) signal to limit overshoot or to avoid exciting resonant modes of the plant

A common prefilter is a simple lowpass filter that reduces noise in the input signal.

Open the Bode diagram for the prefilter by opening the right-click
menu in the Closed-Loop Bode Editor in the Graphical Tuning window,
and then selecting **Select Compensators >
F(F)**.

**Selecting the Prefilter in the Graphical
Tuning Window**

For clarity, the previous figure does not show the open-loop
Bode diagram for the compensator (**C**).
To remove the Bode diagram from the Graphical Tuning window, go to
the **SISO Design Task** node on the
Control and Estimation Tools Manager, click the **Graphical
Tuning** tab, and for Plot 2, Open Loop 1, select Plot type `None`

.

**Prefilter Bode Diagram**

If you haven't imported a prefilter, the default is a unity
gain. You can add poles and zeros and adjust the gain using the same
methods as you did when designing the compensator (C) on the **Compensator Editor** page.

A quick way to create a lowpass roll-off filter is to add a
pair of complex poles. To do this, first click the **Compensator
Editor** tab and change the compensator to `F`

.
Right-click in the **Dynamics** table
and select **Add Pole/Zero > Complex Pole**.
Select this line to show the editable parameters in the **Edit Selected Dynamics** group box. For this
example, try to place the poles at about 50 rad/s. The following figure
shows the poles added to the prefilter Bode diagram.

**Adding a Complex Pair of Poles to the Prefilter
Bode Diagram**

By default, the damping ratio of the complex pair is 1.0, which means that there are two real-valued poles at about -50 rad/s. The green curve, which represents the prefilter Bode response, shows the -3 dB point for the roll-off is at about 50 rad/s. The magenta curve, which represents the closed-loop response from the prefilter to the plant output, shows that after the -3 dB point, the closed-loop gain rolls off at -40 dB/decade to provide some noise disturbance rejection.

As an alternative approach, you can design a prefilter using
the Control System Toolbox™ commands like `ss`

or `tf`

and
then import the design directly into the prefilter. For example, to
create the lowpass filter using `zpk`

, try

prefilt=zpk([],[-35 + 35i, -35 - 35i],1)

and import `prefilt`

by clicking **System Data** on the **Architecture** page.
This opens the System Data dialog box. Click **Browse** to
open the Model Import dialog box, as shown next.

**Importing a Prefilter**

Select `prefilt`

from the **Available
Models** list and click **Import** to
import the prefilter model. Click **Close** to
close the Import Model dialog box. After you have imported the prefilter
model, you can modify it using the same methods as described in this
chapter for compensator design.

Was this topic helpful?