\documentclass[../thesis.tex]{subfiles}

\graphicspath{
	{.}
	{../../figures/}
	{../../../figures/}
}

\begin{document}
\chapter{Timing Mechanisms}
\label{sec:time}
Need reference system with better accuracy to constrain


\begin{figure}
	\includegraphics[width=\textwidth]{clocks/reference-clock.pdf}
	\caption{
		Using a reference clock to compare two other clocks.
	}
	\label{fig:reference-clock}
\end{figure}


\section{Global Navigation Satellite System}
\label{sec:time:gnss}
$\sigma_t \sim 20 \ns$

\section{White Rabbit Precision Time Protocol}
\label{sec:time:gnss}
\begin{figure}
	\includegraphics[width=\textwidth]{white-rabbit/protocol/delaymodel.pdf}
	\caption{
		From \cite{WRPTP}.
		Delays between two White Rabbit nodes.
	}
	\label{fig:wr:delaymodel}
\end{figure}
\subsection{PTP}
\begin{figure}
	\includegraphics[width=\textwidth,height=0.5\textheight,keepaspectratio]{white-rabbit/protocol/ptpMSGs-color.pdf}
	\caption{
		From \cite{WRPTP}.
		Precision Time Protocol (PTP) messages
	}
\end{figure}

\subsection{White Rabbit}
SyncE
\begin{figure}
	\includegraphics[width=\textwidth,height=0.5\textheight,keepaspectratio]{white-rabbit/protocol/wrptpMSGs_1.pdf}
	\caption{
		From \cite{WRPTP}.
		White Rabbit extended PTP messages
	}
	\label{fig:wr:protocol}
\end{figure}

\begin{figure}
	\includegraphics[width=\textwidth,height=0.5\textheight,keepaspectratio]{clocks/wr-clocks.pdf}
	\caption{
		White Rabbit clocks
	}
	\label{fig:wr:clocks}
\end{figure}

\section{Beacon}
\label{sec:time:beacon}
The idea of a beacon is semi-analogous to an oscillator in electronic circuits.
A periodic signal is sent out from a transmitter (the oscillator), and captured by an antenna (the chip the oscillator drives).

In a digital circuit, the oscillator often emits a discrete (square wave) signal (see Figure~\ref{fig:beacon:ttl}).
A tick is then defined as the moment that the signal changes from high to low or vice versa.

In this scheme, synchronising requires latching on the change very precisely.
As between the ticks, there is no time information in the signal.
\\


Instead of introducing more ticks in the same time, and thus a higher frequency of the oscillator, a smooth continous signal can also be used.
This enables the opportunity to determine the phase of the signal by measuring the signal at some time interval.
This time interval has an upper limit on its size depending on the properties of the signal, such as its frequency, but also on the length of the recording.


In Figure~\ref{fig:beacon:sine}, both sampling~1~and~2 can reconstruct the sine wave from the measurements.
Meanwhile, the square wave has some 
\\


\begin{figure}[h]
	\begin{subfigure}{0.45\textwidth}
		\includegraphics[width=\textwidth]{beacon/ttl_beacon.pdf}
		\caption{
			Discrete (square wave) clocks are commonly found in digital circuits.
		}
		\label{fig:beacon:ttl}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.45\textwidth}
		\includegraphics[width=\textwidth]{beacon/sine_beacon.pdf}
		\caption{
			A sine wave clock, as will be employed throughout this document.
		}
		\label{fig:beacon:sine}
	\end{subfigure}
	
	\caption{
		Two different beacon signals with the same frequency.
		Both show two samplings with a small offset in time.
		Reconstructing the signal is easier to do for the sine wave.\todo{Add fourier spectra?}
	}
	\label{fig:beacon:ttl_sine_beacon}
\end{figure}

%% Second timescale needed

Instead of driving the antenna, the beacon is meant to synchronise the clock of the antenna with the clock of the transmitter.
With one oscillator, the antenna can work in phase with the transmitter, but the actual 
To do so, the signal needs to have a second timescale.



\begin{figure}
		\includegraphics[width=0.5\textwidth]{beacon/auger/1512.02216.figure2.beacon_beat.png}
		\caption{
			From Ref~\cite{PierreAuger:2015aqe}
			The beacon signal that the \PAObs\ employs.
		}
		\label{fig:beacon:pa}
\end{figure}


The phase measured is dependent on the time needed to traverse the distance between transmitter and antenna.
As 







In the case there are multiple antennas, distances from the transmitter to each antenna vary greatly.
As the phase 


\subsection{Fourier Transform}
\begin{equation}
	\label{eq:fourier}
	\hat{f}(\omega) = \frac{1}{2\pi} \int \dif{t}\, f(t)\, \exp(i \omega t)
\end{equation}

\subsection{Beacons in Airshower timing}
To setup a time synchronising system for airshower measurements, actually only the high frequency part of the beacon must be employed.
The low frequency part, from which the number of oscillations of the high frequency part are counted, is supplied be the very airshower that is measured.


Since the signal is an electromagntic wave, its phase velocity $v$ depends on the refractive index~$n$ as 
\begin{equation}
	\label{eq:refractive_index}
	v_p = \frac{c}{n}
\end{equation}
with $c$ the speed of light in vacuum.


\end{document}
