Add analysis on the sensitivity function stape

This commit is contained in:
tdehaeze committed 2020-12-01 13:41:12 +01:00
1 parent bd27568455
commit 7a1817c20d
9 files changed
+563 -565

No files matched your search

+128 -68
View File
@@ -1121,59 +1121,159 @@ Similarly, to reduce the effect of measurement noise $n$ on the output $y$, we w
** Sensitivity Function
<<sec:sensitivity_transfer_functions>>
#+begin_src matlab
K1 = 14e8 * ... % Gain
1/(s^2) * ... % Double Integrator
(1 + s/(2*pi*10/sqrt(8)))/(1 + s/(2*pi*10*sqrt(8))); % Lead
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]].
K2 = 1e8 * ... % Gain
1/(s^2) * ... % Double Integrator
(1 + s/(2*pi*1/sqrt(8)))/(1 + s/(2*pi*1*sqrt(8))); % Lead
The comparison of the sensitivity functions shapes and their effect on the step response is summarized in Table [[tab:compare_sensitivity_shapes]].
K3 = 1e8 * ... % Gain
1/(s^2) * ... % Double Integrator
(1 + s/(2*pi*1/sqrt(2)))/(1 + s/(2*pi*1*sqrt(2))); % Lead
#+name: tab:compare_sensitivity_shapes
#+caption: Comparison of the sensitivity function shape and the corresponding step response for the three controller variations
| Controller | Sensitivity Function Shape | Change of the Step Response |
|------------+----------------------------------------------------+----------------------------------|
| $K_1(s)$ | Larger bandwidth $\omega_b$ | Faster rise time |
| $K_2(s)$ | Larger peak value $\Vert S\Vert_\infty$ | Large overshoot and oscillations |
| $K_3(s)$ | Larger low frequency gain $\vert S(j\cdot 0)\vert$ | Larger static error |
#+begin_src matlab :exports none
wc = 2*pi*1; L_w = 8; wi = 2*pi*0.02;
Kr = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
Kr = Kr/abs(evalfr(Kr*G, j*wc));
wc = 2*pi*2; L_w = 8; wi = 2*pi*0.045;
K1 = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
K1 = K1/abs(evalfr(K1*G, j*wc));
wc = 2*pi*1; L_w = 2; wi = 2*pi*0.03;
K2 = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
K2 = K2/abs(evalfr(K2*G, j*wc));
wc = 2*pi*1; L_w = 8; wi = 2*pi*0.2;
K3 = 1/((s + wi)^2) * ... % Double Integrator
(1 + s/(wc/sqrt(L_w)))/(1 + s/(wc*sqrt(L_w))); % Lead
K3 = K3/abs(evalfr(K3*G, j*wc));
Sr = 1/(1 + Kr*G);
S1 = 1/(1 + K1*G);
S2 = 1/(1 + K2*G);
S3 = 1/(1 + K3*G);
Tr = Kr*G/(1 + Kr*G);
T1 = K1*G/(1 + K1*G);
T2 = K2*G/(1 + K2*G);
T3 = K3*G/(1 + K3*G);
bodeFig({S1, S2, S3})
#+end_src
#+begin_src matlab
freqs = logspace(-1, 2, 1000);
#+begin_src matlab :exports none
freqs = logspace(-2, 2, 1000);
figure;
tiledlayout(1, 2, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile;
hold on;
plot(freqs, abs(squeeze(freqresp(S1, freqs, 'Hz'))), 'DisplayName', '$L(s)$');
plot(freqs, abs(squeeze(freqresp(S2, freqs, 'Hz'))), 'DisplayName', '$L_w(s)$');
plot(freqs, abs(squeeze(freqresp(S3, freqs, 'Hz'))), 'DisplayName', '$L_w(s) / \gamma$, $L_w(s) \cdot \gamma$');
plot(freqs, abs(squeeze(freqresp(S1, freqs, 'Hz'))), 'DisplayName', '$K_1(s)$');
plot(freqs, abs(squeeze(freqresp(S2, freqs, 'Hz'))), 'DisplayName', '$K_2(s)$');
plot(freqs, abs(squeeze(freqresp(S3, freqs, 'Hz'))), 'DisplayName', '$K_3(s)$');
plot(freqs, abs(squeeze(freqresp(Sr, freqs, 'Hz'))), 'k-', 'DisplayName', '$K_r(s)$');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frquency [Hz]'); ylabel('Sensitivity Magnitude');
hold off;
legend('location', 'southeast');
ylim([1e-3, 3]);
#+end_src
ax2 = nexttile;
t = linspace(0, 1, 1000);
y1 = step(T1, t);
y2 = step(T2, t);
y3 = step(T3, t);
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/sensitivity_shape_effect.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name: fig:sensitivity_shape_effect
#+caption: Sensitivity function magnitude $|S(j\omega)|$ corresponding to the reference controller $K_r(s)$ and the three modified controllers $K_i(s)$
#+RESULTS:
[[file:figs/sensitivity_shape_effect.png]]
#+begin_src matlab :exports none
t = linspace(0, 5, 1000);
figure;
hold on;
plot(t, y1)
plot(t, y2)
plot(t, y3)
plot(t, step(T1, t), 'DisplayName', '$K_1(s)$')
plot(t, step(T2, t), 'DisplayName', '$K_2(s)$')
plot(t, step(T3, t), 'DisplayName', '$K_3(s)$')
plot(t, step(Tr, t), 'k-', 'DisplayName', '$K_r(s)$')
hold off
xlabel('Time [s]'); ylabel('Step Response');
legend('location', 'northeast');
ylim([0, 1.7])
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/sensitivity_shape_effect_step.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name: fig:sensitivity_shape_effect_step
#+caption: Step response (response from $r$ to $y$) for the different controllers
#+RESULTS:
[[file:figs/sensitivity_shape_effect_step.png]]
#+begin_src latex :file h-infinity-spec-S.pdf
\begin{tikzpicture}
\begin{axis}[%
width=8cm,
height=4cm,
at={(0,0)},
xmode=log,
xmin=0.01,
xmax=10000,
ymin=-80,
ymax=40,
ylabel={Magnitude [dB]},
xlabel={Frequency [Hz]},
ytick={40, 20, 0, -20, -40, -60, -80},
xminorgrids,
yminorgrids
]
\addplot [thick, color=black, forget plot]
table[row sep=crcr]{%
0.01 -60\\
0.1 -60\\
190 6\\
10000 6\\
};
\draw[<-] (0.05, -60) -- (0.1, -70);
\draw (0.1, -70) -- (2, -70) node[right, fill=white, draw]{\footnotesize{Small static error}};
\draw[<-] (70, -3) -- (3, -3) node[left, fill=white, draw]{\footnotesize{Speed}};
\draw[<-] (300, 6) -- (200, 20);
\draw (200, 20) -- (10, 20) node[left, fill=white, draw]{\footnotesize{Robustness}};
\end{axis}
\end{tikzpicture}
#+end_src
#+begin_definition
- Closed-Loop Bandwidth ::
The closed-loop bandwidth $\omega_b$ is the frequency where $|S(j\omega)|$ first crosses $1/\sqrt{2} = -3dB$ from below.
In general, a large bandwidth corresponds to a faster rise time.
#+end_definition
#+begin_important
From the simple analysis above, we can draw a first estimation of the wanted shape for the sensitivity function in Figure [[fig:h-infinity-spec-S]].
The wanted characteristics on the magnitude of the sensitivity function are then:
- 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 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*.
#+name: fig:h-infinity-spec-S
#+caption: Typical wanted shape of the Sensitivity transfer function
[[file:figs/h-infinity-spec-S.png]]
#+end_important
** Robustness: Module Margin
<<sec:module_margin>>
@@ -1655,46 +1755,6 @@ The obtained shapes are shown in Figure [[fig:high_order_weight]].
** Sensitivity Function Shaping - Example
<<sec:sensitivity_shaping_example>>
#+begin_src latex :file h-infinity-spec-S.pdf
\begin{tikzpicture}
\begin{axis}[%
width=8cm,
height=4cm,
at={(0,0)},
xmode=log,
xmin=0.01,
xmax=10000,
ymin=-80,
ymax=40,
ylabel={Magnitude [dB]},
xlabel={Frequency [Hz]},
ytick={40, 20, 0, -20, -40, -60, -80},
xminorgrids,
yminorgrids
]
\addplot [thick, color=black, forget plot]
table[row sep=crcr]{%
0.01 -60\\
0.1 -60\\
190 6\\
10000 6\\
};
\draw[<-] (0.05, -60) -- (0.1, -70);
\draw (0.1, -70) -- (2, -70) node[right, fill=white, draw]{$\SI{-60}{\decibel} \rightarrow$ \footnotesize{Static error}};
\draw[<-] (1, -40) -- (10, -40) node[right, fill=white, draw]{$\SI{20}{\decibel/dec} \rightarrow$ \footnotesize{Ref. track.}};
\draw[<-] (100, 0) -- (3, 0) node[left, fill=white, draw]{$\omega_c \rightarrow$ \footnotesize{Speed}};
\draw[<-] (300, 6) -- (200, 20);
\draw (200, 20) -- (10, 20) node[left, fill=white, draw]{$\SI{6}{\decibel} \rightarrow$ \footnotesize{Module margin}};
\end{axis}
\end{tikzpicture}
#+end_src
#+name: fig:h-infinity-spec-S
#+caption: Typical wanted shape of the Sensitivity transfer function
#+RESULTS:
[[file:figs/h-infinity-spec-S.png]]
- Robustness: Module margin > 2 ($\Rightarrow \text{GM} > 2 \text{ and } \text{PM} > 29^o$)
- Bandwidth: