From 12eade5d45bb4ef4e41a62a2f59fac89773cef94 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Thu, 16 Dec 2021 06:24:49 +0100 Subject: Constellation plots --- doc/thesis/Makefile | 10 ++- doc/thesis/chapters/implementation.tex | 52 +++++------- .../data/flowgraphs/qpsk_channel_dynamic.dat | Bin 0 -> 4845712 bytes .../data/flowgraphs/qpsk_channel_static.dat | Bin 0 -> 6369352 bytes .../data/flowgraphs/qpsk_equalized_dynamic.dat | Bin 0 -> 1211096 bytes .../data/flowgraphs/qpsk_equalized_static.dat | Bin 0 -> 1592008 bytes .../data/flowgraphs/qpsk_locked_dynamic.dat | Bin 0 -> 1211040 bytes .../figures/data/flowgraphs/qpsk_locked_static.dat | Bin 0 -> 1591992 bytes .../figures/data/flowgraphs/qpsk_sync_dynamic.dat | Bin 0 -> 1211096 bytes .../figures/data/flowgraphs/qpsk_sync_static.dat | Bin 0 -> 1592008 bytes .../data/qpsk_sim_constellations_dynamic.py | 32 ++++++++ .../figures/data/qpsk_sim_constellations_static.py | 32 ++++++++ .../tikz/qpsk-sim-constellations-dynamic.tex | 87 +++++++++++++++++++++ .../tikz/qpsk-sim-constellations-static.tex | 87 +++++++++++++++++++++ 14 files changed, 264 insertions(+), 36 deletions(-) create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_channel_dynamic.dat create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_channel_static.dat create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_equalized_dynamic.dat create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_equalized_static.dat create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_locked_dynamic.dat create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_locked_static.dat create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_sync_dynamic.dat create mode 100644 doc/thesis/figures/data/flowgraphs/qpsk_sync_static.dat create mode 100644 doc/thesis/figures/data/qpsk_sim_constellations_dynamic.py create mode 100644 doc/thesis/figures/data/qpsk_sim_constellations_static.py create mode 100644 doc/thesis/figures/tikz/qpsk-sim-constellations-dynamic.tex create mode 100644 doc/thesis/figures/tikz/qpsk-sim-constellations-static.tex (limited to 'doc') diff --git a/doc/thesis/Makefile b/doc/thesis/Makefile index 79409dc..e23dcfd 100644 --- a/doc/thesis/Makefile +++ b/doc/thesis/Makefile @@ -23,9 +23,15 @@ SOURCES := \ figures/tikz/multipath-impulse-response.tex \ figures/tikz/multipath-frequency-response-plots.tex \ figures/tikz/tapped-delay-line.tex \ - figures/tikz/packet-frame.tex + figures/tikz/packet-frame.tex \ + figures/tikz/qpsk-sim-constellations-static.tex \ + figures/tikz/qpsk-sim-constellations-dynamic.tex + +DATA := \ + figures/data/multipath_frequency_response.dat \ + figures/data/qpsk_sim_constellations_static.dat \ + figures/data/qpsk_sim_constellations_dynamic.dat -DATA := figures/data/multipath_frequency_response.dat # Get the main file from the file MAIN := $(shell sed -ne 's/^.*\!TeX root =\(.*\)$$/\1/ p' $(SOURCES)) diff --git a/doc/thesis/chapters/implementation.tex b/doc/thesis/chapters/implementation.tex index e9928b7..ad33424 100644 --- a/doc/thesis/chapters/implementation.tex +++ b/doc/thesis/chapters/implementation.tex @@ -261,7 +261,6 @@ def block_phase(self, start, end): return sphase * np.ones(nsamples) + freq * np.arange(0, nsamples) \end{lstlisting} - \section{Channel simulations} Here its possible to add some AWGN noise in the channel line. Different parameters can be changed like the noise voltage, time or the frequency offset. @@ -279,6 +278,22 @@ In this part the fading blocks for the simulation are added. Tow different types % %For the a first simulation with some fading the 16QAM simulation model has been extended with a FIR-Filter in the Chanel. The results of this simulation are shown in \figref{fig:simul16QAM} and \figref{fig:simul16QAM_1} as the blue Signal. +\begin{figure} + \centering + \input{figures/tikz/qpsk-sim-constellations-static} + \caption{ + Constellation diagrams for a simulated link using QPSK with AWGN and Rayleighan fading. + } +\end{figure} + +\begin{figure} + \centering + \input{figures/tikz/qpsk-sim-constellations-dynamic} + \caption{ + Constellation diagrams for a simulated link using QPSK with AWGN and Rayleighan fading. The paramters are: frequency offset of 0.2 \%, \SI{100}{\milli\volt} noise, dopper shift for \(v = \SI{2}{\meter\per\second}\), and a NLOS urban PDP. + } +\end{figure} + \subsection{Fading with Discrete-time model} For the statical version according to \ref{sec:discrete-time-model} to implement and illustrat the fading effect, a separate block was created and implemented in the channel. Nearer shown in \ref{lst:fir-block}. This block is based on a FIR filter. It can be displayed with a direct path or without one. With the help of this filter, the delay of the line of side paths are illustrated. In this block it is possible to simulate any number of these paths with different strengths, as long as there is an associated amplitude specified for each delayed path. Unfortunately, these simulation values do not correspond to the realety, because too many incalculable side effects occur, which aren't possiple to ilustrate in this simulation. @@ -356,7 +371,6 @@ It can also be chosen whish Statical model should be taken for the simulation Ra The power delay profile which specify the delay in time for each impulse need to be in sample. For this delay vector some realistic values are for the first delay when theirs non line of side should be zero. The second delayed path depend on the environment of measurement. In an indoor enviroment it is usually between \(1\cdot10^{-9}\) to \(1\cdot10^{-7}\) and in an outdoor environment between \(1\cdot10^{-7}\) to \(1\cdot10^{-5}\). The rest depends on on the bandwidth. - %TODO finish this paragraph %\begin{german} % @@ -371,9 +385,6 @@ The power delay profile which specify the delay in time for each impulse need to \skelpar[5]{ Simulate an example from the skript } - - - \subsection{Measurements} @@ -419,35 +430,8 @@ For generating the Byte error rate it is focus on byte-blocks of a specific leng return len(inp) \end{lstlisting} +\section{Technical pro -\begin{figure} - \includegraphics[width=\linewidth]{./figures/pdfs/qam_nogui.pdf} - \caption{GNU Radio Blocks} - \label{fig:simul16QAM_block} -\end{figure} - -\begin{figure} - \includegraphics[width=\linewidth]{./figures/screenshots/QAM16_Fading_2.png} - \caption{Simulation results} - \label{fig:simul16QAM} -\end{figure} - -\begin{figure} - \includegraphics[width=\linewidth]{./figures/screenshots/QAM16_Fading_2_.png} - \caption{Simulation results} - \label{fig:simul16QAM_1} -\end{figure} - -\begin{figure} - \includegraphics[width=\linewidth]{./figures/pdfs/qam_Hardware_1711.pdf} - \caption{GNU Radio Blocks Hardware} - \label{fig:simul16QAM_Hardware_Aufbau} -\end{figure} - -\begin{figure} - \includegraphics[width=\linewidth]{./figures/screenshots/QAM16_Hardware_1711.png} - \caption{Hardware results} - \label{fig:simul16QAM__Hardware} -\end{figure} +\section{Issue with the current implementation} % TODO: Picture of the setup diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_channel_dynamic.dat b/doc/thesis/figures/data/flowgraphs/qpsk_channel_dynamic.dat new file mode 100644 index 0000000..560f179 Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_channel_dynamic.dat differ diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_channel_static.dat b/doc/thesis/figures/data/flowgraphs/qpsk_channel_static.dat new file mode 100644 index 0000000..7466d69 Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_channel_static.dat differ diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_equalized_dynamic.dat b/doc/thesis/figures/data/flowgraphs/qpsk_equalized_dynamic.dat new file mode 100644 index 0000000..473c43d Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_equalized_dynamic.dat differ diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_equalized_static.dat b/doc/thesis/figures/data/flowgraphs/qpsk_equalized_static.dat new file mode 100644 index 0000000..c884795 Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_equalized_static.dat differ diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_locked_dynamic.dat b/doc/thesis/figures/data/flowgraphs/qpsk_locked_dynamic.dat new file mode 100644 index 0000000..92a9b97 Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_locked_dynamic.dat differ diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_locked_static.dat b/doc/thesis/figures/data/flowgraphs/qpsk_locked_static.dat new file mode 100644 index 0000000..1e85803 Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_locked_static.dat differ diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_sync_dynamic.dat b/doc/thesis/figures/data/flowgraphs/qpsk_sync_dynamic.dat new file mode 100644 index 0000000..bc21557 Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_sync_dynamic.dat differ diff --git a/doc/thesis/figures/data/flowgraphs/qpsk_sync_static.dat b/doc/thesis/figures/data/flowgraphs/qpsk_sync_static.dat new file mode 100644 index 0000000..cb5ab19 Binary files /dev/null and b/doc/thesis/figures/data/flowgraphs/qpsk_sync_static.dat differ diff --git a/doc/thesis/figures/data/qpsk_sim_constellations_dynamic.py b/doc/thesis/figures/data/qpsk_sim_constellations_dynamic.py new file mode 100644 index 0000000..7e23125 --- /dev/null +++ b/doc/thesis/figures/data/qpsk_sim_constellations_dynamic.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import os +import numpy as np + +DATA_DIR = "./figures/data/flowgraphs" +SPS = 4 + +channel = np.fromfile(f"{DATA_DIR}/qpsk_channel_dynamic.dat", dtype=np.complex64)[::SPS] +sync = np.fromfile(f"{DATA_DIR}/qpsk_sync_dynamic.dat", dtype=np.complex64) +equalized = np.fromfile(f"{DATA_DIR}/qpsk_equalized_dynamic.dat", dtype=np.complex64) +locked = np.fromfile(f"{DATA_DIR}/qpsk_locked_dynamic.dat", dtype=np.complex64) + +samples = [channel, sync, equalized, locked] + +# print(list(map(len, samples))) + +start = 67.8e3 +end = start + 200 + +get_range = lambda arr: arr[int(start):int(end)] +get_parts = lambda v: (np.real(v), np.imag(v)) + +values = map(get_range, samples) +parts = [p for v in map(get_parts, values) for p in v] +data = np.array(list(zip(*parts))) + +# save to file +location = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) +name, _ = os.path.splitext(os.path.basename(__file__)) +filename = os.path.join(location, name + ".dat") +np.savetxt(filename, data, fmt='%.6e') diff --git a/doc/thesis/figures/data/qpsk_sim_constellations_static.py b/doc/thesis/figures/data/qpsk_sim_constellations_static.py new file mode 100644 index 0000000..61fdcb1 --- /dev/null +++ b/doc/thesis/figures/data/qpsk_sim_constellations_static.py @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 + +import os +import numpy as np + +DATA_DIR = "./figures/data/flowgraphs" +SPS = 4 + +channel = np.fromfile(f"{DATA_DIR}/qpsk_channel_static.dat", dtype=np.complex64)[::SPS] +sync = np.fromfile(f"{DATA_DIR}/qpsk_sync_static.dat", dtype=np.complex64) +equalized = np.fromfile(f"{DATA_DIR}/qpsk_equalized_static.dat", dtype=np.complex64) +locked = np.fromfile(f"{DATA_DIR}/qpsk_locked_static.dat", dtype=np.complex64) + +samples = [channel, sync, equalized, locked] + +# print(list(map(len, samples))) + +start = 67.8e3 +end = start + 200 + +get_range = lambda arr: arr[int(start):int(end)] +get_parts = lambda v: (np.real(v), np.imag(v)) + +values = map(get_range, samples) +parts = [p for v in map(get_parts, values) for p in v] +data = np.array(list(zip(*parts))) + +# save to file +location = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) +name, _ = os.path.splitext(os.path.basename(__file__)) +filename = os.path.join(location, name + ".dat") +np.savetxt(filename, data, fmt='%.6e') diff --git a/doc/thesis/figures/tikz/qpsk-sim-constellations-dynamic.tex b/doc/thesis/figures/tikz/qpsk-sim-constellations-dynamic.tex new file mode 100644 index 0000000..5f7d1de --- /dev/null +++ b/doc/thesis/figures/tikz/qpsk-sim-constellations-dynamic.tex @@ -0,0 +1,87 @@ +% vim: set ts=2 sw=2 noet: +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Channel with ISI}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -5, xmax = 5, + ymin = -5, ymax = 5, + ] + + \addplot[magenta, only marks] table[x index = 0, y index = 1] + {figures/data/qpsk_sim_constellations_dynamic.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Synchronized}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -5, xmax = 5, + ymin = -5, ymax = 5, + ] + + \addplot[magenta!80!blue, only marks] table[x index = 2, y index = 3] + {figures/data/qpsk_sim_constellations_dynamic.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill + +\vspace{3mm} + +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Equalized}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -1.5, xmax = 1.5, + ymin = -1.5, ymax = 1.5, + ] + + \addplot[magenta!50!blue, only marks] table[x index = 4, y index = 5] + {figures/data/qpsk_sim_constellations_dynamic.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Locked}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -1.5, xmax = 1.5, + ymin = -1.5, ymax = 1.5, + ] + + \addplot[magenta!30!blue, only marks] table[x index = 6, y index = 7] + {figures/data/qpsk_sim_constellations_dynamic.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill + diff --git a/doc/thesis/figures/tikz/qpsk-sim-constellations-static.tex b/doc/thesis/figures/tikz/qpsk-sim-constellations-static.tex new file mode 100644 index 0000000..ffd6a2f --- /dev/null +++ b/doc/thesis/figures/tikz/qpsk-sim-constellations-static.tex @@ -0,0 +1,87 @@ +% vim: set ts=2 sw=2 noet: +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Channel with ISI}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -5, xmax = 5, + ymin = -5, ymax = 5, + ] + + \addplot[magenta, only marks] table[x index = 0, y index = 1] + {figures/data/qpsk_sim_constellations_static.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Synchronized}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -5, xmax = 5, + ymin = -5, ymax = 5, + ] + + \addplot[magenta!80!blue, only marks] table[x index = 2, y index = 3] + {figures/data/qpsk_sim_constellations_static.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill + +\vspace{3mm} + +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Equalized}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -1.5, xmax = 1.5, + ymin = -1.5, ymax = 1.5, + ] + + \addplot[magenta!50!blue, only marks] table[x index = 4, y index = 5] + {figures/data/qpsk_sim_constellations_static.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill +\begin{subfigure}{.45\linewidth} +\begin{tikzpicture} + \begin{axis}[ + title = {Locked}, + width = 6.5cm, height = 6.5cm, + % ylabel = {Quadrature}, + % xlabel = {In-Phase}, + xlabel near ticks, + ylabel near ticks, + grid = major, + xmin = -1.5, xmax = 1.5, + ymin = -1.5, ymax = 1.5, + ] + + \addplot[magenta!30!blue, only marks] table[x index = 6, y index = 7] + {figures/data/qpsk_sim_constellations_static.dat}; + \end{axis} +\end{tikzpicture} +\end{subfigure} +\hfill + -- cgit v1.2.1