A brief and practical introduction to Control
Table of ContentsClose
This document is also available as a pdf.
Introduction
The purpose of this document is to give a practical introduction to the wonderful world of
No attend is made to provide an exhaustive treatment of the subject.
When possible, Matlab scripts used for the example/exercises are provided such that you can easily test them on your computer.
The general structure of this document is as follows:
- A short introduction to model based control is given in Section 1
- Classical open loop shaping method is presented in Section 2.
It is also shown that
synthesis can be used for open loop shaping - Important concepts indispensable for
control such as the norm and the generalized plant are introduced in Section 3 - A very important step in
control is to express the control specifications (performances, robustness, etc.) as an optimization problem. Such procedure is described in Section 4 - One of the most useful use of the
control is the shaping of closed-loop transfer functions. Such technique is presented in Section 5 - Finally, complete examples of the use of
Control for practical problems are provided in Section 6
1 Introduction to Model Based Control
1.1 Model Based Control - Methodology
The typical methodology for Model Based Control techniques is schematically shown in Figure 1.
It consists of three steps:
- Identification or modeling: a mathematical model
representing the plant dynamics is obtained - Translate the specifications into mathematical criteria:
- Specifications: Response Time, Noise Rejection, Maximum input amplitude, Robustness, …
- Mathematical Criteria: Cost Function, Shape of transfer function, Phase/Gain margin, Roll-Off, …
- Synthesis: research of a controller
that satisfies the specifications for the model of the system
Figure 1: Typical Methodoly for Model Based Control
In this document, we will suppose a model of the plant is available (step 1 already performed), and we will focus on steps 2 and 3.
In Section 2, steps 2 and 3 will be described for a control techniques called classical (open-)loop shaping.
Then, steps 2 and 3 for the
1.2 From Classical Control to Robust Control
Many different model based control techniques have been developed since the birth of classical control theory in the ’30s.
Classical control methods were developed starting from 1930 based on tools such as the Laplace and Fourier transforms. It was then natural to study systems in the frequency domain using tools such as the Bode and Nyquist plots. Controllers were manually tuned to optimize criteria such as control bandwidth, gain and phase margins.
The ’60s saw the development of control techniques based on a state-space. Linear algebra and matrices were used instead of the frequency domain tool of the class control theory. This allows multi-inputs multi-outputs systems to be easily treated. Kalman introduced the well known Kalman estimator as well the notion of optimality by minimizing quadratic cost functions. This set of developments is loosely termed Modern Control theory.
By the 1980’s, modern control theory was shown to have some robustness issues and to lack the intuitive tools that the classical control methods were offering. This led to a new control theory called Robust control that blends the best features of classical and modern techniques. This robust control theory is the subject of this document.
The three presented control methods are compared in Table 1.
Note that in parallel, there have been numerous other developments, including non-linear control, adaptive control, machine-learning control just to name a few.
Classical Control | Modern Control | Robust Control | |
---|---|---|---|
Date | 1930- | 1960- | 1980- |
Tools | Transfer Functions | State Space formulation | Systems/Signal Norms |
Nyquist, Bode Plots | Riccati Equations | Closed Loop TF | |
Root Locus | Kalman Filters | Closed Loop Shaping | |
Phase/Gain margins | Weighting Functions | ||
Open Loop Shaping | Disk margin | ||
Controllers | P, PI, PID | Full State Feedback | General Control Conf. |
Leads, Lags | LQG, LQR | ||
Advantages | Study Stability | Automatic Synthesis | Automatic Synthesis |
Simple | MIMO | MIMO | |
Natural | Optimization Problem | Optimization Problem | |
Guaranteed Robustness | |||
Disadvant. | Manual Method | No Guaranteed Robustness | Requires knowledge of tools |
Only SISO | Rejection of Pert. | Need good model of the system | |
No input usage lim. |
1.3 Example System
Throughout this document, multiple examples and practical application of presented control strategies will be provided. Most of them will be applied on a physical system presented in this section.
This system is shown in Figure 2. It could represent an active suspension stage supporting a payload. The inertial motion of the payload is measured using an inertial sensor and this is feedback to a force actuator. Such system could be used to actively isolate the payload (disturbance rejection problem) or to make it follow a trajectory (tracking problem).
The notations used on Figure 2 are listed and described in Table 2.
Figure 2: Test System consisting of a payload with a mass
Notation | Description | Value | Unit |
---|---|---|---|
Payload’s mass to position / isolate | [kg] | ||
Stiffness of the suspension system | [N/m] | ||
Damping coefficient of the suspension system | [N/(m/s)] | ||
Payload absolute displacement (measured by an inertial sensor) | [m] | ||
Ground displacement, it acts as a disturbance | [m] | ||
Actuator force | [N] | ||
Wanted position of the mass (the reference) | [m] | ||
Position error | [m] | ||
Feedback controller | to be designed | [N/m] |
Exercice
Derive the following open-loop transfer functions:
Hint
You can follow this generic procedure:
- List all applied forces ot the mass: Actuator force, Stiffness force (Hooke’s law), …
- Apply the Newton’s Second Law on the payload
- Transform the differential equations into the Laplace domain:
- Write
as a function of and
Results
Having obtained
Figure 3: Block diagram corresponding to the example system of Figure 2
Let’s define the system parameters on Matlab.
Copy1: k = 1e6; % Stiffness [N/m] 2: c = 4e2; % Damping [N/(m/s)] 3: m = 10; % Mass [kg]
And now the system dynamics
Copy4: G = 1/(m*s^2 + c*s + k); % Plant 5: Gd = (c*s + k)/(m*s^2 + c*s + k); % Disturbance
The Bode plots of
Figure 4: Bode plot of the plant
Figure 5: Magnitude of the disturbance transfer function
2 Classical Open Loop Shaping
After an introduction to classical Loop Shaping in Section 2.1, a practical example is given in Section 2.2. Such Loop Shaping is usually performed manually with tools coming from the classical control theory.
However, the
2.1 Introduction to Loop Shaping
Definition
Loop Shaping refers to a control design procedure that involves explicitly shaping the magnitude of the Loop Transfer Function
Definition
The Loop Gain (or Loop transfer function)
Its name comes from the fact that this is actually the “gain around the loop”.
Figure 6: Classical Feedback Architecture
This synthesis method is one of main way controllers are design in the classical control theory.
It is widely used and generally successful as many characteristics of the closed-loop system depend on the shape of the open loop gain
- Good Tracking:
large - Good disturbance rejection:
large - Attenuation of measurement noise on plant output:
small - Small magnitude of input signal:
small - Nominal stability:
small (RHP zeros and time delays) - Robust stability:
small (neglected dynamics)
The shaping of the Loop Gain is done manually by combining several leads, lags, notches…
This process is very much simplified by the fact that the loop gain
Figure 7: Typical Wanted Shape for the Loop Gain
The shaping of closed-loop transfer functions is obviously not as simple as they don’t depend linearly on
2.2 Example of Manual Open Loop Shaping
Example
Let’s take our example system described in Section 1.3 and design a controller using the Open-Loop shaping synthesis approach. The specifications are:
- Disturbance rejection: Highest possible rejection below 1Hz
- Positioning speed: Bandwidth of approximately 10Hz
- Noise attenuation: Roll-off of -40dB/decade past 30Hz
- Robustness: Gain margin > 3dB and Phase margin > 30 deg
Exercice
Using SISOTOOL
, design a controller that fulfills the specifications.
Copysisotool(G)
Hint
You can follow this procedure:
- In order to have good disturbance rejection at low frequency, add a simple or double integrator
- In terms of the loop gain, the bandwidth can be defined at the frequency
where first crosses 1 from above. Therefore, adjust the gain such that crosses 1 at around 10Hz - The roll-off at high frequency for noise attenuation should already be good enough. If not, add a low pass filter
- Add a Lead centered around the crossover frequency (10 Hz) and tune it such that sufficient phase margin is added. Verify that the gain margin is good enough.
Let’s say we came up with the following controller.
CopyK = 14e8 * ... % Gain 1/(s^2) * ... % Double Integrator 1/(1 + s/2/pi/40) * ... % Low Pass Filter (1 + s/(2*pi*10/sqrt(8)))/(1 + s/(2*pi*10*sqrt(8))); % Lead
The bode plot of the Loop Gain is shown in Figure 8 and we can verify that we have the wanted stability margins using the margin
command:
Copy[Gm, Pm, ~, Wc] = margin(G*K)
Requirements | Manual Method |
---|---|
Gain Margin |
3.1 |
Phase Margin |
35.4 |
Crossover |
10.1 |
Figure 8: Bode Plot of the obtained Loop Gain
2.3 Loop Shaping Synthesis
The synthesis of controllers based on the Loop Shaping method can be automated using the
Using Matlab, it can be easily performed using the loopsyn
command:
CopyK = loopsyn(G, Lw);
where:
G
is the (LTI) plantLw
is the wanted loop shapeK
is the synthesize controller
See also
Matlab documentation of loopsyn
(link).
Therefore, by just providing the wanted loop shape and the plant model, the
Even though we will not go into details and explain how such synthesis is working, an example is provided in the next section.
2.4 Example of the Loop Shaping Synthesis
To apply the
Such shape corresponds to the typical wanted Loop gain Shape shown in Figure 7.
Specification | Corresponding Loop Shape | |
---|---|---|
Dist. Rej. | Highest possible rejection below 1Hz | Slope of -40dB/dec at low frequency |
Pos. Speed | Bandwidth of approximately 10Hz | |
Noise Att. | Roll-off of -40dB/decade past 30Hz | Roll-off of -40dB/decade past 30Hz |
Robustness | Slope of -20dB/decade near the crossover |
Then, a (stable, minimum phase) transfer function
Using Matlab, we have:
CopyLw = 2.3e3 * ... 1/(s^2) * ... % Double Integrator (1 + s/(2*pi*10/sqrt(3)))/(1 + s/(2*pi*10*sqrt(3))); % Lead
The loopsyn
command:
Copy[K, ~, GAM] = loopsyn(G, Lw);
The obtained Loop Gain is shown in Figure 9 and matches the specified one by a factor
Figure 9: Obtained Open Loop Gain
Important
When using the
This is usually done by breaking down the controller into simple elements such as low pass filters, high pass filters, notches, leads, etc.
Let’s briefly analyze the obtained controller which bode plot is shown in Figure 10:
- two integrators are used at low frequency to have the wanted low frequency high gain
- a lead is added centered with the crossover frequency to increase the phase margin
- a notch is added at the resonance of the plant to increase the gain margin (this is very typical of
controllers, and can be an issue, more info on that latter)
Figure 10: Obtained controller
Let’s finally compare the obtained stability margins of the
Specifications | Manual Method | |
---|---|---|
Gain Margin |
3.1 | 31.7 |
Phase Margin |
35.4 | 54.7 |
Crossover |
10.1 | 9.9 |
3 A first Step into the world
In this section, the
After the
The generalized plant, a very useful tool to describe a control problem, is presented in Section 3.3.
The
Finally, an example showing how to convert a typical feedback control architecture into a generalized plant is given in Section 3.5.
3.1 The Norm
Definition
The
For a single-input single-output system
Example
Let’s compute the hinfnorm
function:
Copyhinfnorm(G)
7.9216e-06
We can see in Figure 11 that indeed, the
Figure 11: Example of the
3.2 Synthesis
Definition
The
Why optimizing the
Important
Then applying the
- Write the problem as standard
problem using the generalized plant (described in the next section) - Translate the specifications as
norms of transfer functions (Section 4) - Make the synthesis and analyze the obtained controller
As the
Note that there are many ways to use the
3.3 The Generalized Plant
The first step when applying the
The generalized plant, usually noted
The meaning of these inputs and outputs are summarized in Table 5.
A practical example about how to derive the generalized plant for a classical control problem is given in Section 3.5.
Important
Figure 12: Inputs and Outputs of the generalized Plant
Notation | Meaning |
---|---|
Generalized plant model | |
Exogenous inputs: references, disturbances, noises | |
Exogenous outputs: signals to be minimized | |
Controller inputs: measurements | |
Control signals |
3.4 The Synthesis applied on the Generalized plant
Once the generalized plant is obtained, the
Important
Synthesis applied on the generalized plant
Find a stabilizing controller
After
The obtained controller
Figure 13: General Control Configuration
Using Matlab, the hinfsyn
command (documentation):
CopyK = hinfsyn(P, nmeas, ncont);
where:
P
is the generalized plant transfer function matrixnmeas
is the number of sensed output (size of )ncont
is the number of control signals (size of )K
obtained controller (of sizencont x nmeas
) that minimizes the norm from to .
Note that the general control configure of Figure 13, as its name implies, is quite general and can represent feedback control as well as feedforward control architectures.
3.5 From a Classical Feedback Architecture to a Generalized Plant
The procedure to convert a typical control architecture as the one shown in Figure 14 to a generalized Plant is as follows:
- Define signals of the generalized plant:
, , and - Remove
and rearrange the inputs and outputs to match the generalized configuration shown in Figure 12
Exercice
Consider the feedback control architecture shown in Figure 14.
Suppose we want to design
- Convert the control architecture to a generalized configuration
- Compute the transfer function matrix of the generalized plant
using Matlab as a function or and
Figure 14: Classical Feedback Control Architecture (Tracking)
Hint
First, define the signals of the generalized plant:
- Exogenous inputs:
- Signals to be minimized:
Usually, we want to minimize the tracking errors
and the control signal : - Controller inputs: this is the signal at the input of the controller:
- Controller outputs: signal generated by the controller:
Then, Remove
Answer
The obtained generalized plant shown in Figure 15.
Figure 15: Generalized plant of the Classical Feedback Control Architecture (Tracking)
Using Matlab, the generalized plant can be defined as follows:
CopyP = [1 -G; 0 1; 1 -G] P.InputName = {'w', 'u'}; P.OutputName = {'e', 'u', 'v'};
4 Modern Interpretation of Control Specifications
As shown in Section 2, the loop gain
However, the loop gain
The modern interpretation of control specifications then consists of determining the required shape of the closed-loop transfer functions such that the system behavior corresponds to the requirements.
Once this is done, the
One of the most important closed-loop transfer function is called the sensitivity function. Its link with the closed-loop behavior of the feedback system is studied in Section 4.2.
The robustness (stability margins) of the system can also be linked to the shape of the sensitivity function with the use of the module margin (Section 4.3).
Links between typical control specifications and shapes of the closed-loop transfer functions are summarized in Section 4.4.
4.1 Closed Loop Transfer Functions and the Gang of Four
Consider the typical feedback system shown in Figure 16.
The behavior (performances) of this feedback system is determined by the closed-loop transfer functions from the inputs (
Depending on the specification, different closed-loop transfer functions do matter. These are summarized in Table 6.
Figure 16: Simple Feedback Architecture with
Specification | CL Transfer Function |
---|---|
Reference Tracking | From |
Disturbance Rejection | From |
Measurement Noise Filtering | From |
Small Command Amplitude | From |
Stability | All |
Robustness (stability margins) | Module margin (see Section 4.3) |
Exercice
For the feedback system in Figure 16, write the output signals
Hint
Take one of the output (e.g.
Isolate
Do the same procedure for
Answer
The following equations should be obtained:
Important
We can see that they are 4 different closed-loop transfer functions describing the behavior of the feedback system in Figure 16. These called the Gang of Four:
See also
If a feedforward controller is included, a Gang of Six transfer functions can be defined. More on that in this short video.
The behavior of the feedback system in Figure 16 is fully described by the following set of equations:
Thus, for reference tracking, we have to shape the closed-loop transfer function from
4.2 The Sensitivity Function
The sensitivity function is indisputably the most important closed-loop transfer function of a feedback system. In this section, we will see how the shape of the sensitivity function will impact the performances of the closed-loop system.
Suppose we have developed a “reference” controller
The comparison of the sensitivity functions shapes and their effect on the step response is summarized in Table 7.
Controller | Sensitivity Function Shape | Change of the Step Response |
---|---|---|
Larger bandwidth |
Faster rise time | |
Larger peak value |
Large overshoot and oscillations | |
Larger low frequency gain |
Larger static error |
Figure 17: Sensitivity function magnitude
Figure 18: Step response (response from
Definition
- Closed-Loop Bandwidth
The closed-loop bandwidth
is the frequency where first crosses from below.In general, a large bandwidth corresponds to a faster rise time.
Important
From the simple analysis above, we can draw a first estimation of the wanted shape for the sensitivity function (Figure 19):
- A small magnitude at low frequency to make the static errors small
- A wanted minimum closed-loop bandwidth in order to have fast rise time and good rejection of perturbations
- A small peak value (small
norm) in order to limit large overshoot and oscillations. This generally means higher robustness. This will become clear in the next section about the module margin.
Figure 19: Typical wanted shape of the Sensitivity transfer function
4.3 Robustness: Module Margin
Let’s start this section by an example demonstrating why the phase and gain margins might not be good indicators of robustness.
Will follow a discussion about the module margin, a robustness indicator that can be linked to the
Example
Consider the following plant
Copyw0 = 2*pi*100; xi = 0.1; k = 1e7; Gt = 1/k*(s/w0/4 + 1)/(s^2/w0^2 + 2*xi*s/w0 + 1);
Let’s say we have designed a controller
CopyKt = 1.2e6*(s + w0)/s;
The following characteristics can be determined from the Loop gain in Figure 20:
- Control bandwidth of
- Infinite gain margin (the phase of the loop-gain never reaches
) - More than
of phase margin
This clearly indicate very good robustness of the closed-loop system! Or does it? Let’s find out.
Figure 20: Bode plot of the obtained Loop Gain
Now let’s suppose the controller is implemented in practice, and the “real” plant
Copyxi = 0.03;
The obtained “real” loop gain is shown in Figure 21. At a frequency little bit above 100Hz, the phase of the loop gain reaches -180 degrees while its magnitude is more than one which indicates instability.
It is confirmed by checking the stability of the closed loop system:
Copyisstable(feedback(Gr,K))
0
Figure 21: Bode plots of
Therefore, even a small change of the plant parameter renders the system unstable even though both the gain margin and the phase margin for the nominal plant are excellent.
This is due to the fact that the gain and phase margin are robustness indicators corresponding a pure change or gain or a pure change of phase but not a combination of both.
Let’s now determine a new robustness indicator based on the Nyquist Stability Criteria.
Definition
- Nyquist Stability Criteria (for stable systems)
- If the open-loop transfer function
is stable, then the closed-loop system will be unstable for any encirclement of the point on the Nyquist plot. - Nyquist Plot
- The Nyquist plot shows the evolution of
in the complex plane from .
See also
For more information about the general Nyquist Stability Criteria, you may want to look at this video.
From the Nyquist stability criteria, it is clear that we want
Definition
- Module Margin
- The Module Margin
is defined as the minimum distance between the point and the loop gain in the complex plane.
Example
A typical Nyquist plot is shown in Figure 22. The gain, phase and module margins are graphically shown to have an idea of what they represent.
Figure 22: Nyquist plot with visual indication of the Gain margin
As expected from Figure 22, there is a close relationship between the module margin and the gain and phase margins.
We can indeed show that for a given value of the module margin
Let’s now try to express the Module margin
Therefore, for a given
Important
The
The wanted robustness of the closed-loop system can be specified by setting a maximum value on
Note that this is why large peak value of
Example
Typical, we require
See also
To learn more about module/disk margin, you can check out this video.
4.4 Summary of typical specification and associated wanted shaping
Open-Loop Shaping | Closed-Loop Shaping | |
---|---|---|
Reference Tracking | ||
Disturbance Rejection | ||
Measurement Noise Filtering | ||
Small Command Amplitude | ||
Robustness | Phase/Gain margins | Module margin: |
5 Shaping of closed-loop transfer functions
In the previous sections, we have seen that the performances of the system depends on the shape of the closed-loop transfer function.
Therefore, the synthesis problem is to design
To do so, weighting functions are included in the generalized plant and the
Some advice on the design of weighting functions are given in Section 5.2.
An example of the
Multiple closed-loop transfer functions can be shaped at the same time. Such synthesis is usually called Mixed-sensitivity Loop Shaping and is one of the most powerful tool of the robust control theory. Some insight on the use and limitations of such techniques are given in Section 5.4.
5.1 How to Shape closed-loop transfer function? Using Weighting Functions!
Suppose we apply the
However, as the
Figure 23: Generalized Plant
Important
The trick is to include a weighting function
Now, the closed-loop transfer function from
Let’s now show how this is equivalent as shaping the sensitivity function:
Important
As shown in Equation
Therefore, the choice of the weighting function
Figure 24: Weighted Generalized Plant
Exercice
Using matlab, compute the weighted generalized plant shown in Figure 25 as a function of
Hint
The weighted generalized plant can be defined in Matlab using two techniques:
- by writing manually the 4 transfer functions from
to - by pre-multiplying the (non-weighted) generalized plant by a block-diagonal transfer function matrix containing the weights for the outputs
and1
for the outputs
Answer
The two solutions below can be used.
CopyPw = [Ws -Ws*G; 1 -G];
The second solution is however more general, and can also be used when weights are added at the inputs by post-multiplying instead of pre-multiplying.
CopyP = [1 -G; 1 -G]; Pw = blkdiag(Ws, 1)*P;
5.2 Design of Weighting Functions
Weighting function included in the generalized plant must be proper, stable and minimum phase transfer functions.
Definition
- proper
- more poles than zeros, this implies
- stable
- no poles in the right half plane
- minimum phase
- no zeros in the right half plane
Good guidelines for design of weighting function are given in [2].
There is a Matlab function called makeweight
that allows to design first-order weights by specifying the low frequency gain, high frequency gain, and the gain at a specific frequency:
CopyW = makeweight(dcgain,[freq,mag],hfgain)
with:
dcgain
: low frequency gain[freq,mag]
: frequencyfreq
at which the gain ismag
hfgain
: high frequency gain
Example
The Matlab code below produces a weighting function with the following characteristics (Figure 25):
- Low frequency gain of 100
- Gain of 1 at 10Hz
- High frequency gain of 0.5
CopyWs = makeweight(1e2, [2*pi*10, 1], 1/2);
Figure 25: Obtained Magnitude of the Weighting Function
See also
Quite often, higher orders weights are required.
In such case, the following formula can be used:
The parameters permit to specify:
- the low frequency gain:
- the high frequency gain:
- the absolute gain at
: - the absolute slope between high and low frequency:
A Matlab function implementing Equation
Copyfunction [W] = generateWeight(args) arguments args.G0 (1,1) double {mustBeNumeric, mustBePositive} = 0.1 args.G1 (1,1) double {mustBeNumeric, mustBePositive} = 10 args.Gc (1,1) double {mustBeNumeric, mustBePositive} = 1 args.wc (1,1) double {mustBeNumeric, mustBePositive} = 2*pi args.n (1,1) double {mustBeInteger, mustBePositive} = 1 end if (args.Gc <= args.G0 && args.Gc <= args.G1) || (args.Gc >= args.G0 && args.Gc >= args.G1) eid = 'value:range'; msg = 'Gc must be between G0 and G1'; throwAsCaller(MException(eid,msg)) end s = zpk('s'); W = (((1/args.wc) * sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.G1)^(2/args.n)))*s + (args.G0/args.Gc)^(1/args.n)) / ((1/args.G1)^(1/args.n) * (1/args.wc) * sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.G1)^(2/args.n)))*s + (1/args.Gc)^(1/args.n)))^args.n; end
Let’s use this function to generate three weights with the same high and low frequency gains, but but different slopes.
CopyW1 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 1); W2 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 2); W3 = generateWeight('G0', 1e2, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 3);
The obtained shapes are shown in Figure 26.
Figure 26: Higher order weights using Equation
5.3 Shaping the Sensitivity Function
Let’s design a controller using the
- Bandwidth of at least 10Hz
- Small static errors for step responses
- Robustness: Large module margin
( and )
As usual, the plant used is the one presented in Section 1.3.
Exercice
Translate the requirements as upper bounds on the Sensitivity function and design the corresponding weighting functions using Matlab.
Hint
The typical wanted upper bound of the sensitivity function is shown in Figure 27.
More precisely:
- Recall that the closed-loop bandwidth is defined as the frequency
first crosses from below - For the small static error, -60dB is usually enough as other factors (measurement noise, disturbances) will anyhow limit the performances
- Recall that the module margin is equal to the inverse of the
norm of the sensitivity function:
Remember that the wanted upper bound of the sensitivity function is defined by the inverse magnitude of the weight.
Figure 27: Typical wanted shape of the Sensitivity transfer function
Answer
We want to design the weighting function
Using Matlab, such weighting function can be generated using the makeweight
function as shown below:
CopyWs = makeweight(1e3, [2*pi*10, sqrt(2)], 1/2);
Or using the generateWeight
function:
CopyWs = generateWeight('G0', 1e3, ... 'G1', 1/2, ... 'Gc', sqrt(2), 'wc', 2*pi*10, ... 'n', 2);
Let’s say we came up with the following weighting function:
CopyWs = generateWeight('G0', 1e3, ... 'G1', 1/2, ... 'Gc', sqrt(2), 'wc', 2*pi*10, ... 'n', 2);
The weighting function is then added to the generalized plant.
CopyP = [1 -G; 1 -G]; Pw = blkdiag(Ws, 1)*P;
And the
CopyK = hinfsyn(Pw, 1, 1, 'Display', 'on');
Test bounds: 0.5 <= gamma <= 0.51 gamma X>=0 Y>=0 rho(XY)<1 p/f 5.05e-01 0.0e+00 0.0e+00 3.000e-16 p Limiting gains... 5.05e-01 0.0e+00 0.0e+00 3.461e-16 p 5.05e-01 -3.5e+01 # -4.9e-14 1.732e-26 f Best performance (actual): 0.503
This is indeed what we can see by comparing
Important
Obtaining
Yet, obtaining a
Figure 28: Weighting function and obtained closed-loop sensitivity
5.4 Shaping multiple closed-loop transfer functions - Limitations
As was shown in Section 4, each of the four main closed-loop transfer functions (called the gang of four) will impact different characteristics of the closed-loop system. This is summarized in Table 9.
Therefore, we might want to shape multiple closed-loop transfer functions at the same time.
For instance
Specifications | TF | Wanted shape |
---|---|---|
Fast Reference Tracking | Set lower bound on the bandwidth | |
Small Steady State Errors | Small low frequency gain | |
Follow Step ref. inputs | Slope of +20dB/dec at low frequency | |
Follow Ramp ref. inputs | Slope of +40dB/dec at low frequency | |
Follow Sin. ref. inputs | Small magnitude centered on the sin. frequency | |
Output Disturbance Rejection | Small gain in the disturbance bandwidth | |
Input Disturbance Rejection | Small gain in the disturbance bandwidth | |
Prevent notching resonances | Limit gain around resonance | |
Small Command Amplitude | Small at high frequency | |
Limitation of the Bandwidth | Set an upper bound on the bandwidth | |
Measurement Noise Filtering | Small high frequency gain | |
Stability margins | Module margin: |
|
Robust to unmodelled dynamics | Small at freq. where uncertainty is large |
Depending on which closed-loop transfer function are to be shaped, different weighted generalized plant can be used. Some of them are described below for reference, it is a good exercise to try to re-design such weighted generalized plants.
Shaping of S and KS
Figure 29: Generalized Plant to shape
Weighting functions:
is used to shape is used to shape
CopyP = [1 -G 0 1 1 -G]; Pw = blkdiag(W1, W2, 1)*P;
Shaping of S and T
Figure 30: Generalized Plant to shape
Weighting functions:
is used to shape is used to shape
CopyP = [1 -G 0 G 1 -G]; Pw = blkdiag(W1, W2, 1)*P;
Shaping of S and GS
Figure 31: Generalized Plant to shape
Weighting functions:
is used to shape is used to shape
CopyP = [1 -1 G -G G -G]; Pw = blkdiag(W1, W2, 1)*P;
Shaping of S, T and KS
Figure 32: Generalized Plant to shape
Weighting functions:
is used to shape is used to shape is used to shape
CopyP = [1 -G 0 1 0 G 1 -G]; Pw = blkdiag(W1, W2, W3, 1)*P;
Shaping of S, T and GS
Figure 33: Generalized Plant to shape
Weighting functions:
is used to shape is used to shape is used to shape
CopyP = [1 -1 G -G 0 1 G -G]; Pw = blkdiag(W1, W2, W3, 1)*P;
Shaping of S, T, KS and GS
Figure 34: Generalized Plant to shape
Weighting functions:
is used to shape is used to shape is used to shape is used to shape
CopyP = [ 1 -G -G 0 0 1 1 -G -G]; Pw = blkdiag(W1, W2, 1)*P*blkdiag(1, W3, 1);
Important
When shaping multiple closed-loop transfer functions, one should be very careful about the three following points that are further discussed:
- The shaped closed-loop transfer functions are linked by mathematical relations and cannot be shaped independently
- Closed-loop transfer function can only be shaped in certain frequency range
- The size of the obtained controller may be very large and not implementable in practice
Warning
Mathematical relations are linking the closed-loop transfer functions.
For instance, the sensitivity function
This means that
It is therefore not possible to shape the four closed-loop transfer functions independently. The weighting function should be carefully design such as these fundamental relations are not violated.
For practical control systems, above some frequency (the control bandwidth), the loop gain is much smaller than 1. On the other size, there is a frequency range where the loop gain is much larger than 1, this frequency range is called the bandwidth. Let’s see what does that means for the closed-loop transfer function. First, take the case of the sensibility function:
This means that the Sensitivity function cannot be shaped at frequencies where the loop gain is small.
Similar relationship can be found for
Exercice
Determine the approximate norms of
Hint
You can follows this procedure for
- Write the closed-loop transfer function as a function of
and - Take
and conclude on the norm of the closed-loop transfer function - Take
and conclude
Answer
The obtained constrains are shown in Figure 35.
Depending on the frequency band, the norms of the closed-loop transfer functions are a function of the controller
Therefore the weighting functions should only focus on certainty frequency range depending on the transfer function being shaped. These regions are summarized in Figure 35.
Figure 35: Shaping the Gang of Four. Blue regions indicate that the transfer function can be shaped using
Warning
The order (e.g. number of state) of the controller given by the
Two approaches can be used to obtain controllers with reasonable order:
- use simple weights (usually first order)
- perform a model reduction on the obtained high order controller
6 Mixed-Sensitivity Control - Example
Let’s now apply the
In Section 6.1 the control problem is presented.
The design procedure used to apply the
The important step of interpreting the specifications as wanted shape of closed-loop transfer functions is performed in Section 6.3.
Finally, the shaping of closed-loop transfer functions is performed in Sections 6.4, 6.5 and 6.6.
6.1 Control Problem
Let’s consider our usual test system shown in Figure 36.
Figure 36: Test System consisting of a payload with a mass
Important
The control specifications are:
- The displacement
should follow reference inputs with negligible static error after 0.1s - Reject disturbances
in less than 0.1s - Limit the effect of measurement noise
on the output displacement - Obtain a Robust System with good stability margins
The considered inputs are:
- disturbances
as step inputs with an amplitude of - reference inputs with are ramp inputs with a slope of
and a time duration of - measurement noise
with a large spectral density at high frequency (increasing starting from 100Hz)
6.2 Control Design Procedure
Here is the general design procedure that will be followed:
- Compute the model of the plant
- Write the control system as a general control problem
- Translate the specifications into the wanted shape of closed-loop transfer functions
- Chose the suitable weighted general plant to shape the wanted quantities
- Shape sequentially the chosen closed-loop transfer functions
Let’s first convert the system of Figure 36 into the classical feedback architecture of Figure 37.
Figure 37: Block diagram corresponding to the example system
The two transfer functions present in the system are derived and defined below:
Copy1: k = 1e6; % Stiffness [N/m] 2: c = 4e2; % Damping [N/(m/s)] 3: m = 10; % Mass [kg] 4: 5: % Control Plant 6: G = 1/(m*s^2 + c*s + k); 7: % Disturbance dynamics 8: Gd = (c*s + k)/(m*s^2 + c*s + k);
We also define the inputs signals that will be used for time domain simulations. They are graphically shown in Figure 38.
Copy9: % Time Vector 10: t = 0:1e-4:0.5; 11: 12: % Reference Input 13: r = zeros(size(t)); 14: r(t>0.05 & t<=0.25) = 1e-4*(t(t>0.05 & t<=0.25)-0.05); 15: r(t>0.25) = 2e-5; 16: 17: % Measurement Noise 18: Fs = 1e3; % Sampling Frequency [Hz] 19: Ts = 1/Fs; % Sampling Time [s] 20: n = sqrt(Fs/2)*randn(1, length(t)); % Signal with an ASD equal to one 21: n = lsim(1e-6*(s + 2*pi*1e2)^2/(s + 2*pi*1e3)^2/(1+s/2/pi/500), n, t)'; % Shaped noise 22: 23: % Disturbance 24: d = zeros(size(t)); 25: d(t>0.3) = 5e-6;
Figure 38: Time domain inputs signals
We also define the generalized plant corresponding to the system and that will be used for time domain simulations (Figure 39).
Figure 39: Generalized plant that will be used for simulations
The Generalized plant of Figure 39 is defined on Matlab as follows:
Copy26: Psim = [0 0 Gd G 27: 0 0 0 1 28: 1 -1 -Gd -G]; 29: 30: Psim.InputName = {'r', 'n', 'd', 'u'}; 31: Psim.OutputName = {'y', 'u', 'e'};
Time domain simulations will be performed by first computing the closed-loop system using the lft
command and then using the lsim
command on the closed-loop system:
Copy32: % Compute the closed-Loop System, K is the controller 33: P_CL = lft(Psim, K); 34: 35: % Time simulation of the closed-loop system with specified inputs 36: z = lsim(P_CL, [r; n; d], t); 37: % The two outputs are 38: y = z(:,1); % Output Motion [m] 39: u = z(:,2); % Input usage [N]
6.3 Modern Interpretation of control specifications
Exercice
- Translate the control specifications into wanted shape of closed-loop transfer functions
- Conclude and the closed-loop transfer functions to be shaped
- Chose a general configuration architecture that allows to shape these transfer function
- Using Matlab, define the generalized plant
After converting the control specifications into wanted shape of closed-loop transfer functions, we might come up with the Table 10.
In such case, we want to shape
Specification | TF | Wanted Shape |
---|---|---|
Follow Step Reference | +40dB of slope at low frequency | |
Reject Disturbances | Small gain | |
Reject measurement noise | Small high frequency (>100Hz) gain | |
Robust System | Small |
To do so, we use to generalized plant shown in Figure 40 for the synthesis where the three closed-loop tranfert functions from
This generalized plant is defined on Matlab as follows:
Copy40: P = [1 -1 41: G -G 42: 0 1 43: G -G];
Figure 40: Generalized plant chosen for the shaping of
However, to performed the
Copy44: Pw = blkdiag(W1, W2, W3, 1)*P;
Figure 41: Generalized weighted plant used for the
Finlay, performing the hinfsyn
command:
Copy45: K = hinfsyn(Pw, 1, 1);
Now let’s shape the three closed-loop transfer functions sequentially:
6.4 Step 1 - Shaping of
Let’s first shape the Sensitivity function as it is usually the most important of the Gang of four closed-loop transfer functions.
To do so, we have to create a weight
- small low frequency gain:
- minimum crossover frequency of
: - small maximum peak magnitude for robustness properties:
The weighting function is design using the generateWeigh
function and its inverse shape can be seen in Figure
Copy46: W1 = generateWeight('G0', 1e3, ... 47: 'G1', 1/2, ... 48: 'Gc', sqrt(2), 'wc', 2*pi*10, ... 49: 'n', 1);
To not constrain
Copy50: W2 = tf(1e-8); 51: W3 = tf(1e-8);
The
Copy52: Pw = blkdiag(W1, W2, W3, 1)*P; 53: K1 = hinfsyn(Pw, 1, 1, 'Display', 'on');
Test bounds: 0.5 <= gamma <= 0.51 gamma X>=0 Y>=0 rho(XY)<1 p/f 5.05e-01 0.0e+00 0.0e+00 5.511e-14 p Limiting gains... 5.05e-01 0.0e+00 0.0e+00 1.867e-14 p Best performance (actual): 0.502
Figure 42: Obtained Shape Closed-Loop transfer functions (dashed black lines indicate inverse magnitude of the weighting functions)
Time domain simulation is then performed and the obtained output displacement and control inputs are shown in Figure 43.
We can see:
- we are not able to follow the ramp input. This have to be solved by modifying the weighting function
- we have poor rejection of disturbances. This we be solve by shaping
in Section 6.5 - we have quite large effect of the measurement noise. This will be solved by shaping
in Section 6.6
Figure 43: Time domain simulation results
Remember that in order to follow ramp inputs, the sensitivity function should have a slope of +40dB/dec at low frequency (Table 9).
To do so, let’s modify
Copy54: W1 = generateWeight('G0', 1e3, ... 55: 'G1', 1/2, ... 56: 'Gc', sqrt(2), 'wc', 2*pi*15, ... 57: 'n', 2);
The
The time domain signals are shown in Figure 45 and it is confirmed that the ramps are now follows without static errors.
Figure 44: Obtained Shape Closed-Loop transfer functions
Figure 45: Time domain simulation results
6.5 Step 2 - Shaping of
Looking at Figure 46, it is clear that the rejection of disturbances is not satisfactory.
This can also be seen by the large peak of
This poor rejection of disturbances is actually due to the fact that the obtain controller has at notch at the resonance frequency of the plant.
To overcome this issue, we can simply increase the magnitude of
Copy58: W2 = tf(4e5);
The
Figure 46: Obtained Shape Closed-Loop transfer functions
Time domain simulation results are shown in Figure 47. If is shown that indeed, the disturbance rejection performance are much better and only very small oscillation is obtained.
Figure 47: Time domain simulation results
6.6 Step 3 - Shaping of
Finally, we want to limit the effect of the noise on the displacement output.
To do so,
This is done by increasing the high frequency gain of the weighting function
The final weighting function
Copy59: W3 = generateWeight('G0', 1e-1, ... 60: 'G1', 1e4, ... 61: 'Gc', 1, 'wc', 2*pi*70, ... 62: 'n', 2);
The
- The high frequency gain of
is indeed reduced - This comes as the expense of a large magnitude both
and . This means we will probably have slightly less good disturbance rejection and tracking performances.
Figure 48: Obtained Shape Closed-Loop transfer functions
The time domain simulation signals are shown in Figure 49. We can indeed see a slightly less good disturbance rejection. However, the vibrations induced by the sensor noise is well reduced. This can be seen when zooming on the output signal in Figure 50.
Figure 49: Time domain simulation results
Figure 50: Zoom on the output signal
6.7 Conclusion and Discussion
Hopefully this practical example will help you apply the
As an exercise, plot and analyze the evolution of the controller and loop gain transfer functions during the 3 synthesis steps.
If the large input usage is considered to be not acceptable, the shaping of
7 Conclusion
Hopefully, this document gave you a glimpse on how useful and powerful the
Resources
For a complete treatment of multivariable robust control, I would highly recommend this book [3]. If you want to nice reference book in French, look at [4].
You can also look at the very good lectures below.