Modelling and control by Anthony Rossiter

# GAIN AND PHASE MARGINS AND LEAD/LAG COMPENSATION

This is a section in the chapter on classical control analysis techniques. It brings together the sections on Bode and Nyquist and use insights from these as a tool for feedback design using lead and lag compensation. Use the left hand toolbar to access the other chapters and themes.

 It is implicit in several of these chapters that students have core competence in some mathematical topics such as polynomials, roots, complex numbers, exponentials and Laplace. More information on these can be found in the Mathematics theme on the left hand toobar. This section contains the following topics. Under each topic there are hardcopy (pdf) notes, a video talk through of key derivations with example problems and also a tutorial sheet for users to test themselves.

## Margins 1 - motivation and illustration of impact

Illustration of how the position of the Nyquist diagam relative to the -1 point tends to be directly related to the closed-loop behaviour. Uses several examples to show that being close to -1 tends to result in poor behaviour and also indicates that some formal measure of distance from -1 could be useful.

• A summary of key facts and derivations is given in the pdf file.
• A talk through video is on youtube.

#### Quick test question

Which statement is true?
A. -1 is significant because closed-loop poles come from GM=-1.
B. Ideally -1 should be on the right as that ensures poles are in the RHP.
C. Ideally Nyquist should be to the left of -1 as that ensures poles are in the LHP.
D. None of the above.

## Margins 2 - definition of gain margin

Introduces a definition of the distance of the Nyquist plot from the -1 point, that is the gain margin. Gives examples and pictures to help students understand this visually and a number of numerical examples to emphasise the procedure for computing the gain margin.

• A summary of key facts and derivations is given in the pdf file.
• A talk through video is on youtube.

#### Quick test question

Gain margin can be given as:
A. The distance between the intersection with the negative real axis and the -1 point.
B. The gain when Nyquist crosses the negative real axis.
C. -20log10(gain) when Nyquist crosses the negative real axis.
D. None of the above.

## Margins 3 - definition of phase margin

Introduces a definition of the distance of the Nyquist plot from the -1 point, that is the phase margin. Gives examples and pictures to help students understand this visually and a number of numerical examples to emphasise the procedure for computing the phase margin.

• A summary of key facts and derivations is given in the pdf file.
• A talk through video is on youtube.

## Margins 4 - using the bode diagram and MATLAB

Shows how gain and phase margins can be deduced directly from the Bode diagram and indeed can be estimated by inspection. Links margins to closed-loop stability to give visual insight into what from of Bode diagram is 'good' and what form is usually 'bad'. Demonstrates MATLAB tools which compute and illustrate gain and phase margins.

• A summary of key facts and derivations is given in the pdf file.
• A talk through video is on youtube.

## Margins 5 - tutorial sheet

Goes through a number of examples, to demonstrate the computation of gain and phase margins. Some examples are analytic and some make use of Bode diagrams. [WARNING: minor typo at about 11min 40 sec where a superscript is wrong side of a bracket - should be (4-5.642)=-31.8 ]

• A summary of key facts and derivations is given in the pdf file.
• A talk through video is on youtube.

## Margins 6 - effect of changing compensator gain on the gain margin

Shows how change in compensator gain has a very simple affect on the gain margin. Presents simple formulae for this effect and several illustrations. Emphasises the use of Bode diagrams for margin computation and also shows how to achieve a specified gain margin with an elementary computation.

• A summary of key facts and derivations is given in the pdf file.
• A talk through video is on youtube.

#### Quick test question

Increasing gain has what effect on the gain margin?
A. Gain margin in decibels decreases.
B. Gain margin increases.
C. The sign of the gain margin in decibels is unaffected.
D. None of the above.

## Margins 7 - effect of changing compensator gain on the phase margin

Shows how change in compensator gain has a non-simple affect on the phase margin, but by using the Bode diagram, the affect is obvious. Uses the phase margin definition to show how it is very simple to specify the required gain to achieved a desired phase margin. Examples demonstrate this both analytically and using Bode diagrams, the latter being more pragmatic for many systems.

## Margins 8 - example designs changing compensator gain to achived desired phase margin

Develops the previous two videos by giving a number of worked examples showing how to achieve a desired phase margin just by changes in gain. Uses analytic methods, Bode diagrams and MATLAB tools.

• A summary of key facts and derivations is given in the pdf file.
• A talk through video is on youtube.

## Margins 9 - the affect of lag compensators on margins

Reviews the impact of a lag compensator on the Bode diagram and hence shows how this affects the margins. This insight is used to develop good and bad practice in lag compensator design. The video finishes with a mechanistic rule base for lag compensator design - something that is useful for very rapid rough tuning (but not necessarily a final design).

• A summary of key facts and derivations is given in the pdf file.
• Talk through video is on youtube.

## Margins 10 - mechanistic lag compensation design with MATLAB

Shows how MATLAB tools can be used quickly and efficiently to implement, and illustrate, the mechanistic design procedure for a lag compensator. Designs are based on a target phase margin and desired steady-state gain recovery. Further fine tuning would be needed in practice.

## Margin 11 - the affect of lead compensators on margins

Reviews the impact of a lead compensator on the Bode diagram and hence shows how this affects the margins. This insight is used to develop good and bad practice in lead compensator design. The video finishes with a mechanistic rule base for lead compensator design - something that is useful for very rapid rough tuning (but not necessarily a final design).

• A summary of key facts and derivations is given in the pdf file.
• Talk through video is on youtube.

## Margins 12 - mechanistic lead compensation design with MATLAB

Shows how MATLAB tools can be used quickly and efficiently to implement, and illustrate, the mechanistic design procedure for a lead compensator. Designs are based on a target gain cross over frequency and a target phase margin. Further fine tuning would be needed in practice. [Two obvious typos: (i) on 5min 30 (author writes square root of beta instead of just beta) and (ii) around 13min 30 (author uses a cross over frequency of 9.75 in lead design as opposed to 9.43)].

• A tutorial sheet with key facts and problems is given in the pdf file.
• Talk through video is on youtube.
• MATLAB files with key data is in margin12.m

## Margins 13 - affect of lead-lag compensation on margins

Reviews the impact of lead and lag compensators and hence presents an argument for compensators which include both these components. This insight is used to propose and illustrate a simple mechanistic design procedure for lead-lag compensators, assuming that the specification includes three objectives: (i) gain cross over frequency; (ii) phase margin and (iii) low frequency gain characteristics.

• Talk through video is on youtube.

## Margins 14 - lead-lag compensation with MATLAB

Shows how MATLAB tools can be used quickly and efficiently to implement, and illustrate, the mechanistic design procedure for a lead-lag compensator. Designs are based on a target gain cross over frequency and a target phase margin. Further fine tuning would be needed in practice.

• Talk through video is on youtube.

## Margins 15 - what is an ideal phase margin?

Presents analysis which explains the basis for the use of a 60 degree phase margin as a good target. Illustrates the limitations of this assumption through numerous examples.

• Talk through video is on youtube.

## Margins 16 - exam question 1 on margins and and compensators

Presents a typical examination questions for students to attempt. Covers basic analysis tools of Nyquist, Bode and root-loci and analysis of potential lead/lag compensators. Also gives a worked solution. [Silly typo in construction of Bode gain plot - asymptote drawn to w=root(3) rather than w=3.]

• Talk through video is on youtube.

## Margins 17 - exam question 2 on margins and compensators

Presents a typical examination questions for students to attempt. Covers basic analysis tools of Nyquist, Bode and root-loci and analysis of potential lead/lag compensators. Also gives a worked solution.

• Talk through video is on youtube.

## Margins 20 - Aeroplane roll example with lead compensator design

This GUI is focussed on the process of finding a lead compensator for roll control in an aircraft, and of course assessing the efficacy and limitations. Students are able to see the Bode and root-loci diagrams and select the lead parameters as well as viewing the impact on behaviour. The aeroplane time constant and gain can also be changed.

• A short video introduction to the GUI is available here.
• A summary of the GUI and the underlying context is given in the pdf file.
• The GUI (a MATLAB p-file and fig file) are available here (both needed).