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

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

\begin{document}
\chapter{Disciplining by Beacon}
\label{sec:disciplining}
The time accuracy supplied by a \gls{GNSS} is not enough to do interferometry.
In this chapter,


\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.
\\

\todo{Possibly Invert story from short->long to long->short}
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 leeway on the precise timing.\todo{reword sentence}
\\

\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 with the same samplelength and number of samples.
	}
	\label{fig:beacon:ttl_sine_beacon}
	\todo{Add fourier spectra?}
\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 synchronization can be off by a multiple of periods.
To be able to determine this offset, a second timescale needs to be introduced in the signal.
\\

This slower timescale allows to count the ticks of the quicker signal.\todo{Extend paragraph}

\begin{figure}
	\begin{subfigure}{0.45\textwidth}
%		\includegraphics[width=0.5\textwidth]{beacon/sine_beacon_multiple_periods_off.pdf}
		\caption{
			Two syntonised beacons.
			The actual synchronization is off by a multiple of periods.
		}
		\label{fig:second_timescale:off}
	\end{subfigure}
	\hfill
	\begin{subfigure}{0.45\textwidth}
%		\includegraphics[width=0.5\textwidth]{beacon/sine_beacon_multiple_periods_off.pdf}
		\caption{
			Two syntonised beacons, the actual synchronization is off by a multiple of periods.
		}
		\label{fig:second_timescale:on}
	\end{subfigure}
	\caption{
		}
	\label{fig:second_timescale}
	\todo{Fill figure and caption}
\end{figure}

\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 \acrlong*{PAObs} employs.
		}
		\label{fig:beacon:pa}
\end{figure}



\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 by the very airshower that is measured.


\begin{equation}
	\label{eq:correlation_cont}
	\Corr(\tau; u,v) = \int_{-\infty}^{\infty} \dif t \, u(t)\, v^*(t-\tau)
\end{equation}

\begin{equation}
	\label{eq:correlation_sample}
	\Corr(k; u,v) = \sum_n u[n] \, v^*[n-k]
\end{equation}



\section{Beacon synchronisation}

As outlined in Section~\ref{sec:time:beacon}, a beacon can also be employed to synchronise the stations.
This chapter outlines the steps required to setup a synchronisation between multiple antennae using one transmitter.



\bigskip
The distance between a transmitter and an antenna incurs a time delay $t_d$.
Since the signal is an electromagnetic 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.
Note that the refractive index of air is dependent on, among other things, the pressure and temperature of the air the signal is passing through and the frequencies of the signal.


To synchronise two antennas with a common signal, the difference in these time delays must be known.
Taking the refractive index to be constant results in
\begin{equation}
	\label{eq:spatial_time_difference_simple}
	\phantom{.}
	\Delta t_{d} = t_{d_1} - t_{d_2} = (d_1 - d_2)/v = d_{12} / v
	.
\end{equation}
\\

In addition to the time delay incurred from varying distances, the local antenna clock can be skewed.
This effect shows up as an additional time delay $t_c$.

In total, the difference in apparent arrival time of a signal is a combination of both time delays
\begin{equation}
	\label{eq:total_time_difference}
	\phantom{.}
	\Delta t = t_d + t_c
	.
\end{equation}

\begin{figure}
	\centering
	\includegraphics[width=0.7\textwidth,height=0.7\textheight,keepaspectratio]{beacon/beacon_spatial_time_difference_setup.pdf}
	\caption{
		An example setup of two antennas ($A_i$) at different distances from a transmitter ($T$).
	}
	\label{fig:beacon_spatial_setup}
\end{figure}



\clearpage
% \delta \phase
As mentioned in Section~\ref{sec:time:beacon}, a beacon consisting of a single sine wave allows to syntonise two antennas by measuring the phase difference of the beacon at both antennas $\Delta \phase = \phase_1 - \phase_2$.
This means the local clock difference of the two antennas can be corrected upto an unknown multiple $k$ of its period, with
\begin{equation}
	\label{eq:phase_diff_to_time_diff}
	\phantom{.}
	\Delta t = \Delta t_\phase + kT = \left(\frac{\Delta \phase}{2\pi} + k\right) T
	.
\end{equation}
By finding a suitably long timescale signal in addition to the sine wave, the amount of periods $k$ can be determined.
\\

\begin{figure}
	\centering
	\includegraphics[width=\textwidth]{beacon/08_beacon_sync_timing_outline.pdf}
	\caption{
		Waveforms of a beacon at two antennas, where the clocks have not been synchronised.
		Grey dotted lines indicate periods of the sine wave (orange),
		full lines indicate the time of the impulsive signal (blue).
		Both are sent out from the same transmitter.
		The sine wave allows to resolve a small timing delay ($\Delta t_\phase$),
		while the impulsive signal allows to calibrate the amount of cycles ($m$,~$n$) the two clocks are separated.
	}
	\label{fig:beacon_outline}
	\todo{
		Redo figure without xticks and spines,
		rename $\Delta t_\phase$,
		also remove impuls time diff
	}
\end{figure}

In Figure~\ref{fig:beacon_outline}, both such a signal and a sine wave beacon are shown as received at two desynchronised antennas.
The total time delay $\Delta t$ is indicated by the location of the peak of the slow signal.
Part of this delay can be observed as a phase difference $\Delta \phase$ between the two beacons.


% k from coherent sum
\bigskip
The phase difference of the beacon signal obtained in Figure~\ref{fig:beacon_outline} allows to correct small (with respect to the beacon frequency) time delays.
The total time delay may, however, be much larger than one such period.
As shown in \eqref{eq:phase_diff_to_time_diff}, after correcting for the time delay proportional to the phase difference $\Delta t_\phase$, the left-over time delay should be a multiple of the beacon period $kT$.

\bigskip
When the slower signal is transmitted from the transmitter that sent out the beacon signal, then the number of periods $k$ can be obtained directly from the signal.
If, however, the slow signal is sent from a different transmitter, the different distances incur different time delays.
In a static setup, these distance should be measured to such a degree to have a time delay accuracy of about one period of the beacon signal.\todo{reword sentence}
\\

\bigskip
If measuring the distances to the required accuracy is not possible, a different method must be found to obtain the correct number of periods.
The total time delay in \eqref{eq:phase_diff_to_time_diff} contains a continuous term $\Delta t_\phase$ that can be determined from the beacon signal, and a discrete term $k T$ where $k$ is the unknown discrete quantity.
\\

Since $k$ is discrete, the best time delay might be determined from the calibration signal by using a coherent sum
\begin{equation}
	\label{eq:coherent_sum}
	\phantom{,}
	%\chi( t; k) = \sum
	,
\end{equation}
where .., finding the best time delay at the maximum of the sum.
The time delay obtained from the coherent sum

\bigskip
When measuring airshowers, the very signal of the airshower can be used as the calibration signal.
This falls into the dynamic setup described above.
However, while in a static setup the value of $k$ can be estimated from the distances, the distances for each airshower will differ.
\\



\hrule
\bigskip
\hrule

Simulation

Sine + impulsive signal

\end{document}
