Tangle + move to matlab folder

This commit is contained in:
Thomas Dehaeze 2020-11-10 12:53:45 +01:00
parent 1956132d55
commit e4f5e82281
8 changed files with 253 additions and 57 deletions

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2020-11-10 mar. 11:16 -->
<!-- 2020-11-10 mar. 12:53 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Encoder - Test Bench</title>
<meta name="generator" content="Org mode" />
@ -26,19 +26,19 @@
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgaf79dd3">1. Experimental Setup</a></li>
<li><a href="#org7a3b4de">2. Noise Spectral Density of the Encoder</a>
<li><a href="#org5ac16f2">1. Experimental Setup</a></li>
<li><a href="#org7441659">2. Noise Spectral Density of the Encoder</a>
<ul>
<li><a href="#orgfbf4ee1">2.1. Load Data</a></li>
<li><a href="#org6c853de">2.2. Time Domain Results</a></li>
<li><a href="#orgd135f83">2.3. Frequency Domain Noise</a></li>
<li><a href="#orgfface02">2.1. Load Data</a></li>
<li><a href="#orgeab98b2">2.2. Time Domain Results</a></li>
<li><a href="#org9d7a1b2">2.3. Frequency Domain Noise</a></li>
</ul>
</li>
<li><a href="#org1e07ca4">3. Dynamics from Actuator to Encoder</a>
<li><a href="#orga15f5e0">3. Dynamics from Actuator to Encoder</a>
<ul>
<li><a href="#orga05d6d1">3.1. Load Data</a></li>
<li><a href="#orga8a55da">3.2. Excitation and Measured Signals</a></li>
<li><a href="#org4873d25">3.3. Identification</a></li>
<li><a href="#org371d2a2">3.1. Load Data</a></li>
<li><a href="#orgb2df3c8">3.2. Excitation and Measured Signals</a></li>
<li><a href="#orgfb97858">3.3. Identification</a></li>
</ul>
</li>
</ul>
@ -53,23 +53,23 @@ In this document, we wish to study the use of an encoder in parallel with an Amp
The document is divided into the following Sections:
</p>
<ul class="org-ul">
<li>Section <a href="#org05b69c6">1</a>: the test-bench used is described</li>
<li>Section <a href="#org0031eaa">2</a>: the noise spectral density of the encoder is estimated</li>
<li>Section <a href="#org8178907">3</a>: the dynamics from the amplified piezoelectric actuator to the encoder measured displacement is identified</li>
<li>Section <a href="#org973b24d">1</a>: the test-bench used is described</li>
<li>Section <a href="#org7331cce">2</a>: the noise spectral density of the encoder is estimated</li>
<li>Section <a href="#org9fb1af3">3</a>: the dynamics from the amplified piezoelectric actuator to the encoder measured displacement is identified</li>
</ul>
<div id="outline-container-orgaf79dd3" class="outline-2">
<h2 id="orgaf79dd3"><span class="section-number-2">1</span> Experimental Setup</h2>
<div id="outline-container-org5ac16f2" class="outline-2">
<h2 id="org5ac16f2"><span class="section-number-2">1</span> Experimental Setup</h2>
<div class="outline-text-2" id="text-1">
<p>
<a id="org05b69c6"></a>
<a id="org973b24d"></a>
</p>
<p>
The experimental Setup is schematically represented in Figure <a href="#org54243a1">1</a>.
The experimental Setup is schematically represented in Figure <a href="#org2529a80">1</a>.
</p>
<div class="note" id="orgba61b71">
<div class="note" id="org3cc7332">
<p>
Here are the equipment used in the test bench:
</p>
@ -89,21 +89,21 @@ The displacement of the mass (relative to the mechanical frame) is measured both
</p>
<div id="org54243a1" class="figure">
<div id="org2529a80" class="figure">
<p><img src="figs/exp_setup_schematic.png" alt="exp_setup_schematic.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Schematic of the Experiment</p>
</div>
<div id="orgc63322f" class="figure">
<div id="orgdf4e259" class="figure">
<p><img src="figs/IMG_20201023_153905.jpg" alt="IMG_20201023_153905.jpg" />
</p>
<p><span class="figure-number">Figure 2: </span>Side View of the encoder</p>
</div>
<div id="org795dc71" class="figure">
<div id="orga98f1bf" class="figure">
<p><img src="figs/IMG_20201023_153914.jpg" alt="IMG_20201023_153914.jpg" />
</p>
<p><span class="figure-number">Figure 3: </span>Front View of the encoder</p>
@ -111,11 +111,11 @@ The displacement of the mass (relative to the mechanical frame) is measured both
</div>
</div>
<div id="outline-container-org7a3b4de" class="outline-2">
<h2 id="org7a3b4de"><span class="section-number-2">2</span> Noise Spectral Density of the Encoder</h2>
<div id="outline-container-org7441659" class="outline-2">
<h2 id="org7441659"><span class="section-number-2">2</span> Noise Spectral Density of the Encoder</h2>
<div class="outline-text-2" id="text-2">
<p>
<a id="org0031eaa"></a>
<a id="org7331cce"></a>
</p>
<p>
The goal in this section is the estimate the noise of both the encoder and the intereferometer.
@ -127,15 +127,15 @@ Ideally, a mechanical part would clamp the two together, we here suppose that th
</p>
</div>
<div id="outline-container-orgfbf4ee1" class="outline-3">
<h3 id="orgfbf4ee1"><span class="section-number-3">2.1</span> Load Data</h3>
<div id="outline-container-orgfface02" class="outline-3">
<h3 id="orgfface02"><span class="section-number-3">2.1</span> Load Data</h3>
<div class="outline-text-3" id="text-2-1">
<p>
The measurement data are loaded and the offset are removed using the <code>detrend</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'mat/int_enc_huddle_test.mat'</span>, <span class="org-string">'interferometer'</span>, <span class="org-string">'encoder'</span>, <span class="org-string">'t'</span>);
<pre class="src src-matlab">load(<span class="org-string">'int_enc_huddle_test.mat'</span>, <span class="org-string">'interferometer'</span>, <span class="org-string">'encoder'</span>, <span class="org-string">'t'</span>);
</pre>
</div>
@ -147,22 +147,22 @@ encoder = detrend(encoder, 0);
</div>
</div>
<div id="outline-container-org6c853de" class="outline-3">
<h3 id="org6c853de"><span class="section-number-3">2.2</span> Time Domain Results</h3>
<div id="outline-container-orgeab98b2" class="outline-3">
<h3 id="orgeab98b2"><span class="section-number-3">2.2</span> Time Domain Results</h3>
<div class="outline-text-3" id="text-2-2">
<p>
The measurement of both the encoder and interferometer are shown in Figure <a href="#org332769b">4</a>.
The measurement of both the encoder and interferometer are shown in Figure <a href="#orgc0bfd00">4</a>.
</p>
<div id="org332769b" class="figure">
<div id="orgc0bfd00" class="figure">
<p><img src="figs/huddle_test_time_domain.png" alt="huddle_test_time_domain.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Huddle test - Time domain signals</p>
</div>
<p>
The raw signals are filtered with a Low Pass filter (defined below) such that we can see the low frequency motion (Figure <a href="#orgc5b97b7">5</a>).
The raw signals are filtered with a Low Pass filter (defined below) such that we can see the low frequency motion (Figure <a href="#org2bb066f">5</a>).
</p>
<div class="org-src-container">
<pre class="src src-matlab">G_lpf = 1<span class="org-type">/</span>(1 <span class="org-type">+</span> s<span class="org-type">/</span>2<span class="org-type">/</span><span class="org-constant">pi</span><span class="org-type">/</span>10);
@ -170,7 +170,7 @@ The raw signals are filtered with a Low Pass filter (defined below) such that we
</div>
<div id="orgc5b97b7" class="figure">
<div id="org2bb066f" class="figure">
<p><img src="figs/huddle_test_time_domain_filtered.png" alt="huddle_test_time_domain_filtered.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Huddle test - Time domain signals filtered with a LPF at 10Hz</p>
@ -178,8 +178,8 @@ The raw signals are filtered with a Low Pass filter (defined below) such that we
</div>
</div>
<div id="outline-container-orgd135f83" class="outline-3">
<h3 id="orgd135f83"><span class="section-number-3">2.3</span> Frequency Domain Noise</h3>
<div id="outline-container-org9d7a1b2" class="outline-3">
<h3 id="org9d7a1b2"><span class="section-number-3">2.3</span> Frequency Domain Noise</h3>
<div class="outline-text-3" id="text-2-3">
<p>
The noise of the measurement (supposing there is no motion) is now translated in the frequency domain by computed the Amplitude Spectral Density.
@ -195,7 +195,7 @@ win = hann(ceil(10<span class="org-type">/</span>Ts));
</div>
<p>
The comparison of the ASD of the encoder and interferometer are shown in Figure <a href="#orgd76ad0f">6</a>.
The comparison of the ASD of the encoder and interferometer are shown in Figure <a href="#org7272303">6</a>.
</p>
<p>
@ -203,7 +203,7 @@ It is clear that although the encoder exhibit higher frequency noise, is it more
</p>
<div id="orgd76ad0f" class="figure">
<div id="org7272303" class="figure">
<p><img src="figs/huddle_test_asd.png" alt="huddle_test_asd.png" />
</p>
<p><span class="figure-number">Figure 6: </span>Amplitude Spectral Density of the signals during the Huddle test</p>
@ -212,25 +212,25 @@ It is clear that although the encoder exhibit higher frequency noise, is it more
</div>
</div>
<div id="outline-container-org1e07ca4" class="outline-2">
<h2 id="org1e07ca4"><span class="section-number-2">3</span> Dynamics from Actuator to Encoder</h2>
<div id="outline-container-orga15f5e0" class="outline-2">
<h2 id="orga15f5e0"><span class="section-number-2">3</span> Dynamics from Actuator to Encoder</h2>
<div class="outline-text-2" id="text-3">
<p>
<a id="org8178907"></a>
<a id="org9fb1af3"></a>
</p>
<p>
Now the dynamics from the force actuator to the measurement by the encoder is identified.
</p>
</div>
<div id="outline-container-orga05d6d1" class="outline-3">
<h3 id="orga05d6d1"><span class="section-number-3">3.1</span> Load Data</h3>
<div id="outline-container-org371d2a2" class="outline-3">
<h3 id="org371d2a2"><span class="section-number-3">3.1</span> Load Data</h3>
<div class="outline-text-3" id="text-3-1">
<p>
As usual, the measurement data are loaded.
</p>
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'mat/int_enc_id_noise_bis.mat'</span>, <span class="org-string">'interferometer'</span>, <span class="org-string">'encoder'</span>, <span class="org-string">'u'</span>, <span class="org-string">'t'</span>);
<pre class="src src-matlab">load(<span class="org-string">'int_enc_id_noise_bis.mat'</span>, <span class="org-string">'interferometer'</span>, <span class="org-string">'encoder'</span>, <span class="org-string">'u'</span>, <span class="org-string">'t'</span>);
</pre>
</div>
@ -257,18 +257,18 @@ u = detrend(u, 0);
</div>
</div>
<div id="outline-container-orga8a55da" class="outline-3">
<h3 id="orga8a55da"><span class="section-number-3">3.2</span> Excitation and Measured Signals</h3>
<div id="outline-container-orgb2df3c8" class="outline-3">
<h3 id="orgb2df3c8"><span class="section-number-3">3.2</span> Excitation and Measured Signals</h3>
<div class="outline-text-3" id="text-3-2">
<p>
The excitation signal is a white noise filtered by a low pass filter to not excite too much the high frequency modes.
</p>
<p>
The excitation signal is shown in Figure <a href="#org8db32e3">7</a>.
The excitation signal is shown in Figure <a href="#org0fde08c">7</a>.
</p>
<div id="org8db32e3" class="figure">
<div id="org0fde08c" class="figure">
<p><img src="figs/encoder_identification_excitation_time.png" alt="encoder_identification_excitation_time.png" />
</p>
</div>
@ -277,15 +277,15 @@ The excitation signal is shown in Figure <a href="#org8db32e3">7</a>.
The measured motion by the interferometer and encoder is shown in Figure
</p>
<div id="org10991a6" class="figure">
<div id="orgefc6685" class="figure">
<p><img src="figs/encoder_identification_motion.png" alt="encoder_identification_motion.png" />
</p>
</div>
</div>
</div>
<div id="outline-container-org4873d25" class="outline-3">
<h3 id="org4873d25"><span class="section-number-3">3.3</span> Identification</h3>
<div id="outline-container-orgfb97858" class="outline-3">
<h3 id="orgfb97858"><span class="section-number-3">3.3</span> Identification</h3>
<div class="outline-text-3" id="text-3-3">
<p>
Now the dynamics from the voltage sent to the voltage amplitude driving the APA95ML to the measured displacement by both the encoder and interferometer are computed.
@ -304,22 +304,22 @@ win = hann(ceil(10<span class="org-type">/</span>Ts));
</div>
<p>
The obtained coherence is shown in Figure <a href="#org0b95482">9</a>.
The obtained coherence is shown in Figure <a href="#org1795d67">9</a>.
It is shown that the identification is good until 500Hz for the interferometer and until 1kHz for the encoder.
</p>
<div id="org0b95482" class="figure">
<div id="org1795d67" class="figure">
<p><img src="figs/identification_dynamics_coherence.png" alt="identification_dynamics_coherence.png" />
</p>
</div>
<p>
The compared dynamics as measured by the intereferometer and encoder are shown in Figure <a href="#orgb017bd4">10</a>.
The compared dynamics as measured by the intereferometer and encoder are shown in Figure <a href="#org4ea418f">10</a>.
</p>
<div id="orgb017bd4" class="figure">
<div id="org4ea418f" class="figure">
<p><img src="figs/identification_dynamics_bode.png" alt="identification_dynamics_bode.png" />
</p>
</div>
@ -334,7 +334,7 @@ The second resonance at around 900Hz most likely corresponds to the resonance of
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-11-10 mar. 11:16</p>
<p class="date">Created: 2020-11-10 mar. 12:53</p>
</div>
</body>
</html>

View File

@ -75,6 +75,9 @@ The displacement of the mass (relative to the mechanical frame) is measured both
[[file:figs/IMG_20201023_153914.jpg]]
* Noise Spectral Density of the Encoder
:PROPERTIES:
:header-args:matlab+: :tangle matlab/encoder_noise.m
:END:
<<sec:encoder_noise>>
** Introduction :ignore:
@ -96,7 +99,7 @@ Ideally, a mechanical part would clamp the two together, we here suppose that th
The measurement data are loaded and the offset are removed using the =detrend= command.
#+begin_src matlab
load('mat/int_enc_huddle_test.mat', 'interferometer', 'encoder', 't');
load('int_enc_huddle_test.mat', 'interferometer', 'encoder', 't');
#+end_src
#+begin_src matlab
@ -187,6 +190,9 @@ It is clear that although the encoder exhibit higher frequency noise, is it more
[[file:figs/huddle_test_asd.png]]
* Dynamics from Actuator to Encoder
:PROPERTIES:
:header-args:matlab+: :tangle matlab/dynamics_encoder.m
:END:
<<sec:dynamics_encoder>>
** Introduction :ignore:
@ -204,7 +210,7 @@ Now the dynamics from the force actuator to the measurement by the encoder is id
** Load Data
As usual, the measurement data are loaded.
#+begin_src matlab
load('mat/int_enc_id_noise_bis.mat', 'interferometer', 'encoder', 'u', 't');
load('int_enc_id_noise_bis.mat', 'interferometer', 'encoder', 'u', 't');
#+end_src
The first 0.1 seconds are removed as it corresponds to transient behavior.

118
matlab/dynamics_encoder.m Normal file
View File

@ -0,0 +1,118 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
% Load Data
% As usual, the measurement data are loaded.
load('int_enc_id_noise_bis.mat', 'interferometer', 'encoder', 'u', 't');
% The first 0.1 seconds are removed as it corresponds to transient behavior.
interferometer = interferometer(t>0.1);
encoder = encoder(t>0.1);
u = u(t>0.1);
t = t(t>0.1);
% Finally the offset are removed using the =detrend= command.
interferometer = detrend(interferometer, 0);
encoder = detrend(encoder, 0);
u = detrend(u, 0);
% Excitation and Measured Signals
% The excitation signal is a white noise filtered by a low pass filter to not excite too much the high frequency modes.
% The excitation signal is shown in Figure [[fig:encoder_identification_excitation_time]].
figure;
plot(t, u);
xlabel('Time [s]'); ylabel('Voltage [V]');
% #+name: fig:encoder_identification_excitation_time
% #+caption:
% #+RESULTS:
% [[file:figs/encoder_identification_excitation_time.png]]
% The measured motion by the interferometer and encoder is shown in Figure
figure;
hold on;
plot(t, interferometer, 'DisplayName', 'Interferometer');
plot(t, encoder, 'DisplayName', 'Encoder');
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
legend('location', 'southeast');
% Identification
% Now the dynamics from the voltage sent to the voltage amplitude driving the APA95ML to the measured displacement by both the encoder and interferometer are computed.
Ts = 1e-4; % Sampling Time [s]
win = hann(ceil(10/Ts));
[tf_i_est, f] = tfestimate(u, interferometer, win, [], [], 1/Ts);
[co_i_est, ~] = mscohere(u, interferometer, win, [], [], 1/Ts);
[tf_e_est, ~] = tfestimate(u, encoder, win, [], [], 1/Ts);
[co_e_est, ~] = mscohere(u, encoder, win, [], [], 1/Ts);
% The obtained coherence is shown in Figure [[fig:identification_dynamics_coherence]].
% It is shown that the identification is good until 500Hz for the interferometer and until 1kHz for the encoder.
figure;
hold on;
plot(f, co_i_est, '-', 'DisplayName', 'Interferometer')
plot(f, co_e_est, '-', 'DisplayName', 'Encoder')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Coherence'); xlabel('Frequency [Hz]');
hold off;
xlim([0.5, 5e3]);
legend('location', 'southwest');
% #+name: fig:identification_dynamics_coherence
% #+caption:
% #+RESULTS:
% [[file:figs/identification_dynamics_coherence.png]]
% The compared dynamics as measured by the intereferometer and encoder are shown in Figure [[fig:identification_dynamics_bode]].
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2, 1]);
hold on;
plot(f, abs(tf_i_est), '-', 'DisplayName', 'Interferometer')
plot(f, abs(tf_e_est), '-', 'DisplayName', 'Encoder')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); set(gca, 'XTickLabel',[]);
hold off;
ylim([1e-7, 3e-4]);
legend('location', 'southwest');
ax2 = nexttile;
hold on;
plot(f, 180/pi*angle(tf_i_est), '-')
plot(f, 180/pi*angle(tf_e_est), '-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase [deg]'); xlabel('Frequency [Hz]');
hold off;
yticks(-360:90:360);
axis padded 'auto x'
linkaxes([ax1,ax2], 'x');
xlim([0.5, 5e3]);

72
matlab/encoder_noise.m Normal file
View File

@ -0,0 +1,72 @@
%% Clear Workspace and Close figures
clear; close all; clc;
%% Intialize Laplace variable
s = zpk('s');
% Load Data
% The measurement data are loaded and the offset are removed using the =detrend= command.
load('int_enc_huddle_test.mat', 'interferometer', 'encoder', 't');
interferometer = detrend(interferometer, 0);
encoder = detrend(encoder, 0);
% Time Domain Results
% The measurement of both the encoder and interferometer are shown in Figure [[fig:huddle_test_time_domain]].
figure;
hold on;
plot(t, encoder, 'DisplayName', 'Encoder')
plot(t, interferometer, 'DisplayName', 'Interferometer')
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
legend('location', 'northeast');
% #+name: fig:huddle_test_time_domain
% #+caption: Huddle test - Time domain signals
% #+RESULTS:
% [[file:figs/huddle_test_time_domain.png]]
% The raw signals are filtered with a Low Pass filter (defined below) such that we can see the low frequency motion (Figure [[fig:huddle_test_time_domain_filtered]]).
G_lpf = 1/(1 + s/2/pi/10);
figure;
hold on;
plot(t, lsim(G_lpf, encoder, t), 'DisplayName', 'Encoder')
plot(t, lsim(G_lpf, interferometer, t), 'DisplayName', 'Interferometer')
hold off;
xlabel('Time [s]'); ylabel('Displacement [m]');
legend('location', 'northeast');
% Frequency Domain Noise
% The noise of the measurement (supposing there is no motion) is now translated in the frequency domain by computed the Amplitude Spectral Density.
Ts = 1e-4;
win = hann(ceil(10/Ts));
[p_i, f] = pwelch(interferometer, win, [], [], 1/Ts);
[p_e, ~] = pwelch(encoder, win, [], [], 1/Ts);
% The comparison of the ASD of the encoder and interferometer are shown in Figure [[fig:huddle_test_asd]].
% It is clear that although the encoder exhibit higher frequency noise, is it more stable at low frequency as the length of the beam path in the air is much smaller and thus changed of temperature/pressure/humity of the air has much smaller effect on the measured displacement.
figure;
hold on;
plot(f, sqrt(p_i), 'DisplayName', 'Interferometer');
plot(f, sqrt(p_e), 'DisplayName', 'Encoder');
hold off;
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('ASD [$m/\sqrt{Hz}$]'); xlabel('Frequency [Hz]');
legend();
xlim([1e-1, 5e3]);