From e4f5e82281f0bfb579c422304f1ff8c78813c7b6 Mon Sep 17 00:00:00 2001 From: Thomas Dehaeze Date: Tue, 10 Nov 2020 12:53:45 +0100 Subject: [PATCH] Tangle + move to matlab folder --- index.html | 110 ++++++++--------- index.org | 10 +- matlab/dynamics_encoder.m | 118 +++++++++++++++++++ matlab/encoder_noise.m | 72 +++++++++++ {mat => matlab/mat}/int_enc_comp.mat | Bin {mat => matlab/mat}/int_enc_huddle_test.mat | Bin {mat => matlab/mat}/int_enc_id_noise.mat | Bin {mat => matlab/mat}/int_enc_id_noise_bis.mat | Bin 8 files changed, 253 insertions(+), 57 deletions(-) create mode 100644 matlab/dynamics_encoder.m create mode 100644 matlab/encoder_noise.m rename {mat => matlab/mat}/int_enc_comp.mat (100%) rename {mat => matlab/mat}/int_enc_huddle_test.mat (100%) rename {mat => matlab/mat}/int_enc_id_noise.mat (100%) rename {mat => matlab/mat}/int_enc_id_noise_bis.mat (100%) diff --git a/index.html b/index.html index a275cfd..51177c8 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Encoder - Test Bench @@ -26,19 +26,19 @@

Table of Contents

@@ -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:

-
-

1 Experimental Setup

+
+

1 Experimental Setup

- +

-The experimental Setup is schematically represented in Figure 1. +The experimental Setup is schematically represented in Figure 1.

-
+

Here are the equipment used in the test bench:

@@ -89,21 +89,21 @@ The displacement of the mass (relative to the mechanical frame) is measured both

-
+

exp_setup_schematic.png

Figure 1: Schematic of the Experiment

-
+

IMG_20201023_153905.jpg

Figure 2: Side View of the encoder

-
+

IMG_20201023_153914.jpg

Figure 3: Front View of the encoder

@@ -111,11 +111,11 @@ The displacement of the mass (relative to the mechanical frame) is measured both
-
-

2 Noise Spectral Density of the Encoder

+
+

2 Noise Spectral Density of the Encoder

- +

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

-
-

2.1 Load Data

+
+

2.1 Load Data

The measurement data are loaded and the offset are removed using the detrend command.

-
load('mat/int_enc_huddle_test.mat', 'interferometer', 'encoder', 't');
+
load('int_enc_huddle_test.mat', 'interferometer', 'encoder', 't');
 
@@ -147,22 +147,22 @@ encoder = detrend(encoder, 0);
-
-

2.2 Time Domain Results

+
+

2.2 Time Domain Results

-The measurement of both the encoder and interferometer are shown in Figure 4. +The measurement of both the encoder and interferometer are shown in Figure 4.

-
+

huddle_test_time_domain.png

Figure 4: Huddle test - Time domain signals

-The raw signals are filtered with a Low Pass filter (defined below) such that we can see the low frequency motion (Figure 5). +The raw signals are filtered with a Low Pass filter (defined below) such that we can see the low frequency motion (Figure 5).

G_lpf = 1/(1 + s/2/pi/10);
@@ -170,7 +170,7 @@ The raw signals are filtered with a Low Pass filter (defined below) such that we
 
-
+

huddle_test_time_domain_filtered.png

Figure 5: Huddle test - Time domain signals filtered with a LPF at 10Hz

@@ -178,8 +178,8 @@ The raw signals are filtered with a Low Pass filter (defined below) such that we
-
-

2.3 Frequency Domain Noise

+
+

2.3 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. @@ -195,7 +195,7 @@ win = hann(ceil(10/Ts));

-The comparison of the ASD of the encoder and interferometer are shown in Figure 6. +The comparison of the ASD of the encoder and interferometer are shown in Figure 6.

@@ -203,7 +203,7 @@ It is clear that although the encoder exhibit higher frequency noise, is it more

-
+

huddle_test_asd.png

Figure 6: Amplitude Spectral Density of the signals during the Huddle test

@@ -212,25 +212,25 @@ It is clear that although the encoder exhibit higher frequency noise, is it more
-
-

3 Dynamics from Actuator to Encoder

+
+

3 Dynamics from Actuator to Encoder

- +

Now the dynamics from the force actuator to the measurement by the encoder is identified.

-
-

3.1 Load Data

+
+

3.1 Load Data

As usual, the measurement data are loaded.

-
load('mat/int_enc_id_noise_bis.mat', 'interferometer', 'encoder', 'u', 't');
+
load('int_enc_id_noise_bis.mat', 'interferometer', 'encoder', 'u', 't');
 
@@ -257,18 +257,18 @@ u = detrend(u, 0);
-
-

3.2 Excitation and Measured Signals

+
+

3.2 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 7. +The excitation signal is shown in Figure 7.

-
+

encoder_identification_excitation_time.png

@@ -277,15 +277,15 @@ The excitation signal is shown in Figure 7. The measured motion by the interferometer and encoder is shown in Figure

-
+

encoder_identification_motion.png

-
-

3.3 Identification

+
+

3.3 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. @@ -304,22 +304,22 @@ win = hann(ceil(10/Ts));

-The obtained coherence is shown in Figure 9. +The obtained coherence is shown in Figure 9. It is shown that the identification is good until 500Hz for the interferometer and until 1kHz for the encoder.

-
+

identification_dynamics_coherence.png

-The compared dynamics as measured by the intereferometer and encoder are shown in Figure 10. +The compared dynamics as measured by the intereferometer and encoder are shown in Figure 10.

-
+

identification_dynamics_bode.png

@@ -334,7 +334,7 @@ The second resonance at around 900Hz most likely corresponds to the resonance of

Author: Dehaeze Thomas

-

Created: 2020-11-10 mar. 11:16

+

Created: 2020-11-10 mar. 12:53

diff --git a/index.org b/index.org index e72cccc..c641dd6 100644 --- a/index.org +++ b/index.org @@ -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: <> ** 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: <> ** 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. diff --git a/matlab/dynamics_encoder.m b/matlab/dynamics_encoder.m new file mode 100644 index 0000000..e5b4233 --- /dev/null +++ b/matlab/dynamics_encoder.m @@ -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]); diff --git a/matlab/encoder_noise.m b/matlab/encoder_noise.m new file mode 100644 index 0000000..95508c8 --- /dev/null +++ b/matlab/encoder_noise.m @@ -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]); diff --git a/mat/int_enc_comp.mat b/matlab/mat/int_enc_comp.mat similarity index 100% rename from mat/int_enc_comp.mat rename to matlab/mat/int_enc_comp.mat diff --git a/mat/int_enc_huddle_test.mat b/matlab/mat/int_enc_huddle_test.mat similarity index 100% rename from mat/int_enc_huddle_test.mat rename to matlab/mat/int_enc_huddle_test.mat diff --git a/mat/int_enc_id_noise.mat b/matlab/mat/int_enc_id_noise.mat similarity index 100% rename from mat/int_enc_id_noise.mat rename to matlab/mat/int_enc_id_noise.mat diff --git a/mat/int_enc_id_noise_bis.mat b/matlab/mat/int_enc_id_noise_bis.mat similarity index 100% rename from mat/int_enc_id_noise_bis.mat rename to matlab/mat/int_enc_id_noise_bis.mat