now including codeblocks (TM)

This commit is contained in:
Tom Selier 2024-02-03 16:33:20 +01:00
parent f71bb93d94
commit 4d9e35d0c9
1 changed files with 115 additions and 6 deletions

View File

@ -7,11 +7,39 @@
\usepackage{caption}
\usepackage{graphicx}
\usepackage{enumitem}
\usepackage{listings}
\usepackage{xcolor}
\newenvironment{Figure}
{\par\medskip\noindent\minipage{\linewidth}}
{\endminipage\par\medskip}
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolour}{rgb}{0.97,0.97,0.95}
\lstdefinestyle{mystyle}{
backgroundcolor=\color{backcolour},
commentstyle=\color{codegreen},
keywordstyle=\color{magenta},
numberstyle=\tiny\color{codegray},
stringstyle=\color{codepurple},
basicstyle=\ttfamily\footnotesize,
breakatwhitespace=false,
breaklines=true,
captionpos=b,
keepspaces=true,
numbers=left,
numbersep=5pt,
showspaces=false,
showstringspaces=false,
showtabs=false,
tabsize=2
}
\lstset{style=mystyle}
\graphicspath{{images/}}
\title{B00st converter}
@ -97,19 +125,44 @@
mean over the period of 1 millisecond. Thus, the highest measured value can be
subtracted from the lowest measured value.
\begin{lstlisting}[language=Python, caption={Peak to peak function}]
def PK_PK(all_data, ch):
output_pk = []
for data in all_data:
maximum = max(data[ch + 1])
minimum = min(data[ch + 1])
pk_pk = maximum-minimum
output_pk.append(pk_pk)
return output_pk
\end{lstlisting}
\subsubsection{Standard Deviation}\label{section:standard_devation}
The second metric used to measure noise was the standard deviation.
Unlike, peak to peak it givesa better impression of the noise over a longer
signal. SD can be calculated using equation \ref{eq:sd}.
The second metric used to measure noise was the standard deviation (SD).
Unlike peak to peak, it gives a better impression of the average noise over
a longer period. SD can be calculated using equation \ref{eq:sd}.
\begin{equation}
\label{eq:sd}
\sigma = \sqrt{\frac{1}{N}\sum^{N-1}_{i=0}(x[i] - \mu)^2}
\end{equation}
Where $x[i]$ is each voltage measurement, $\mu$ is the mean of the signal and
$N$ is the total amount of samples.
\noindent Where $x[i]$ is each voltage measurement, $\mu$ is the mean of the
signal and $N$ is the total amount of samples.
\begin{lstlisting}[language=Python, caption={SD function}]
def SD(all_data, ch):
output_SD = []
for data in all_data:
N = len(data[ch + 1])
MU = sum(data[ch + 1])/N
x = 0
for val in data[ch + 1]:
x += (val-MU)**2
SD = sqrt((1/N) * x)
output_SD.append(SD)
return [output_load, output_SD]
\end{lstlisting}
\subsection{Ripple characteristics} \label{section:ripple}
@ -142,6 +195,50 @@
sample in the signal can be multiplied by the corresponding value in the window,
preparing the signal for the FFT.
\begin{lstlisting}[language=python, caption={Hamming function}]
def window(y):
N = len(y)
hamming = []
for n in range(N):
hamming.append(
0.54 - 0.46 * cos(2*np.pi*(n/N)))
y = [hamming[i]*x for i, x in enumerate(y)]
return y
\end{lstlisting}
\begin{lstlisting}[language=python, caption={FFT function}]
def Freq(all_data, ch):
output_freq = []
for data in all_data:
# FFT
# using realfft,
# because the signal only has real parts
y = np.fft.rfft(data[ch + 1])
# Window
y = window(y)
# Calculate the bins
dt = data[1][1] - data[1][0]
x = np.fft.rfftfreq(len(data[ch+1]), dt)
# find maximum, max() and np.argmax()
# are not playing nice with
# imaginary numbers
maximum = 0
max_idx = 0
offset = 1 # Skip the first bin, DC offset
for idx, val in enumerate(y[offset:]):
mag = sqrt(val.real**2 + val.imag**2)
if mag > maximum:
maximum = mag
max_idx = idx + offset
# get the frequency of the maximum
output_freq.append(x[max_idx])
return [output_load, output_freq]
\end{lstlisting}
\subsection{Start up} \label{section:start_up}
The last characteristics is the start up, specifically the different rise times
@ -156,6 +253,18 @@
filtered using a low pass filter, reducing the high frequencies from the
measurement.
\begin{lstlisting}[language=python, caption={LPF snippet}]
initial = data[3][0]
dt = data[1][1] - data[1][0]
x_filter = [initial]
for i in range(1, len(data[3])):
x_dot_filter = \
(data[3][i] - x_filter[i-1])/0.0002
x_filter.append(
x_filter[i-1] + x_dot_filter*dt)
\end{lstlisting}
\section{Results}
In this section the results from section \ref{section:methodology} will be
@ -230,7 +339,7 @@
Using the values from figure \ref{fig:schematic_full}, the resonating frequency
of the circuit should be around $27KHz$. Thus, this cannot be the cause of
the high frequency. As the frequency of the ripple is magnitudes higher
than the LC-circuit's resosonant frequency, what is seen is most likely the
than the LC-circuit's resonant frequency, what is seen is most likely the
Self Resonating Frequency (SRF) of the inductor. Typically the SRF is
$>10 MHz$, so that could be a probable source of the high frequencies.