% Created 2020-12-10 jeu. 18:27
% Intended LaTeX compiler: pdflatex
\documentclass[a4paper, 10pt, DIV=12, parskip=full]{scrreprt}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\usepackage[most]{tcolorbox}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{tabularx}
\usepackage{array}
\usepackage{siunitx}
\input{preamble.tex}
\author{Dehaeze Thomas}
\date{\today}
\title{Attocube - Test Bench}
\hypersetup{
 pdfauthor={Dehaeze Thomas},
 pdftitle={Attocube - Test Bench},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 27.1 (Org mode 9.5)}, 
 pdflang={English}}
\begin{document}

\maketitle
\tableofcontents


In this document, few caracteristics of the Attocube Displacement Measuring Interferometer IDS3010 (\href{https://www.attocube.com/en/products/laser-displacement-sensor/displacement-measuring-interferometer}{link}) are studied:
\begin{itemize}
\item Section \ref{sec:attocube_asd_noise}: the ASD noise of the measured displacement is estimated
\item Section \ref{sec:effect_air_protection}: the effect of two air protections on the stability of the measurement is studied
\item Section \ref{sec:attocube_non_linearity}: the cyclic non-linearity of the attocube is estimated using a encoder
\end{itemize}

\chapter{Estimation of the Spectral Density of the Attocube Noise}
\label{sec:orgdeffe75}
\label{sec:attocube_asd_noise}
\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/test-bench-schematic.png}
\caption{\label{fig:test-bench-schematic}Test Bench Schematic}
\end{figure}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1,width=\linewidth]{figs/IMG-7865.JPG}
\caption{\label{fig:test-bench-picture}Picture of the test bench. The Attocube and mirror are covered by a ``bubble sheet''}
\end{figure}
\section{Long and Slow measurement}
\label{sec:orgee32cb3}
The first measurement was made during \textasciitilde{}17 hours with a sampling time of \(T_s = 0.1\,s\).

\begin{minted}[]{matlab}
load('long_test_plastic.mat', 'x', 't')
Ts = 0.1; % [s]
\end{minted}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/long_meas_time_domain_full.png}
\caption{\label{fig:long_meas_time_domain_full}Long measurement time domain data}
\end{figure}

Let's fit the data with a step response to a first order low pass filter (Figure \ref{fig:long_meas_time_domain_fit}).

\begin{minted}[]{matlab}
f = @(b,x) b(1)*(1 - exp(-x/b(2)));

y_cur = x(t < 17.5*60*60);
t_cur = t(t < 17.5*60*60);

nrmrsd = @(b) norm(y_cur - f(b,t_cur)); % Residual Norm Cost Function
B0 = [400e-9, 2*60*60];                        % Choose Appropriate Initial Estimates
[B,rnrm] = fminsearch(nrmrsd, B0);     % Estimate Parameters ‘B’
\end{minted}

The corresponding time constant is (in [h]):
\begin{verbatim}
2.0658
\end{verbatim}


\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/long_meas_time_domain_fit.png}
\caption{\label{fig:long_meas_time_domain_fit}Fit of the measurement data with a step response of a first order low pass filter}
\end{figure}

We can see in Figure \ref{fig:long_meas_time_domain_full} 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 \texttt{t1} and \texttt{t2}.
The obtained displacement is shown in Figure \ref{fig:long_meas_time_domain_zoom}.

\begin{minted}[]{matlab}
t1 = 10.5; t2 = 17.5; % [h]

x = x(t > t1*60*60 & t < t2*60*60);
x = x - mean(x);
t = t(t > t1*60*60 & t < t2*60*60);
t = t - t(1);
\end{minted}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/long_meas_time_domain_zoom.png}
\caption{\label{fig:long_meas_time_domain_zoom}Kept data (removed slow drifts during the first hours)}
\end{figure}

The Power Spectral Density of the measured displacement is computed
\begin{minted}[]{matlab}
win = hann(ceil(length(x)/20));
[p_1, f_1] = pwelch(x, win, [], [], 1/Ts);
\end{minted}

As a low pass filter was used in the measurement process, we multiply the PSD by the square of the inverse of the filter's norm.
\begin{minted}[]{matlab}
G_lpf = 1/(1 + s/2/pi);
p_1 = p_1./abs(squeeze(freqresp(G_lpf, f_1, 'Hz'))).^2;
\end{minted}

Only frequencies below 2Hz are taken into account (high frequency noise will be measured afterwards).
\begin{minted}[]{matlab}
p_1 = p_1(f_1 < 2);
f_1 = f_1(f_1 < 2);
\end{minted}

\section{Short and Fast measurement}
\label{sec:org48317cd}
An second measurement is done in order to estimate the high frequency noise of the interferometer.
The measurement is done with a sampling time of \(T_s = 0.1\,ms\) and a duration of \textasciitilde{}100s.

\begin{minted}[]{matlab}
load('short_test_plastic.mat')
Ts = 1e-4; % [s]
\end{minted}

\begin{minted}[]{matlab}
x = detrend(x, 0);
\end{minted}

The time domain measurement is shown in Figure \ref{fig:short_meas_time_domain}.

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/short_meas_time_domain.png}
\caption{\label{fig:short_meas_time_domain}Time domain measurement with the high sampling rate}
\end{figure}

The Power Spectral Density of the measured displacement is computed
\begin{minted}[]{matlab}
win = hann(ceil(length(x)/20));
[p_2, f_2] = pwelch(x, win, [], [], 1/Ts);
\end{minted}

\section{Obtained Amplitude Spectral Density of the measured displacement}
\label{sec:orgdffca76}

The computed ASD of the two measurements are combined in Figure \ref{fig:psd_combined}.

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/psd_combined.png}
\caption{\label{fig:psd_combined}Obtained Amplitude Spectral Density of the measured displacement}
\end{figure}

\chapter{Effect of the ``bubble sheet'' and ``Aluminium tube''}
\label{sec:org7c7f561}
\label{sec:effect_air_protection}
\begin{figure}[htbp]
\centering
\includegraphics[scale=1,width=\linewidth]{figs/IMG-7864.JPG}
\caption{\label{fig:picture-test-bench-aluminium-tube}Aluminium tube used to protect the beam path from disturbances}
\end{figure}
Measurements corresponding to the used of both the aluminium tube and the ``bubble sheet ''are loaded and PSD is computed.
\begin{minted}[]{matlab}
load('short_test_plastic.mat');
Ts = 1e-4; % [s]

t_1 = t;
x_1 = detrend(x, 0);

[p_1, f_1] = pwelch(x_1, win, [], [], 1/Ts);
\end{minted}
Then, the measurement corresponding to the use of the aluminium tube only are loaded and the PSD is computed.
\begin{minted}[]{matlab}
load('short_test_alu_tube.mat');
Ts = 1e-4; % [s]

t_2 = t;
x_2 = detrend(x, 0);

[p_2, f_2] = pwelch(x_2, win, [], [], 1/Ts);
\end{minted}
Finally, the measurements when neither using the aluminium tube nor the ``bubble sheet'' are used.
\begin{minted}[]{matlab}
load('short_test_without_material.mat');
Ts = 1e-4; % [s]

t_3 = t;
x_3 = detrend(x, 0);

[p_3, f_3] = pwelch(x_3, win, [], [], 1/Ts);
\end{minted}
The time domain signals are compared in Figure \ref{fig:time_domain_comp_bubble_aluminium} and the power spectral densities are compared in Figure \ref{fig:asd_noise_comp_bubble_aluminium}.
\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/time_domain_comp_bubble_aluminium.png}
\caption{\label{fig:time_domain_comp_bubble_aluminium}Time domain signals}
\end{figure}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/asd_noise_comp_bubble_aluminium.png}
\caption{\label{fig:asd_noise_comp_bubble_aluminium}Comparison of the noise ASD with and without bubble sheet}
\end{figure}

\chapter{Measurement of the Attocube's non-linearity}
\label{sec:org3e242a7}
\label{sec:attocube_non_linearity}
The measurement setup is shown in Figure \ref{fig:exp_setup_schematic}.

\begin{note}
Here are the equipment used in the test bench:
\begin{itemize}
\item Renishaw Resolution Encoder with 1nm resolution (\href{doc/L-9517-9448-05-B\_Data\_sheet\_RESOLUTE\_BiSS\_en.pdf}{doc})
\item Attocube interferometer (\href{doc/IDS3010.pdf}{doc})
\item Cedrat Amplified Piezoelectric Actuator APA95ML (\href{doc/APA95ML.pdf}{doc})
\item Voltage Amplifier LA75B (\href{doc/LA75B.pdf}{doc})
\item Speedgoat IO131 with 16bits ADC and DAC (\href{doc/IO130 IO131 OEM Datasheet.pdf}{doc})
\end{itemize}
\end{note}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/exp_setup_schematic.png}
\caption{\label{fig:exp_setup_schematic}Schematic of the Experiment}
\end{figure}

A DAC and voltage amplified are used to move the mass with the Amplified Piezoelectric Actuator (APA95ML).
The encoder and the attocube are measure ring the same motion.

As will be shown shortly, this measurement permitted to measure the period non-linearity of the Attocube.

\section{Load Data}
\label{sec:orga1094f1}
The measurement data are loaded and the offset are removed using the \texttt{detrend} command.

\begin{minted}[]{matlab}
load('int_enc_comp.mat', 'interferometer', 'encoder', 'u', 't');
Ts = 1e-4; % Sampling Time [s]
\end{minted}

\begin{minted}[]{matlab}
interferometer = detrend(interferometer, 0);
encoder = detrend(encoder, 0);
u = detrend(u, 0);
\end{minted}

\section{Time Domain Results}
\label{sec:org8c99670}
One period of the displacement of the mass as measured by the encoder and interferometer are shown in Figure \ref{fig:int_enc_one_cycle}.
It consist of the sinusoidal motion at 0.5Hz with an amplitude of approximately \(70\mu m\).

The frequency of the motion is chosen such that no resonance in the system is excited.
This should improve the coherence between the measurements made by the encoder and interferometer.

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/int_enc_one_cycle.png}
\caption{\label{fig:int_enc_one_cycle}One cycle measurement}
\end{figure}

The difference between the two measurements during the same period is shown in Figure \ref{fig:int_enc_one_cycle_error}.

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/int_enc_one_cycle_error.png}
\caption{\label{fig:int_enc_one_cycle_error}Difference between the Encoder and the interferometer during one cycle}
\end{figure}

\section{Difference between Encoder and Interferometer as a function of time}
\label{sec:org3c86e57}
The data is filtered using a second order low pass filter with a cut-off frequency \(\omega_0\) as defined below.

\begin{minted}[]{matlab}
w0 = 2*pi*5; % [rad/s]
xi = 0.7;

G_lpf = 1/(1 + 2*xi/w0*s + s^2/w0^2);
\end{minted}

After filtering, the data is ``re-shaped'' such that we can superimpose all the measured periods as shown in Figure \ref{fig:int_enc_error_mean_time}.
This gives an idea of the measurement error as given by the Attocube during a \(70 \mu m\) motion.
\begin{minted}[]{matlab}
d_err_mean = reshape(lsim(G_lpf, encoder - interferometer, t), [2/Ts floor(Ts/2*length(encoder))]);
d_err_mean = d_err_mean - mean(d_err_mean);
\end{minted}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/int_enc_error_mean_time.png}
\caption{\label{fig:int_enc_error_mean_time}Difference between the two measurement in the time domain, averaged for all the cycles}
\end{figure}

\section{Difference between Encoder and Interferometer as a function of position}
\label{sec:orgbdfe98f}
Figure \ref{fig:int_enc_error_mean_time} 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).

To do so, all the attocube measurements corresponding to each position measured by the Encoder (resolution of \(1nm\)) are averaged.
Figure \ref{fig:int_enc_error_mean_position} 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.
\begin{minted}[]{matlab}
[e_sorted, ~, e_ind] = unique(encoder);

i_mean = zeros(length(e_sorted), 1);
for i = 1:length(e_sorted)
  i_mean(i) = mean(interferometer(e_ind == i));
end

i_mean_error = (i_mean - e_sorted);
\end{minted}

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/int_enc_error_mean_position.png}
\caption{\label{fig:int_enc_error_mean_position}Difference between the two measurement as a function of the measured position by the encoder, averaged for all the cycles}
\end{figure}

The period of the non-linearity seems to be equal to \(765 nm\) which corresponds to half the wavelength of the Laser (\(1.53 \mu m\)).
For the motion range done here, the non-linearity is measured over \textasciitilde{}18 periods which permits to do some averaging.

\begin{minted}[]{matlab}
win_length = 1530/2; % length of the windows (corresponds to 765 nm)
num_avg = floor(length(e_sorted)/win_length); % number of averaging

i_init = ceil((length(e_sorted) - win_length*num_avg)/2); % does not start at the extremity

e_sorted_mean_over_period = mean(reshape(i_mean_error(i_init:i_init+win_length*num_avg-1), [win_length num_avg]), 2);
\end{minted}

The obtained periodic non-linearity is shown in Figure \ref{fig:int_non_linearity_period_wavelength}.

\begin{figure}[htbp]
\centering
\includegraphics[scale=1]{figs/int_non_linearity_period_wavelength.png}
\caption{\label{fig:int_non_linearity_period_wavelength}Non-Linearity of the Interferometer over the period of the wavelength}
\end{figure}
\end{document}
