This article is contained in *Scilab Control Engineering Basics* study module, which is used as course material for International Undergraduate Program in Electrical-Mechanical Manufacturing Engineering, Department of Mechanical Engineering, Kasetsart University.

### Module Key Study Points

- Understand the tradeoffs in feedback control design
- Learn how to formulate design specs as bounds on frequency responses

- Relationships between open-loop and closed-loop frequency responses
- Perform basic frequency response shaping of loop transfer function

Recall from module 2, we define 3 important transfer functions

Loop :

Sensitivity :

Complementary Sensitivity :

that become the key players, especially for an approach of feedback control design commonly known as “classical control,” since it originated from the ’40 during WWII. This study module focuses on such approach. In essence, we will perform frequency response shaping on the loop transfer function L(s) to yield the desired control specifications, often referred to as *loopshaping**.

* We have to make a remark though, that this term is also used in some modern design scheme to shape the closed-loop frequency responses directly. In this module we focus on shaping the open-loop transfer function L(s).

Before getting into the design procedure, we need to formulate the stability and performance requirements from last module to a general SISO feedback diagram with exogenous signals injected at various points in the loop, as shown in Figure 1.

Figure 1 a general SISO feedback diagram

### Performance Criteria

The following closed-loop responses can be easily derived

Together with the plant, the transfer functions that play the roles in these expressions are the sensitivity S(s) and complementary sensitivity T(s). Note that these two closed-loop transfer functions are functions of the controller, so design criteria can be casted on them.

For example, good tracking performance requires that e(s) approaches zero. From (5), it implies that S(s) should be made small. Now, suppose that measurement noise n(s) is prevalent in this system. We do not want this unwanted signal to affect the plant output y(s). From (4), this noise rejection requirement implies that T(s) should be made small. So, we must design a controller to yield small S(s) and T(s). But this requirement violates the algebraic constraint

i.e., when S(s) approaches 0, T(s) goes to 1, and vice versa. This conflict suggests that some tradeoffs have to be made in the control design specifications.

Fortunately, in normal situation the exogenous signals entering the feedback loop in Figure 1 have different frequency spectrum that could ease off the problem considerably. We summarize them as follows:

- r (command input): common command signal is smooth and varies gradually with time, so it naturally lies in low-frequency region.
- d_i, d_o (disturbance): a typical disturbance signal entering at the input or output of the plant also has low-frequency spectrum, such as mechanical vibration, resonance, or in the robot joint case, the dynamic force exerting from adjacent links.
- n (measurement noise): most sensors become noisy when frequency increases. So the measurement noise generally lies in high-frequency region.

This allows us to cast frequency-dependent specifications to S(s) and T(s). It is more convenient to represent them as magnitude of frequency responses |S(jω)| and |T(jω)|. So, in the above situation, we can make |S(jω)| small in low frequency region (for good tracking), and |T(jω)| small in high frequency region (noise rejection).

### Stability Criteria

Note: in the discussion that follows, we assume a stable, minimum-phase plant, such as the DC motor robot joint used as our example. Some statements may not be valid for an unstable or non-minimum phase plant.

Stability requirement for classical control design can be explained clearly using relationship between the magnitude of sensitivity |S(jω)| and Nyquist plot of L(jω) as shown in Figure 2. It can be shown that the distance from L(jω) curve to the critical point -1 is inversely proportional to |S(jω)|. The shorter this distance, the poorer stability margin of the system. The circle in Figure 2 represents the magnitude |S(jω)|= 1. Hence, when |S(jω)| > 1, the curve of L(jω) is inside the circle. As a result, control design spec for stability can be made as a bound on the peak of sensitivity frequency response. Note that this peak occurs at some mid frequency region before |S(jω)| converges to 1 and |T(jω)| roll-off.

Figure 2 relationship between sensitivity frequency response and Nyquist plot

### Design Criteria Imposed on Loop Transfer Function

In some postmodern control strategy such as H_{∞} synthesis, the stability and performance bounds discussed above can be formulated into weighting functions on S and T directly. That strategy is also called loopshaping (on closed-loop transfer functions). For the classical control design scheme, however, the frequency response shaping is performed on the loop transfer function L(s). Hence, all the criteria must be converted to bounds on L.

To summarize the stability and performance criteria on the closed-loop transfer functions, we separate them to 3 frequency regions LOW, MID, and HIGH. From the above discussion, we have the following design specs

- LOW: |S(jω)| ≪ 1 for good tracking and disturbance attenuation
- MID: since |S(jω)| ≫ 1 indicates poor stability. An upper bound on |S(jω)| is needed. Note from the algebraic constraint that |S(jω)| ≫ 1 implies |T(jω)| ≫ 1 .
- HIGH: |T(jω)| ≪ 1 for measurement noise rejection performance.

Now, these closed-loop bounds can be converted to constraints on L(jω) by using these relationships

- LOW: for small S(jω), we have S(jω) = 1/1 + L(jω) ≈ 1/L(jω). Hence |S(jω)| ≪ 1 implies |L(jω)| ≫ 1; i.e., the bound on L is created by inverting the bound on S.
- MID: By means of Figure 2, the bound on S is translated to stability margins criteria on L. For a stable, minimum phase plant, Bode gain-phase relationship is normally used in shaping L(jω) in MID frequency to have sufficient phase margin. More on this later.
- HIGH: for small T(jω), we have T(jω) = L(jω)/1 + L(jω) ≈ L(jω) . Hence |T(jω)| ≪ 1 implies |L(jω)| ≪ 1; i.e., the bound on L is the same as the bound on T.

This can be summarized in Figure 3 and 4.

Figure 3 bounds on S and T

Figure 4 bounds on L

### Bode Gain-Phase Relationship

The stability requirement on L(jω) in Figure 4 may need more explanation. Suppose there is no stability requirement in terms of phase margin, we could make the magnitude of L to have its slope as steep as we want to easily satisfy both the low and high frequency bounds. Such simplicity is not feasible due to a constraint at the crossover frequency known as the Bode gain-phase relationship, which states that

*For a stable, minimum-phase system, the phase of any transfer function L(jω) has a unique relationship with its magnitude. On a log-log plot, if the slope of magnitude plot has a constant slope n over a decade of frequency, then *

This suggests a basic rule for stability of classical control design. For the closed loop system to have sufficient phase margin, within some frequency region around crossover, the slope of |L(jω)| must be approximately -1, or -20 dB/decade. This is depicted in Figure 4. may have higher slope in low and high frequency regions to satisfy the performance bounds, but at crossover it should try to maintain -20 dB/decade for some frequency band.

Now I hope the reader could grab the concept. No better way to understand classical control design than experimenting with a problem set.

Example: let us design a controller for our same old robot joint driven by DC motor developed since the first module

with the following design specs

- steady state error is eliminated
- low frequency disturbance is attenuated at least 0.01 below 1 Hz
- high frequency measurement noise is attenuated 0.1 above 100 Hz
- closed-loop stable, with phase margin at least 40 degrees

From the above discussion, this can be translated to stability and performance bounds

- L(s) has an integrator. Note that P(s) already has one
- |S(jω)| ≤ -40 dB ⇒ |L(jω)| ≥ 40 dB below 1 Hz
- |T(jω)| ≤ 20 dB ⇒ |L(jω)| ≤ 20 dB above 100 Hz
- L(jω) has at least 40 degrees phase margin, or max|S(jω)|≤ 3.3 dB*

* Problem 1 asks you to derive this relationship

To aid this design problem, we write a specific script file lshape.sce. Download this file and open it with SciNote. The variables for design specs 2 – 4 are initialized at the top of file, which you could later change to modify the bounds to your own specs. Right now we stick with the given values.

Let’s see how this script works. From module 2, we design a lead-lag compensator

that yields closed-loop stability and quite good tracking performance. This controller is the default when you first download the script. So we start our experiment with it. Run the script from Scilab command prompt

-->exec('lshape.sce',-1)

to observe the frequency responses versus bounds in Figure 5 and 6. Loopshaping procedure uses Figure 5 as a tool to design a controller, while Figure 6 is used to demonstrate the relationship between the frequency responses and bounds from open-loop and closed-loop systems.

Figure 5 plot of L(jω) versus bounds from lshape.sce

Figure 6 |S(jω)| and |T(jω)| versus bounds from lshape.sce

Notice from Figure 5 that, the lead-lag compensator (9) does not meet the low-frequency requirement. The curve of |L(jω)| must be above the 40 dB line shown in magenta for all frequency less than 1 Hz. The text in legend for LF bound also shows (violated!). As a result, the |S(jω)| curve in Figure 6 violates its LF bound, where it should be below the -40 dB level for all frequency less than 1 Hz.

So we need to design a new controller, obviously with more LF gain and higher bandwidth, to meet the specs. To demonstrate the Bode gain-phase relationship, let’s do something crazy by choosing a controller with only proportional gain of 60000. Figure 7 shows the resulting L(jω), with its magnitude curve above the LF bound and below the HF bound as desired. Checking the phase margin, however, we see that the system now has zero phase margin. The magnitude of S (and T) in Figure 8 also violates the stability bound. Can you explain what happens?

Go back to the Bode gain-phase relationship statement. This static gain controller results in the slope of |L(jω)| equals -40 dB/decade at crossover frequency. So its phase is -180 degree; i.e., no phase margin left. Simulate this system to verify that the step response should oscillate indefinitely.

Figure 7 plot of L(jω) versus bounds with static gain C = 60000

Figure 8 |S(jω)| and |T(jω)| versus bounds with static gain C=60000

So, to design a controller that meets all specs, the curve of |L(jω)| must be above the LF bound, pass the crossover at slope -20 dB/decade (and maintain this slope for as wide frequency range as possible to achieve enough phase margin), and roll off below the HF bound.

We recommend that the reader should first try shaping the loop by his/her own controller to understand the concept. If you don’t succeed or your patience run out, lshape.sce comes with a sample controller

Uncomment the lines that create this controller, and run the script to see Figure 9 and 10. The responses versus all stability and performance bounds confirm that this controller meets all the specs. The system has phase margin equal 55 degrees. The bandwidth is about 25 Hz.

Figure 9 plot of L(jω) versus bounds from controller (10)

Figure 10 |S(jω)| and |T(jω)| versus bounds from controller (10)

Use the Xcos model lshapesim.zcos in Figure 11 to simulate time-domain responses. What we want to verify in particular is design specs no 2 and 3; i.e., disturbance and measurement noise attenuation. The disturbance and measurement noise signals are set to 10sin 2πt and sin 200πt , respectively.

Figure 11 lshapesim.zcos — Xcos model for time-domain response simulation

So with disturbance attenuation of 0.01 and noise attenuation of 0.1, both signals should make the output oscillates at magnitude 0.1. Figure 12 and 13 confirms that both the specs are met.

Figure 12 disturbance attenuation response of controller (12)

Figure 13 measurement noise attenuation response of controller (12)

### Problems

1. Show that the relationship between phase margin φ and the maximum peak of |S(jω)| is given by

2. Use lshape.sce to design a controller to achieve disturbance attenuation performance of 0.001 (-60 dB). Other specs remain the same.

3. Design a controller to achieve disturbance attenuation of 0.01 (-40 dB) for frequency below 10 Hz. Other specs remain the same. Explain if you are unable to get a controller that meets these requirements.

### Supplement

- Control design using Bode plots – MIT OpenCourseWare
- Scilab tips: we have not discussed some commands in the CACSD group that may be helpful, such as g_margin and p_margin , which are quite convenient for computing gain and phase margins, respectively. Read Scilab help for usage of such commands.
- Scilab/files used in this module
- lshape.sce — Scilab script file for loopshaping design
- lshapesim.zcos — Xcos model file for time-domain simulation