aboutsummaryrefslogtreecommitdiffstats
path: root/doc/thesis/chapters
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--doc/thesis/chapters/implementation.tex70
-rw-r--r--doc/thesis/chapters/theory.tex34
2 files changed, 60 insertions, 44 deletions
diff --git a/doc/thesis/chapters/implementation.tex b/doc/thesis/chapters/implementation.tex
index e366881..afcb2d0 100644
--- a/doc/thesis/chapters/implementation.tex
+++ b/doc/thesis/chapters/implementation.tex
@@ -8,10 +8,19 @@
For the simulation task and after for the Hardware part, the open-source Software GNU Radio has been chosen. This software uses toolboxes for signal processing systems too simulate or/and implement a software-defined radio, based on Python and some C++ implementations for some rapid-application-development environments. The toolboxes can simply, with the help of the graphical user interface, used by drag-and-drop. The Boxes are used to write applications, to receive or to transmit date for a digital system. Some blocks like different filters, channel codes or demodulator elements and a lot more are already implemented. For missing application new elements can be added by coding own blocks. With the help of the GNU Radio software those toolboxes can easily get connected to each other, creating data streams.
\section{Sender chain}
-\subsection{Data source}
+\subsection{Data frame}
+
+\begin{figure}
+ \centering
+ \input{figures/tikz/packet-frame}
+ \caption{
+ Structure of framed data packets used in the implementation.
+ \label{fig:dataframe}
+ }
+\end{figure}
+
+To compute the empirical \emph{bit error rate} (BER) of the setup, the data has to be framed on by the sender and the bitstream synchronized on the receiver side. The structure of a data packed used in the implementation is shown in \figref{fig:dataframe}. A frame begins with an user specified \(k\)-byte preamble, that in the current implementation serves as synchronization pattern. Another use case for the preamble sequence could be to introduce channel estimation pilot symbols. Following the preamble are 4 bytes encoded using a (31, 26) Hamming code (plus 1 padding bit), that contain metadata about the packet, namely payload ID and payload length. Because the payload length in bytes is encoded in 21 bits, the maximum payload size is 2 MiB, which together with 32 possible unique IDs gives a maximum data transfer with unique frame headers of 64 MiB. These constraints are a result of decisions made to keep the implementation simple.
-%% TODO: replace with file file
-In this simulation a random source has been chosen.
\subsection{Modulation}
@@ -28,39 +37,40 @@ With the the polyphase clock sync the symbols can be synchronized by preforming
\paragraph{Equalizer}
-\paragraph{Costas Loop}
-
-The Costas Loop is used for frequency and phase adjustment it locks the center frequency of the signal additional it converts it back to de baseband. For different modulation types different orders of the loop had to be chosen
-
-\paragraph{Constellation decoder}
-
-From the complex space the constellation points are decode to bits.
+\skelpar[2]{CMA equalizer.}
-\subsection{Frame synchronization}
+\subsection{Frame synchronization and phase correction}
-\begin{figure}
- \centering
- \input{figures/tikz/packet-frame}
- \caption{
- Structure of framed data packets used in the implementation.
- \label{fig:dataframe}
- }
-\end{figure}
-
-To compute the empirical \emph{bit error rate} (BER) of the setup, the data has to be framed on by the sender and the bitstream synchronized on the receiver side. The structure of a data packed used in the implementation is shown in \figref{fig:dataframe}. A frame begins with an user specified \(k\)-byte preamble, that in the current implementation serves as synchronization pattern. Another use case for the preamble sequence could be to introduce channel estimation pilot symbols. Following the preamble are 4 bytes encoded using a (31, 26) Hamming code (plus 1 padding bit), that contain metadata about the packet, namely payload ID and payload length. Because the payload length in bytes is encoded in 21 bits, the maximum payload size is 2 MiB, which together with 32 possible unique IDs gives a maximum data transfer with unique frame headers of 64 MiB. These constraints are a result of decisions made to keep the implementation simple.
+Once the envelope's clock is synchronized in the processing chain the data stream has one sample per symbol. At this point it is necessary to find where each data frame starts or end in order to correctly decode their payloads. For such purpose a special sequence of samples called \emph{access code} is put in front of each frame. Access codes are sequences of samples that are specially chosen to have autocorrelation values with a high peak at zero, and that rapidly descend for other shifted value. In other words, the autocorrelation of an access code high only when the sequence is perfectly aligned. Thus by cross correlating an envelope signal \(r(t)\), that periodically contains an access code \(a(t)\) with the access code itself, and looking for peaks in the result, it is possible to determine where each frames begin. Furthermore by analyzing the values of the peaks it is possible to extract informations about the phase and frequency offsets.
-On the receiver side the bitstream is synchronized using a XOR correlator. To find the synchronization delay \(d\) (in samples) the XOR correlator computes the binary cross correlation
-\begin{equation} \label{eqn:binary-xcorr}
- R_{\vec{m}\vec{p}} = N - \sum_i (\vec{m} \oplus \vec{p})_i
+To actually see how that is possible, recall that mathematically the cross correlation (denoted here by \(\star\)) of two values complex signals is
+\begin{equation}
+ R_{ra}
+ = r(t) \star a(t)
+ = \int_\mathbb{R} r(\tau) a^*(\tau - t) \,d\tau
+ = r(t) * a^*(-t),
\end{equation}
-between the synchronization bit pattern \(\vec{p}\) and a shift register \(\vec{m}(n)\) of the same length \(N\). Put into words \eqref{eqn:binary-xcorr} subtracts the number bits that differ between \(\vec{m}\) and \(\vec{p}\) from the length of the registers. Thus if all bits are equal, the difference is zero and the correlations has a maximum value of \(N\). The task of the correlator is then to find the delay / skip such that the pattern maches, i.e.
+which is equivalent to a convolution, where the left term being time-reversed complex conjugated \cite{Gallager}. This last property is especially useful because it makes possible to implement cross correlation using FIR filters. Some interesting properties of the cross correlation are that correlation with itself (also called autocorrelation) at \(t = 0\) is
\begin{equation}
- d = \argmax_n \big( R_{\vec{m}\vec{p}}(n) \big)
- = \argmax_n \left( N - \sum_i (\vec{m}(n) \oplus \vec{p})_i \right)
- .
+ R_{aa} = (a \star a)(0)
+ = \int_\mathbb{R} a(\tau) a^*(\tau - 0) \,d\tau
+ = \int_\mathbb{R} |a(\tau)|^2 \,d\tau \in \mathbb{R},
\end{equation}
-
-Once the bit stream is synchronized, the packets are deframed and the payloads compared to a local copy of the sent data to compute the BER, again by XOR'ing the data blocks and counting the bit that are set. Further details are discussed in \S\ref{sec:ber}.
+which is a real number. And the correlation with an out of phase copy \(a'(t) = a(t) e^{j\varphi}\) is
+\begin{equation}
+ % R_{a'a} =
+ (a' \star a)(0)
+ = \int_\mathbb{R} a(\tau)e^{j\varphi} a^*(\tau) \,d\tau
+ = R_{aa} e^{j\varphi}.
+\end{equation}
+The important thing to notice in the previous expression is that since \(R_{aa}\) is a real number, the phase of the cross correlation at \(t = 0\) is the phase of \(a'(t)\). This fact is used to implement a fine phase correction for the received envelope in relatively few steps as follows:
+\begin{itemize}
+ \item Compute the cross correlation of the envelope \(r(t)\) with the access code \(a(t)\), i.e. \(R_{ra}(t) = (r \star a)(t)\).
+ \item Find the maximum value of \(\hat{R}_{ra} = \max R_{ra}(t)\) (correlation peak).
+ \item Extract the phase offset \(\varphi = \angle \hat{R}_{ra}\).
+ \item Remove the phase offset in the envelope by multiplying with the complex conjugate of the offset, that is \(\hat{r}(t) = r(t) e^{-j\varphi}\)
+\end{itemize}
+%% TODO: frequency correction using linear interpolation
\section{Channel simulations}
diff --git a/doc/thesis/chapters/theory.tex b/doc/thesis/chapters/theory.tex
index e3c0117..2da4722 100644
--- a/doc/thesis/chapters/theory.tex
+++ b/doc/thesis/chapters/theory.tex
@@ -225,6 +225,8 @@ Equation \eqref{eqn:multipath-frequency-response} shows that the frequency respo
\subsection{Discrete-time model}\label{sec:Discrete-time-model}
+% TODO: discuss the "bins" of discrete time
+
Since in practice signal processing is done digitally, it is meaningful to discuss the properties of a discrete-time model. To keep the complexity of the model manageable some assumptions are necessary, thus the sent discrete signal \(s(n)\)\footnote{This is an abuse of notation. The argument \(n\) is used to mean the \(n\)-th digital sample of \(s\), whereas \(s(t)\) is used for the analog waveform.} is assumed to have a finite single sided bandwidth \(W\). This implies that in the time-domain signal is a series of sinc-shaped pulses each shifted from the previous by a time interval \(T = 1 / (2W)\) (Nyquist rate):
\begin{equation}
s(t) = \sum_n s(n) \sinc(t/T - n)
@@ -234,7 +236,7 @@ The waveform \(s(t)\) is then convolved with the CIR function \(h(\tau, t)\) (wi
r(t) &= \int_ \mathbb{R} \sum_n s(n) \sinc(\tau / T - n) \sum_k c_k(t) \delta(\tau - \tau_k(t)) \,d\tau \\
&= \sum_n s(n) \sum_k c_k(t) \sinc(t/T - \tau_k(t)/T - n),
\end{align*}
-which is then sampled at the Nyquist rate of \(2W = 1/T\), resulting in a set of samples\footnote{Again, the abusing notation \(r(m)\) means the \(m\)-th digital sample of \(r(t)\).}:
+which is then sampled at the Nyquist rate of \(2W = 1/T\), resulting in a set of samples\footnote{Again, the abusing notation \(r(m)\) means the \(m\)-th digital sample of \(r(t)\), i.e. \(r(mT)\).}:
\[
r(m) = \sum_n s(n) \sum_k c_k(mT) \sinc(m - \tau_k(mT)/T - n).
\]
@@ -258,19 +260,8 @@ is different from \eqref{eqn:multipath-impulse-response} consider again the plot
}
\end{figure}
-From a signal processing perspective \eqref{eqn:discrete-multipath-impulse-response} can be interpreted as a simple tapped delay line, schematically drawn in \figref{fig:tapped-delay-line}, which confirms that the presented mathematical model is indeed a FIR filter. Simple multipath channels can be simulated with just a few lines of code, for example the data for \figref{fig:multipath-frequency-response-plots} is generated in just four lines of Python shown in listing \ref{lst:two-tap-fir}. The difficulty of fading channels in practice lies in the estimation of the values for the constantly changing parmeters \(c_k(t)\) and \(\tau_k(t)\).
-
-\begin{lstlisting}[language=python, captionpos=b, caption={
- Simulation of a multipath channel using a 2 tap FIR filter.
-}, label={lst:two-tap-fir}]
-import numpy as np
-
-def tap(c, tau, f):
- return np.exp(2j * np.pi * f * tau)
+From a signal processing perspective \eqref{eqn:discrete-multipath-impulse-response} can be interpreted as a simple tapped delay line, schematically drawn in \figref{fig:tapped-delay-line}, which confirms that the presented mathematical model is indeed a FIR filter. Simple multipath channels can be simulated with just a few lines of code, for example the data for the static fading channel in \figref{fig:multipath-frequency-response-plots} is generated in just four lines of Python. The difficulty of fading channels in practice lies in the estimation of the constantly changing parameters \(c_k(t)\) and \(\tau_k(t)\).
-f = np.logspace(5, 8, num=320)
-multipath = tap(.8, 500e-9, f) + tap(.4, 300e-9, f)
-\end{lstlisting}
\subsection{Fractional Delay}\label{sec:fractional-delay}
% TO Do quelle: http://users.spa.aalto.fi/vpv/publications/vesan_vaitos/ch3_pt1_fir.pdf
@@ -332,7 +323,22 @@ The first non-zero sample can be find out with the help of the index M in \eqref
\subsection{Statistical model}
-Because as mentioned earlier it is difficult to estimate the time-dependent parameters of \(h_l(t)\) in many cases it is easier to model the components of the CIR as stochastic processes, thus greatly reducing the number of parameters. This is especially effective for channels that are constantly changing, because by the central limit theorem the cumulative effect of many small changes tend to a normal statistical distribution.
+Because as mentioned earlier it is difficult to estimate the time-dependent parameters of \(h_l(m)\) in many cases it is easier to model the components of the CIR as stochastic processes, thus greatly reducing the number of parameters. This is especially effective for channels that are constantly changing, because by the central limit theorem the cumulative effect of many small changes tends to a normal statistical distribution.
+
+Recall that \(h_l(m)\) is a function of time because \(c_k\) and \(\tau_k\) change over time. The idea of the statistical model is to replace the cumulative change caused by \(c_k\) and \(\tau_k\) (which are difficult to estimate) by picking the next CIR sample \(h_l(m +1)\) from a \emph{circularly symmetric complex Gaussian distribution}, written as
+\begin{equation}
+ h_l \sim \mathcal{CN}(0, \sigma^2)
+\end{equation}
+for some parameter \(\sigma\). Loosely speaking, the distribution needs to be ``circular'' because \(h_l\) is a complex number, which is two dimensional, it can however be understood as \(\Re{h_l} \sim \mathcal{N}(0, \sigma^2)\) and \(\Im{h_l} \sim \mathcal{N}(\mu, \sigma^2)\), i.e. having each component being normally distributed.
+
+
+
+\begin{subequations}
+ \begin{align}
+ R_{l} (k) &= \E{h_l(m) h_l^*(m+k)}, \\
+ 0 &= \E{h_l(m) h_k^*(m)} \text { for } l \neq k
+ \end{align}
+\end{subequations}
\begin{figure}
\centering