OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
process_cp_hk_tlmy.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "hdf.h"
3 #include "PGS_IO_L0.h"
4 #include "EN_eng_data.h"
5 
6 
8  PGSt_IO_L0_Packet *eng_pkt_2_1,
9  uint16 scan_number)
10 /*
11 !C*****************************************************************************
12 
13 !Description: This function processes eng group 2 pkt #1. The appropriate
14  eng_data Vdatas are updated for this scan using the data in
15  the engineering packet's Current/Prior HK Tlmy section.
16  (c.f. CDRL Table 30-6A and the Vdata_list file).
17 
18 !Input Parameters:
19  PGSt_IO_LO_Packet *eng_pkt_2_1 ** eng grp 2 packet #1
20  for the current scan **
21 
22  uint16 scan_number ** The scan number (counting
23  from 1) of the current scan
24  within the current
25  granule **
26 !Output Parameters:
27  None
28 
29 !Input/Output Parameters:
30  EN_VDATA_TYPE_t *eng_data ** The Vdata array
31  structure **
32 
33 Return Values:
34  None
35 
36 Externally Defined:
37  EN_VDATA_TYPE_t (EN_eng_data.h)
38  PGSt_IO_LO_Packet (PGS_IO.h)
39 
40 Called By:
41  process_eng_packet
42 
43 Routines Called:
44  extr_bits
45  update_eng_data
46  update_eng_data_for_maj_cycle_n
47 
48 !Revision History:
49  revision 1.0 1997/09/11 17:30:00
50  Qi Huang/RDC (qhuang@ltpmail.gsfc.nasa.gov)
51  Original development
52 
53 !Team-unique Header:
54  This software is developed by the MODIS Science
55  Data Support Team (SDST) for the National Aeronautics
56  and Space Administration (NASA), Goddard Space Flight
57  Center (GSFC), under contract NAS5-32373.
58 
59 !References and Credits:
60  None
61 
62 !Design Notes:
63 
64  Use the current Major Cycle (first 6 bits of eng_pkt_2_1's data) to
65  decide which Vdatas to update:
66 
67  ------------------------------------------------------------------------
68  If Major Cycle is: | then update Vdatas at vdata_array indices:
69  ------------------------------------------------------------------------
70  all | 0, 1, 2
71  ------------------------------------------------------------------------
72  Major Cycle (MOD 8) = |
73  0 | 3
74  1 | 4
75  2 | 5
76  3 | 6, 7, 8
77  4 | 9, 10
78  5 | 11, 12
79  6 | 13
80  7 | 14
81  ------------------------------------------------------------------------
82  0..32 | 15..47
83  ------------------------------------------------------------------------
84 
85  Then use the 'prior' Major Cycle (first 6 bits of the "prior" section (bits
86  512..517) of eng_pkt_2_1->data (i.e. bits 656..661 from the start of the
87  packet header)) to decide which Vdatas to update using the above map, except
88  this time do not update the "all" category (Vdatas 0, 1, or 2).
89 
90  (c.f. CDRL Table 30-6A, CDRL Table 20-4, and the Vdata_list)
91 
92 !END************************************************************************
93 */
94 {
95  /*****************************************************************************/
96  /* */
97  /* Define and Initialize Local Variables */
98  /* */
99  /*****************************************************************************/
100 
101  int is_cp_hk_prior_section = FALSE;
102  int start_byte;
103  int start_bit;
104  int num_bits;
105  int i;
106  uint16 major_cycle;
107 
108 
109  /*****************************************************************************/
110  /* */
111  /* set is_cp_hk_prior_section to FALSE (done during declaration) */
112  /* */
113  /*****************************************************************************/
114 
115  /*****************************************************************************/
116  /* */
117  /* DO FOR ( i = 0 to 2 ) to update the three "Telemetry Major Cycle All" */
118  /* Vdatas */
119  /* CALL update_eng_data to update the eng_data (vdata_array) */
120  /* structure with the eng data values in the eng pkt */
121  /* INPUTS: i, eng_pkt_2_1, scan_number, eng_data, */
122  /* is_cp_hk_prior_section */
123  /* OUTPUTS: eng_data */
124  /* RETURN: None */
125  /* END DO */
126  /* */
127  /*****************************************************************************/
128 
129  for (i=0; i<3; i++)
130  update_eng_data(i,eng_pkt_2_1,scan_number,eng_data,is_cp_hk_prior_section);
131 
132 
133  /*****************************************************************************/
134  /* */
135  /* set start_byte to 18 <-- 144/8 = 18 = the start of the data section */
136  /* set start_bit to 0 */
137  /* set num_bits to 6 */
138  /* */
139  /*****************************************************************************/
140 
141  start_byte = 18;
142  start_bit = 0;
143  num_bits = 6;
144 
145 
146  /*****************************************************************************/
147  /* */
148  /* CALL extr_bits to get the current Major Cycle (the first 6 bits of */
149  /* eng_pkt_2_1 's data section) */
150  /* INPUTS: num_bits, start_byte, start_bit, eng_pkt_2_1 */
151  /* OUTPUTS: None */
152  /* RETURN: major_cycle */
153  /* */
154  /*****************************************************************************/
155 
156  major_cycle = extr_bits(eng_pkt_2_1,start_bit,start_byte,num_bits);
157 
158 
159  /*****************************************************************************/
160  /* */
161  /* CALL update_eng_data_for_maj_cycle_n to update the appropriate "Telemetry*/
162  /* Major Cycle X of 63" and "Telemetry Major Cycle X of 7" Vdata(s) for */
163  /* the "current" section of eng packet 2-1 */
164  /* INPUTS: major_cycle, eng_pkt_2_1, scan_number, eng_data, */
165  /* is_cp_hk_prior_section */
166  /* OUTPUTS: eng_data */
167  /* RETURN: None */
168  /* */
169  /*****************************************************************************/
170 
171  update_eng_data_for_maj_cycle_n( major_cycle,eng_pkt_2_1,scan_number,eng_data,
172  is_cp_hk_prior_section);
173 
174 
175  /*****************************************************************************/
176  /* */
177  /* set start_byte to 82 <-- 656/8 = 82 = the start of the "prior" part of */
178  /* eng packet 2-1's data section */
179  /* set start_bit to 0 */
180  /* set num_bits to 6 */
181  /* */
182  /*****************************************************************************/
183 
184  start_byte = 82;
185  start_bit = 0;
186  num_bits = 6;
187 
188 
189  /*****************************************************************************/
190  /* */
191  /* CALL extr_bits to get the prior Major Cycle for the eng packet's */
192  /* "prior" section */
193  /* INPUTS: num_bits, start_byte, start_bit, eng_pkt_2_1 */
194  /* OUTPUTS: None */
195  /* RETURN: major_cycle */
196  /* */
197  /*****************************************************************************/
198 
199  major_cycle = extr_bits(eng_pkt_2_1,start_bit,start_byte,num_bits);
200 
201 
202  /*****************************************************************************/
203  /* */
204  /* set is_cp_hk_prior_section to True */
205  /* */
206  /*****************************************************************************/
207 
208  is_cp_hk_prior_section = TRUE;
209 
210 
211  /*****************************************************************************/
212  /* */
213  /* CALL update_eng_data_for_maj_cycle_n to update the appropriate "Telemetry*/
214  /* Major Cycle X of 63" and "Telemetry Major Cycle X of 7" Vdata(s) for */
215  /* the "prior" section of eng packet 2-1 */
216  /* INPUTS: major_cycle, eng_pkt_2_1, scan_number, eng_data, */
217  /* is_cp_hk_prior_section */
218  /* OUTPUTS: eng_data */
219  /* RETURN: None */
220  /* */
221  /*****************************************************************************/
222 
223  update_eng_data_for_maj_cycle_n(major_cycle,eng_pkt_2_1,scan_number,eng_data,
224  is_cp_hk_prior_section);
225 
226  return;
227 }
void update_eng_data_for_maj_cycle_n(uint16 major_cycle, PGSt_IO_L0_Packet *eng_pkt_2_1, uint16 scan_number, EN_VDATA_TYPE_t *eng_data, int is_cp_hk_prior_section)
#define FALSE
Definition: rice.h:164
#define TRUE
Definition: rice.h:165
void update_eng_data(uint16 index, PGSt_IO_L0_Packet *eng_packet, uint16 scan_number, EN_VDATA_TYPE_t *eng_data, int use_cp_prior_offset)
void process_cp_hk_tlmy(EN_VDATA_TYPE_t *eng_data, PGSt_IO_L0_Packet *eng_pkt_2_1, uint16 scan_number)
uint32 extr_bits(uint8 *a, int start_bit, int start_byte, int num_bits)
Definition: extr_bits.c:6
int i
Definition: decode_rs.h:71