From e505627adad7510673f983cd158016342aa1bdfc Mon Sep 17 00:00:00 2001 From: jaseg Date: Tue, 14 Apr 2020 18:36:09 +0200 Subject: ma: add a bunch of graphs, some dsss demod proto explanation --- ma/safety_reset.tex | 151 ++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 142 insertions(+), 9 deletions(-) (limited to 'ma') diff --git a/ma/safety_reset.tex b/ma/safety_reset.tex index e403368..392bb3c 100644 --- a/ma/safety_reset.tex +++ b/ma/safety_reset.tex @@ -1093,12 +1093,24 @@ interface and its good tolerance of system resets due to unexpected power loss. \begin{figure} \centering - \includegraphics{../lab-windows/fig_out/freq_meas_spectrum} - \caption{Fourier transform of the 24 hour grid frequency trace in fig. \ref{freq_meas_trace} with some notable peaks - annotated with the corresponding period in seconds. The $\frac{1}{f}$ line indicates a pink noise spectrum. We can - clearly see the noise spectrum flattens below some frequency around $\frac{1}{120 \text{s}}$. This effect is due to - primary control actively regulating grid frequency over such time intervals. Beyond the $\frac{1}{f}$ slope starting - at around $1 \text{Hz}$ we can make out a white noise floor in the order of $\frac{\mu\text{Hz}}{\text{Hz}}$. + \includegraphics{../lab-windows/fig_out/mains_voltage_spectrum} + \caption{Power spectral density of the mains voltage trace in fig. \ref{freq_meas_trace}. We can see the expected + peak at $50 \text{Hz}$ along with smaller peaks at odd harmonics. We can also see a number of spurious tones both + between harmonics and at low frequencies, as well as some bands containing high noise energy around $0.1 + \text{Hz}$. This graph demonstrates a high signal-to-noise ratio that is not very demanding on our frequency + estimation algorithm. + } + \label{mains_voltage_spectrum} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/freq_meas_spectrum} + \caption{Power spectral density of the 24 hour grid frequency trace in fig. \ref{freq_meas_trace} with some notable + peaks annotated with the corresponding period in seconds. The $\frac{1}{f}$ line indicates a pink noise spectrum. + Around a period of $20 \text{s}$ the PSD starts to fall off at about $\frac{1}{f^3}$ until we can make out some + bumps at periods around $2$ and $3 \text{s}$. Starting at at around $1 \text{Hz}$ we can see a white noise floor in + the order of $\frac{\mu\text{Hz}^2}{\text{Hz}}$. % TODO: where does this noise floor come from? Is it a fundamental property of the grid? Is it due to limitations of % our measurement setup (such as ocxo stability/phase noise) ??? } @@ -1120,9 +1132,130 @@ our target platform is a cheap low-end microcontroller. Our demonstrator firmwar language such as C or rust. For prototyping these languages lack flexibility compared to python. % FIXME introduce project outline, specs -> proto -> demo above! -To validate our modulation scheme we performed a series of simulations. We produced modulated frequency data that we -superimposed with an actual grid frequency measurement series. -% FIXME do test series with simulated noise emulating measured noise spectrum +To validate our modulation scheme we first performed a series of simulations on our python demodulator prototype +implementation. To simulate a modulated grid frequency signal we added noise to a synthetic modulation signal. For most +simulations we used measured frequency data gathered with our frequency sensor. We only have a limited amount of capture +data. Re-using segements of this data as background noise in multiple simulation runs could hypothetically lead to our +simulation results depending on individual features of this particular capture that would be common between all runs. To +estimate the impact of this problem we re-ran some of our simulations with artificial random noise synthesized with a +power spectral density matching that of our capture. To do this, we first measured our capture's PSD, then fitted a +low-resolution spline to the PSD curve in log-log coordinates. We then generated white noise, multiplied the resampled +spline with the DFT of the synthetic noise and performed an iDFT on the result. The resulting time-domain signal is our +synthetic grid frequency data. Fig.\ \ref{freq_meas_spectrum} shows the PSD of our measured grid frequency signal. The +red line indicates the low-resolution log-log spline interpolation used for shaping our artificial noise. Fig.\ +\ref{simulated_noise_spectrum} shows the PSD of our simulated signal overlayed with the same spline as a red line and +shows time-domain traces of both simulated (blue) and reference signals (orange) at various time scales. Visually both +signals look very similar, suggesting we have found a good synthetic approximation of our measurements. + +\begin{figure} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/simulated_noise_spectrum} + \caption{Synthetic grid frequency in comparison with measured data. The topmost graph shows the synthetic spectrum + compared to the spline approximation of the measured spectrum (red line). The other graphs show time-domain + synthetic data (blue) in comparison with measured data (orange). + } + \label{simulated_noise_spectrum} +\end{figure} + +In our simulations, we manipulated four main variables of our modulation scheme and demodulation algorithm and observed +their impact on symbol error rate (SER): +\begin{description} + \item[Modulation amplitude.] Higher amplitude should correspond to a lower SER. + \item[Modulation bit count.] Higher bit count $n$ means longer transmissions but yields higher theoretical decoding + gain, and should increase demodulator sensitivity. Ultimately, we want to find a sweet spot of manageable + transmission length at good demodulator sensitivity. + \item[Decimation] or DSSS chip duration. The chip time determines where in the grid frequency spectrum (fig.\ + \ref{freq_meas_spectrum} our modulated signal is located. Given our noise spectrum (fig.\ + \ref{freq_meas_spectrum}) lower chip durations (shifting our signal upwards in the spectrum) should yield lower + in-band background noise which should correspond to lower symbol error rates. + \item[Demodulation correlator peak threshold factor.] The first step of our prototype demodulation algorithm is to + calculate the correlation between all $2^n+1$ Gold sequences + % FIXME add a \ref here, describe proto demod alg somewhere + and to identify peaks corresponding to the input data containing a correctly aligned Gold sequence. The + threshold factor is a factor peaks of what magnitude compared to baseline noise levels are considered in the + following maximum likelihood estimation (MLE) decoding. % FIXME do we actually do MLS? +\end{description} + +As indicated by our results, symbol error rate is a good proxy of demodulation performance. With decreasing +signal-to-noise ratio, margins in various parts of the demodulator decrease which statistically leads to an increased +symbol error rate. Our simulations yield smooth, reproducible SER curves with adequately low error bounds. This +indicates SER is related fairly monotonically to the signal-to-noise margins inside our demodulator prototype. + +\begin{figure} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/dsss_gold_nbits_overview} + \caption{ + } + \label{dsss_gold_nbits_overview} +\end{figure} + +\begin{figure} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/dsss_gold_nbits_sensitivity} + \caption{ + } + \label{dsss_gold_nbits_sensitivity} +\end{figure} + +\begin{figure} + \begin{subfigure}{\textwidth} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/dsss_thf_amplitude_5678} + \label{dsss_thf_amplitude_5678} + \caption{ + } + \end{subfigure} + \begin{subfigure}{\textwidth} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/dsss_thf_sensitivity_5678} + \label{dsss_thf_sensitivity_5678} + \caption{ + } + \end{subfigure} + \caption{ + } + \label{dsss_thf_sensitivity} +\end{figure} + +\begin{figure} + \begin{subfigure}{\textwidth} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/chip_duration_sensitivity_5} + \label{chip_duration_sensitivity_5} + \caption{ + } + \end{subfigure} + \begin{subfigure}{\textwidth} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/chip_duration_sensitivity_6} + \label{chip_duration_sensitivity_6} + \caption{ + } + \end{subfigure} + \caption{ + } + \label{chip_duration_sensitivity} +\end{figure} + +\begin{figure} + \begin{subfigure}{\textwidth} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/chip_duration_sensitivity_cmp_meas_6} + \label{chip_duration_sensitivity_cmp_meas_6} + \caption{ + } + \end{subfigure} + \begin{subfigure}{\textwidth} + \centering + \includegraphics[width=\textwidth]{../lab-windows/fig_out/chip_duration_sensitivity_cmp_synth_6} + \label{chip_duration_sensitivity_cmp_synth_6} + \caption{ + } + \end{subfigure} + \caption{ + } + \label{chip_duration_sensitivity_cmp} +\end{figure} \section{Implementation of a demonstrator unit} -- cgit