63 TUDEF(
"EngNav",
"getSubframePattern");
66 const uint32_t subframe1P[10] =
67 { 0x22c000e4, 0x215ba160, 0x00180012, 0x1fffffc0, 0x3fffffc3,
68 0x3ffffffc, 0x3fffc009, 0x16d904f0, 0x003fdbac, 0x247c139c };
69 const uint32_t subframe2P[10] =
70 { 0x22c000e4, 0x215bc2f0, 0x16c2eb4d, 0x032c41a0, 0x26abc7e0,
71 0x0289c0dd, 0x0d5ecc38, 0x036b6842, 0x034f4df0, 0x1904c0b4 };
72 const uint32_t subframe3P[10] =
73 { 0x22c000e4, 0x215be378, 0x3ffcc344, 0x1a8441f1, 0x3ff80b74,
74 0x1c8deb5e, 0x0a34d52d, 0x14a5013e, 0x3fee8c2f, 0x16c35c80 };
76 testMesg =
"Subframe Pattern obtained was incorrect";
87 TUDEF(
"EngNav",
"Compute Parity");
94 uint32_t zero = 0x00000000;
95 uint32_t data1 = 0x22C000C0;
96 uint32_t data2 = 0x17344000;
97 uint32_t data3 = 0x2142EF00;
98 uint32_t data4 = 0x15E67180;
100 testMesg =
"Parity computed was incorrect";
121 TUDEF(
"EngNav",
"Fix Parity");
125 uint32_t data1 = 0x22C000C0;
126 uint32_t data2 = 0x17344000;
127 uint32_t data3 = 0x2142EF00;
128 uint32_t data4 = 0x15E67180;
130 uint32_t data5 = 0x32098100;
131 uint32_t CompareData1 = 0x22C000C0 | 0x0000024;
132 uint32_t CompareData2 = 0x17344000 | 0x0000022;
133 uint32_t CompareData3 = 0x2142EF00 | 0x000001B;
134 uint32_t CompareData4 = 0x15E67180 | 0x0000002;
136 uint32_t CompareData5 = 0x32098100 | 0x00000DC;
140 testMesg =
"Parity computed is incorrect";
158 TUDEF(
"EngNav",
"Check Parity");
163 const uint32_t subframe1P[10] =
164 { 0x22c000e4, 0x215ba160, 0x00180012, 0x1fffffc0, 0x3fffffc3,
165 0x3fffffff, 0x3fffc035, 0x16d904f3, 0x003fdb90, 0x247c1339 };
166 const uint32_t subframe2P[10] =
167 { 0x22c000e4, 0x215bc2f0, 0x16c2eb4d, 0x032c41a3, 0x26abc7dc,
168 0x0289c0dd, 0x0d5ecc3b, 0x0036b67f, 0x034f4de5, 0x1904c0a1 };
169 const uint32_t subframe3P[10] =
170 { 0x22c000e4, 0x215be378, 0x3ffcc344, 0x1a8441f1, 0x3ff80b61,
171 0x1c8deb4b, 0x0a34d530, 0x14a50138, 0x3fee8c2f, 0x16c35c83 };
173 testMesg =
"Parity computed is incorrect";
188 TUDEF(
"EngNav",
"getHOWTime");
191 uint32_t how1 = 0x215ba160;
192 uint32_t how2 = 0x215bc2f0;
193 uint32_t how3 = 0x215be378;
195 testMesg =
"Returned TOW time from the HOW is incorrect";
206 TUDEF(
"EngNav",
"getSFID");
209 uint32_t how1 = 0x215ba160;
210 uint32_t how2 = 0x215bc2f0;
211 uint32_t how3 = 0x215be378;
213 testMesg =
"Returned subframe ID was incorrect";
224 TUDEF(
"EngNav",
"Subframe Convert");
227 double output1[60], output2[60], output3[60];
228 const uint32_t subframe1P[10] =
229 { 0x22c000e4, 0x215ba160, 0x00180012, 0x1fffffc0, 0x3fffffc3,
230 0x3ffffffc, 0x3fffc009, 0x16d904f0, 0x003fdbac, 0x247c139c };
231 const uint32_t subframe2P[10] =
232 { 0x22c000e4, 0x215bc2f0, 0x16c2eb4d, 0x032c41a0, 0x26abc7e0,
233 0x0289c0dd, 0x0d5ecc38, 0x036b6842, 0x034f4df0, 0x1904c0b4 };
234 const uint32_t subframe3P[10] =
235 { 0x22c000e4, 0x215be378, 0x3ffcc344, 0x1a8441f1, 0x3ff80b76,
236 0x1c8deb5e, 0x0a34d52d, 0x14a5013e, 0x3fee8c2f, 0x16c35c80 };
239 testMesg =
"Subframe Convert function failed";
240 testFramework.assert(
244 testMesg =
"TLM Preamble is incorrect";
245 testFramework.assert(output1[0] == 0x8B, testMesg, __LINE__);
246 testMesg =
"TLM Message is incorrect";
247 testFramework.assert(output1[1] == 0, testMesg, __LINE__);
248 testMesg =
"How Word (time?) is incorrect";
249 testFramework.assert(output1[2] == 409902, testMesg, __LINE__);
250 testMesg =
"Alert flag is incorrect";
251 testFramework.assert(output1[3] == 0, testMesg, __LINE__);
252 testMesg =
"Subframe ID is incorrect";
253 testFramework.assert(output1[4] == 1, testMesg, __LINE__);
254 testMesg =
"Transmit Week Number is incorrect";
255 testFramework.assert(output1[5] == 1025, testMesg, __LINE__);
256 testMesg =
"L2 code flag is incorrect";
257 testFramework.assert(output1[6] == 2, testMesg, __LINE__);
258 testMesg =
"SV Accuracy is incorrect";
259 testFramework.assert(output1[7] == 0, testMesg, __LINE__);
260 testMesg =
"SV Health is incorrect";
261 testFramework.assert(output1[8] == 0, testMesg, __LINE__);
262 testMesg =
"IODC flag is incorrect";
263 testFramework.assert(output1[9]/2048 == 0x5B, testMesg,
265 testMesg =
"L2 code flag is incorrect";
266 testFramework.assert(output1[10] == 0, testMesg, __LINE__);
267 testMesg =
"Group Delay Differential is incorrect";
268 testFramework.assert(output1[11] == 0, testMesg, __LINE__);
269 testMesg =
"Clock Epoch is incorrect";
270 testFramework.assert(output1[12] == 409904, testMesg, __LINE__);
271 testMesg =
"Clock Drift Rate is incorrect";
272 testFramework.assert(output1[13] == 0, testMesg, __LINE__);
273 testMesg =
"Clock Drift is incorrect";
274 testFramework.assert(abs(output1[14] + .165982783074E-10)*pow(b10,10) < eps,
276 testMesg =
"Clock Bias is incorrect";
277 testFramework.assert(abs(output1[15] + .839701388031E-03)*pow(b10,3) < eps,
280 testMesg =
"Subframe Convert function failed";
281 testFramework.assert(EngNavThing.
subframeConvert(subframe2P, 1025, output2),
284 testMesg =
"TLM Preamble is incorrect";
285 testFramework.assert(output2[0] == 0x8B, testMesg, __LINE__);
286 testMesg =
"TLM Message is incorrect";
287 testFramework.assert(output2[1] == 0, testMesg, __LINE__);
288 testMesg =
"How Word (time?) is incorrect";
289 testFramework.assert(output2[2] == 409908, testMesg, __LINE__);
290 testMesg =
"Alert flag is incorrect";
291 testFramework.assert(output2[3] == 0, testMesg, __LINE__);
292 testMesg =
"Subframe ID is incorrect";
293 testFramework.assert(output2[4] == 2, testMesg, __LINE__);
294 testMesg =
"IODE is incorrect";
295 testFramework.assert(output2[5]/2048 == 91, testMesg,
297 testMesg =
"CRS is incorrect";
298 testFramework.assert(abs(output2[6] - 93.40625) < eps, testMesg, __LINE__);
299 testMesg =
"Correction to Mean Motion is incorrect";
300 testFramework.assert(abs(output2[7] - (.11604054784E-8))*pow(b10,8) < eps,
302 testMesg =
"Mean Anomaly at Epoch is incorrect";
303 testFramework.assert(abs(output2[8] - 0.162092304801) < eps, testMesg,
305 testMesg =
"CUC is incorrect";
306 testFramework.assert(abs(output2[9] - .484101474285E-5)*pow(b10,5) < eps,
308 testMesg =
"Eccentricity is incorrect";
309 testFramework.assert(abs(output2[10] - .626740418375E-2)*pow(b10,2) < eps,
311 testMesg =
"CUS is incorrect";
312 testFramework.assert(abs(output2[11] - .652112066746E-5)*pow(b10,5) < eps,
314 testMesg =
"Square Root of Semi-Major Axis is incorrect";
315 testFramework.assert(abs(output2[12] - .515365489006E4)*pow(b10,-4) < eps,
317 testMesg =
"Time of Epoch is incorrect";
318 testFramework.assert(output2[13] == 409904, testMesg, __LINE__);
319 testMesg =
"Fit interval flag is incorrect";
320 testFramework.assert(output2[14] == 0, testMesg, __LINE__);
322 testMesg =
"Subframe Convert function failed";
323 testFramework.assert(EngNavThing.
subframeConvert(subframe3P, 1025, output3),
326 testMesg =
"TLM Preamble is incorrect";
327 testFramework.assert(output3[0] == 0x8B, testMesg, __LINE__);
328 testMesg =
"TLM Message is incorrect";
329 testFramework.assert(output3[1] == 0, testMesg, __LINE__);
330 testMesg =
"How Word (time?) is incorrect";
331 testFramework.assert(output3[2] == 409914, testMesg, __LINE__);
332 testMesg =
"Alert flag is incorrect";
333 testFramework.assert(output3[3] == 0, testMesg, __LINE__);
334 testMesg =
"Subframe ID is incorrect";
335 testFramework.assert(output3[4] == 3, testMesg, __LINE__);
336 testMesg =
"CIC is incorrect";
337 testFramework.assert(abs(output3[5] + .242143869400E-7)*pow(b10,7) < eps,
339 testMesg =
"Right ascension of ascending node is incorrect";
340 testFramework.assert(abs(output3[6] - .329237003460) < eps, testMesg,
342 testMesg =
"CIS is incorrect";
343 testFramework.assert(abs(output3[7] + .596046447754E-7)*pow(b10,7) < eps,
345 testMesg =
"Inclination is incorrect";
346 testFramework.assert(abs(output3[8] - 1.11541663136) < eps, testMesg,
348 testMesg =
"CRC is incorrect";
349 testFramework.assert(abs(output3[9] - 326.59375)*pow(b10, -3) < eps, testMesg,
352 "Arguement of perigee is incorrect";
353 testFramework.assert(abs(output3[10] - 2.06958726335)*pow(b10, -1) < eps,
355 testMesg =
"Right ascension of ascending node time derivative is incorrect";
356 testFramework.assert(abs(output3[11] + .638312302555E-8)*pow(b10,10) < eps,
358 testMesg =
"AODE? is incorrect";
359 testFramework.assert(output3[12]/2048 == 91, testMesg, __LINE__);
360 testMesg =
"Inclination time derivative is incorrect";
361 testFramework.assert(abs(output3[13] - .307155651409E-9)*pow(b10,9) < eps,
377 TUDEF(
"EngNav",
"getNMCTValidity");
379 string infilename = gnsstk::getPathData() +
380 gnsstk::getFileSep() +
"test_getNMCTValidity.txt";
381 ifstream infile(infilename.c_str());
386 uint32_t aodoExp, aodoGot;
388 bool gotData =
false;
395 getline(infile, line);
396 if ((line[0] ==
'#') || (
numWords(line) != 16))
401 for (
unsigned wordnum = 0; wordnum < 10; wordnum++)
415 if (aodoExp == 27900)
417 testFramework.assert(
419 sf2, howWeek, aodoGot, tnmctGot, toeGot, totGot),
420 "Unexpected return value", __LINE__);
426 testFramework.assert(
428 sf2, howWeek, aodoGot, tnmctGot, toeGot, totGot),
429 "Unexpected return value", __LINE__);
435 testFramework.assert(gotData,
"Did not test any NMCT data", __LINE__);
450 unsigned errorTotal = 0;
461 cout <<
"Total Failures for " << __FILE__ <<
": " << errorTotal