|
ocssw
1.0
|
00001 #include "L1A_prototype.h" 00002 #include "hdf.h" 00003 #include "PGS_IO_L0.h" 00004 #include "EN_eng_data.h" 00005 00006 00007 void process_cp_hk_tlmy (EN_VDATA_TYPE_t *eng_data, 00008 PGSt_IO_L0_Packet *eng_pkt_2_1, 00009 uint16 scan_number) 00010 /* 00011 !C***************************************************************************** 00012 00013 !Description: This function processes eng group 2 pkt #1. The appropriate 00014 eng_data Vdatas are updated for this scan using the data in 00015 the engineering packet's Current/Prior HK Tlmy section. 00016 (c.f. CDRL Table 30-6A and the Vdata_list file). 00017 00018 !Input Parameters: 00019 PGSt_IO_LO_Packet *eng_pkt_2_1 ** eng grp 2 packet #1 00020 for the current scan ** 00021 00022 uint16 scan_number ** The scan number (counting 00023 from 1) of the current scan 00024 within the current 00025 granule ** 00026 !Output Parameters: 00027 None 00028 00029 !Input/Output Parameters: 00030 EN_VDATA_TYPE_t *eng_data ** The Vdata array 00031 structure ** 00032 00033 Return Values: 00034 None 00035 00036 Externally Defined: 00037 EN_VDATA_TYPE_t (EN_eng_data.h) 00038 PGSt_IO_LO_Packet (PGS_IO.h) 00039 00040 Called By: 00041 process_eng_packet 00042 00043 Routines Called: 00044 extr_bits 00045 update_eng_data 00046 update_eng_data_for_maj_cycle_n 00047 00048 !Revision History: 00049 revision 1.0 1997/09/11 17:30:00 00050 Qi Huang/RDC (qhuang@ltpmail.gsfc.nasa.gov) 00051 Original development 00052 00053 !Team-unique Header: 00054 This software is developed by the MODIS Science 00055 Data Support Team (SDST) for the National Aeronautics 00056 and Space Administration (NASA), Goddard Space Flight 00057 Center (GSFC), under contract NAS5-32373. 00058 00059 !References and Credits: 00060 None 00061 00062 !Design Notes: 00063 00064 Use the current Major Cycle (first 6 bits of eng_pkt_2_1's data) to 00065 decide which Vdatas to update: 00066 00067 ------------------------------------------------------------------------ 00068 If Major Cycle is: | then update Vdatas at vdata_array indices: 00069 ------------------------------------------------------------------------ 00070 all | 0, 1, 2 00071 ------------------------------------------------------------------------ 00072 Major Cycle (MOD 8) = | 00073 0 | 3 00074 1 | 4 00075 2 | 5 00076 3 | 6, 7, 8 00077 4 | 9, 10 00078 5 | 11, 12 00079 6 | 13 00080 7 | 14 00081 ------------------------------------------------------------------------ 00082 0..32 | 15..47 00083 ------------------------------------------------------------------------ 00084 00085 Then use the 'prior' Major Cycle (first 6 bits of the "prior" section (bits 00086 512..517) of eng_pkt_2_1->data (i.e. bits 656..661 from the start of the 00087 packet header)) to decide which Vdatas to update using the above map, except 00088 this time do not update the "all" category (Vdatas 0, 1, or 2). 00089 00090 (c.f. CDRL Table 30-6A, CDRL Table 20-4, and the Vdata_list) 00091 00092 !END************************************************************************ 00093 */ 00094 { 00095 /*****************************************************************************/ 00096 /* */ 00097 /* Define and Initialize Local Variables */ 00098 /* */ 00099 /*****************************************************************************/ 00100 00101 int is_cp_hk_prior_section = FALSE; 00102 int start_byte; 00103 int start_bit; 00104 int num_bits; 00105 int i; 00106 uint16 major_cycle; 00107 00108 00109 /*****************************************************************************/ 00110 /* */ 00111 /* set is_cp_hk_prior_section to FALSE (done during declaration) */ 00112 /* */ 00113 /*****************************************************************************/ 00114 00115 /*****************************************************************************/ 00116 /* */ 00117 /* DO FOR ( i = 0 to 2 ) to update the three "Telemetry Major Cycle All" */ 00118 /* Vdatas */ 00119 /* CALL update_eng_data to update the eng_data (vdata_array) */ 00120 /* structure with the eng data values in the eng pkt */ 00121 /* INPUTS: i, eng_pkt_2_1, scan_number, eng_data, */ 00122 /* is_cp_hk_prior_section */ 00123 /* OUTPUTS: eng_data */ 00124 /* RETURN: None */ 00125 /* END DO */ 00126 /* */ 00127 /*****************************************************************************/ 00128 00129 for (i=0; i<3; i++) 00130 update_eng_data(i,eng_pkt_2_1,scan_number,eng_data,is_cp_hk_prior_section); 00131 00132 00133 /*****************************************************************************/ 00134 /* */ 00135 /* set start_byte to 18 <-- 144/8 = 18 = the start of the data section */ 00136 /* set start_bit to 0 */ 00137 /* set num_bits to 6 */ 00138 /* */ 00139 /*****************************************************************************/ 00140 00141 start_byte = 18; 00142 start_bit = 0; 00143 num_bits = 6; 00144 00145 00146 /*****************************************************************************/ 00147 /* */ 00148 /* CALL extr_bits to get the current Major Cycle (the first 6 bits of */ 00149 /* eng_pkt_2_1 's data section) */ 00150 /* INPUTS: num_bits, start_byte, start_bit, eng_pkt_2_1 */ 00151 /* OUTPUTS: None */ 00152 /* RETURN: major_cycle */ 00153 /* */ 00154 /*****************************************************************************/ 00155 00156 major_cycle = extr_bits(eng_pkt_2_1,start_bit,start_byte,num_bits); 00157 00158 00159 /*****************************************************************************/ 00160 /* */ 00161 /* CALL update_eng_data_for_maj_cycle_n to update the appropriate "Telemetry*/ 00162 /* Major Cycle X of 63" and "Telemetry Major Cycle X of 7" Vdata(s) for */ 00163 /* the "current" section of eng packet 2-1 */ 00164 /* INPUTS: major_cycle, eng_pkt_2_1, scan_number, eng_data, */ 00165 /* is_cp_hk_prior_section */ 00166 /* OUTPUTS: eng_data */ 00167 /* RETURN: None */ 00168 /* */ 00169 /*****************************************************************************/ 00170 00171 update_eng_data_for_maj_cycle_n( major_cycle,eng_pkt_2_1,scan_number,eng_data, 00172 is_cp_hk_prior_section); 00173 00174 00175 /*****************************************************************************/ 00176 /* */ 00177 /* set start_byte to 82 <-- 656/8 = 82 = the start of the "prior" part of */ 00178 /* eng packet 2-1's data section */ 00179 /* set start_bit to 0 */ 00180 /* set num_bits to 6 */ 00181 /* */ 00182 /*****************************************************************************/ 00183 00184 start_byte = 82; 00185 start_bit = 0; 00186 num_bits = 6; 00187 00188 00189 /*****************************************************************************/ 00190 /* */ 00191 /* CALL extr_bits to get the prior Major Cycle for the eng packet's */ 00192 /* "prior" section */ 00193 /* INPUTS: num_bits, start_byte, start_bit, eng_pkt_2_1 */ 00194 /* OUTPUTS: None */ 00195 /* RETURN: major_cycle */ 00196 /* */ 00197 /*****************************************************************************/ 00198 00199 major_cycle = extr_bits(eng_pkt_2_1,start_bit,start_byte,num_bits); 00200 00201 00202 /*****************************************************************************/ 00203 /* */ 00204 /* set is_cp_hk_prior_section to True */ 00205 /* */ 00206 /*****************************************************************************/ 00207 00208 is_cp_hk_prior_section = TRUE; 00209 00210 00211 /*****************************************************************************/ 00212 /* */ 00213 /* CALL update_eng_data_for_maj_cycle_n to update the appropriate "Telemetry*/ 00214 /* Major Cycle X of 63" and "Telemetry Major Cycle X of 7" Vdata(s) for */ 00215 /* the "prior" section of eng packet 2-1 */ 00216 /* INPUTS: major_cycle, eng_pkt_2_1, scan_number, eng_data, */ 00217 /* is_cp_hk_prior_section */ 00218 /* OUTPUTS: eng_data */ 00219 /* RETURN: None */ 00220 /* */ 00221 /*****************************************************************************/ 00222 00223 update_eng_data_for_maj_cycle_n(major_cycle,eng_pkt_2_1,scan_number,eng_data, 00224 is_cp_hk_prior_section); 00225 00226 return; 00227 }
1.7.6.1