\hypertarget{ltc_8h}{
\section{ltc.h File Reference}
\label{ltc_8h}\index{ltc.h@{ltc.h}}
}
Public definitions for LAT Thermal Control software (LTC). 

{\tt \#include \char`\"{}LTC/LTC\_\-tlmdefs.h\char`\"{}}\par
\subsection*{Functions}
\begin{CompactItemize}
\item 
unsigned int \hyperlink{ltc_8h_4be1d663f489cf24166b60594179f09b}{LTC\_\-initialize} (void)
\begin{CompactList}\small\item\em Initializes and configures thermal control software. \item\end{CompactList}\item 
unsigned int \hyperlink{ltc_8h_2827bb147efc162df8fbc896448f2dac}{LTC\_\-shutdown} (void)
\begin{CompactList}\small\item\em Release resources associated with LTC. \item\end{CompactList}\item 
unsigned int \hyperlink{ltc_8h_d57add660dbed4e5227115db65e58524}{LTC\_\-StartTask} (void)
\begin{CompactList}\small\item\em Start Thermal Control processing. \item\end{CompactList}\item 
unsigned int \hyperlink{ltc_8h_23cdf08e50f35c0fa666ef876becf653}{LTC\_\-StopTask} (void)
\begin{CompactList}\small\item\em Stop Thermal Control processing. \item\end{CompactList}\item 
unsigned int \hyperlink{ltc_8h_f8bbce555ca5c41411680d32b9e337f8}{LTC\_\-GetTlm} (\hyperlink{struct__LTC__DiagLTC__Tlm}{LTC\_\-DiagLTC\_\-Tlm} $\ast$tt)
\begin{CompactList}\small\item\em Retreive telemetry data. \item\end{CompactList}\item 
unsigned int \hyperlink{ltc_8h_52eeae04cdc77cd8a03e3ec4cfde2af8}{LTC\_\-GetConfigFile} (unsigned int $\ast$fid)
\begin{CompactList}\small\item\em Get LTC configuration file ID. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Public definitions for LAT Thermal Control software (LTC). 

Control is accomplished by reading-in radiator interface (RIT) and heat pipe reservoir temperatures via the PDU, applying these temperatures to a control algorithm that calcuates whether to turn on or off the heat pipe reservoir heaters, and then commanding the heater on/off bits in the SIB. There are twelve heat pipes numbered or indexed internally as 0 - 11. The temperature sensors and on/off switch bits must be consistent and refer to the same heat $\backslash$ pipe. The on/off bits in the SIB Heater Control Register refer to the left and right heater. Thus the association of heater index to SIB HCR bits is as follows: 0 - Left Heater 0, 1 - Left Heater 1,..., 5 - Left Heater 5, 6 - Right Heater 0, 7 - Right Heater 1,..., 11 - Right Heater 5. The temperature sensor addresses must be setup consistent with this numbering. For reference to the LAT, the left and right radiators refer to the -Y and +Y radiators, respectively. The VCHP numbering used in the instrumentation list for the -Y radiator is VCHP 0 is closest to -X and for the +Y radiator 0 is closest to +X. Thus heat pipe 0 is on the -Y radiator in the most -X direction, heat pipe 5 is on the -Y radiator in the most +X direction, heat pipe 6 is on the +Y radiator in the most -X direction and heat pipe 11 is on the +Y radiator in the most +X direction.

The temperature sensors are read using the monitor capability of the PDU. The PDU is capable of monitoring 160 quanities, but only contains 20 12-bit ADCs. Thus the values to read or monitor are organized into eight groups of 20 different sensors per group. When requested, an entire group is digitized and values read into the 3 PDU environment registers. The sensor values within a group are referenced according to ADC banks 0 - 19 consecutively in the environment registers. Thus the value for a particular sensor is identified by its group and ADC bank number (e.g. +Y\_\-VCHP\_\-DSHP\_\-INTF \_\-T\_\-1 is group 5 and ADC bank 7). Futhermore, the temperature sensors required for LTC are scattered among all eight groups as defined by tables in the PDU document. The environment registers are 96 bits (3 unsigned ints) wide. Environment registers 0 contains 7 values (ADC Banks 0 - 6), register 1 contains 7 values (ADC Banks 7 - 13) and register 2 contains 6 values (ADC Banks 14 - 19).

The pduTable defined below is orgnized by group and defines for each group the ADC bank numbers for temperature sensors values required by LTC from the given group. This table also associates each measurement with a particular heat pipe and measurement type (RIT or Reservoir).

Once each LTC cycle, the PDU is commanded via the Monitor Register to digitize all the eight groups - one at a time. For each group, the group number is written to the PDU monitor register, and after a delay ($\sim$140 usecs) the 3 environment registers are read into the pduReg array. The PDU commanding is accomplished using LCB command and response lists that are precomputed at initialization and submitted each LTC cycle. The temperature sensor values used by LTC are extracted from the register array and stored into the heat pipe variables for used by the LTC control algorithm.

Temperature sensors are connected (hardware wise) with heat pipes. Each heat pipe has a primary and redundant reservoir heater, and a primary and redundant DSHP and XLHP sensors. The control algorithm uses a reservoir and RIT temperature for each heat pipe. Anyone of the primary and redundant DSHP and XLHP sensors may be selected for the RIT temperature of a heat pipe, and any primary or redundant reservoir heater sensor may be selected for the reservoir tempearture of a heat pipe. Sensors may be mapped via the HP Configuration File to a different heat pipe then their hardware connection. A sensor is defined by its connected heat pipe and sensor type (DSHP, DSHP Redundant, XLHP, XLHP Redundant, primary reservoir heater and redundant reservoir heater. The mapping of sensors is defined in the HP Configuration File, and is stored in the ritSel and resSel variables of the structure for each heat pipe. 

\subsection{Function Documentation}
\hypertarget{ltc_8h_52eeae04cdc77cd8a03e3ec4cfde2af8}{
\index{ltc.h@{ltc.h}!LTC_GetConfigFile@{LTC\_\-GetConfigFile}}
\index{LTC_GetConfigFile@{LTC\_\-GetConfigFile}!ltc.h@{ltc.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int LTC\_\-GetConfigFile (unsigned int $\ast$ {\em fid})}}
\label{ltc_8h_52eeae04cdc77cd8a03e3ec4cfde2af8}


Get LTC configuration file ID. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em fid}]Stores LTC master FOF file ID on return. \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]LTC MSG code.\end{description}
\end{Desc}
Get the file ID value of the LTC master configuration file-of-files (FOF) which is currently in use. A value of '0' means that the built-in configuration is being used. \hypertarget{ltc_8h_f8bbce555ca5c41411680d32b9e337f8}{
\index{ltc.h@{ltc.h}!LTC_GetTlm@{LTC\_\-GetTlm}}
\index{LTC_GetTlm@{LTC\_\-GetTlm}!ltc.h@{ltc.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int LTC\_\-GetTlm ({\bf LTC\_\-DiagLTC\_\-Tlm} $\ast$ {\em tt})}}
\label{ltc_8h_f8bbce555ca5c41411680d32b9e337f8}


Retreive telemetry data. 

Get LTC telemetry values.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em tt}]- Pointer to telemetry structure \end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em An}]LTC MSG code $\backslash$ $\backslash$ Telemetry block contents: $\backslash$ $\backslash$ Bytes Off Name Contents $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 24 $|$ 0 $|$ snsrSel $|$ Per HP, selected RIT and RES sensors. For each $|$ $\backslash$ $|$ $|$ $|$ $|$ sensor the connected HP and sensor type is given.$|$ $\backslash$ $|$ $|$ $|$ $|$ 2 bytes per heat pipe, one byte per sensor: $|$ $\backslash$ $|$ $|$ $|$ $|$ 4-bits for HP \# and 4-bits for type (DSHP, $|$ $\backslash$ $|$ $|$ $|$ $|$ DSHP\_\-R, XLHP, XLHP\_\-R, RSVR, and RSVR\_\-R) $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 12 $|$ 24 $|$ snsrStat $|$ Per HP, input sensor status. $|$ $\backslash$ $|$ $|$ $|$ $|$ RIT/RES 4 bits each, 0-NOT\_\-READ, 1-READ\_\-GOOD $|$ $\backslash$ $|$ $|$ $|$ $|$ 2-READ\_\-BAD, 3-BROKEN. One byte pad added. $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 2 $|$ 36 $|$ actvHp $|$ Per HP, 1-active, 0-not active (ON or OFF) $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 144 $|$ 38 $|$ rawAdc $|$ Per each of 72 possible primary and redundant $|$ $\backslash$ $|$ $|$ $|$ $|$ sensors, raw ADC values (12 bits) and (4 bits) $|$ $\backslash$ $|$ $|$ $|$ $|$ read status. Ordered by HP, i.e. 6 for HP0, 6 $|$ $\backslash$ $|$ $|$ $|$ $|$ for HP1,...,6 for HP11. $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 48 $|$ 182 $|$ temps $|$ Per each HP, temperature values input to control $|$ $\backslash$ $|$ $|$ $|$ $|$ Smoothed and converted to celsius for RIT and $|$ $\backslash$ $|$ $|$ $|$ $|$ RES. Fixed point scaled values. First 12 are $|$ $\backslash$ $|$ $|$ $|$ $|$ for RIT and 2nd 12 for RES. $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 24 $|$ 230 $|$ ritLo $|$ Low limit for RIT sensors, heat pipes 0 - 11 $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 24 $|$ 254 $|$ ritHi $|$ High limit for RIT sensors, heat pipes 0 - 11 $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 24 $|$ 278 $|$ resLo $|$ Low limit for reservoir sensors, HPs 0 - 11 $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 24 $|$ 302 $|$ resHi $|$ High limit for reservoir sensors, HPs 0 - 11 $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 24 $|$ 326 $|$ dbDelta $|$ Deadband delta limit, HPs 0 - 11 $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 2 $|$ 350 $|$ htrCmd $|$ Bit for each HP reservoir heater command, 1 is $|$ $\backslash$ $|$ $|$ $|$ $|$ command to on and 0 commanded to off. The upper $|$ $\backslash$ $|$ $|$ $|$ $|$ bit (2$\ast$$\ast$15) indicates commanding mode: 1 is $|$ $\backslash$ $|$ $|$ $|$ $|$ actively sending commands to heaters, and 0 is $|$ $\backslash$ $|$ $|$ $|$ $|$ calculating commands but not sending to heaters. $|$ $\backslash$ $|$------$|$-----$|$-------------$|$--------------------------------------------------$|$ $\backslash$ $|$ 2 $|$ 352 $|$ htrReg $|$ Bit for each SIB control heater bit, 1 is $|$ $\backslash$ $|$ $|$ $|$ $|$ commanded on and 0 commanded off. The upper $|$ $\backslash$ $|$ $|$ $|$ $|$ bit (2$\ast$$\ast$15) indicates LTC run mode: 1 is running $|$ $\backslash$ $|$ $|$ $|$ $|$ and 0 is stopped. $|$ $\backslash$ $|$-----------------------------------------------------------------------------$|$ $\backslash$ $|$-----------------------------------------------------------------------------$|$ $\backslash$ $|$ 354 $|$ TOTAL BYTES $|$ $|$ $\backslash$ `-----------------------------------------------------------------------------' $\backslash$ \end{description}
\end{Desc}
\hypertarget{ltc_8h_4be1d663f489cf24166b60594179f09b}{
\index{ltc.h@{ltc.h}!LTC_initialize@{LTC\_\-initialize}}
\index{LTC_initialize@{LTC\_\-initialize}!ltc.h@{ltc.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int LTC\_\-initialize (void)}}
\label{ltc_8h_4be1d663f489cf24166b60594179f09b}


Initializes and configures thermal control software. 

LTC initialization using LTC\_\-DB lookup.

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]LTC MSG code. \end{description}
\end{Desc}
\hypertarget{ltc_8h_2827bb147efc162df8fbc896448f2dac}{
\index{ltc.h@{ltc.h}!LTC_shutdown@{LTC\_\-shutdown}}
\index{LTC_shutdown@{LTC\_\-shutdown}!ltc.h@{ltc.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int LTC\_\-shutdown (void)}}
\label{ltc_8h_2827bb147efc162df8fbc896448f2dac}


Release resources associated with LTC. 

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]LTC MSG code \end{description}
\end{Desc}
\hypertarget{ltc_8h_d57add660dbed4e5227115db65e58524}{
\index{ltc.h@{ltc.h}!LTC_StartTask@{LTC\_\-StartTask}}
\index{LTC_StartTask@{LTC\_\-StartTask}!ltc.h@{ltc.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int LTC\_\-StartTask (void)}}
\label{ltc_8h_d57add660dbed4e5227115db65e58524}


Start Thermal Control processing. 

Start LTC Control Task.

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]LTC MSG code.\end{description}
\end{Desc}
Start LTC thermal control task and telecommand processing (ITC task). \hypertarget{ltc_8h_23cdf08e50f35c0fa666ef876becf653}{
\index{ltc.h@{ltc.h}!LTC_StopTask@{LTC\_\-StopTask}}
\index{LTC_StopTask@{LTC\_\-StopTask}!ltc.h@{ltc.h}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}unsigned int LTC\_\-StopTask (void)}}
\label{ltc_8h_23cdf08e50f35c0fa666ef876becf653}


Stop Thermal Control processing. 

Stop LTC Control Task.

\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em A}]LTC MSG code.\end{description}
\end{Desc}
Stop LTC thermal control task and telecommand processing (ITC task). 