\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper, margin=2cm]{geometry}

\usepackage{siunitx}
\sisetup{
     group-separator = {.},
     input-decimal-markers={.},
     output-decimal-marker = {.},
     group-minimum-digits=9}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{subfigure}
\usepackage{float}
\usepackage{wrapfig}
\usepackage{multicol}
\usepackage{amsmath, amssymb}
\usepackage{hyperref}
\usepackage{pdfpages}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{fit} % <-- needed for dashed box (fit)
\usepackage[european, rotatelabels]{circuitikz}

\hyphenpenalty=10000	%to stop cutting words in a paragraph

\pagestyle{fancy}
\fancyhf{}

\rhead{\includegraphics*[scale=0.013]{./Pictures/FaSTTUBe_Logo_ohneAuto.png}}
\rfoot{Page \thepage \hspace{1pt} of \pageref{LastPage}}
\lhead{Car 313, 23.04, Rev. 1}
\chead{\large TSAL Schematic}

\begin{document}

\section{TS\_Error Latching}
Once the state of $\overline{\mathrm{TS\_Error}}$ is reached for more then 1s (to prevent noise causing error), the latch U8 (74LVC1G74) will be triggered (page. \ref). This cannot be reset, unless the LVS power cycle is carried out. The backup pull-down resistor R9 for discharging the capacitor can also be placed if the CLR pin does not discharge fast enough.

% \begin{center}
% 	\begin{circuitikz}[]
% 		% LEGEND
% 		\draw[green!50!black] (0,2) -- ++(1,0);
% 		\draw (1,2) node[right]{$0.13mm^2$ unshielded - \href{https://media.distrelec.com/Web/Downloads/_t/ds/8724476_eng_tds.pdf}{RS PRO 8724476}, 2A};
%
% 		% IMD
% 		\node[draw, minimum width=1.5cm, minimum height=1cm, label=above:IR155-3204] (IMD) at (0,0) {\href{https://www.bender.de/fileadmin/content/Products/d/e/IR155-32xx-V004_D00115_D_XXEN.pdf}{IMD}};
%
% 		% AMS Master
% 		\node[draw, minimum width=1.5cm, minimum height=1cm] (AMS-IO) at (8,0) {\hyperlink{ams-io}{AMS Master - Input/Output}};
% 		\node[draw, minimum width=1.5cm, minimum height=1cm] (AMS-SDC) at (8,-2) {\hyperlink{ams-sdc}{AMS Master - SDC Latching Circuit}};
% 		\node[draw, minimum width=1.5cm, minimum height=1cm] (AMS-MCU) at (8,-4) {\hyperlink{ams-mcu}{AMS Master - Microcontroller}};
% 		\node[draw, dashed, fit=(AMS-IO) (AMS-SDC) (AMS-MCU), inner sep=0.5cm, label=above:AMS Master] {};
%
% 		% Arrows
% 		\draw[->, thick, color=green!50!black] (IMD.east) -- (AMS-IO.west) node[midway, above] {IMD\_OK};
% 		\draw[->] (AMS-IO.south) -- (AMS-SDC.north) node[midway, right] {IMD\_OK};
% 		\draw[->] (AMS-MCU.north) -- (AMS-SDC.south) node[midway, right] {$\overline{\text{AMS\_Error}}$};
%
% 		% Now overlay an invisible hyperlink box over AMS-IO
% 		%\node[opacity=0, fill opacity=0, text opacity=0, fit=(AMS-IO), inner sep=0pt](linkcover) {\hyperlink{ams-io}{\phantom{AMS Master - Input/Output}}};
% 	\end{circuitikz}
% \end{center}
% \subsection{IMD Latching}
% \begin{itemize}
% 	\item The \texttt{IMD\_OK} signal is pulled high approximately 1.5 seconds after startup for the \href{https://www.bender.de/fileadmin/content/Products/d/e/IR155-32xx-V004_D00115_D_XXEN.pdf}{IR155-3204 IMD}.
% 	\item Therefore the Power-on Reset (PoR) lasts approximately 2 seconds.
%
% \end{itemize}
% \subsection{AMS Latching}
% \begin{itemize}
% 	\item The \texttt{AMS\_OK} signal is pulled low until the following conditions are met:
% 	      \begin{itemize}
% 		      \item The AMS Master communicates with all six AMS Slaves, each providing valid voltage and temperature measurements.
% 		      \item The AMS Master communicates with the shunt sensor (\href{https://www.isabellenhuetteusa.com/wp-content/uploads/2022/07/Datasheet-IVT-S-V1.03.pdf}{IVT-S-300-U3-I-CAN2-12/24})
% 	      \end{itemize}
% \end{itemize}


\section{SCS signal implementation}
\subsection{Relay states}
As shown on page \ref, the relay state is measured through a set of voltage dividers and a windows comparator. The \texttt{Closed} signal is used for the state detection logic (which controls the TSAL green LEDs). When the aux cable are open, it is the same as the $\overline{\mathrm{Closed}}$ state, which will keep the green TSAL off.

The "short to GND" state can be ruled out by the comparator which compares the signal with a \SI{0.3}{\volt} reference.

Since we do not have aux connections with our precharge relay, the circuit works differently then the AIRs. (page. \ref) Here, the TS voltage on the inverter side is measured to check whether the precharge or AIR+ is closed or not. This signal is then compared with the AIR+ and precharge control signal to check if a mismatch is present. The rule T 11.9.2 does not apply here since no additional wires are used (all circuits are integrated on the PCB.)

\subsection{TS\_Off/TSAL\_Green}
% TODO:change DC schematic to include pulldown resistor at GREEN_EN
The TS\_Off (also shown as TSAL\_Green in the schematics) are sent out to the TSAL through a wire connection (as seen on page \ref). If the wire is disconnected the pull-down resistor will ensure that the constant current driver IS32LT3178 is disabled.

% TODO:add LED circuit on dashboard
The TS\_Off LED (and also the AMS\_Error and IMD\_Error LEDs) on the dashboard is controlled through a microcontroller, the default state (as shown in page \ref) is set, so that the TS\_Off LED will be off and the other two will be on (due to the additional NOT gate.)

Both signals are transmitted every 50 ms over the CAN bus. If the Dashboard does not receive a CAN message from the AMS Master within 150 ms, it will reach timeout and the default state will be reached. Since CAN bus has checksum already integrated in the protocol, the timeout will also be reached if data corruption happens for a prolonged period.

% \begin{center}
% 	\begin{circuitikz}[]
% 		% IMD
% 		\node[draw, minimum width=1.5cm, minimum height=1cm] (AMS) at (0,0) {AMS Master};
%
% 		% AMS Master
% 		\node[draw, minimum width=1.5cm, minimum height=1cm] (DB) at (8,0) {{Dashboard}};
% 		\node[draw, dashed, fit=(AMS), inner sep=0.5cm, label=above:Accumulator] {};
% 		% Arrows
% 		\draw[->, thick] (AMS.east) -- (DB.west) node[midway, above] {IMD\_OK} node[midway, below] {AMS\_OK};
% 	\end{circuitikz}
% \end{center}
%
% Both signals are transmitted every 50 ms over the CAN bus. If the Dashboard does not receive a CAN message from the AMS Master within 150 ms,
% it will trigger a fault condition. In response to this fault, the following LEDs will be activated:
% the \texttt{AMS Error} LED will be turned on, the \texttt{IMD Error} LED will be turned on, and the \texttt{TS Off} LED will remain off.



% \includepdf[pages={1}, landscape=true]{./Documents/TS-overview.pdf}
\includepdf[pages={9}, landscape=true]{./Documents/Master_FT25.pdf}
% \hypertarget{ams-mcu}{}
%\includepdf[pages={3}, landscape=true]{./Documents/Master_FT25.pdf}
\includepdf[pages={5,15,2,11,12,14}, landscape=true]{./Documents/Master_FT25.pdf}
\includepdf[landscape=true]{./Documents/dashboard-FT25.pdf}
% \includepdf[pages={2}, landscape=true]{./Documents/TS-overview.pdf}
\includepdf[landscape=true]{./Documents/DC.pdf}

\end{document}
