$RCSfile: L1CrisProcessing,v $ $Author: rgr $ $Date: 1997/05/08 13:02:06 $ $Revision: 1.2 $ Description of CRIS Level-One Processing The purpose of this document is to describe the processing that occurs on the CRIS data during the level-one processing at the ACE Science Center (ASC). I. Overview of ASC Instrument Level-One Processing The data that is the starting point of the level-one processing has the following characteristics: 1. The data consists of a single stream in chronological (S/C clock) order. The raw S/C data can reach the Mission Operation Center (MOC) and eventually the ASC by several paths. The level-zero processing merges the different paths into a single stream and inserts fill data in places where there is missing data. 2. Each S/C minor frame has associated with it a one-bit quality flag. The quality indicates whether the level-zero processing encountered uncorrectable errors in processing the data for that minor frame. If uncorrectable errors are encountered, the level-zero processing removes the minor frame and inserts fill data. 3. The data stream is expected to contain few dropouts, and the dropouts that occur are expected to cluster during time intervals when receiving conditions are poor. The level-one processing of instrument data is performed inside a loop that calls four C functions per instrument for each S/C minor frame. The four functions associated with CRIS are 1. accum_cris_level1, 2. accum_cris_browse, 3. output_cris_level1, 4. output_cris_browse. From the names, it is obvious that accum_cris_level1 and output_cris_level1 are associated with the generation and output of CRIS level-one data. The other functions are associated with the generation and output of browse data and will not be discussed in this document. The function, output_cris_level1, directly controls the structure and content of the CRIS data that is written to the level-one data set which will be distributed to the instrument teams. It has only indirect control of the format of the data written to the CDROM. The format is controlled by the eight functions 1. write_cris_subset, 2. write_cris_hskp, 3. write_cris_command_table, 4. write_cris_low_priority_rate, 5. write_cris_high_priority_rate, 6. write_cris_event, 7. write_cris_command_echo, 8. write_cris_diag_event. Each of the above write functions is written by a PERL script that is furnished by the ASC. The PERL script takes as input the definition of a C data structure and generates a write function with embedded HDF calls. When that PERL-generated write function is called it writes the data to the level-one data set. The ASC will furnish the inverse read functions that will allow the user to recover the original C data structure from the level-one HDF data set. In addition to the instrument data, the level-one product includes S/C housekeeping data. The ASC will furnish functions that given the level-one S/C housekeeping structure, the functions will return the attitude and postion of the S/C. Also the ASC will furnish a function that converts the S/C clock to utc. II. Overview of CRIS Telemtry CRIS operates on a 256 instrument minor frame cycle. During each instrument cycle, CRIS has a sync bit which remains low for the first 128 instrument minor frames and high for the next 128 instrument minor frames. During each instrument cycle, CRIS samples each housekeeping parameter once, each low priority rate once, and each high priority rate sixteen times. CRIS during its normal processing, outputs a collection of compressed events during the instrument cycle. In general, the compressed events will span instrument minor frame boundaries, but during periods of normal processing will not span instrument cycle boundaries. CRIS contains an 844 byte command table which defines the instrument status. During each instrument cycle, 66 bytes of the command table is readout as part of the housekeeping data. It takes about 13 instrument cycles to readout the entire table. When CRIS receives a command, it puts a command response in its telemetry. In general, command response spans minor frames and can span cycle boundaries. Finally, CRIS can be put into a diagnostic mode. During diagnostic mode, CRIS suspends putting compressed events into its telemetry stream, and substitutes diagnostic event data. The housekeeping/rate and command responses are uneffected. The most important point from the above discussion is that CRIS produces seven different types of data plus the raw telemetry which is captured in the subset data type. The CRIS level one processing reflects this data organization. III. S/C Minor Frames and Instrument Minor Frames The ACE S/C produces one minor frame of data per second. Within each S/C minor frame there is a 58 byte allocation for CRIS data. CRIS produces one 58 byte instrument minor frame per second. CRIS uses its 58 byte allocation in the S/C minor frame to output the last four bytes of the previous instrument minor frame and the first 54 bytes of the current instrument minor frame. The ACE S/C maintains a major frame counter and a minor frame counter. The S/C housekeeping data is tied to these counters, and most instruments' telemetry are also tied to the S/C minor and major frame counters. CRIS does not use these counters. IV. Overview of CRIS Level-One Processing The CRIS level-one processing parses the natural occuring data structures from the raw CRIS data. Each data structure which is built contains a S/C clock time tag that allows the data to be traced to the original S/C minor frame and to correlate it with other data. The data inside the structures is left in raw units, i.e. ADC values, PHA value, and counts. The details of each structure is covered in the next section. The level-one processing is done on an instrument cycle basis. In other words, 256 instrument minor frames are processed at a time. The criteria used to determine whether a block of 258 minor frames contains a valid instrument cycle is the following: 1. There must be at least one minor frame in the block that precedes the instrument cycle. It may contain fill data. 2. There must be at least one minor frame in the block that follows the instrument cycle. It may contain fill data. 3. All the minor frames that contain sync transition bits must have the correct sync bit, clock, and minor and major frame counters. 4. At least four of the six minor frames that should contain sync transition bits must be present. 5. The total number of minor frames that have the wrong sync bit or clock or major frame counter or minor frame counter must be less than 4. 6. The total number of frames that have the correct sync bit, clock, major frame counter, and minor frame counter must be at least equal to the number of minor frames in an instrument cycle minus six. If the block passes the test, then the data is processed and put in the appropriate data structure. If the block fails, the following happens: 1. the oldest S/C minor frame is removed from the block, 2. another S/C minor frame is added to the end of the block, 3. the block is retested using the above criteria. In the level-one processing, there is an event recovery algorithm that is used to recover most events from an instrument cycle that has missing minor frames or bit errors. In the CRIS telemetry, the length of each event is encoded in the first byte of the event. Once the beginning of an event is found, the beginning of the next event can be found by using the length of the found event to compute the location of the next event. If an instrument cycle has a missing minor frame or a bit error in the wrong place, this chain of finding events is broken. The level-one processing recovers most of the remaining events in the instrument cycle by exploiting the redundant information stored in the event. In an event, not only is the total of length of the event stored in the event, but the length of the components of the event are stored. When the chain of events is broken, the level-one processing finds the other end of the chain by assuming that the first byte after the break is the first byte of the next event. Since the first byte contains the length of the event and the lengths of the components of the events are in fixed locations relative to the start of an event, the "candidate" event can be tested for a self-consistent length. If the "candidate" event passes, the algorithm then uses the length of the "candidate" event to find the next "candidate" event. If a chain of three self-consistent "candidate" events are found, then the algorithm decides it has found the other side of the chain. If a chain of three self-consistent "candidate" events is not found with the first byte after the break, then each successive byte is tested until a chain of three self- consistent "candidate" events is found or the end of the cycle is encountered. V. CRIS Level One Data Structures For each of the write functions mentioned in section I of this document, there is a corresponding data structure which will be written to the level-one data set using HDF functions. The purpose of this section is to define these data structures and provide some explanation for their existence and form. Each subsection will begin with the actual C structure followed by a brief explanation. The C structures use the symbolic constants defined below. #define MAX_CRIS_EVT_AGE 64 #define MAX_NUM_CRIS_CMD_ECHO_CHARS 54 #define MAX_NUM_CRIS_NORMAL_EVT_BYTES 166 #define NUM_CRIS_EVT_BUFFERS 64 #define NUM_CRIS_EVT_BUFFER_BYTES 14848 #define NUM_CRIS_HIGH_PRIORITY_RATES 2 #define NUM_CRIS_RAW_STACK_EVT_BYTES 72 #define NUM_CRIS_SOFT_EVT_BYTES 2000 #define NUM_CRIS_TELEMETRY_BYTES 58 A. CRIS Subset Structure struct L1CrisSubset { uint32 ClockMinorFramePre; uint32 ClockMinorFrame; uint8 FormatIdPre; uint8 FormatId; uint8 MajorFrameCountPre; uint8 MajorFrameCount; uint8 MinorFrameCountPre; uint8 MinorFrameCount; uint8 QualityPre; uint8 quality; uint8 MainBusVoltagePre; uint8 MainBusVoltage; uint8 CrisCurrentPre; uint8 CrisCurrent; uint8 CrisInternalTemperature1Pre; uint8 CrisInternalTemperature1; uint8 CrisInternalTemperature2Pre; uint8 CrisInternalTemperature2; uint8 CrisInterfaceTemperaturePre; uint8 CrisInterfaceTemperature; uint8 CrisData[NUM_CRIS_TELEMETRY_BYTES]; }; /* Definition: */ /* ClockMinorFramePre = S/C clock of the minor frame(preliminary) */ /* ClockMinorFrame = S/C clock of the minor frame */ /* FormatIdPre = Format of the minor frame(preliminary) */ /* FormatId = Format of the minor frame */ /* MajorFrameCountPre = Major frame count of the minor */ /* frame(preliminary) */ /* MajorFrameCount = Major frame count of the minor frame */ /* MinorFrameCountPre = Minor frame count of the minor */ /* frame(preliminary) */ /* MinorFrameCount = Minor frame count of the minor frame */ /* QualityPre = Quality flag associated with the minor */ /* quality = Quality flag associated with the minor frame */ /* MainBusVoltagePre = Main bus voltage value(preliminary) */ /* MainBusVoltage = Main bus voltage value (255=no data) */ /* CrisCurrentPre = CRIS I/F & survial heater current */ /* (preliminary) */ /* CrisCurrent = CRIS I/F & survial heater current (255=no data) */ /* CrisInternalTemperature1Pre = CRIS internal temperature 1 */ /* (preliminary) */ /* CrisInternalTemperature1 = CRIS internal temperature 1 */ /* (255=no data) */ /* CrisInternalTemperature2Pre = CRIS internal temperature 2 */ /* (preliminary) */ /* CrisInternalTemperature2 = CRIS internal temperature 2 */ /* (255=no data) */ /* CrisInterfaceTemperaturePre = CRIS interface temperature */ /* (preliminary) */ /* CrisData = CRIS data */ The structure has a dual purpose. It is used to capture the raw CRIS telemetry, and it is also used to capture the CRIS-specific S/C housekeeping. The Ace Science Center is discouraging the storing of raw telemetry in the level-one product. So this structure may be modified to hold only the CRIS-specific S/C housekeeping. When the S/C is in ADC mode, a complete set of S/C housekeeping comes out in every S/C minor frame. When the S/C is in science mode, the S/C housekeeping set is transmitted over a S/C major frame. Therefore, different S/C housekeeping variables appear in each minor frame. In the other full collection S/C formats, the housekeeping is not present. The level-one processing looks at the S/C format, the minor frame counter, the quality flag, and the preliminary housekeeping values to determine the S/C variables present and the value that should be put in the fields for the CRIS-specific S/C housekeeping variables. B. Housekeeping Structure struct L1CrisHskp { uint32 ClockCycle; uint16 MonitorP7V; uint16 MonitorP15V; uint16 MonitorP19V; uint16 MonitorP13V; uint16 MonitorM13V; uint16 MonitorP5V; uint16 MonitorP6V; uint16 MonitorM6V; uint16 MonitorP12V; uint16 MonitorM12V; uint16 MonitorM7V; uint16 MonitorMcp1; uint16 MonitorMcp2; uint16 MonitorHvps1I; uint16 MonitorHvps2I; uint16 MonitorHvps3I; uint16 MonitorHvps4I; uint16 MonitorSoftPsaI; uint16 MonitorSoftPsbI; uint16 PostDcE1a; uint16 PostDcE1b; uint16 PostDcE2ab; uint16 PostDcE3ab; uint16 PostDcE4ab; uint16 PostDcE5ab; uint16 PostDcE6ab; uint16 PostDcE7ab; uint16 PostDcE8ab; uint16 PostDcE9ab; uint16 PostDcG2ab; uint16 PostDcG3ab; uint16 PostDcG4ab; uint16 PostDcG5ab; uint16 PostDcG6ab; uint16 PostDcG7ab; uint16 PostDcE1c; uint16 PostDcE1d; uint16 PostDcE2cd; uint16 PostDcE3cd; uint16 PostDcE4cd; uint16 PostDcE5cd; uint16 PostDcE6cd; uint16 PostDcE7cd; uint16 PostDcE8cd; uint16 PostDcE9cd; uint16 PostDcG2cd; uint16 PostDcG3cd; uint16 PostDcG4cd; uint16 PostDcG5cd; uint16 PostDcG6cd; uint16 PostDcG7cd; uint8 DacG2ab; uint8 DacG3ab; uint8 DacG4ab; uint8 DacG5ab; uint8 DacG6ab; uint8 DacG7ab; uint8 DacE9ab; uint8 DacG2cd; uint8 DacG3cd; uint8 DacG4cd; uint8 DacG5cd; uint8 DacG6cd; uint8 DacG7cd; uint8 DacE9cd; uint16 TemperatureMotherBoardDet; uint16 TemperatureE12Det; uint16 TemperatureE12Elect; uint16 TemperatureE34Elect; uint16 TemperatureE34Det; uint16 TemperatureE56Elect; uint16 TemperatureE56Det; uint16 TemperatureE789Elect; uint16 TemperatureE789Det; uint16 TemperatureLvps; uint16 TemperatureHvps; uint16 TemperatureAnalogBoard; uint16 TemperaturePostRegBoard; uint16 TemperatureMotherBoardC; uint16 TemperatureMotherBoardElect; uint16 TemperatureLogicBoard; uint16 TemperatureFiberPlaneTop0; uint16 TemperatureFiberPlaneTop1; uint16 TemperatureFiberPlaneMid; uint16 TemperatureFiberPlaneBot; uint16 TemperatureImageInt1Side; uint16 TemperatureImageInt2Side; uint16 TemperatureImageInt1Rear; uint16 TemperatureCamera1Elect; uint16 TemperatureHvps1; uint16 TemperatureImageInt2Rear; uint16 TemperatureCamera2Elect; uint16 TemperatureHvps2; uint8 HeaterCcdA; uint8 HeaterCcdB; uint8 HeaderCris; uint8 StatusTmSide; uint8 StatusRefresh; uint8 QualityMonitorP7V; uint8 QualityMonitorP15V; uint8 QualityMonitorP19V; uint8 QualityMonitorP13V; uint8 QualityMonitorM13V; uint8 QualityMonitorP5V; uint8 QualityMonitorP6V; uint8 QualityMonitorM6V; uint8 QualityMonitorP12V; uint8 QualityMonitorM12V; uint8 QualityMonitorM7V; uint8 QualityMonitorMcp1; uint8 QualityMonitorMcp2; uint8 QualityMonitorHvps1I; uint8 QualityMonitorHvps2I; uint8 QualityMonitorHvps3I; uint8 QualityMonitorHvps4I; uint8 QualityMonitorSoftPsaI; uint8 QualityMonitorSoftPsbI; uint8 QualityPostDcE1a; uint8 QualityPostDcE1b; uint8 QualityPostDcE2ab; uint8 QualityPostDcE3ab; uint8 QualityPostDcE4ab; uint8 QualityPostDcE5ab; uint8 QualityPostDcE6ab; uint8 QualityPostDcE7ab; uint8 QualityPostDcE8ab; uint8 QualityPostDcE9ab; uint8 QualityPostDcG2ab; uint8 QualityPostDcG3ab; uint8 QualityPostDcG4ab; uint8 QualityPostDcG5ab; uint8 QualityPostDcG6ab; uint8 QualityPostDcG7ab; uint8 QualityPostDcE1c; uint8 QualityPostDcE1d; uint8 QualityPostDcE2cd; uint8 QualityPostDcE3cd; uint8 QualityPostDcE4cd; uint8 QualityPostDcE5cd; uint8 QualityPostDcE6cd; uint8 QualityPostDcE7cd; uint8 QualityPostDcE8cd; uint8 QualityPostDcE9cd; uint8 QualityPostDcG2cd; uint8 QualityPostDcG3cd; uint8 QualityPostDcG4cd; uint8 QualityPostDcG5cd; uint8 QualityPostDcG6cd; uint8 QualityPostDcG7cd; uint8 QualityDacG2ab; uint8 QualityDacG3ab; uint8 QualityDacG4ab; uint8 QualityDacG5ab; uint8 QualityDacG6ab; uint8 QualityDacG7ab; uint8 QualityDacE9ab; uint8 QualityDacG2cd; uint8 QualityDacG3cd; uint8 QualityDacG4cd; uint8 QualityDacG5cd; uint8 QualityDacG6cd; uint8 QualityDacG7cd; uint8 QualityDacE9cd; uint8 QualityTemperatureMotherBoardDet; uint8 QualityTemperatureE12Det; uint8 QualityTemperatureE12Elect; uint8 QualityTemperatureE34Elect; uint8 QualityTemperatureE34Det; uint8 QualityTemperatureE56Elect; uint8 QualityTemperatureE56Det; uint8 QualityTemperatureE789Elect; uint8 QualityTemperatureE789Det; uint8 QualityTemperatureLvps; uint8 QualityTemperatureHvps; uint8 QualityTemperatureAnalogBoard; uint8 QualityTemperaturePostRegBoard; uint8 QualityTemperatureMotherBoardC; uint8 QualityTemperatureMotherBoardElect; uint8 QualityTemperatureLogicBoard; uint8 QualityTemperatureFiberPlaneTop0; uint8 QualityTemperatureFiberPlaneTop1; uint8 QualityTemperatureFiberPlaneMid; uint8 QualityTemperatureFiberPlaneBot; uint8 QualityTemperatureImageInt1Side; uint8 QualityTemperatureImageInt2Side; uint8 QualityTemperatureImageInt1Rear; uint8 QualityTemperatureCamera1Elect; uint8 QualityTemperatureHvps1; uint8 QualityTemperatureImageInt2Rear; uint8 QualityTemperatureCamera2Elect; uint8 QualityTemperatureHvps2; uint8 QualityHeaterCcdA; uint8 QualityHeaterCcdB; uint8 QualityHeaderCris; uint8 QualityStatusTmSide; uint8 QualityStatusRefresh; }; /* Definition: */ /* ClockCycle = S/C clock of the first minor frame of the cycle */ /* */ /* Note: Quality bits are defined in the table below. If the field */ /* which the quality byte is trying to characterize contains */ /* multiple bytes, the quality byte associated with the field */ /* is the logical "or" of the individual quality bytes. */ /* */ /* Quality bits: */ /* 0x01 = Format ID error */ /* 0x02 = Minor/major counter error */ /* 0x04 = S/C clock error */ /* 0x08 = Sync bit error */ /* 0x10 = Command table index error */ /* 0x20 = Cycle number error */ /* 0x40 = Level 0 quality bit */ /* 0x80 = Level 1 quality bit */ In the CRIS telemetry stream, three bytes from each minor frame are used to output housekeeping and rate quantities. CRIS generates one set of housekeeping values per instrument cycle. Each housekeeping quantity is measured as it is being put into the telemetry stream. C. Command Table Structure struct L1CrisCommandTable { uint32 ClockMinorFrame0; uint32 ClockMinorFrame1; uint8 ecmd[6]; uint16 phadisc; uint16 audgflg; uint16 audglim; uint16 valcflg; uint16 samplim; uint16 heflg; uint16 hyflg; uint16 preoflg; uint16 hetlim; uint16 hytlim; uint8 htcmd[16]; uint16 rcmd; uint16 qctime; uint16 ledtime; uint16 sfmisc; uint16 camsel; uint16 iilima; uint16 iilimb; uint8 iilims[8]; uint8 lsarr[40]; uint8 loarr[40]; uint16 laymax; uint16 remmax; uint8 b_xoff[2]; uint16 rngmsk[2]; uint8 bparams[20]; uint16 twotelen; uint16 gphaen; uint16 stbfon; uint16 ncenbox; uint16 b_cenbox[64]; uint16 iilim; uint16 iignct; uint16 iignrf; uint16 sftdisc; uint16 sftrig0; uint16 sftrig1; uint16 cdscoff; uint16 tdscoff; uint16 srgbits[2]; uint8 dacvals[52]; uint8 dacsize[52]; uint8 hdisc2[12]; uint8 hdisc1[12]; uint8 hdisc0[12]; uint8 mdisc2[12]; uint8 mdisc1[12]; uint8 mdisc0[12]; uint8 adcen[12]; uint8 gdiscen[12]; uint8 mdiscen[12]; uint8 hdiscen[12]; uint16 cnoc1[7]; uint16 cnoc2[7]; uint16 ihiprr0; uint16 ihiprr1; uint16 stimeid; uint8 eidmap[256]; uint8 QualityEcmd[6]; uint8 QualityPhadisc; uint8 QualityAudgflg; uint8 QualityAudglim; uint8 QualityValcflg; uint8 QualitySamplim; uint8 QualityHeflg; uint8 QualityHyflg; uint8 QualityPreoflg; uint8 QualityHetlim; uint8 QualityHytlim; uint8 QualityHtcmd[16]; uint8 QualityRcmd; uint8 QualityGctime; uint8 QualityLedtime; uint8 QualitySfmisc; uint8 QualityCamsel; uint8 QualityIilima; uint8 QualityIilimb; uint8 QualityIilims[8]; uint8 QualityLsarr[40]; uint8 QualityLoarr[40]; uint8 QualityLaymax; uint8 QualityRemmax; uint8 QualityB_xoff[2]; uint8 QualityRngmsk[2]; uint8 QualityBparams[20]; uint8 QualityTwotelen; uint8 QualityGphaen; uint8 QualityStbfon; uint8 QualityNcenbox; uint8 QualityB_cenbox[64]; uint8 QualityIilim; uint8 QualityIignct; uint8 QualityIignrf; uint8 QualitySftdisc; uint8 QualitySftrig0; uint8 QualitySftrig1; uint8 QualityCdscoff; uint8 QualityTdscoff; uint8 QualitySrgbits[2]; uint8 QualityDacvals[52]; uint8 QualityDacsize[52]; uint8 QualityHdisc2[12]; uint8 QualityHdisc1[12]; uint8 QualityHdisc0[12]; uint8 QualityMdisc2[12]; uint8 QualityMdisc1[12]; uint8 QualityMdisc0[12]; uint8 QualityAdcen[12]; uint8 QualityGdiscen[12]; uint8 QualityMdiscen[12]; uint8 QualityHdiscen[12]; uint8 QualityCnoc1[7]; uint8 QualityCnoc2[7]; uint8 QualityIhiprr0; uint8 QualityIhiprr1; uint8 QualityStimeid; uint8 QualityEidmap[256]; }; /* Definition: */ /* ClockMinorFrame0 = S/C clock of the minor frame containing the */ /* first byte of the command table */ /* ClockMinorFrame1 = S/C clock of the minor frame containing the */ /* last byte of the command table */ /* */ /* Note: Quality bits are defined in the table below. If the field */ /* which the quality byte is trying to characterize contains */ /* multiple bytes, the quality byte associated with the field */ /* is the logical "or" of the individual quality bytes. */ /* */ /* Quality bits: */ /* 0x01 = Format ID error */ /* 0x02 = Minor/major counter error */ /* 0x04 = S/C clock error */ /* 0x08 = Sync bit error */ /* 0x10 = Command table index error */ /* 0x20 = Cycle number error */ /* 0x40 = Level 0 quality bit */ /* 0x80 = Level 1 quality bit */ In each instrument cycle, CRIS reads out 66 bytes of the command table. So it takes about one hour to read out a complete command table. When CRIS reaches the end of the command table, it immediatley begins to reread the table. Since the readout of the command table spans about an hour, it is assumed the occasionally a minor frame of data will be missing. For places where there is missing data, the level-one processing sets the quality flag for those variables and sets their values to the last value which has no quality bits set. The two clocks associated with the command table only indicate when the readout of the command table started and when it ended. They should not be interpreted to mean that in the time interval the command table's values was stable. D. Low-Priority Rate Structure struct L1CrisLowPriorityRate { uint32 ClockCycle; uint32 stmco; uint32 stmoff; uint32 z1ab; uint32 z2ab; uint32 z_gt_2ab; uint32 z1cd; uint32 z2cd; uint32 z_gt_2cd; uint32 hazard; uint32 gh; uint32 mor; uint32 hor; uint32 adc2ab; uint32 mnrgab; uint32 adc2cd; uint32 mnrgcd; uint32 e1a; uint32 e1b; uint32 e2ab; uint32 e3ab; uint32 e4ab; uint32 e5ab; uint32 e6ab; uint32 e7ab; uint32 e8ab; uint32 e9ab; uint32 g2ab; uint32 g3ab; uint32 g4ab; uint32 g5ab; uint32 g6ab; uint32 g7ab; uint32 e1c; uint32 e1d; uint32 e2cd; uint32 e3cd; uint32 e4cd; uint32 e5cd; uint32 e6cd; uint32 e7cd; uint32 e8cd; uint32 e9cd; uint32 g2cd; uint32 g3cd; uint32 g4cd; uint32 g5cd; uint32 g6cd; uint32 g7cd; uint32 EventBuffer[NUM_CRIS_EVT_BUFFERS]; uint32 livetim; uint32 helivet; uint32 hylivet; uint32 trg0rat; uint32 trg1rat; uint32 trg01; uint32 ntagint; uint32 nvldint; uint32 nevproc; uint32 nrtproc; uint32 nsfterr; uint32 nbadid; uint32 ncebful; uint32 nrebful; uint32 nmacsys; uint32 nhdwrej; uint8 QualityStmco; uint8 QualityStmoff; uint8 QualityZ1ab; uint8 QualityZ2ab; uint8 QualityZ_gt_2ab; uint8 QualityZ1cd; uint8 QualityZ2cd; uint8 QualityZ_gt_2cd; uint8 QualityHazard; uint8 QualityGh; uint8 QualityMor; uint8 QualityHor; uint8 QualityAdc2ab; uint8 QualityMnrgab; uint8 QualityAdc2cd; uint8 QualityMnrgcd; uint8 QualityE1a; uint8 QualityE1b; uint8 QualityE2ab; uint8 QualityE3ab; uint8 QualityE4ab; uint8 QualityE5ab; uint8 QualityE6ab; uint8 QualityE7ab; uint8 QualityE8ab; uint8 QualityE9ab; uint8 QualityG2ab; uint8 QualityG3ab; uint8 QualityG4ab; uint8 QualityG5ab; uint8 QualityG6ab; uint8 QualityG7ab; uint8 QualityE1c; uint8 QualityE1d; uint8 QualityE2cd; uint8 QualityE3cd; uint8 QualityE4cd; uint8 QualityE5cd; uint8 QualityE6cd; uint8 QualityE7cd; uint8 QualityE8cd; uint8 QualityE9cd; uint8 QualityG2cd; uint8 QualityG3cd; uint8 QualityG4cd; uint8 QualityG5cd; uint8 QualityG6cd; uint8 QualityG7cd; uint8 QualityEventBuffer[NUM_CRIS_EVT_BUFFERS]; uint8 QualityLivetim; uint8 QualityHelivet; uint8 QualityHylivet; uint8 QualityTrg0rat; uint8 QualityTrg1rat; uint8 QualityTrg01; uint8 QualityNtagint; uint8 QualityNvldint; uint8 QualityNevproc; uint8 QualityNrtproc; uint8 QualityNsfterr; uint8 QualityNbadid; uint8 QualityNcebful; uint8 QualityNrebful; uint8 QualityNmacsys; uint8 QualityNhdwrej; }; /* Definition: */ /* ClockCycle = Adjusted S/C clock of the first minor frame of */ /* the cycle in which the rate was accumulated. */ /* The value 256 is subtracted from the S/C clock of */ /* the first minor frame of the cycle in which the */ /* low priority rates were readout. */ /* */ /* Note: All rates are decompressed. */ /* */ /* Note: Quality bits are defined in the table below. If the field */ /* which the quality byte is trying to characterize contains */ /* multiple bytes, the quality byte associated with the field */ /* is the logical "or" of the individual quality bytes. */ /* */ /* Quality bits: */ /* 0x01 = Format ID error */ /* 0x02 = Minor/major counter error */ /* 0x04 = S/C clock error */ /* 0x08 = Sync bit error */ /* 0x10 = Command table index error */ /* 0x20 = Cycle number error */ /* 0x40 = Level 0 quality bit */ /* 0x80 = Level 1 quality bit */ The CRIS low-priority rates are readout once per instrument cycle. At the start of each instrument cycle, all the low-priority rate counters are initialized to zero. The rates are then accumulated for one instrument cycle, and readout in the next. So, the S/C is adjusted to correspond to the start of the accumulation period. E. High-Priority Rate Structure struct L1CrisHighPriorityRate { uint32 ClockMinorFrame; uint32 hp[NUM_CRIS_HIGH_PRIORITY_RATES]; uint8 QualityHp[NUM_CRIS_HIGH_PRIORITY_RATES]; }; /* Definition: */ /* ClockMinorFrame = S/C clock of the minor frame in which the */ /* high priority rate accumulation began */ /* hp = high priority rates */ /* QualityHp = Quality data flags for high priority rates */ /* */ /* Note: All rates are decompressed. */ /* */ /* Note: Quality bits are defined in the table below. If the field */ /* which the quality byte is trying to characterize contains */ /* multiple bytes, the quality byte associated with the field */ /* is the logical "or" of the individual quality bytes. */ /* */ /* Quality bits: */ /* 0x01 = Format ID error */ /* 0x02 = Minor/major counter error */ /* 0x04 = S/C clock error */ /* 0x08 = Sync bit error */ /* 0x10 = Command table index error */ /* 0x20 = Cycle number error */ /* 0x40 = Level 0 quality bit */ /* 0x80 = Level 1 quality bit */ Each CRIS high-priority rates is readout sixteen times during an instrument cycle. Both rates are latched at the beginning of each instrument cycle and every 16 minor frames after that. The high priority rates are then readout in the following 1/16 instrument cycle. The S/C clock is adjusted to correspond to the beginning of each accumulation interval. The variables that go into the high-priority rates are controlled by the command table variables ihiprr0 and ihiprr1. F. Compressed Event Structure struct L1CrisEvent { uint32 ClockCycle; uint16 NumberNormalEventBytes[MAX_CRIS_EVT_AGE]; uint16 NumberEvents; uint8 EventBuffer[NUM_CRIS_EVT_BUFFER_BYTES]; uint8 ContinuationFlag; }; /* Definition: */ /* ClockCycle = S/C clock of the first minor frame of the cycle */ /* in which CRIS processed the event */ /* NumberNormalEventBytes = Number of bytes ised for normal event */ /* processing from each of the cycles */ /* that can contribute events to this */ /* structure. */ /* NumberEvents = Number of events stored in the event buffer */ /* EventBuffer = Event buffer */ /* ContinuationFlag = Flag indicating events from this cycle are */ /* continued in the next structure */ /* */ /* Note: Each event in the event buffer is preceded by two bytes. */ /* The first is the relative age of the event in cycles. The */ /* second is the minor frame in which the first byte of the */ /* event was transmitted. */ The CRIS compressed events occupy most of the CRIS data stream. These events come from CRIS in a compressed form, and this form is maintained during the level-one processing. Even though it would have been possible to define a fixed data structure to store each event, it was felt that this would result in greatly enlarged data files. Since the work to expand a compressed event should be small compared to the work of analysing the event, it was felt that doing the expansion at analysis time was more appropriate. Standard functions to expand the compressed event into a fixed structure can be furnished to the CRIS team members. The actual events have an internal time tag with a resolution of 256 seconds. The S/C clock associated with an event is the time the event was put in the telemetry stream; it is not the time that CRIS processed the event. For low-priority events, the readout time can be significantly different from the time the event was processed. The continuation flag in the data structure is only expected to be used infrequently. G. Command Echo Structure struct L1CrisCommandEcho { uint32 ClockMinorFrame; uint8 NumberChars; char8 CommandEcho[MAX_NUM_CRIS_CMD_ECHO_CHARS]; }; /* Definition: */ /* ClockMinorFrame = S/C clock of the minor frame containing the */ /* command echo */ /* NumberChars = Number of characters in the command echo */ /* CommandEcho = Command echo characters */ Whenever a command is received, CRIS puts a command response in its telemetry. There is no agreed-upon limit on the size of the CRIS command response. Also, the form of the command response is ASCII characters with embedded linefeeds and carriage returns. The command response was designed to be displayed on a "dumb" terminal and to be interpreted by humans. Since command responses usually span minor frames and also can span instrument cycles, there is no simple way to determine where one command response ends and another begins. To keep the level-one processing simple, it was decided to call the portion of the command response that appears in a instrument minor frame a command echo and define a structure to contain it. H. Diagnostic Event Structure struct L1CrisDiagnosticEvent { uint32 ClockMinorFrame; uint16 RawStack[NUM_CRIS_RAW_STACK_EVT_BYTES/2]; uint16 SoftEvent[NUM_CRIS_RAW_SOFT_EVT_BYTES/2]; uint8 NormalEvent[MAX_NUM_CRIS_NORMAL_EVT_BYTES]; uint8 ContinuationFlag; }; /* Definition: */ /* ClockMinorFrame = S/C clock of the minor frame containing the */ /* start of the diagnostic event */ /* RawStack = Raw stack event portion of the diagnostic event */ /* SoftEvent = Raw SOFT event portion of the diagnostic event */ /* NormalEvent = Normal event portion of the diagnostic event */ /* ContinuationFlag = Flag indicating the SOFT portion of the */ /* event is continued in the next cycle */ The size of a CRIS diagnostic event is dominate by the portion containing the raw SOFT data. The maximum length of the SOFT data is controlled by a firmware limit which is currently set at 6 Kbytes. There is also a maximum hardware limit of 32 Kbytes. It is assumed that the SOFT portion of the diagnostic event will be generally less than 2000 bytes. If the SOFT portion exceeds this limit, then the continuation flag is used.