Re-organize subsections

This commit is contained in:
tdehaeze committed 2020-12-01 18:49:40 +01:00
1 parent 7a1817c20d
commit 21c874f66a
15 files changed
+1369 -869

No files matched your search

+344 -158
View File
@@ -67,6 +67,12 @@ This document is structured as follows:
* Introduction to Model Based Control
<<sec:model_based_control>>
** Introduction :ignore:
- Section [[sec:model_based_control_methodology]]
- Section [[sec:comp_classical_modern_robust_control]]
- Section [[sec:example_system]]
** Model Based Control - Methodology
<<sec:model_based_control_methodology>>
@@ -396,6 +402,8 @@ And now the system dynamics $G(s)$ and $G_d(s)$ (their bode plots are shown in F
freqs = logspace(0, 3, 1000);
figure;
tiledlayout(1, 1, 'TileSpacing', 'None', 'Padding', 'None');
nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(Gd, freqs, 'Hz'))));
hold off;
@@ -417,6 +425,13 @@ And now the system dynamics $G(s)$ and $G_d(s)$ (their bode plots are shown in F
* Classical Open Loop Shaping
<<sec:open_loop_shaping>>
** Introduction :ignore:
- Section [[sec:open_loop_shaping_introduction]]
- Section [[sec:loop_shaping_example]]
- Section [[sec:h_infinity_open_loop_shaping]]
- Section [[sec:h_infinity_open_loop_shaping_example]]
** Introduction to Loop Shaping
<<sec:open_loop_shaping_introduction>>
@@ -631,15 +646,13 @@ The $\mathcal{H}_\infty$ optimal open loop shaping synthesis is performed using
[K, ~, GAM] = loopsyn(G, Lw);
#+end_src
The Bode plot of the obtained controller is shown in Figure [[fig:open_loop_shaping_hinf_K]].
#+begin_important
It is always important to analyze the controller after the synthesis is performed.
In the end, a synthesize controller is just a combination of low pass filters, high pass filters, notches, leads, etc.
#+end_important
Let's briefly analyze this controller:
Let's briefly analyze the obtained controller which bode plot is shown in Figure [[fig:open_loop_shaping_hinf_K]]:
- 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 $\mathcal{H}_\infty$ controllers, and can be an issue, more info on that latter)
@@ -675,7 +688,7 @@ Let's briefly analyze this controller:
#+RESULTS:
[[file:figs/open_loop_shaping_hinf_K.png]]
The obtained Loop Gain is shown in Figure [[fig:open_loop_shaping_hinf_L]].
The obtained Loop Gain is shown in Figure [[fig:open_loop_shaping_hinf_L]] and matches the specified one by a factor $\gamma$.
#+begin_src matlab :exports none
freqs = logspace(0, 3, 1000);
@@ -736,9 +749,17 @@ Let's now compare the obtained stability margins of the $\mathcal{H}_\infty$ con
| Phase Margin $> 30$ [deg] | 35.4 | 54.7 |
| Crossover $\approx 10$ [Hz] | 10.1 | 9.9 |
* First Steps in the $\mathcal{H}_\infty$ world
* A first Step into the $\mathcal{H}_\infty$ world
<<sec:h_infinity_introduction>>
** Introduction :ignore:
- Section [[sec:h_infinity_norm]]
- Section [[sec:h_infinity_synthesis]]
- Section [[sec:generalized_plant]]
- Section [[sec:h_infinity_general_synthesis]]
- Section [[sec:generalized_plant_derivation]]
** The $\mathcal{H}_\infty$ Norm
<<sec:h_infinity_norm>>
@@ -810,7 +831,7 @@ Note that there are many ways to use the $\mathcal{H}_\infty$ Synthesis:
- Open Loop Shaping $\mathcal{H}_\infty$ Synthesis (=loopsyn= [[https://www.mathworks.com/help/robust/ref/loopsyn.html][doc]])
- Mixed Sensitivity Loop Shaping (=mixsyn= [[https://www.mathworks.com/help/robust/ref/lti.mixsyn.html][doc]])
- Fixed-Structure $\mathcal{H}_\infty$ Synthesis (=hinfstruct= [[https://www.mathworks.com/help/robust/ref/lti.hinfstruct.html][doc]])
- Signal Based $\mathcal{H}_\infty$ Synthesis
- Signal Based $\mathcal{H}_\infty$ Synthesis, and many more...
** The Generalized Plant
<<sec:generalized_plant>>
@@ -1007,18 +1028,21 @@ Using Matlab, the generalized plant can be defined as follows:
P.OutputName = {'e', 'u', 'v'};
#+end_src
* Modern Interpretation of the Control Specifications
* Modern Interpretation of Control Specifications
<<sec:modern_interpretation_specification>>
** Introduction
** Introduction :ignore:
As shown in Section [[sec:open_loop_shaping]], the loop gain $L(s) = G(s) K(s)$ is a useful and easy tool for the manual design of controllers.
- Section [[sec:closed_loop_tf]]
- Section [[sec:sensitivity_transfer_functions]]
- Section [[sec:module_margin]]
- Section [[sec:other_requirements]]
$L(s)$ is very easy to shape as it depends linearly on $K(s)$.
As shown in Section [[sec:open_loop_shaping]], the loop gain $L(s) = G(s) K(s)$ is a useful and easy tool when manually designing controllers.
This is mainly due to the fact that $L(s)$ is very easy to shape as it depends /linearly/ on $K(s)$.
Moreover, important quantities such as the stability margins and the control bandwidth can be estimated from the shape/phase of $L(s)$.
However, the loop gain $L(s)$ does *not* directly give the performances of the closed-loop system.
The closed loop system behavior is indeed determined by the *closed-loop* transfer functions.
However, the loop gain $L(s)$ does *not* directly give the performances of the closed-loop system, which are determined by the *closed-loop* transfer functions.
If we consider the feedback system shown in Figure [[fig:gang_of_four_feedback]], we can link to the following specifications to closed-loop transfer functions.
This is summarized in Table [[tab:spec_closed_loop_tf]].
@@ -1082,7 +1106,7 @@ Isolate $y$ at the right hand side, and finally obtain:
Do the same procedure for $u$ and $\epsilon$
#+HTML: </details>
#+HTML: <details><summary>Anwser</summary>
#+HTML: <details><summary>Answer</summary>
The following equations should be obtained:
\begin{align}
y &= \frac{GK}{1 + GK} r + \frac{G}{1 + GK} d - \frac{GK}{1 + GK} n \\
@@ -1115,12 +1139,16 @@ And we have:
u &= KS r - S d - KS n
\end{align}
Thus, for reference tracking, we want to shape the /closed-loop/ transfer function from $r$ to $\epsilon$, that is the sensitivity function $S(s)$.
Similarly, to reduce the effect of measurement noise $n$ on the output $y$, we want to act on the complementary sensitivity function $T(s)$.
Thus, for reference tracking, we have to shape the /closed-loop/ transfer function from $r$ to $\epsilon$, that is the sensitivity function $S(s)$.
Similarly, to reduce the effect of measurement noise $n$ on the output $y$, we have to act on the complementary sensitivity function $T(s)$.
** Sensitivity Function
<<sec:sensitivity_transfer_functions>>
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 $K_r(s)$ and made three small changes to obtained three controllers $K_1(s)$, $K_2(s)$ and $K_3(s)$.
The obtained sensitivity functions are shown in Figure [[fig:sensitivity_shape_effect]] and the corresponding step responses are shown in Figure [[fig:sensitivity_shape_effect_step]].
@@ -1342,6 +1370,9 @@ This might indicate very good robustness properties of the closed-loop system.
Now let's suppose the "real" plant $G_r(s)$ as a slightly lower damping factor:
#+begin_src matlab
xi = 0.03;
#+end_src
#+begin_src matlab :exports none
Gr = 1/k*(s/w0/4 + 1)/(s^2/w0^2 + 2*xi*s/w0 + 1);
#+end_src
@@ -1350,7 +1381,7 @@ At a frequency little bit above 100Hz, the phase of the loop gain reaches -180 d
It is confirmed by checking the stability of the closed loop system:
#+begin_src matlab :results value replace
isstable(feedback(Gp,K))
isstable(feedback(Gr,K))
#+end_src
#+RESULTS:
@@ -1413,23 +1444,18 @@ Let's now determine a new robustness indicator based on the Nyquist Stability Cr
For more information about the /general/ Nyquist Stability Criteria, you may want to look at [[https://www.youtube.com/watch?v=sof3meN96MA][this]] video.
#+end_seealso
From the Nyquist stability criteria, it is clear that we want $L(j\omega)$ to be as far away from the $-1$ point (called the /unstable point/) in the complex plane.
From this, we define the *module margin*.
From the Nyquist stability criteria, it is clear that we want $L(j\omega)$ to be as far as possible from the $-1$ point (called the /unstable point/) in the complex plane.
This minimum distance is called the *module margin*.
#+begin_definition
- Module Margin ::
The Module Margin $\Delta M$ is defined as the *minimum distance* between the point $-1$ and the loop gain $L(j\omega)$ in the complex plane.
#+end_definition
#+begin_exampl
A typical Nyquist plot is shown in Figure [[fig:module_margin_example]].
The gain, phase and module margins are graphically shown to have an idea of what they represent.
As expected from Figure [[fig:module_margin_example]], 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 $\Delta M$, we have:
\begin{equation}
\Delta G \ge \frac{\Delta M}{\Delta M - 1}; \quad \Delta \phi \ge \frac{1}{\Delta M}
\end{equation}
#+begin_src matlab :exports none
% Example Plant
k = 1e6; % Stiffness [N/m]
@@ -1485,6 +1511,14 @@ We can indeed show that for a given value of the module margin $\Delta M$, we ha
#+caption: Nyquist plot with visual indication of the Gain margin $\Delta G$, Phase margin $\Delta \phi$ and Module margin $\Delta M$
#+RESULTS:
[[file:figs/module_margin_example.png]]
#+end_exampl
As expected from Figure [[fig:module_margin_example]], 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 $\Delta M$, we have:
\begin{equation}
\Delta G \ge \frac{\Delta M}{\Delta M - 1}; \quad \Delta \phi \ge \frac{1}{\Delta M}
\end{equation}
Let's now try to express the Module margin $\Delta M$ as an $\mathcal{H}_\infty$ norm of a closed-loop transfer function:
\begin{align*}
@@ -1506,6 +1540,7 @@ The wanted robustness of the closed-loop system can be specified by setting a ma
#+end_important
Note that this is why large peak value of $|S(j\omega)|$ usually indicate robustness problems.
And we know understand why setting an upper bound on the magnitude of $S$ is generally a good idea.
#+begin_exampl
Typical, we require $\|S\|_\infty < 2 (6dB)$ which implies $\Delta G \ge 2$ and $\Delta \phi \ge 29^o$
@@ -1515,12 +1550,59 @@ Note that this is why large peak value of $|S(j\omega)|$ usually indicate robust
To learn more about module/disk margin, you can check out [[https://www.youtube.com/watch?v=XazdN6eZF80][this]] video.
#+end_seealso
** How to *Shape* transfer function? Using of Weighting Functions!
** TODO Other Requirements
<<sec:other_requirements>>
Interpretation of the $\mathcal{H}_\infty$ norm of systems:
- frequency by frequency attenuation / amplification
Let's note $G_t(s)$ the closed-loop transfer function from $w$ to $z$.
Consider an input sinusoidal signal $w(t) = \sin\left( \omega_0 t \right)$, then the output signal $z(t)$ will be equal to:
\[ z(t) = A \sin\left( \omega_0 t + \phi \right) \]
with:
- $A = |G_t(j\omega_0)|$ is the magnitude of $G_t(s)$ at $\omega_0$
- $\phi = \angle G_t(j\omega_0)$ is the phase of $G_t(s)$ at $\omega_0$
Noise Attenuation: typical wanted shape for $T$
#+name: tab:specification_modern
#+caption: Typical Specifications and corresponding wanted norms of open and closed loop tansfer functions
| | Open-Loop Shaping | Closed-Loop Shaping |
|-----------------------------+--------------------+--------------------------------------------|
| Reference Tracking | $L$ large | $S$ small |
| Disturbance Rejection | $L$ large | $GS$ small |
| Measurement Noise Filtering | $L$ small | $T$ small |
| Small Command Amplitude | $K$ and $L$ small | $KS$ small |
| Robustness | Phase/Gain margins | Module margin: $\Vert S\Vert_\infty$ small |
* $\mathcal{H}_\infty$ Shaping of closed-loop transfer functions
<<sec:closed-loop-shaping>>
** Introduction :ignore:
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 $K(s)$ such that closed-loop system is stable and such that various closed-loop transfer functions such as $S$, $KS$ and $T$ are shaped as wanted.
This is clearly not simple as these closed-loop transfer functions does not depend linearly on $K$.
But don't worry, the $\mathcal{H}_\infty$ synthesis will do this job for us!
This
Section [[sec:weighting_functions]]
Section [[sec:weighting_functions_design]]
Section [[sec:sensitivity_shaping_example]]
Section [[sec:shaping_multiple_tf]]
** How to Shape closed-loop transfer function? Using Weighting Functions!
<<sec:weighting_functions>>
- [ ] Maybe put this section in Previous chapter
If the $\mathcal{H}_\infty$ synthesis is applied on the generalized plant $P(s)$ shown in Figure [[fig:loop_shaping_S_without_W]], it will generate a controller $K(s)$ such that the $\mathcal{H}_\infty$ norm of closed-loop transfer function from $r$ to $\epsilon$ is minimized.
This closed-loop transfer function actually correspond to the sensitivity function.
Therefore, it will minimize the the $\mathcal{H}_\infty$ norm of the sensitivity function: $\|S\|_\infty$.
Let's say we want to shape the sensitivity transfer function corresponding to the transfer function from $r$ to $\epsilon$ of the control architecture shown in Figure [[fig:loop_shaping_S_without_W]].
However, as the $\mathcal{H}_\infty$ norm is the maximum peak value of the transfer function's magnitude, this synthesis is quite useless and clearly does not allow to *shape* the norm of $S(j\omega)$ over all frequencies.
#+begin_src latex :file loop_shaping_S_without_W.pdf
\begin{tikzpicture}
@@ -1534,10 +1616,10 @@ Let's say we want to shape the sensitivity transfer function corresponding to th
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.4, 0)$)node[branch]{} |- (epsilon) node[above left](z1){$\epsilon$};
\draw[->] ($(addw.east)+(0.4, 0)$)node[branch]{} |- (epsilon) node[above](z1){$z = \epsilon$};
\draw[->] (addw.east) -- (addw-|z1) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} ($(G-|w)+(0.4, 0)$) -- (G.west);
\draw[->] (K.west) -| node[near end, left]{$u$} ($(G-|w)+(0.1, 0)$) -- (G.west);
\draw[->] (w) node[above]{$w = r$} -| (addw.north);
@@ -1553,25 +1635,24 @@ Let's say we want to shape the sensitivity transfer function corresponding to th
#+RESULTS:
[[file:figs/loop_shaping_S_without_W.png]]
If the $\mathcal{H}_\infty$ synthesis is directly applied on the generalized plant $P(s)$ shown in Figure [[fig:loop_shaping_S_without_W]], if will minimize the $\mathcal{H}_\infty$ norm of transfer function from $r$ to $\epsilon$ (the sensitivity transfer function).
However, as the $\mathcal{H}_\infty$ norm is the maximum peak value of the transfer function's magnitude, it does not allow to *shape* the norm over all frequencies.
#+begin_important
The /trick/ is to include a *weighting function* $W_S(s)$ in the generalized plant as shown in Figure [[fig:loop_shaping_S_with_W]].
Now, the closed-loop transfer function from $w$ to $z$ is equal to $W_s(s)S(s)$ and applying the $\mathcal{H}_\infty$ synthesis to the /weighted/ generalized plant $\tilde{P}(s)$ will generate a controller $K(s)$ such that $\|W_s(s)S(s)\|_\infty$ is minimized.
#+end_important
A /trick/ is to include a *weighting function* in the generalized plant as shown in Figure [[fig:loop_shaping_S_with_W]].
Applying the $\mathcal{H}_\infty$ synthesis to the /weighted/ generalized plant $\tilde{P}(s)$ (Figure [[fig:loop_shaping_S_with_W]]) will generate a controller $K(s)$ that minimizes the $\mathcal{H}_\infty$ norm between $r$ and $\tilde{\epsilon}$:
Let's now show how this is equivalent as *shaping* the sensitivity function:
\begin{align}
& \left\| \frac{\tilde{\epsilon}}{r} \right\|_\infty < \gamma (=1)\nonumber \\
\Leftrightarrow & \left\| W_s(s) S(s) \right\|_\infty < 1\nonumber \\
& \left\| W_s(s) S(s) \right\|_\infty < 1\nonumber \\
\Leftrightarrow & \left| W_s(j\omega) S(j\omega) \right| < 1 \quad \forall \omega\nonumber \\
\Leftrightarrow & \left| S(j\omega) \right| < \frac{1}{\left| W_s(j\omega) \right|} \quad \forall \omega \label{eq:sensitivity_shaping}
\end{align}
#+begin_important
As shown in Equation eqref:eq:sensitivity_shaping, the $\mathcal{H}_\infty$ synthesis allows to *shape* the magnitude of the sensitivity transfer function.
Therefore, the choice of the weighting function $W_s(s)$ is very important.
Its inverse magnitude will define the frequency dependent upper bound of the sensitivity transfer function magnitude.
As shown in Equation eqref:eq:sensitivity_shaping, the $\mathcal{H}_\infty$ synthesis applying on the /weighted/ generalized plant allows to *shape* the magnitude of the sensitivity transfer function.
Therefore, the choice of the weighting function $W_s(s)$ is very important: its inverse magnitude will define the wanted *upper bound* of the sensitivity function magnitude.
#+end_important
#+begin_src latex :file loop_shaping_S_with_W.pdf
@@ -1593,10 +1674,10 @@ Applying the $\mathcal{H}_\infty$ synthesis to the /weighted/ generalized plant
% Connections
\draw[->] (G.east) -- (addw.west);
\draw[->] ($(addw.east)+(0.4, 0)$)node[branch]{} |- (Ws.west)node[above left]{$\epsilon$};
\draw[->] (Ws.east) -- (epsilon) node[above left](z1){$\tilde{\epsilon}$};
\draw[->] (Ws.east) -- (epsilon) node[above](z1){$z = \tilde{\epsilon}$};
\draw[->] (addw.east) -- (addw-|z1) |- node[near start, right]{$v$} (K.east);
\draw[->] (K.west) -| node[near end, left]{$u$} ($(G-|w)+(0.4, 0)$) -- (G.west);
\draw[->] (K.west) -| node[near end, left]{$u$} ($(G-|w)+(0.2, 0)$) -- (G.west);
\draw[->] (w) node[above]{$w = r$} -| (addw.north);
\end{tikzpicture}
@@ -1607,41 +1688,59 @@ Applying the $\mathcal{H}_\infty$ synthesis to the /weighted/ generalized plant
#+RESULTS:
[[file:figs/loop_shaping_S_with_W.png]]
Once the weighting function is designed, it should be added to the generalized plant as shown in Figure [[fig:loop_shaping_S_with_W]].
#+begin_exercice
Using matlab, compute the weighted generalized plant shown in Figure [[fig:first_order_weight]] as a function of $G(s)$ and $W_S(s)$.
The weighted generalized plant can be defined in Matlab by either re-defining all the inputs or by pre-multiplying the (non-weighted) generalized plant by a block-diagonal MIMO transfer function containing the weights for the outputs $z$ and =1= for the outputs $v$.
#+HTML: <details><summary>Hint</summary>
The weighted generalized plant can be defined in Matlab using two techniques:
- by writing manually the 4 transfer functions from $[w, u]$ to $[\tilde{\epsilon}, v]$
- by pre-multiplying the (non-weighted) generalized plant by a block-diagonal transfer function matrix containing the weights for the outputs $z$ and =1= for the outputs $v$
#+HTML: </details>
#+HTML: <details><summary>Answer</summary>
The two solutions below can be used.
#+begin_src matlab :tangle no :eval no
Pw = [Ws -Ws*G;
1 -G]
1 -G];
#+end_src
% Alternative
#+begin_src matlab :tangle no :eval no
Pw = blkdiag(Ws, 1)*P;
#+end_src
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.
#+HTML: </details>
#+end_exercice
** Design of Weighting Functions
<<sec:weighting_functions_design>>
Weighting function used must be *proper*, *stable* and *minimum phase* transfer functions.
Weighting function included in the generalized plant must be *proper*, *stable* and *minimum phase* transfer functions.
#+begin_definition
- proper ::
more poles than zeros, this implies $\lim_{\omega \to \infty} |W(j\omega)| < \infty$
- stable ::
no poles in the right half plane
- minimum phase ::
no zeros in the right half plane
#+end_definition
Matlab is providing the =makeweight= function that creates a first-order weights by specifying the low frequency gain, high frequency gain, and a gain at a specific frequency:
Matlab is providing the =makeweight= function that allows to design first-order weights by specifying the low frequency gain, high frequency gain, and the gain at a specific frequency:
#+begin_src matlab :tangle no :eval no
W = makeweight(dcgain,[freq,mag],hfgain)
#+end_src
with:
- =dcgain=
- =freq=
- =mag=
- =hfgain=
- =dcgain=: low frequency gain
- =[freq,mag]=: frequency =freq= at which the gain is =mag=
- =hfgain=: high frequency gain
#+begin_exampl
The Matlab code below produces a weighting function with a magnitude shape shown in Figure [[fig:first_order_weight]].
The Matlab code below produces a weighting function with the following characteristics (Figure [[fig:first_order_weight]]):
- Low frequency gain of 100
- Gain of 1 at 10Hz
- High frequency gain of 0.5
#+begin_src matlab
Ws = makeweight(1e2, [2*pi*10, 1], 1/2);
@@ -1672,7 +1771,7 @@ The Matlab code below produces a weighting function with a magnitude shape shown
#+begin_seealso
Quite often, higher orders weights are required.
In such case, the following formula can be used the design of these weights:
In such case, the following formula can be used:
\begin{equation}
W(s) = \left( \frac{
@@ -1752,52 +1851,103 @@ The obtained shapes are shown in Figure [[fig:high_order_weight]].
[[file:figs/high_order_weight.png]]
#+end_seealso
** Sensitivity Function Shaping - Example
** Shaping the Sensitivity Function
<<sec:sensitivity_shaping_example>>
Let's design a controller using the $\mathcal{H}_\infty$ synthesis that fulfils the following requirements:
1. Bandwidth of at least 10Hz
2. Small static errors for step responses
3. Robustness: Large module margin $\Delta M > 0.5$ ($\Rightarrow \Delta G > 2$ and $\Delta \phi > 29^o$)
- Robustness: Module margin > 2 ($\Rightarrow \text{GM} > 2 \text{ and } \text{PM} > 29^o$)
- Bandwidth:
- Slope of -2
As usual, the plant used is the one presented in Section [[sec:example_system]].
First, the weighting functions is generated.
#+begin_src matlab
Ws = generateWeight('G0', 1e3, 'G1', 1/2, 'Gc', 1, 'wc', 2*pi*10, 'n', 2);
#+begin_exercice
Translate the requirements as upper bounds on the Sensitivity function and design the corresponding Weight using Matlab.
#+HTML: <details><summary>Hint</summary>
The typical wanted upper bound of the sensitivity function is shown in Figure [[fig:h-infinity-spec-S-bis]].
More precisely:
1. Recall that the closed-loop bandwidth is defined as the frequency $|S(j\omega)|$ first crosses $1/\sqrt{2} = -3dB$ from below
2. For the small static error, -60dB is usually enough as other factors (measurement noise, disturbances) will anyhow limit the performances
3. Recall that the module margin is equal to the inverse of the $\mathcal{H}_\infty$ norm of the sensitivity function:
\[ \Delta M = \frac{1}{\|S\|_\infty} \]
Remember that the wanted upper bound of the sensitivity function is defined by the *inverse* magnitude of the weight.
#+name: fig:h-infinity-spec-S-bis
#+caption: Typical wanted shape of the Sensitivity transfer function
[[file:figs/h-infinity-spec-S.png]]
#+HTML: </details>
#+HTML: <details><summary>Answer</summary>
1. $|W_s(j \cdot 2 \pi 10)| = \sqrt{2}$
2. $|W_s(j \cdot 0)| = 10^3$
3. $\|W_s\|_\infty = 0.5$
Using Matlab, such weighting function can be generated using the =makeweight= function as shown below:
#+begin_src matlab :eval no :tangle no
Ws = makeweight(1e3, [2*pi*10, sqrt(2)], 1/2);
#+end_src
It is then added to the generalized plant.
Or using the =generateWeight= function:
#+begin_src matlab :eval no :tangle no
Ws = generateWeight('G0', 1e3, ...
'G1', 1/2, ...
'Gc', sqrt(2), 'wc', 2*pi*10, ...
'n', 2);
#+end_src
#+HTML: </details>
#+end_exercice
Let's say we came up with the following weighting function:
#+begin_src matlab
Ws = generateWeight('G0', 1e3, ...
'G1', 1/2, ...
'Gc', sqrt(2), 'wc', 2*pi*10, ...
'n', 2);
#+end_src
The weighting function is then added to the generalized plant.
#+begin_src matlab
P = [1 -G;
1 -G];
Pw = blkdiag(Ws, 1)*P;
#+end_src
And the $\mathcal{H}_\infty$ synthesis is performed.
And the $\mathcal{H}_\infty$ synthesis is performed on the /weighted/ generalized plant.
#+begin_src matlab :results output replace
K = hinfsyn(Pw, 1, 1, 'Display', 'on');
#+end_src
#+RESULTS:
#+begin_example
K = 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 4.497e-28 p
5.05e-01 0.0e+00 0.0e+00 3.000e-16 p
Limiting gains...
5.05e-01 0.0e+00 0.0e+00 0.000e+00 p
5.05e-01 -1.8e+01 # -2.9e-15 1.514e-15 f
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.504
Best performance (actual): 0.503
#+end_example
The obtained $\gamma \approx 0.5$ means that it found a controller $K(s)$ that stabilize the closed-loop system, and such that:
$\gamma \approx 0.5$ means that the $\mathcal{H}_\infty$ synthesis generated a controller $K(s)$ that stabilizes the closed-loop system, and such that:
\begin{aligned}
& \| W_s(s) S(s) \|_\infty < 0.5 \\
& \| W_s(s) S(s) \|_\infty \approx 0.5 \\
& \Leftrightarrow |S(j\omega)| < \frac{0.5}{|W_s(j\omega)|} \quad \forall \omega
\end{aligned}
This is indeed what we can see by comparing $|S|$ and $|W_S|$ in Figure [[fig:results_sensitivity_hinf]].
#+begin_important
Having $\gamma < 1$ means that the $\mathcal{H}_\infty$ synthesis found a controller such that the specified closed-loop transfer functions are bellow the specified upper bounds.
Having $\gamma$ slightly above one does not necessary means the obtained controller is not "good".
It just means that at some frequency, one of the closed-loop transfer functions is above the specified upper bound by a factor $\gamma$.
#+end_important
#+begin_src matlab :exports none
figure;
hold on;
@@ -1817,89 +1967,18 @@ This is indeed what we can see by comparing $|S|$ and $|W_S|$ in Figure [[fig:re
#+RESULTS:
[[file:figs/results_sensitivity_hinf.png]]
** Complementary Sensitivity Function
** Shaping multiple closed-loop transfer functions
<<sec:shaping_multiple_tf>>
As was shown in Section [[sec:modern_interpretation_specification]], depending on the specifications, up to four closed-loop transfer function may be shaped (the Gang of four).
This was summarized in Table [[tab:specification_modern]].
** Summary
For instance to limit the control input $u$, $KS$ should be shaped while to filter measurement noise, $T$ should be shaped.
#+name: tab:specification_modern
#+caption: Table caption
| | Open-Loop Shaping | Closed-Loop Shaping |
|-----------------------------+--------------------+--------------------------------------------|
| Reference Tracking | $L$ large | $S$ small |
| Disturbance Rejection | $L$ large | $GS$ small |
| Measurement Noise Filtering | $L$ small | $T$ small |
| Small Command Amplitude | $K$ and $L$ small | $KS$ small |
| Robustness | Phase/Gain margins | Module margin: $\Vert S\Vert_\infty$ small |
When multiple closed-loop transfer function are shaped at the same time, it is refereed to as "Mixed-Sensitivity $\mathcal{H}_\infty$ Control" and is the subject of Section [[sec:h_infinity_mixed_sensitivity]].
#+begin_src latex :file h-infinity-4-blocs-constrains.pdf
\begin{tikzpicture}
\begin{scope}[shift={(0, 0)}]
\draw[] (2.5, 1.0) node[]{$S$};
\draw[fill=blue!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim GK^{-1}$};
\draw[fill=red!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.5) node[]{$\sim 1$};
\draw[fill=red!20] (2.5, 0.15) circle (0.15);
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-2) to[out=45,in=180+45] (2,0) to[out=45,in=180] (2.5,0.3) to[out=0,in=180] (3.5,0) to[out=0,in=180] (5, 0);
\draw[dashed] (-0.5, -2.7) rectangle (5.5, 1.4);
\end{scope}
Depending on the closed-loop transfer function being shaped, different general control configuration are used and are described below.
\begin{scope}[shift={(6.4, 0)}]
\draw[] (2.5, 1.0) node[]{$GS$};
\draw[fill=blue!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim K^{-1}$};
\draw[fill=red!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.5) node[]{$\sim G$};
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-2) to[out=45,in=180+45] (1, -1) to[out=45, in=180] (2.5,-0.2) to[out=0,in=180-45] (4,-1) to[out=-45,in=180-45] (5, -2);
\draw[dashed] (-0.5, -2.7) rectangle (5.5, 1.4);
\end{scope}
\begin{scope}[shift={(0, -4.4)}]
\draw[] (2.5, 1.0) node[]{$KS$};
\draw[fill=red!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -1.8) node[]{$\sim G^{-1}$};
\draw[fill=blue!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.3) node[]{$\sim K$};
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-1.5) to[out=45,in=180+45] (1, -0.5) to[out=45, in=180] (2.5,0.3) to[out=0,in=180-45] (4,-0.5) to[out=-45,in=180-45] (5, -1.5);
\draw[dashed] (-0.5, -2.7) rectangle (5.5, 1.4);
\end{scope}
\begin{scope}[shift={(6.4, -4.4)}]
\draw[] (2.5, 1.0) node[]{$T$};
\draw[fill=red!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim 1$};
\draw[fill=blue!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.5) node[]{$\sim GK$};
\draw[fill=red!20] (2.5, 0.15) circle (0.15);
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,0) to[out=0,in=180] (1.5,0) to[out=0,in=180] (2.5,0.3) to[out=0,in=-45] (3,0) to[out=-45,in=180-45] (5, -2);
\draw[dashed] (-0.5, -2.7) rectangle (5.5, 1.4);
\end{scope}
\end{tikzpicture}
#+end_src
#+name: fig:h-infinity-4-blocs-constrains
#+caption: Shaping the Gang of Four: Limitations
#+RESULTS:
[[file:figs/h-infinity-4-blocs-constrains.png]]
* $\mathcal{H}_\infty$ Mixed-Sensitivity Synthesis
<<sec:h_infinity_mixed_sensitivity>>
** Problem
** Typical Procedure
** Step 1 - Shaping of the Sensitivity Function
** Step 2 - Shaping of
** General Configuration for various shaping
*** S KS :ignore:
#+HTML: <details><summary>Shaping of S and KS</summary>
#+begin_src latex :file general_conf_shaping_S_KS.pdf
@@ -2132,15 +2211,63 @@ This is indeed what we can see by comparing $|S|$ and $|W_S|$ in Figure [[fig:re
- $W_2W_3$ is used to shape $T$
#+HTML: </details>
* Conclusion
<<sec:conclusion>>
* Things to add :noexport:
** 2 blocs criterion - constrains
#+begin_src latex :file h-infinity-2-blocs-constrains.pdf
*** Limitation :ignore:
When shaping multiple closed-loop transfer functions, one should be verify 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
- 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
#+begin_warning
Mathematical relations are linking the closed-loop transfer functions.
For instance, the sensitivity function $S(s)$ and the complementary sensitivity function $T(s)$ as link by the following well known relation:
\begin{equation}
S(s) + T(s) = 1
\end{equation}
This means that $|S(j\omega)|$ and $|T(j\omega)|$ cannot be made small at the same time!
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.
#+end_warning
The control bandwidth is clearly limited by physical constrains such as sampling frequency, electronics bandwidth,
\begin{align*}
&|G(j\omega) K(j\omega)| \ll 1 \Longrightarrow |S(j\omega)| = \frac{1}{1 + |G(j\omega)K(j\omega)|} \approx 1 \\
&|G(j\omega) K(j\omega)| \gg 1 \Longrightarrow |S(j\omega)| = \frac{1}{1 + |G(j\omega)K(j\omega)|} \approx \frac{1}{|G(j\omega)K(j\omega)|}
\end{align*}
Similar relationship can be found for $T$, $KS$ and $GS$.
#+begin_exercice
Determine the approximate norms of $T$, $KS$ and $GS$ for large loop gains ($|G(j\omega) K(j\omega)| \gg 1$) and small loop gains ($|G(j\omega) K(j\omega)| \ll 1$).
#+HTML: <details><summary>Hint</summary>
You can follows this procedure for $T$, $KS$ and $GS$:
1. Write the closed-loop transfer function $T(s)$ as a function of $K(s)$ and $G(s)$
2. Take $|K(j\omega)G(j\omega)| \gg 1$ and conclude on $|T(j\omega)|$
3. Take $|K(j\omega)G(j\omega)| \ll 1$ and conclude on $|T(j\omega)|$
#+HTML: </details>
#+HTML: <details><summary>Answer</summary>
The obtained constrains are shown in Figure [[fig:h-infinity-4-blocs-constrains]].
#+HTML: </details>
#+end_exercice
Depending on the frequency band, the norms of the closed-loop transfer functions depend on the controller $K$ and therefore can be shaped.
However, in some frequency bands, the norms do not depend on the controller and therefore *cannot* be shaped.
Therefore the weighting functions should only focus on certainty frequency range depending on the transfer function being shaped.
These regions are summarized in Figure [[fig:h-infinity-4-blocs-constrains]].
#+begin_src latex :file h-infinity-4-blocs-constrains.pdf
\begin{tikzpicture}
\begin{scope}[shift={(0, 0)}]
\draw[] (2.5, 1.0) node[]{$S$};
\draw[fill=blue!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim GK^{-1}$};
\draw[fill=red!20] (3.6, -2.5) rectangle (5.2, 0.5);
@@ -2148,11 +2275,40 @@ This is indeed what we can see by comparing $|S|$ and $|W_S|$ in Figure [[fig:re
\draw[fill=red!20] (2.5, 0.15) circle (0.15);
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-2) to[out=45,in=180+45] (2,0) to[out=45,in=180] (2.5,0.3) to[out=0,in=180] (3.5,0) to[out=0,in=180] (5, 0);
\draw[dashed] (-0.5, -2.7) rectangle (5.5, 1.4);
\draw[dashed] rectangle ;
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (S) {};
\node[below] at (S.north) {$S$};
\end{scope}
\end{scope}
\begin{scope}[shift={(6.4, 0)}]
\draw[] (2.5, 1.0) node[]{$T$};
\draw[fill=blue!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim K^{-1}$};
\draw[fill=red!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.5) node[]{$\sim G$};
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-2) to[out=45,in=180+45] (1, -1) to[out=45, in=180] (2.5,-0.2) to[out=0,in=180-45] (4,-1) to[out=-45,in=180-45] (5, -2);
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (GS) {};
\node[below] at (GS.north) {$GS$};
\end{scope}
\end{scope}
\begin{scope}[shift={(0, -4.4)}]
\draw[fill=red!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -1.8) node[]{$\sim G^{-1}$};
\draw[fill=blue!20] (3.6, -2.5) rectangle (5.2, 0.5);
\draw[] (4.5, -0.3) node[]{$\sim K$};
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,-1.5) to[out=45,in=180+45] (1, -0.5) to[out=45, in=180] (2.5,0.3) to[out=0,in=180-45] (4,-0.5) to[out=-45,in=180-45] (5, -1.5);
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (KS) {};
\node[below] at (KS.north) {$KS$};
\end{scope}
\end{scope}
\begin{scope}[shift={(6.4, -4.4)}]
\draw[fill=red!20] (-0.2, -2.5) rectangle (1.4, 0.5);
\draw[] (0.6, -0.5) node[]{$\sim 1$};
\draw[fill=blue!20] (3.6, -2.5) rectangle (5.2, 0.5);
@@ -2160,16 +2316,46 @@ This is indeed what we can see by comparing $|S|$ and $|W_S|$ in Figure [[fig:re
\draw[fill=red!20] (2.5, 0.15) circle (0.15);
\draw[dashed] (-0.4, 0) -- (5.4, 0);
\draw [] (0,0) to[out=0,in=180] (1.5,0) to[out=0,in=180] (2.5,0.3) to[out=0,in=-45] (3,0) to[out=-45,in=180-45] (5, -2);
\draw[dashed] (-0.5, -2.7) rectangle (5.5, 1.4);
\begin{scope}[on background layer]
\node[fit={(-0.5, -2.7) (5.5, 1.4)}, inner sep=0pt, draw, dashed, fill=black!20!white] (T) {};
\node[below] at (T.north) {$T$};
\end{scope}
\end{scope}
\end{tikzpicture}
#+end_src
#+name: fig:h-infinity-4-blocs-constrains
#+caption: Shaping the Gang of Four: Limitations
#+RESULTS:
[[file:figs/h-infinity-2-blocs-constrains.png]]
[[file:figs/h-infinity-4-blocs-constrains.png]]
#+begin_warning
The order (resp. number of state) of the controller given by the $\mathcal{H}_\infty$ synthesis is equal to the order (resp. number of state) of the weighted generalized plant.
It is thus equal to the *sum* of the number of state of the non-weighted generalized plant and the number of state of all the weighting functions.
Two approaches can be used to obtain controllers with reasonable order:
1. use simple weights (usually first order)
2. perform a model reduction on the obtained high order controller
#+end_warning
* Mixed-Sensitivity $\mathcal{H}_\infty$ Control - Example
<<sec:h_infinity_mixed_sensitivity>>
** Problem
** Typical Procedure
** Step 1 - Shaping of the Sensitivity Function
** Step 2 - Shaping of
* Conclusion
<<sec:conclusion>>
* Resources
:PROPERTIES:
:UNNUMBERED: notoc
:END:
yt:?listType=playlist&list=PLn8PRpmsu08qFLMfgTEzR8DxOPE7fBiin