encoder-test-bench/index.html

346 lines
14 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"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-10-23 ven. 23:04 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Encoder - Test Bench</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<link rel="stylesheet" type="text/css" href="./css/zenburn.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
<script>MathJax = {
tex: {
tags: 'ams',
macros: {bm: ["\\boldsymbol{#1}",1],}
}
};
</script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
</head>
<body>
<div id="content">
<h1 class="title">Encoder - Test Bench</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org0d09252">1. Experimental Setup</a></li>
<li><a href="#org4c1706c">2. Huddle Test</a>
<ul>
<li><a href="#org169c9b3">2.1. Load Data</a></li>
<li><a href="#org71d6eed">2.2. Time Domain Results</a></li>
<li><a href="#org526b687">2.3. Frequency Domain Noise</a></li>
</ul>
</li>
<li><a href="#org25a61fe">3. Comparison Interferometer / Encoder</a>
<ul>
<li><a href="#orgb31234a">3.1. Load Data</a></li>
<li><a href="#org4fa5441">3.2. Time Domain Results</a></li>
<li><a href="#orge79e200">3.3. Difference between Encoder and Interferometer as a function of time</a></li>
<li><a href="#org625a811">3.4. Difference between Encoder and Interferometer as a function of position</a></li>
</ul>
</li>
<li><a href="#org2e4bf3b">4. Identification</a>
<ul>
<li><a href="#org8a892bd">4.1. Load Data</a></li>
<li><a href="#org7e3c2ba">4.2. Identification</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org0d09252" class="outline-2">
<h2 id="org0d09252"><span class="section-number-2">1</span> Experimental Setup</h2>
<div class="outline-text-2" id="text-1">
<p>
The experimental Setup is schematically represented in Figure <a href="#org5bc9553">1</a>.
</p>
<div id="org5bc9553" 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="org7f3df10" 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="org71727ed" 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>
</div>
</div>
</div>
<div id="outline-container-org4c1706c" class="outline-2">
<h2 id="org4c1706c"><span class="section-number-2">2</span> Huddle Test</h2>
<div class="outline-text-2" id="text-2">
<p>
The goal in this section is the estimate the noise of both the encoder and the intereferometer.
</p>
</div>
<div id="outline-container-org169c9b3" class="outline-3">
<h3 id="org169c9b3"><span class="section-number-3">2.1</span> Load Data</h3>
<div class="outline-text-3" id="text-2-1">
<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>
</div>
<div class="org-src-container">
<pre class="src src-matlab">interferometer = detrend(interferometer, 0);
encoder = detrend(encoder, 0);
</pre>
</div>
</div>
</div>
<div id="outline-container-org71d6eed" class="outline-3">
<h3 id="org71d6eed"><span class="section-number-3">2.2</span> Time Domain Results</h3>
<div class="outline-text-3" id="text-2-2">
<div id="org06a0d1c" 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>
<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);
</pre>
</div>
<div id="orgee9ad22" 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>
</div>
</div>
</div>
<div id="outline-container-org526b687" class="outline-3">
<h3 id="org526b687"><span class="section-number-3">2.3</span> Frequency Domain Noise</h3>
<div class="outline-text-3" id="text-2-3">
<div class="org-src-container">
<pre class="src src-matlab">Ts = 1e<span class="org-type">-</span>4;
win = hann(ceil(10<span class="org-type">/</span>Ts));
[p_i, f] = pwelch(interferometer, win, [], [], 1<span class="org-type">/</span>Ts);
[p_e, <span class="org-type">~</span>] = pwelch(encoder, win, [], [], 1<span class="org-type">/</span>Ts);
</pre>
</div>
<div id="org7e02bb2" 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>
</div>
</div>
</div>
</div>
<div id="outline-container-org25a61fe" class="outline-2">
<h2 id="org25a61fe"><span class="section-number-2">3</span> Comparison Interferometer / Encoder</h2>
<div class="outline-text-2" id="text-3">
<p>
The goal here is to make sure that the interferometer and encoder measurements are coherent.
We may see non-linearity in the interferometric measurement.
</p>
</div>
<div id="outline-container-orgb31234a" class="outline-3">
<h3 id="orgb31234a"><span class="section-number-3">3.1</span> Load Data</h3>
<div class="outline-text-3" id="text-3-1">
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'mat/int_enc_comp.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>
<div class="org-src-container">
<pre class="src src-matlab">interferometer = detrend(interferometer, 0);
encoder = detrend(encoder, 0);
u = detrend(u, 0);
</pre>
</div>
</div>
</div>
<div id="outline-container-org4fa5441" class="outline-3">
<h3 id="org4fa5441"><span class="section-number-3">3.2</span> Time Domain Results</h3>
<div class="outline-text-3" id="text-3-2">
<div id="org486d613" class="figure">
<p><img src="figs/int_enc_one_cycle.png" alt="int_enc_one_cycle.png" />
</p>
<p><span class="figure-number">Figure 7: </span>One cycle measurement</p>
</div>
<div id="org2bb119e" class="figure">
<p><img src="figs/int_enc_one_cycle_error.png" alt="int_enc_one_cycle_error.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Difference between the Encoder and the interferometer during one cycle</p>
</div>
</div>
</div>
<div id="outline-container-orge79e200" class="outline-3">
<h3 id="orge79e200"><span class="section-number-3">3.3</span> Difference between Encoder and Interferometer as a function of time</h3>
<div class="outline-text-3" id="text-3-3">
<div class="org-src-container">
<pre class="src src-matlab">Ts = 1e<span class="org-type">-</span>4;
d_i_mean = reshape(interferometer, [2<span class="org-type">/</span>Ts floor(Ts<span class="org-type">/</span>2<span class="org-type">*</span>length(interferometer))]);
d_e_mean = reshape(encoder, [2<span class="org-type">/</span>Ts floor(Ts<span class="org-type">/</span>2<span class="org-type">*</span>length(encoder))]);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>5; <span class="org-comment">% [rad/s]</span>
xi = 0.7;
G_lpf = 1<span class="org-type">/</span>(1 <span class="org-type">+</span> 2<span class="org-type">*</span>xi<span class="org-type">/</span>w0<span class="org-type">*</span>s <span class="org-type">+</span> s<span class="org-type">^</span>2<span class="org-type">/</span>w0<span class="org-type">^</span>2);
d_err_mean = reshape(lsim(G_lpf, encoder <span class="org-type">-</span> interferometer, t), [2<span class="org-type">/</span>Ts floor(Ts<span class="org-type">/</span>2<span class="org-type">*</span>length(encoder))]);
d_err_mean = d_err_mean <span class="org-type">-</span> mean(d_err_mean);
</pre>
</div>
<div id="orgf0015d1" class="figure">
<p><img src="figs/int_enc_error_mean_time.png" alt="int_enc_error_mean_time.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Difference between the two measurement in the time domain, averaged for all the cycles</p>
</div>
</div>
</div>
<div id="outline-container-org625a811" class="outline-3">
<h3 id="org625a811"><span class="section-number-3">3.4</span> Difference between Encoder and Interferometer as a function of position</h3>
<div class="outline-text-3" id="text-3-4">
<p>
Compute the mean of the interferometer measurement corresponding to each of the encoder measurement.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[e_sorted, <span class="org-type">~</span>, e_ind] = unique(encoder);
i_mean = zeros(length(e_sorted), 1);
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-constant">i</span></span> = <span class="org-constant">1:length(e_sorted)</span>
i_mean(<span class="org-constant">i</span>) = mean(interferometer(e_ind <span class="org-type">==</span> <span class="org-constant">i</span>));
<span class="org-keyword">end</span>
i_mean_error = (i_mean <span class="org-type">-</span> e_sorted);
</pre>
</div>
<div id="orgd4f6d77" class="figure">
<p><img src="figs/int_enc_error_mean_position.png" alt="int_enc_error_mean_position.png" />
</p>
<p><span class="figure-number">Figure 10: </span>Difference between the two measurement as a function of the measured position by the encoder, averaged for all the cycles</p>
</div>
<p>
The period of the non-linearity seems to be \(1.53 \mu m\) which corresponds to the wavelength of the Laser.
</p>
<div class="org-src-container">
<pre class="src src-matlab">win_length = 1530; <span class="org-comment">% length of the windows (corresponds to 1.53 um)</span>
num_avg = floor(length(e_sorted)<span class="org-type">/</span>win_length); <span class="org-comment">% number of averaging</span>
i_init = ceil((length(e_sorted) <span class="org-type">-</span> win_length<span class="org-type">*</span>num_avg)<span class="org-type">/</span>2); <span class="org-comment">% does not start at the extremity</span>
e_sorted_mean_over_period = mean(reshape(i_mean_error(i_init<span class="org-type">:</span>i_init<span class="org-type">+</span>win_length<span class="org-type">*</span>num_avg<span class="org-type">-</span>1), [win_length num_avg]), 2);
</pre>
</div>
<div id="orgb5a621e" class="figure">
<p><img src="figs/int_non_linearity_period_wavelength.png" alt="int_non_linearity_period_wavelength.png" />
</p>
<p><span class="figure-number">Figure 11: </span>Non-Linearity of the Interferometer over the period of the wavelength</p>
</div>
</div>
</div>
</div>
<div id="outline-container-org2e4bf3b" class="outline-2">
<h2 id="org2e4bf3b"><span class="section-number-2">4</span> Identification</h2>
<div class="outline-text-2" id="text-4">
</div>
<div id="outline-container-org8a892bd" class="outline-3">
<h3 id="org8a892bd"><span class="section-number-3">4.1</span> Load Data</h3>
<div class="outline-text-3" id="text-4-1">
<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>
</div>
<div class="org-src-container">
<pre class="src src-matlab">interferometer = detrend(interferometer, 0);
encoder = detrend(encoder, 0);
u = detrend(u, 0);
</pre>
</div>
</div>
</div>
<div id="outline-container-org7e3c2ba" class="outline-3">
<h3 id="org7e3c2ba"><span class="section-number-3">4.2</span> Identification</h3>
<div class="outline-text-3" id="text-4-2">
<div class="org-src-container">
<pre class="src src-matlab">Ts = 1e<span class="org-type">-</span>4; <span class="org-comment">% Sampling Time [s]</span>
win = hann(ceil(10<span class="org-type">/</span>Ts));
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">[tf_i_est, f] = tfestimate(u, interferometer, win, [], [], 1<span class="org-type">/</span>Ts);
[co_i_est, <span class="org-type">~</span>] = mscohere(u, interferometer, win, [], [], 1<span class="org-type">/</span>Ts);
[tf_e_est, <span class="org-type">~</span>] = tfestimate(u, encoder, win, [], [], 1<span class="org-type">/</span>Ts);
[co_e_est, <span class="org-type">~</span>] = mscohere(u, encoder, win, [], [], 1<span class="org-type">/</span>Ts);
</pre>
</div>
<div id="org801d42d" class="figure">
<p><img src="figs/identification_dynamics_coherence.png" alt="identification_dynamics_coherence.png" />
</p>
</div>
<div id="org7f77bc5" class="figure">
<p><img src="figs/identification_dynamics_bode.png" alt="identification_dynamics_bode.png" />
</p>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-10-23 ven. 23:04</p>
</div>
</body>
</html>