Add equipment documentation

This commit is contained in:
2020-11-10 10:21:08 +01:00
parent 70d45841b5
commit 4b3076bae5
8 changed files with 96 additions and 76 deletions
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
+87 -74
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. 09:53 -->
<!-- 2020-11-10 mar. 10:21 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Attocube - Test Bench</title>
<meta name="generator" content="Org mode" />
@@ -13,7 +13,6 @@
<link rel="stylesheet" type="text/css" href="./css/custom.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: {
@@ -35,53 +34,53 @@
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org31551fe">1. Estimation of the Spectral Density of the Attocube Noise</a>
<li><a href="#org904a034">1. Estimation of the Spectral Density of the Attocube Noise</a>
<ul>
<li><a href="#org2ca70e8">1.1. Long and Slow measurement</a></li>
<li><a href="#org4dffcb8">1.2. Short and Fast measurement</a></li>
<li><a href="#org83ac827">1.3. Obtained Amplitude Spectral Density of the measured displacement</a></li>
<li><a href="#org82d6608">1.1. Long and Slow measurement</a></li>
<li><a href="#org3c3c1f8">1.2. Short and Fast measurement</a></li>
<li><a href="#orgcaa0ccd">1.3. Obtained Amplitude Spectral Density of the measured displacement</a></li>
</ul>
</li>
<li><a href="#orgf63ae3e">2. Effect of the &ldquo;bubble sheet&rdquo; and &ldquo;Aluminium tube&rdquo;</a>
<li><a href="#org1b2ca10">2. Effect of the &ldquo;bubble sheet&rdquo; and &ldquo;Aluminium tube&rdquo;</a>
<ul>
<li><a href="#org1f1ce7f">2.1. Aluminium Tube and Bubble Sheet</a></li>
<li><a href="#orgb26f1e7">2.2. Only Aluminium Tube</a></li>
<li><a href="#org38d2ea6">2.3. Nothing</a></li>
<li><a href="#orgc931b82">2.4. Comparison</a></li>
<li><a href="#orgecd70c2">2.1. Aluminium Tube and Bubble Sheet</a></li>
<li><a href="#orgc9ed213">2.2. Only Aluminium Tube</a></li>
<li><a href="#org8e5170d">2.3. Nothing</a></li>
<li><a href="#org38a78d3">2.4. Comparison</a></li>
</ul>
</li>
<li><a href="#org8ec3157">3. Measurement of the Attocube&rsquo;s non-linearity</a>
<li><a href="#org2ece93a">3. Measurement of the Attocube&rsquo;s non-linearity</a>
<ul>
<li><a href="#orgd049784">3.1. Load Data</a></li>
<li><a href="#orga29027e">3.2. Time Domain Results</a></li>
<li><a href="#orgce6e0ff">3.3. Difference between Encoder and Interferometer as a function of time</a></li>
<li><a href="#org2008a1e">3.4. Difference between Encoder and Interferometer as a function of position</a></li>
<li><a href="#org224e296">3.1. Load Data</a></li>
<li><a href="#org587ad8c">3.2. Time Domain Results</a></li>
<li><a href="#orgbc1a5af">3.3. Difference between Encoder and Interferometer as a function of time</a></li>
<li><a href="#org50e2719">3.4. Difference between Encoder and Interferometer as a function of position</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org31551fe" class="outline-2">
<h2 id="org31551fe"><span class="section-number-2">1</span> Estimation of the Spectral Density of the Attocube Noise</h2>
<div id="outline-container-org904a034" class="outline-2">
<h2 id="org904a034"><span class="section-number-2">1</span> Estimation of the Spectral Density of the Attocube Noise</h2>
<div class="outline-text-2" id="text-1">
<div id="org5b9ba48" class="figure">
<div id="org95807e5" class="figure">
<p><img src="figs/test-bench-schematic.png" alt="test-bench-schematic.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Test Bench Schematic</p>
</div>
<div id="org9ef7a86" class="figure">
<div id="org7768f2f" class="figure">
<p><img src="figs/IMG-7865.JPG" alt="IMG-7865.JPG" />
</p>
<p><span class="figure-number">Figure 2: </span>Picture of the test bench. The Attocube and mirror are covered by a &ldquo;bubble sheet&rdquo;</p>
</div>
</div>
<div id="outline-container-org2ca70e8" class="outline-3">
<h3 id="org2ca70e8"><span class="section-number-3">1.1</span> Long and Slow measurement</h3>
<div id="outline-container-org82d6608" class="outline-3">
<h3 id="org82d6608"><span class="section-number-3">1.1</span> Long and Slow measurement</h3>
<div class="outline-text-3" id="text-1-1">
<p>
The first measurement was made during ~17 hours with a sampling time of \(T_s = 0.1\,s\).
@@ -94,14 +93,14 @@ Ts = 0.1; <span class="org-comment">% [s]</span>
</div>
<div id="org4b6374b" class="figure">
<div id="orgcfab522" class="figure">
<p><img src="figs/long_meas_time_domain_full.png" alt="long_meas_time_domain_full.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Long measurement time domain data</p>
</div>
<p>
Let&rsquo;s fit the data with a step response to a first order low pass filter (Figure <a href="#org36afa1e">4</a>).
Let&rsquo;s fit the data with a step response to a first order low pass filter (Figure <a href="#org3c0ac65">4</a>).
</p>
<div class="org-src-container">
@@ -125,17 +124,17 @@ The corresponding time constant is (in [h]):
<div id="org36afa1e" class="figure">
<div id="org3c0ac65" class="figure">
<p><img src="figs/long_meas_time_domain_fit.png" alt="long_meas_time_domain_fit.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Fit of the measurement data with a step response of a first order low pass filter</p>
</div>
<p>
We can see in Figure <a href="#org4b6374b">3</a> that there is a transient period where the measured displacement experiences some drifts.
We can see in Figure <a href="#orgcfab522">3</a> that there is a transient period where the measured displacement experiences some drifts.
This is probably due to thermal effects.
We only select the data between <code>t1</code> and <code>t2</code>.
The obtained displacement is shown in Figure <a href="#orgf2cfa94">5</a>.
The obtained displacement is shown in Figure <a href="#orgfb35792">5</a>.
</p>
<div class="org-src-container">
@@ -149,7 +148,7 @@ t = t <span class="org-type">-</span> t(1);
</div>
<div id="orgf2cfa94" class="figure">
<div id="orgfb35792" class="figure">
<p><img src="figs/long_meas_time_domain_zoom.png" alt="long_meas_time_domain_zoom.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Kept data (removed slow drifts during the first hours)</p>
@@ -184,8 +183,8 @@ f_1 = f_1(f_1 <span class="org-type">&lt;</span> 2);
</div>
</div>
<div id="outline-container-org4dffcb8" class="outline-3">
<h3 id="org4dffcb8"><span class="section-number-3">1.2</span> Short and Fast measurement</h3>
<div id="outline-container-org3c3c1f8" class="outline-3">
<h3 id="org3c3c1f8"><span class="section-number-3">1.2</span> Short and Fast measurement</h3>
<div class="outline-text-3" id="text-1-2">
<p>
An second measurement is done in order to estimate the high frequency noise of the interferometer.
@@ -204,11 +203,11 @@ Ts = 1e<span class="org-type">-</span>4; <span class="org-comment">% [s]</span>
</div>
<p>
The time domain measurement is shown in Figure <a href="#org0f2f571">6</a>.
The time domain measurement is shown in Figure <a href="#org526dbb8">6</a>.
</p>
<div id="org0f2f571" class="figure">
<div id="org526dbb8" class="figure">
<p><img src="figs/short_meas_time_domain.png" alt="short_meas_time_domain.png" />
</p>
<p><span class="figure-number">Figure 6: </span>Time domain measurement with the high sampling rate</p>
@@ -225,15 +224,15 @@ The Power Spectral Density of the measured displacement is computed
</div>
</div>
<div id="outline-container-org83ac827" class="outline-3">
<h3 id="org83ac827"><span class="section-number-3">1.3</span> Obtained Amplitude Spectral Density of the measured displacement</h3>
<div id="outline-container-orgcaa0ccd" class="outline-3">
<h3 id="orgcaa0ccd"><span class="section-number-3">1.3</span> Obtained Amplitude Spectral Density of the measured displacement</h3>
<div class="outline-text-3" id="text-1-3">
<p>
The computed ASD of the two measurements are combined in Figure <a href="#orga897ad9">7</a>.
The computed ASD of the two measurements are combined in Figure <a href="#orgcd7a108">7</a>.
</p>
<div id="orga897ad9" class="figure">
<div id="orgcd7a108" class="figure">
<p><img src="figs/psd_combined.png" alt="psd_combined.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Obtained Amplitude Spectral Density of the measured displacement</p>
@@ -242,19 +241,19 @@ The computed ASD of the two measurements are combined in Figure <a href="#orga89
</div>
</div>
<div id="outline-container-orgf63ae3e" class="outline-2">
<h2 id="orgf63ae3e"><span class="section-number-2">2</span> Effect of the &ldquo;bubble sheet&rdquo; and &ldquo;Aluminium tube&rdquo;</h2>
<div id="outline-container-org1b2ca10" class="outline-2">
<h2 id="org1b2ca10"><span class="section-number-2">2</span> Effect of the &ldquo;bubble sheet&rdquo; and &ldquo;Aluminium tube&rdquo;</h2>
<div class="outline-text-2" id="text-2">
<div id="orgff246fc" class="figure">
<div id="orgcda5fc5" class="figure">
<p><img src="figs/IMG-7864.JPG" alt="IMG-7864.JPG" />
</p>
<p><span class="figure-number">Figure 8: </span>Aluminium tube used to protect the beam path from disturbances</p>
</div>
</div>
<div id="outline-container-org1f1ce7f" class="outline-3">
<h3 id="org1f1ce7f"><span class="section-number-3">2.1</span> Aluminium Tube and Bubble Sheet</h3>
<div id="outline-container-orgecd70c2" class="outline-3">
<h3 id="orgecd70c2"><span class="section-number-3">2.1</span> Aluminium Tube and Bubble Sheet</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/short_test_plastic.mat'</span>);
@@ -275,8 +274,8 @@ Ts = 1e<span class="org-type">-</span>4; <span class="org-comment">% [s]</span>
</div>
</div>
<div id="outline-container-orgb26f1e7" class="outline-3">
<h3 id="orgb26f1e7"><span class="section-number-3">2.2</span> Only Aluminium Tube</h3>
<div id="outline-container-orgc9ed213" class="outline-3">
<h3 id="orgc9ed213"><span class="section-number-3">2.2</span> Only Aluminium Tube</h3>
<div class="outline-text-3" id="text-2-2">
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'./mat/short_test_alu_tube.mat'</span>);
@@ -290,7 +289,7 @@ Ts = 1e<span class="org-type">-</span>4; <span class="org-comment">% [s]</span>
</div>
<p>
The time domain measurement is shown in Figure <a href="#org0f2f571">6</a>.
The time domain measurement is shown in Figure <a href="#org526dbb8">6</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">win = hann(ceil(length(x)<span class="org-type">/</span>10));
@@ -300,8 +299,8 @@ The time domain measurement is shown in Figure <a href="#org0f2f571">6</a>.
</div>
</div>
<div id="outline-container-org38d2ea6" class="outline-3">
<h3 id="org38d2ea6"><span class="section-number-3">2.3</span> Nothing</h3>
<div id="outline-container-org8e5170d" class="outline-3">
<h3 id="org8e5170d"><span class="section-number-3">2.3</span> Nothing</h3>
<div class="outline-text-3" id="text-2-3">
<div class="org-src-container">
<pre class="src src-matlab">load(<span class="org-string">'./mat/short_test_without_material.mat'</span>);
@@ -315,7 +314,7 @@ Ts = 1e<span class="org-type">-</span>4; <span class="org-comment">% [s]</span>
</div>
<p>
The time domain measurement is shown in Figure <a href="#org0f2f571">6</a>.
The time domain measurement is shown in Figure <a href="#org526dbb8">6</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">win = hann(ceil(length(x)<span class="org-type">/</span>10));
@@ -325,11 +324,11 @@ The time domain measurement is shown in Figure <a href="#org0f2f571">6</a>.
</div>
</div>
<div id="outline-container-orgc931b82" class="outline-3">
<h3 id="orgc931b82"><span class="section-number-3">2.4</span> Comparison</h3>
<div id="outline-container-org38a78d3" class="outline-3">
<h3 id="org38a78d3"><span class="section-number-3">2.4</span> Comparison</h3>
<div class="outline-text-3" id="text-2-4">
<div id="org0e0ae0d" class="figure">
<div id="orgda221c2" class="figure">
<p><img src="figs/asd_noise_comp_bubble_aluminium.png" alt="asd_noise_comp_bubble_aluminium.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Comparison of the noise ASD with and without bubble sheet</p>
@@ -338,15 +337,29 @@ The time domain measurement is shown in Figure <a href="#org0f2f571">6</a>.
</div>
</div>
<div id="outline-container-org8ec3157" class="outline-2">
<h2 id="org8ec3157"><span class="section-number-2">3</span> Measurement of the Attocube&rsquo;s non-linearity</h2>
<div id="outline-container-org2ece93a" class="outline-2">
<h2 id="org2ece93a"><span class="section-number-2">3</span> Measurement of the Attocube&rsquo;s non-linearity</h2>
<div class="outline-text-2" id="text-3">
<p>
The measurement setup is shown in Figure <a href="#org30833d7">10</a>.
The measurement setup is shown in Figure <a href="#org7db5634">10</a>.
</p>
<div class="note" id="org292fd7d">
<p>
Here are the equipment used in the test bench:
</p>
<ul class="org-ul">
<li>Renishaw Resolution Encoder with 1nm resolution (<a href="doc/L-9517-9448-05-B_Data_sheet_RESOLUTE_BiSS_en.pdf">doc</a>)</li>
<li>Attocube interferometer (<a href="doc/IDS3010.pdf">doc</a>)</li>
<li>Cedrat Amplified Piezoelectric Actuator APA95ML (<a href="doc/APA95ML.pdf">doc</a>)</li>
<li>Voltage Amplifier LA75B (<a href="doc/LA75B.pdf">doc</a>)</li>
<li>Speedgoat IO131 with 16bits ADC and DAC (<a href="doc/IO130 IO131 OEM Datasheet.pdf">doc</a>)</li>
</ul>
<div id="org30833d7" class="figure">
</div>
<div id="org7db5634" class="figure">
<p><img src="figs/exp_setup_schematic.png" alt="exp_setup_schematic.png" />
</p>
<p><span class="figure-number">Figure 10: </span>Schematic of the Experiment</p>
@@ -362,8 +375,8 @@ As will be shown shortly, this measurement permitted to measure the period non-l
</p>
</div>
<div id="outline-container-orgd049784" class="outline-3">
<h3 id="orgd049784"><span class="section-number-3">3.1</span> Load Data</h3>
<div id="outline-container-org224e296" class="outline-3">
<h3 id="org224e296"><span class="section-number-3">3.1</span> Load Data</h3>
<div class="outline-text-3" id="text-3-1">
<p>
The measurement data are loaded and the offset are removed using the <code>detrend</code> command.
@@ -384,11 +397,11 @@ u = detrend(u, 0);
</div>
</div>
<div id="outline-container-orga29027e" class="outline-3">
<h3 id="orga29027e"><span class="section-number-3">3.2</span> Time Domain Results</h3>
<div id="outline-container-org587ad8c" class="outline-3">
<h3 id="org587ad8c"><span class="section-number-3">3.2</span> Time Domain Results</h3>
<div class="outline-text-3" id="text-3-2">
<p>
One period of the displacement of the mass as measured by the encoder and interferometer are shown in Figure <a href="#orgeb04850">11</a>.
One period of the displacement of the mass as measured by the encoder and interferometer are shown in Figure <a href="#org5cfca4b">11</a>.
It consist of the sinusoidal motion at 0.5Hz with an amplitude of approximately \(70\mu m\).
</p>
@@ -398,18 +411,18 @@ This should improve the coherence between the measurements made by the encoder a
</p>
<div id="orgeb04850" class="figure">
<div id="org5cfca4b" class="figure">
<p><img src="figs/int_enc_one_cycle.png" alt="int_enc_one_cycle.png" />
</p>
<p><span class="figure-number">Figure 11: </span>One cycle measurement</p>
</div>
<p>
The difference between the two measurements during the same period is shown in Figure <a href="#org3ddfc88">12</a>.
The difference between the two measurements during the same period is shown in Figure <a href="#org58e59b1">12</a>.
</p>
<div id="org3ddfc88" class="figure">
<div id="org58e59b1" 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 12: </span>Difference between the Encoder and the interferometer during one cycle</p>
@@ -417,8 +430,8 @@ The difference between the two measurements during the same period is shown in F
</div>
</div>
<div id="outline-container-orgce6e0ff" class="outline-3">
<h3 id="orgce6e0ff"><span class="section-number-3">3.3</span> Difference between Encoder and Interferometer as a function of time</h3>
<div id="outline-container-orgbc1a5af" class="outline-3">
<h3 id="orgbc1a5af"><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">
<p>
The data is filtered using a second order low pass filter with a cut-off frequency \(\omega_0\) as defined below.
@@ -433,7 +446,7 @@ G_lpf = 1<span class="org-type">/</span>(1 <span class="org-type">+</span> 2<spa
</div>
<p>
After filtering, the data is &ldquo;re-shaped&rdquo; such that we can superimpose all the measured periods as shown in Figure <a href="#org18b1b55">13</a>.
After filtering, the data is &ldquo;re-shaped&rdquo; such that we can superimpose all the measured periods as shown in Figure <a href="#orgef18651">13</a>.
This gives an idea of the measurement error as given by the Attocube during a \(70 \mu m\) motion.
</p>
<div class="org-src-container">
@@ -443,7 +456,7 @@ d_err_mean = d_err_mean <span class="org-type">-</span> mean(d_err_mean);
</div>
<div id="org18b1b55" class="figure">
<div id="orgef18651" 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 13: </span>Difference between the two measurement in the time domain, averaged for all the cycles</p>
@@ -451,17 +464,17 @@ d_err_mean = d_err_mean <span class="org-type">-</span> mean(d_err_mean);
</div>
</div>
<div id="outline-container-org2008a1e" class="outline-3">
<h3 id="org2008a1e"><span class="section-number-3">3.4</span> Difference between Encoder and Interferometer as a function of position</h3>
<div id="outline-container-org50e2719" class="outline-3">
<h3 id="org50e2719"><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>
Figure <a href="#org18b1b55">13</a> gives the measurement error as a function of time.
Figure <a href="#orgef18651">13</a> gives the measurement error as a function of time.
We here wish the compute this measurement error as a function of the position (as measured by the encoer).
</p>
<p>
To do so, all the attocube measurements corresponding to each position measured by the Encoder (resolution of \(1nm\)) are averaged.
Figure <a href="#orgdfccfb5">14</a> is obtained where we clearly see an error with a period comparable to the motion range and a much smaller period corresponding to the non-linear period errors that we wish the estimate.
Figure <a href="#orgfbf0bc5">14</a> is obtained where we clearly see an error with a period comparable to the motion range and a much smaller period corresponding to the non-linear period errors that we wish the estimate.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[e_sorted, <span class="org-type">~</span>, e_ind] = unique(encoder);
@@ -476,7 +489,7 @@ i_mean_error = (i_mean <span class="org-type">-</span> e_sorted);
</div>
<div id="orgdfccfb5" class="figure">
<div id="orgfbf0bc5" 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 14: </span>Difference between the two measurement as a function of the measured position by the encoder, averaged for all the cycles</p>
@@ -498,11 +511,11 @@ e_sorted_mean_over_period = mean(reshape(i_mean_error(i_init<span class="org-typ
</div>
<p>
The obtained periodic non-linearity is shown in Figure <a href="#orgcfbb9a2">15</a>.
The obtained periodic non-linearity is shown in Figure <a href="#org9e948e3">15</a>.
</p>
<div id="orgcfbb9a2" class="figure">
<div id="org9e948e3" 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 15: </span>Non-Linearity of the Interferometer over the period of the wavelength</p>
@@ -513,7 +526,7 @@ The obtained periodic non-linearity is shown in Figure <a href="#orgcfbb9a2">15<
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-11-10 mar. 09:53</p>
<p class="date">Created: 2020-11-10 mar. 10:21</p>
</div>
</body>
</html>
+9 -1
View File
@@ -12,7 +12,6 @@
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="./css/custom.css"/>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/bootstrap.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
#+HTML_HEAD: <script type="text/javascript" src="./js/readtheorg.js"></script>
#+PROPERTY: header-args:matlab :session *MATLAB*
@@ -329,6 +328,15 @@ The time domain measurement is shown in Figure [[fig:short_meas_time_domain]].
** Introduction :ignore:
The measurement setup is shown in Figure [[fig:exp_setup_schematic]].
#+begin_note
Here are the equipment used in the test bench:
- Renishaw Resolution Encoder with 1nm resolution ([[file:doc/L-9517-9448-05-B_Data_sheet_RESOLUTE_BiSS_en.pdf][doc]])
- Attocube interferometer ([[file:doc/IDS3010.pdf][doc]])
- Cedrat Amplified Piezoelectric Actuator APA95ML ([[file:doc/APA95ML.pdf][doc]])
- Voltage Amplifier LA75B ([[file:doc/LA75B.pdf][doc]])
- Speedgoat IO131 with 16bits ADC and DAC ([[file:doc/IO130 IO131 OEM Datasheet.pdf][doc]])
#+end_note
#+name: fig:exp_setup_schematic
#+caption: Schematic of the Experiment
[[file:figs/exp_setup_schematic.png]]
-1
View File
@@ -1 +0,0 @@
!function(a,b){"use strict";function c(c,g){var h=this;h.$el=a(c),h.el=c,h.id=e++,h.$window=a(b),h.$document=a(document),h.$el.bind("destroyed",a.proxy(h.teardown,h)),h.$clonedHeader=null,h.$originalHeader=null,h.isSticky=!1,h.hasBeenSticky=!1,h.leftOffset=null,h.topOffset=null,h.init=function(){h.$el.each(function(){var b=a(this);b.css("padding",0),h.$originalHeader=a("thead:first",this),h.$clonedHeader=h.$originalHeader.clone(),b.trigger("clonedHeader."+d,[h.$clonedHeader]),h.$clonedHeader.addClass("tableFloatingHeader"),h.$clonedHeader.css("display","none"),h.$originalHeader.addClass("tableFloatingHeaderOriginal"),h.$originalHeader.after(h.$clonedHeader),h.$printStyle=a('<style type="text/css" media="print">.tableFloatingHeader{display:none !important;}.tableFloatingHeaderOriginal{position:static !important;}</style>'),a("head").append(h.$printStyle)}),h.setOptions(g),h.updateWidth(),h.toggleHeaders(),h.bind()},h.destroy=function(){h.$el.unbind("destroyed",h.teardown),h.teardown()},h.teardown=function(){h.isSticky&&h.$originalHeader.css("position","static"),a.removeData(h.el,"plugin_"+d),h.unbind(),h.$clonedHeader.remove(),h.$originalHeader.removeClass("tableFloatingHeaderOriginal"),h.$originalHeader.css("visibility","visible"),h.$printStyle.remove(),h.el=null,h.$el=null},h.bind=function(){h.$scrollableArea.on("scroll."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.on("scroll."+d+h.id,h.setPositionValues),h.$window.on("resize."+d+h.id,h.toggleHeaders)),h.$scrollableArea.on("resize."+d,h.toggleHeaders),h.$scrollableArea.on("resize."+d,h.updateWidth)},h.unbind=function(){h.$scrollableArea.off("."+d,h.toggleHeaders),h.isWindowScrolling||(h.$window.off("."+d+h.id,h.setPositionValues),h.$window.off("."+d+h.id,h.toggleHeaders)),h.$scrollableArea.off("."+d,h.updateWidth)},h.toggleHeaders=function(){h.$el&&h.$el.each(function(){var b,c=a(this),d=h.isWindowScrolling?isNaN(h.options.fixedOffset)?h.options.fixedOffset.outerHeight():h.options.fixedOffset:h.$scrollableArea.offset().top+(isNaN(h.options.fixedOffset)?0:h.options.fixedOffset),e=c.offset(),f=h.$scrollableArea.scrollTop()+d,g=h.$scrollableArea.scrollLeft(),i=h.isWindowScrolling?f>e.top:d>e.top,j=(h.isWindowScrolling?f:0)<e.top+c.height()-h.$clonedHeader.height()-(h.isWindowScrolling?0:d);i&&j?(b=e.left-g+h.options.leftOffset,h.$originalHeader.css({position:"fixed","margin-top":h.options.marginTop,left:b,"z-index":3}),h.leftOffset=b,h.topOffset=d,h.$clonedHeader.css("display",""),h.isSticky||(h.isSticky=!0,h.updateWidth()),h.setPositionValues()):h.isSticky&&(h.$originalHeader.css("position","static"),h.$clonedHeader.css("display","none"),h.isSticky=!1,h.resetWidth(a("td,th",h.$clonedHeader),a("td,th",h.$originalHeader)))})},h.setPositionValues=function(){var a=h.$window.scrollTop(),b=h.$window.scrollLeft();!h.isSticky||0>a||a+h.$window.height()>h.$document.height()||0>b||b+h.$window.width()>h.$document.width()||h.$originalHeader.css({top:h.topOffset-(h.isWindowScrolling?0:a),left:h.leftOffset-(h.isWindowScrolling?0:b)})},h.updateWidth=function(){if(h.isSticky){h.$originalHeaderCells||(h.$originalHeaderCells=a("th,td",h.$originalHeader)),h.$clonedHeaderCells||(h.$clonedHeaderCells=a("th,td",h.$clonedHeader));var b=h.getWidth(h.$clonedHeaderCells);h.setWidth(b,h.$clonedHeaderCells,h.$originalHeaderCells),h.$originalHeader.css("width",h.$clonedHeader.width())}},h.getWidth=function(c){var d=[];return c.each(function(c){var e,f=a(this);if("border-box"===f.css("box-sizing"))e=f[0].getBoundingClientRect().width;else{var g=a("th",h.$originalHeader);if("collapse"===g.css("border-collapse"))if(b.getComputedStyle)e=parseFloat(b.getComputedStyle(this,null).width);else{var i=parseFloat(f.css("padding-left")),j=parseFloat(f.css("padding-right")),k=parseFloat(f.css("border-width"));e=f.outerWidth()-i-j-k}else e=f.width()}d[c]=e}),d},h.setWidth=function(a,b,c){b.each(function(b){var d=a[b];c.eq(b).css({"min-width":d,"max-width":d})})},h.resetWidth=function(b,c){b.each(function(b){var d=a(this);c.eq(b).css({"min-width":d.css("min-width"),"max-width":d.css("max-width")})})},h.setOptions=function(c){h.options=a.extend({},f,c),h.$scrollableArea=a(h.options.scrollableArea),h.isWindowScrolling=h.$scrollableArea[0]===b},h.updateOptions=function(a){h.setOptions(a),h.unbind(),h.bind(),h.updateWidth(),h.toggleHeaders()},h.init()}var d="stickyTableHeaders",e=0,f={fixedOffset:0,leftOffset:0,marginTop:0,scrollableArea:b};a.fn[d]=function(b){return this.each(function(){var e=a.data(this,"plugin_"+d);e?"string"==typeof b?e[b].apply(e):e.updateOptions(b):"destroy"!==b&&a.data(this,"plugin_"+d,new c(this,b))})}}(jQuery,window);