Rework first part about sensor description

This commit is contained in:
Thomas Dehaeze 2020-10-01 11:25:23 +02:00
parent f349a89567
commit 2d6df7ff2d
10 changed files with 1022 additions and 550 deletions

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

File diff suppressed because it is too large Load Diff

View File

@ -35,8 +35,56 @@ Two sensors are considered with both different noise characteristics and dynamic
* Sensor Description * Sensor Description
** Introduction :ignore: ** Introduction :ignore:
In Figure [[fig:sensor_model_noise_uncertainty]] is shown a schematic of a sensor model that is used in the following study.
- [ ] Schematic of one sensor #+name: tab:sensor_signals
#+caption: Description of signals in Figure [[fig:sensor_model_noise_uncertainty]]
| *Notation* | *Meaning* |
|---------------+---------------------------------|
| $x$ | Physical measured quantity |
| $\tilde{n}_i$ | White noise with unitary PSD |
| $n_i$ | Shaped noise |
| $v_i$ | Sensor output measurement |
| $\hat{x}_i$ | Estimate of $x$ from the sensor |
#+name: tab:sensor_dynamical_blocks
#+caption: Description of Systems in Figure [[fig:sensor_model_noise_uncertainty]]
| *Notation* | *Meaning* |
|-------------+------------------------------------------------------------------------------|
| $\hat{G}_i$ | Nominal Sensor Dynamics |
| $W_i$ | Weight representing the size of the uncertainty at each frequency |
| $\Delta_i$ | Any complex perturbation such that $\vert\vert\Delta_i\vert\vert_\infty < 1$ |
| $N_i$ | Weight representing the sensor noise |
#+name: fig:sensor_model_noise_uncertainty
#+caption: Sensor Model
#+RESULTS:
[[file:figs-tikz/sensor_model_noise_uncertainty.png]]
In this example, the measured quantity $x$ is the velocity of an object.
The units of signals are listed in Table [[tab:signal_units]].
The units of systems are listed in Table [[tab:dynamical_block_units]].
#+name: tab:signal_units
#+caption: Units of signals in Figure [[fig:sensor_model_noise_uncertainty]]
| *Notation* | *Unit* |
|---------------+---------|
| $x$ | $[m/s]$ |
| $\tilde{n}_i$ | |
| $n_i$ | $[m/s]$ |
| $v_i$ | $[V]$ |
| $\hat{x}_i$ | $[m/s]$ |
#+name: tab:dynamical_block_units
#+caption: Units of Systems in Figure [[fig:sensor_model_noise_uncertainty]]
| *Notation* | *Unit* |
|------------------+-------------------|
| $\hat{G}_i$ | $[\frac{V}{m/s}]$ |
| $\hat{G}_i^{-1}$ | $[\frac{m/s}{V}]$ |
| $W_i$ | |
| $\Delta_i$ | |
| $N_i$ | $[m/s]$ |
** Matlab Init :noexport:ignore: ** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
@ -53,7 +101,11 @@ Two sensors are considered with both different noise characteristics and dynamic
#+end_src #+end_src
** Sensor Dynamics ** Sensor Dynamics
Accelerometer: <<sec:sensor_dynamics>>
Let's consider two sensors measuring the velocity of an object.
The first sensor is an accelerometer.
Its nominal dynamics $\hat{G}_1(s)$ is defined below.
#+begin_src matlab #+begin_src matlab
m_acc = 0.01; % Inertial Mass [kg] m_acc = 0.01; % Inertial Mass [kg]
c_acc = 5; % Damping [N/(m/s)] c_acc = 5; % Damping [N/(m/s)]
@ -63,7 +115,7 @@ Accelerometer:
G1 = -g_acc*m_acc*s/(m_acc*s^2 + c_acc*s + k_acc); % Accelerometer Plant [V/(m/s)] G1 = -g_acc*m_acc*s/(m_acc*s^2 + c_acc*s + k_acc); % Accelerometer Plant [V/(m/s)]
#+end_src #+end_src
Interferometer/Capacitive Sensor: The second sensor is a displacement sensor, its nominal dynamics $\hat{G}_2(s)$ is defined below.
#+begin_src matlab #+begin_src matlab
w_pos = 2*pi*2e3; % Measurement Banwdith [rad/s] w_pos = 2*pi*2e3; % Measurement Banwdith [rad/s]
g_pos = 1e4; % Gain [V/m] g_pos = 1e4; % Gain [V/m]
@ -71,15 +123,19 @@ Interferometer/Capacitive Sensor:
G2 = g_pos/s/(1 + s/w_pos); % Position Sensor Plant [V/(m/s)] G2 = g_pos/s/(1 + s/w_pos); % Position Sensor Plant [V/(m/s)]
#+end_src #+end_src
These nominal dynamics are also taken as the model of the sensor dynamics.
The true sensor dynamics has some uncertainty associated to it and described in section [[sec:sensor_uncertainty]].
Both sensor dynamics in $[\frac{V}{m/s}]$ are shown in Figure [[fig:sensors_nominal_dynamics]].
#+begin_src matlab :exports none #+begin_src matlab :exports none
figure; figure;
% Magnitude % Magnitude
ax1 = subplot(2,1,1); ax1 = subplot(2,1,1);
hold on; hold on;
plot(freqs, abs(squeeze(freqresp(G1, freqs, 'Hz'))), '-', 'DisplayName', '$G_1$'); plot(freqs, abs(squeeze(freqresp(G1, freqs, 'Hz'))), '-', 'DisplayName', '$G_1(j\omega)$');
plot(freqs, abs(squeeze(freqresp(G2, freqs, 'Hz'))), '-', 'DisplayName', '$G_2$'); plot(freqs, abs(squeeze(freqresp(G2, freqs, 'Hz'))), '-', 'DisplayName', '$G_2(j\omega)$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude'); set(gca, 'XTickLabel',[]); ylabel('Magnitude $[\frac{V}{m/s}]$'); set(gca, 'XTickLabel',[]);
legend('location', 'northeast'); legend('location', 'northeast');
hold off; hold off;
@ -97,46 +153,26 @@ Interferometer/Capacitive Sensor:
xlim([freqs(1), freqs(end)]); xlim([freqs(1), freqs(end)]);
#+end_src #+end_src
#+begin_src matlab :exports none #+begin_src matlab :tangle no :exports results :results file replace
% w_pos_u = ureal('w_pos', w_pos, 'Percentage', 50); % Measurement Bandwidth [rad/s] exportFig('figs/sensors_nominal_dynamics.pdf', 'width', 'full', 'height', 'full');
% g_pos_u = ureal('g_pos', g_pos, 'Percentage', 15); % Measurement Gain [V/m]
% G2_u = g_pos_u/s/(1 + s/w_pos_u); % Position Sensor Plant Model [V/(m/s)]
% m_acc_u = ureal('m_acc', m_acc, 'Percentage', 30); % Inertial Mass [kg]
% c_acc_u = ureal('c_acc', c_acc, 'Percentage', 50); % Damping [N/(m/s)]
% k_acc_u = ureal('k_acc', k_acc, 'Percentage', 20); % Stiffness [N/m]
% g_acc_u = ureal('g_acc', g_acc, 'Percentage', 20); % Gain
% G_acc_u = -g_acc_u*m_acc_u*s/(m_acc_u*s^2 + c_acc_u*s + k_acc_u); % Accelerometer Model [V/(m/s)]
% Gss_u = H_acc*inv(G_acc)*G_acc_u + H2*inv(G2)*G2_u;
#+end_src #+end_src
** Sensor Noise #+name: fig:sensors_nominal_dynamics
Noise in $[m/s/\sqrt{Hz}]$. #+caption: Sensor nominal dynamics from the velocity of the object to the output voltage
#+begin_src matlab #+RESULTS:
omegac = 0.05*2*pi; G0 = 1e-1; Ginf = 1e-6; [[file:figs/sensors_nominal_dynamics.png]]
N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/1e4);
omegac = 1000*2*pi; G0 = 1e-6; Ginf = 1e-3;
N2 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/1e4);
#+end_src
#+begin_src matlab :exports none
figure;
hold on;
plot(freqs, abs(squeeze(freqresp(N1, freqs, 'Hz'))), '-', 'DisplayName', '$N_1$');
plot(freqs, abs(squeeze(freqresp(N2, freqs, 'Hz'))), '-', 'DisplayName', '$N_2$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Amplitude Spectral Density $\left[ \frac{m/s}{\sqrt{Hz}} \right]$');
hold off;
xlim([freqs(1), freqs(end)]);
legend('location', 'northeast');
#+end_src
** Sensor Model Uncertainty ** Sensor Model Uncertainty
The model uncertainty is described by multiplicative uncertainty. <<sec:sensor_uncertainty>>
The uncertainty on the sensor dynamics is described by multiplicative uncertainty (Figure [[fig:sensor_model_noise_uncertainty]]).
The true sensor dynamics $G_i(s)$ is then described by eqref:eq:sensor_dynamics_uncertainty.
\begin{equation}
G_i(s) = \hat{G}_i(s) \left( 1 + W_i(s) \Delta_i(s) \right); \quad |\Delta_i(j\omega)| < 1 \forall \omega \label{eq:sensor_dynamics_uncertainty}
\end{equation}
The weights $W_i(s)$ representing the dynamical uncertainty are defined below and their magnitude is shown in Figure [[fig:sensors_uncertainty_weights]].
#+begin_src matlab #+begin_src matlab
W1 = createWeight('n', 2, 'w0', 2*pi*3, 'G0', 2, 'G1', 0.1, 'Gc', 1) * ... W1 = createWeight('n', 2, 'w0', 2*pi*3, 'G0', 2, 'G1', 0.1, 'Gc', 1) * ...
createWeight('n', 2, 'w0', 2*pi*1e3, 'G0', 1, 'G1', 4/0.1, 'Gc', 1/0.1); createWeight('n', 2, 'w0', 2*pi*1e3, 'G0', 1, 'G1', 4/0.1, 'Gc', 1/0.1);
@ -144,33 +180,30 @@ The model uncertainty is described by multiplicative uncertainty.
W2 = createWeight('n', 2, 'w0', 2*pi*1e2, 'G0', 0.05, 'G1', 4, 'Gc', 1); W2 = createWeight('n', 2, 'w0', 2*pi*1e2, 'G0', 0.05, 'G1', 4, 'Gc', 1);
#+end_src #+end_src
The bode plot of the sensors nominal dynamics as well as their defined dynamical spread are shown in Figure [[fig:sensors_nominal_dynamics_and_uncertainty]].
#+begin_src matlab :exports none #+begin_src matlab :exports none
figure; figure;
% Magnitude
ax1 = subplot(2,1,1);
hold on; hold on;
plotMagUncertainty(W1, freqs, 'color_i', 1); plot(freqs, abs(squeeze(freqresp(W1, freqs, 'Hz'))), 'DisplayName', '$|W_1(j\omega)|$');
plotMagUncertainty(W2, freqs, 'color_i', 2); plot(freqs, abs(squeeze(freqresp(W2, freqs, 'Hz'))), 'DisplayName', '$|W_2(j\omega)|$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
set(gca, 'XTickLabel',[]);
ylabel('Magnitude');
ylim([1e-2, 1e1]);
hold off; hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'lin');
% Phase xlabel('Frequency [Hz]'); ylabel('Magnitude');
ax2 = subplot(2,1,2); ylim([0, 5]);
hold on;
plotPhaseUncertainty(W1, freqs, 'color_i', 1);
plotPhaseUncertainty(W2, freqs, 'color_i', 2);
set(gca,'xscale','log');
yticks(-180:90:180);
ylim([-180 180]);
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
hold off;
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]); xlim([freqs(1), freqs(end)]);
legend('location', 'northwest');
#+end_src #+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/sensors_uncertainty_weights.pdf', 'width', 'wide', 'height', 'normal');
#+end_src
#+name: fig:sensors_uncertainty_weights
#+caption: Magnitude of the multiplicative uncertainty weights $|W_i(j\omega)|$
#+RESULTS:
[[file:figs/sensors_uncertainty_weights.png]]
#+begin_src matlab :exports none #+begin_src matlab :exports none
figure; figure;
% Magnitude % Magnitude
@ -184,8 +217,8 @@ The model uncertainty is described by multiplicative uncertainty.
plot(freqs, abs(squeeze(freqresp(G2, freqs, 'Hz'))), 'DisplayName', '$\hat{G}_2$'); plot(freqs, abs(squeeze(freqresp(G2, freqs, 'Hz'))), 'DisplayName', '$\hat{G}_2$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
set(gca, 'XTickLabel',[]); set(gca, 'XTickLabel',[]);
ylabel('Magnitude'); ylabel('Magnitude $[\frac{V}{m/s}]$');
ylim([1e-2, 1e3]); ylim([1e-2, 2e3]);
legend('location', 'northeast'); legend('location', 'northeast');
hold off; hold off;
@ -207,12 +240,65 @@ The model uncertainty is described by multiplicative uncertainty.
xlim([freqs(1), freqs(end)]); xlim([freqs(1), freqs(end)]);
#+end_src #+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/sensors_nominal_dynamics_and_uncertainty.pdf', 'width', 'full', 'height', 'full');
#+end_src
#+name: fig:sensors_nominal_dynamics_and_uncertainty
#+caption: Nominal Sensor Dynamics $\hat{G}_i$ (solid lines) as well as the spread of the dynamical uncertainty (background color)
#+RESULTS:
[[file:figs/sensors_nominal_dynamics_and_uncertainty.png]]
** Sensor Noise
<<sec:sensor_noise>>
The noise of the sensors $n_i$ are modelled by shaping a white noise with unitary PSD $\tilde{n}_i$ eqref:eq:unitary_noise_psd with a LTI transfer function $N_i(s)$ (Figure [[fig:sensor_model_noise_uncertainty]]).
\begin{equation}
\Phi_{\tilde{n}_i}(\omega) = 1 \label{eq:unitary_noise_psd}
\end{equation}
The Power Spectral Density of the sensor noise $\Phi_{n_i}(\omega)$ is then computed using eqref:eq:sensor_noise_shaping and expressed in $[\frac{(m/s)^2}{Hz}]$.
\begin{equation}
\Phi_{n_i}(\omega) = \left| N_i(j\omega) \right|^2 \Phi_{\tilde{n}_i}(\omega) \label{eq:sensor_noise_shaping}
\end{equation}
The weights $N_1$ and $N_2$ representing the amplitude spectral density of the sensor noises are defined below and shown in Figure [[fig:sensors_noise]].
#+begin_src matlab
omegac = 0.05*2*pi; G0 = 1e-1; Ginf = 1e-6;
N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/1e4);
omegac = 1000*2*pi; G0 = 1e-6; Ginf = 1e-3;
N2 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/1e4);
#+end_src
#+begin_src matlab :exports none
figure;
hold on;
plot(freqs, abs(squeeze(freqresp(N1, freqs, 'Hz'))), '-', 'DisplayName', '$|N_1(j\omega)|$');
plot(freqs, abs(squeeze(freqresp(N2, freqs, 'Hz'))), '-', 'DisplayName', '$|N_2(j\omega)|$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Amplitude Spectral Density $\left[ \frac{m/s}{\sqrt{Hz}} \right]$');
hold off;
xlim([freqs(1), freqs(end)]);
legend('location', 'northeast');
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/sensors_noise.pdf', 'width', 'normal', 'height', 'normal');
#+end_src
#+name: fig:sensors_noise
#+caption: Amplitude spectral density of the sensors $\sqrt{\Phi_{n_i}(\omega)} = |N_i(j\omega)|$
#+RESULTS:
[[file:figs/sensors_noise.png]]
** Save Model ** Save Model
All the dynamical systems representing the sensors are saved for further use.
#+begin_src matlab #+begin_src matlab
save('./mat/model.mat', 'freqs', 'G1', 'G2', 'N2', 'N1', 'W2', 'W1'); save('./mat/model.mat', 'freqs', 'G1', 'G2', 'N2', 'N1', 'W2', 'W1');
#+end_src #+end_src
* First Order Complementary Filters * First Order Complementary Filters :noexport:
** Matlab Init :noexport:ignore: ** Matlab Init :noexport:ignore:
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
<<matlab-dir>> <<matlab-dir>>
@ -683,7 +769,6 @@ Thus, at these frequencies, $|W_\phi|$ should be smaller than $1$.
** Weighting Function used to bound the super sensor uncertainty ** Weighting Function used to bound the super sensor uncertainty
Let's define $W_\phi(s)$ in order to bound the maximum allowed phase uncertainty $\Delta\phi_\text{max}$ of the super sensor dynamics. Let's define $W_\phi(s)$ in order to bound the maximum allowed phase uncertainty $\Delta\phi_\text{max}$ of the super sensor dynamics.
The magnitude $|W_\phi(j\omega)|$ is shown in Fig. [[fig:magnitude_wphi]] and the corresponding maximum allowed phase uncertainty of the super sensor dynamics of shown in Fig. [[fig:maximum_wanted_phase_uncertainty]].
#+begin_src matlab #+begin_src matlab
Dphi = 10; % [deg] Dphi = 10; % [deg]
@ -841,8 +926,6 @@ The obtained complementary filters are shown in Fig. [[fig:comp_filter_hinf_unce
[[file:figs/comp_filter_hinf_uncertainty.png]] [[file:figs/comp_filter_hinf_uncertainty.png]]
** Super sensor uncertainty ** Super sensor uncertainty
We can now compute the uncertainty of the super sensor. The result is shown in Fig. [[fig:super_sensor_uncertainty_bode_plot]].
#+begin_src matlab #+begin_src matlab
H2_filters = load('./mat/H2_filters.mat', 'H2', 'H1'); H2_filters = load('./mat/H2_filters.mat', 'H2', 'H1');
#+end_src #+end_src
@ -1035,7 +1118,7 @@ Both dynamical uncertainty and noise characteristics of the individual sensors a
** Weighting Functions on the uncertainty of the super sensor ** Weighting Functions on the uncertainty of the super sensor
We design weights for the $\mathcal{H}_\infty$ part of the synthesis in order to limit the dynamical uncertainty of the super sensor. We design weights for the $\mathcal{H}_\infty$ part of the synthesis in order to limit the dynamical uncertainty of the super sensor.
The maximum wanted multiplicative uncertainty is shown in Fig. [[fig:mixed_syn_hinf_weight]]. The idea here is that we don't really need low uncertainty at low frequency but only near the crossover frequency that is suppose to be around 300Hz here. The maximum wanted multiplicative uncertainty is shown in Fig. .The idea here is that we don't really need low uncertainty at low frequency but only near the crossover frequency that is suppose to be around 300Hz here.
** Mixed $\mathcal{H}_2$ / $\mathcal{H}_\infty$ Synthesis ** Mixed $\mathcal{H}_2$ / $\mathcal{H}_\infty$ Synthesis
The synthesis architecture that is used here is shown in Fig. [[fig:mixed_h2_hinf_synthesis]]. The synthesis architecture that is used here is shown in Fig. [[fig:mixed_h2_hinf_synthesis]].
@ -1199,7 +1282,7 @@ The PSD and CPS of the super sensor's noise are shown in Fig. [[fig:psd_super_se
[[file:figs/cps_super_sensor_mixed_syn.png]] [[file:figs/cps_super_sensor_mixed_syn.png]]
** Obtained Super Sensor's Uncertainty ** Obtained Super Sensor's Uncertainty
The uncertainty on the super sensor's dynamics is shown in Fig. [[fig:super_sensor_dyn_uncertainty_mixed_syn]]. The uncertainty on the super sensor's dynamics is shown in Fig.
#+begin_src matlab :exports none #+begin_src matlab :exports none
Dphi_ss = 180/pi*asin(abs(squeeze(freqresp(W2*H2, freqs, 'Hz'))) + abs(squeeze(freqresp(W1*H1, freqs, 'Hz')))); Dphi_ss = 180/pi*asin(abs(squeeze(freqresp(W2*H2, freqs, 'Hz'))) + abs(squeeze(freqresp(W1*H1, freqs, 'Hz'))));
@ -2700,7 +2783,7 @@ The PSD and CPS of the super sensor's noise are shown in Fig. [[fig:psd_super_se
[[file:figs/cps_super_sensor_mixed_syn.png]] [[file:figs/cps_super_sensor_mixed_syn.png]]
*** Obtained Super Sensor's Uncertainty *** Obtained Super Sensor's Uncertainty
The uncertainty on the super sensor's dynamics is shown in Fig. [[fig:super_sensor_dyn_uncertainty_mixed_syn]]. The uncertainty on the super sensor's dynamics is shown in Fig.
#+begin_src matlab :exports none #+begin_src matlab :exports none
G1 = 1 + w1*ultidyn('Delta',[1 1]); G1 = 1 + w1*ultidyn('Delta',[1 1]);