%! TEX root = ../thesis.tex
\chapter{Theory}
<containing the theoretical evaluation of the Problem and excludes possible procedures used in the experimental setup>

\section{Hardware Component Behavior}
Before starting any experimental data acquisition, some theory needs to be discussed. 
Mainly the conceptual behavior of the onboard measurement circuitry.
\subsection{48V Input Voltage}
\begin{figure}[H]
    \centering
    \includegraphics[width=.9\textwidth]{./tikz/mon48v.pdf}
    \caption{Circuit for measuring the 48V input Voltage, consisting of input potential, two resistors as voltage divider, one full differential operational amplifier (full Diff Op Amp), one operational Amplifier, output voltage as well as the connection to the STM32-Chips input pin}
    \label{mon48v}
\end{figure}

The circuits for measuring input Voltage and current are the most complex, because for Voltage measurement the circuit needs to
\begin{enumerate}
    \item divide our input voltage into a usable potential range
    \item decouple the input from our signal potential
    \item operate within the Chips possible Voltage range of 0-3.3V
\end{enumerate}

The already implemented Cicuit can be seen in figure \ref{mon48v}. It consists of a 1:240 Voltage Divider, a full differential operational amplifier taking in the ~200mV (nominal), and amplifying it by a factor of 8 ($r_\text{diffOpAmp}$). It is decoupling the input and output voltages, so our 48V and 3.3V circuit parts are electricly insulated. The remaining operational amplifier provides futher amplification by a factor of 1.1 ($r_\text{OpAmp}$)

This circuit results in the following equation:

\begin{equation}
    V_\text{48V in}\cdot\frac{R_1}{R_1+R_2} \cdot r_\text{diffOpAmp} \cdot r_\text{OpAmp} = V_\text{48V pin}
\end{equation}

% and the expected behavior, as seen in \ref{beh48v}
% 
% \begin{figure}[h]
%     \centering
%     \hspace*{-.16\textwidth}
%     \includegraphics[width=1.3\textwidth]{./data/theory/v48.pdf}
%     \caption{Expected behavior of our 48V measurement circuit}
%     \label{beh48v}
% \end{figure}

\subsection{48V Input Current}

\begin{figure}[H]
    \centering
    \includegraphics[width=.9\textwidth]{./tikz/mon48i.pdf}
    \caption{Circuit for measuring the 48V input Current, consisting of the powerit Input Circuit, one shunt-resistor, one full diff Op Amp, one Op Amp, output potential, as well as the connection to the STM32-Chip input pin}
    \label{mon48i}
\end{figure}

In case of the current measurement circuit we require the following:
\begin{enumerate}
    \item use a shunt resistor, with minimal heat dissipation 
    \item still providing a good resolution also within the Chips Specifications
\end{enumerate}

Our calculation is based on:
\begin{equation}
    I_\text{48V IN}\cdot R_{shunt} \cdot r_\text{diffOpAmp} \cdot r_\text{OpAmp} = V_\text{48I pin}
\end{equation}

% so we expect:
% \begin{figure}[h]
%     \centering
%     \caption{Expected behavior of our input current measurement circuit}
%     \hspace*{-.16\textwidth}
%     \includegraphics[width=1.3\textwidth]{./data/theory/i48.pdf}
%     \label{beh48i}
% \end{figure}

\subsection{9.6V Output Voltage}

\subsection{1.8V Output Voltage}

\begin{align}
    R_{SET} =& 1 / \left(\frac{1}{R_{potentiometer}} + \frac{1}{R_{parallel}}\right) + R_{series}\\
    =& \frac{R_\text{potentiometer}\cdot R_\text{parallel}}{R_\text{potentiometer} + R_\text{parallel}} + R_\text{series}\\
    V_O =& \frac{30.1 k\Omega}{R_{SET} + 6.49 k\Omega} \cdot 0.7V + 0.7V
\end{align}

\begin{figure}[H]
    \centering
    \includegraphics[width=.7\textwidth]{./tikz/gen18v.pdf}
    \caption{Circuit for generating a changable Output Voltage}
    \label{gen18v}
\end{figure}

\begin{figure}[H]
    \centering
    \hspace*{-.13\textwidth}
    \includegraphics[width=1.3\textwidth]{./data/theory/v18.pdf}
    \caption{Expected bahavior of our output voltage by setting the potentiometer}
    \label{beh1v8}
\end{figure}
\subsection{1.8V Output Current}

\section{ADC Calibration}
\subsection{serial ADC readout}
While the measurements done by the STM32-Chip are using a 12bit ADC, we don't have enough of these inside to be able to completely parallelize the measurements, also only one ADC will be connected to all connected Pins and switch between them.

\section{1.8V Output Regulation}
%\section{Firmware Requirements}
