GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> LTC / dev > ltct / rad750


Interface   Data Structures   File List   Data Fields   Globals  

LTC_ltc.c File Reference

Thermal Control readout and control algorithm functions. More...

#include <LTC/LTC_msgs.h>
#include <ltcPrivate.h>
#include <CCSDS/CCSDS_pkt.h>
#include <LEM/defs.h>
#include <LEM/encode.h>
#include <LEM/encode_structs.h>
#include <LEM/decode.h>
#include <IMM/FPM_pubdefs.h>
#include <ITC/ITC_pubdefs.h>
#include <LCBD/LCBD.h>
#include <MSG/MSG_pubdefs.h>
#include <PBS/FPA.h>
#include <PBS/WUT.h>
#include <PBS/TOV.h>
#include <PBS/TOC.h>
#include <string.h>
#include <stdlib.h>

Functions

static unsigned int LTC_LcbRspCB (LTC_Wrk *tw, LCBD_xcb *xcb)
 LCB callback to process responses from reads of PDU registers.
static void LTC_freeCmd (ITC_QueueItem *qitem, unsigned int status, LTC_Wrk *tw, void *prm1, void *prm2)
static void LTC_freePdu (ITC_QueueItem *qitem, unsigned int status, LTC_Wrk *tw, void *prm1, void *prm2)
static void LTC_freeTelem (ITC_QueueItem *qitem, unsigned int status, LTC_Wrk *tw, void *prm1, void *prm2)
static unsigned int LTC_CnvSmthSnsrs (LTC_Wrk *tw, LTC_HeatPipe *hp, LTC_SnsrType sTyp)
 Converts sensor values to smoothed temperature for a heat pipe.
static int LTC_IsGoodTemps (const LTC_HeatPipe *hp)
 Check goodness of collected temperature values for this heat pipe.
static void LTC_CalcHtrOnOff (LTC_Wrk *tw, const int h)
 Calculate on or off commands for a HP reservoir heater.
static signed int LTC_EstTmp (const LTC_Temperature *tmp)
 Estimates temperature for next cycle.
static signed int LTC_Smooth (LTC_Temperature *tmp)
 Returns smoothed value for temperature.
static void LTC_CnvAdcToTmp (LTC_Sensor *snsr, LTC_Temperature *tmp)
 Converts sensor values to temperature for given heat pipe.
unsigned short GetADCBits (const unsigned int *pduR, const int adc)
 Get 12-bit ADC values from PDU register given ADC number.
static void LTC_CmdHtrs (LTC_Wrk *ltcW)
 Issue "on" or off commands to HP reservoir heaters.
static void LTC_SndTlm (LTC_Wrk *tw)
 Collect, format and send telemetry for LTC.
unsigned int LTC_ProcPduRsp (LTC_Wrk *tw, LTC_CntlProc_Prm *rb, const LTC_rl *rl)
 Callback to process responses from asynchrous reads of PDU registers.
void LTC_ReadSensors (LTC_Wrk *tw)
 Start cycle of LTC control - issue LCB commands.
WUT_cb_status LTC_WkUp (void *p, WUT_tmr *wut)
 Wake up LTC for another processing cycle and restart wake timer.


Detailed Description

Thermal Control readout and control algorithm functions.


Function Documentation

unsigned short GetADCBits ( const unsigned int *  pduR,
const int  adc 
)

Get 12-bit ADC values from PDU register given ADC number.

Parameters:
pduR - PDU register bits (96 bits or 3 x 32)
adc - adc number relative to this register (0 - 7) Byte Offsets 0 1 2 3 4 5 6 7 8 9 0 11 12
8-----8-----8-----8-----8-----8-----8-----8-----8-----8-----8-----8-----8 | | | | | | | | | | | | | | | | | | | | | | | | | --mbz-^-m^----6---^----5---^----4---^---3----^---2----^---1----^----0---- ADC Numbers Byte ADC# OffSet Operation ---- ------ --------- 6 1 0xFFF 5 3 >>4 4 4 0xFFF 3 6 >>4 2 7 0xFFF 1 9 >>4 0 10 0xFFF

Referenced by LTC_ProcPduRsp().

static void LTC_CalcHtrOnOff ( LTC_Wrk tw,
const int  h 
) [static]

Calculate on or off commands for a HP reservoir heater.

Parameters:
tw - LTC working storage.
h - Heat pipe index.

References LTC_Temperature::celsius, LTC_Cntrl::cmd, LTC_Options::cntrlMode, LTC_Options::fail, _LTC_Wrk::htP, LTC_ALWAYS_ON, LTC_AUTO, LTC_IsGoodTemps(), _LTC_Wrk::ltcCntrl, LTC_HeatPipe::opts, LTC_HeatPipe::param, PRINTF, RES_TMP, RIT_TMP, LTC_HeatPipe::temp, and TSCLF.

Referenced by LTC_ProcPduRsp().

static void LTC_CmdHtrs ( LTC_Wrk ltcW  )  [static]

Issue "on" or off commands to HP reservoir heaters.

Parameters:
ltcW - LTC working storage.

References LTC_Cntrl::cmd, _LTC_Wrk::HtrCntrlRg, _LTC_Wrk::HtrWDogRg, _LTC_Wrk::ltcCntrl, and PRINTF.

Referenced by LTC_ProcPduRsp().

void LTC_CnvAdcToTmp ( LTC_Sensor snsr,
LTC_Temperature tmp 
) [static]

Converts sensor values to temperature for given heat pipe.

Parameters:
snsr - Heat pipe sensor record.
tmp - Heat pipe temperature. A consistency check is made that the sensor value has not exceeded the maximum change limit in one LTC interval.

References LTC_Sensor::bdRd, BROKEN, LTC_Temperature::celsius, LTC_Sensor::cnt, LTC_Temperature::cnv, LTC_Temperature::est, LTC_Temperature::estTol, LTC_Sensor::failLimit, LTC_Filter::fdf, LTC_FltDf::fln, LTC_Temperature::flt, LTC_Filter::nv, PRINTF, READ_BAD, READ_GOOD, LTC_Sensor::stat, TSCLF, and LTC_Sensor::tTyp.

Referenced by LTC_CnvSmthSnsrs().

unsigned int LTC_CnvSmthSnsrs ( LTC_Wrk tw,
LTC_HeatPipe hp,
LTC_SnsrType  sTyp 
) [static]

Converts sensor values to smoothed temperature for a heat pipe.

Parameters:
tw - LTC working storage.
hp - Heat pipe record to get smoothed celsius temperature.
sTyp - Sensor type.
Return values:
A LTC MSG code.
The sensor defintion in snsr provides the hp and sensor type which specifies the sensor per the hardware configuration as given in the Sensor Definition File. The final converted and smoothed tempeature is stored in the the temp array pointed to by hp. The temp array contains the RIT and reservoir tempeatures that feed the control algorithm.

References LTC_Temperature::celsius, LTC_Temperature::est, LTC_CnvAdcToTmp(), LTC_EstTmp(), LTC_Smooth(), PRINTF, LTC_HeatPipe::snsr, LTC_HeatPipe::temp, TSCLF, and LTC_Sensor::tTyp.

Referenced by LTC_ProcPduRsp().

signed int LTC_EstTmp ( const LTC_Temperature tmp  )  [static]

Estimates temperature for next cycle.

Parameters:
tmp - Heat pipe temperature structure. Estimates temperature for next cycle using last good raw temperature.

References LTC_Temperature::flt, and LTC_Filter::zn.

Referenced by LTC_CnvSmthSnsrs().

static void LTC_freeCmd ( ITC_QueueItem *  qitem,
unsigned int  status,
LTC_Wrk tw,
void *  prm1,
void *  prm2 
) [static]

Free memory after sending ITC command packets.

Parameters:
qitem The memory buffer.
status Status of telemetry.
tw LTC control structure.
prm1 Completion callback paramter 1.
prm2 Completion callback paramter 2.

References _LTC_Wrk::cmdPool.

static void LTC_freePdu ( ITC_QueueItem *  qitem,
unsigned int  status,
LTC_Wrk tw,
void *  prm1,
void *  prm2 
) [static]

Free memory after receiving PDU response packet.

Parameters:
qitem The memory buffer.
status Status of telemetry.
tw LTC control structure.
prm1 Completion callback paramter 1.
prm2 Completion callback paramter 2.

References _LTC_Wrk::pduPool.

Referenced by LTC_ReadSensors().

static void LTC_freeTelem ( ITC_QueueItem *  qitem,
unsigned int  status,
LTC_Wrk tw,
void *  prm1,
void *  prm2 
) [static]

Free memory after sending ITC telemetry packets.

Parameters:
qitem The memory buffer.
status Status of telemetry.
tw LTC control structure.
prm1 Completion callback paramter 1.
prm2 Completion callback paramter 2.

References _LTC_Wrk::tlmPool.

Referenced by LTC_SndTlm().

static int LTC_IsGoodTemps ( const LTC_HeatPipe hp  )  [static]

Check goodness of collected temperature values for this heat pipe.

Parameters:
hp - Heat pipe data structure.
The smoothing filters for the RIT and reservoir temperature sensors may not have enough back values so the temperature readings will be noisy, and not suitable for commanding the heaters. The length of filters may be (probably not) different for each sensor type (RIT or reservoir) and heat pipe.

References BROKEN, LTC_Filter::fdf, LTC_FltDf::fln, LTC_Temperature::flt, LTC_Filter::nv, LTC_HeatPipe::opts, PRINTF, RES_TMP, LTC_Options::resSel, RIT_TMP, LTC_Options::ritSel, LTC_HeatPipe::snsr, LTC_Sensor::stat, and LTC_HeatPipe::temp.

Referenced by LTC_CalcHtrOnOff().

static unsigned int LTC_LcbRspCB ( LTC_Wrk tw,
LCBD_xcb *  xcb 
) [static]

LCB callback to process responses from reads of PDU registers.

Parameters:
tw - LTC working storage.
xcb - LCBD control block.
Return values:
'0'. 

References _LTC_Wrk::cmdHdrSize, _LTC_Wrk::itcHdrSize, MSG_SIGNAL, and _LTC_Wrk::pduPool.

Referenced by LTC_ReadSensors().

unsigned int LTC_ProcPduRsp ( LTC_Wrk tw,
LTC_CntlProc_Prm rb,
const LTC_rl rl 
)

Callback to process responses from asynchrous reads of PDU registers.

Parameters:
tw - LTC working storage.
rb - Response processing block.
rl - A pointer to the LTC PDU response data.
Return values:
A LTC MSG code.

References _LTC_Wrk::cmdMode, LTC_Sensor::cnt, GetADCBits(), _LTC_CntlProc_Prm::grp, _LTC_Wrk::htP, _LTC_Wrk::lastClNum, LTC_ACTIVE, LTC_CalcHtrOnOff(), LTC_CmdHtrs(), LTC_CnvSmthSnsrs(), LTC_NO, LTC_SndTlm(), LTC_YES, _LTC_CntlProc_Prm::mr, _LTC_CntlProc_Prm::ncl, _LTC_CntlProc_Prm::pdu, _LTC_Wrk::pduReg, _LTC_Wrk::pduTbl, PRINTF, _LTC_rl::rd_rsp, READ_BAD, READ_GOOD, LTC_HeatPipe::snsr, _LTC_Wrk::tlmCnt, and _LTC_Wrk::tlmFreq.

Referenced by LTC_CntlProc().

void LTC_ReadSensors ( LTC_Wrk tw  ) 

Start cycle of LTC control - issue LCB commands.

Queue-up commands (LCBD command list) to read sensors from actvie PDUs.

Parameters:
tw - LTC working storage
The command lists are already built (LTC_InitIO) during initialization. This logic sends each command list to the LCB queue were they are executed. As responses are generated, the callback LTC_LcbRspCB is executed which in turn executes LTC_ProcPduRsp to process the sensor data.

References _LTC_Wrk::cl, _LTC_Wrk::cmdHdrSize, _LTC_CntlProc_Prm::grp, _LTC_Wrk::htP, _LTC_Wrk::itcHdrSize, _LTC_Wrk::lcb, LTC_CNTLPROC_FCODE, LTC_freePdu(), LTC_INTERNAL_CMD_APID, LTC_LcbRspCB(), LTC_NUM_HPs, LTC_PDU_GRPS, LTC_PDUs, LTC_SNSR_TYPS, _LTC_CntlProc_Prm::mr, MSG_SIGNAL, _LTC_CntlProc_Prm::ncl, NOT_READ, _LTC_CntlProc_Prm::pdu, _LTC_Wrk::pdu, _LTC_Wrk::pduPool, _LTC_Wrk::pduReg, _LTC_Wrk::pduTbl, PRINTF, LTC_HeatPipe::snsr, and LTC_Sensor::stat.

Referenced by LTC_CntlStart().

static void LTC_Smooth ( LTC_Temperature tmp  )  [static]

Returns smoothed value for temperature.

Parameters:
tmp - Temperature record for heat pipe.

References LTC_Temperature::celsius, LTC_FltDf::cf, CFSCL, LTC_Filter::fdf, LTC_FltDf::fln, LTC_Temperature::flt, LTC_Filter::nv, and LTC_Filter::zn.

Referenced by LTC_CnvSmthSnsrs().

static void LTC_SndTlm ( LTC_Wrk tw  )  [static]

Collect, format and send telemetry for LTC.

Parameters:
tw - LTC working storage.

References _LTC_Wrk::itcHdrSize, LTC_DIAGLTC_TLM_APID, LTC_freeTelem(), LTC_GetTlm(), MSG_SIGNAL, _LTC_Wrk::tlmHdrSize, and _LTC_Wrk::tlmPool.

Referenced by LTC_ProcPduRsp().

WUT_cb_status LTC_WkUp ( void *  p,
WUT_tmr *  wut 
)

Wake up LTC for another processing cycle and restart wake timer.

Parameters:
p - LTC Working storage.
wut - LTC wake up timer.

References _LTC_Wrk::cmdHdrSize, _LTC_Wrk::cmdPool, _LTC_Wrk::itcHdrSize, LTC_CNTLSTART_FCODE, LTC_freeCmd(), LTC_INTERNAL_CMD_APID, MSG_SIGNAL, PRINTF, _LTC_CntlStart_Prm::spare, and _LTC_Wrk::wutNSecs.

Referenced by LTC_StartTask().


Generated on Mon Mar 28 15:07:40 2011 by  doxygen 1.5.8