SP3NavDataFactory_T.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 
26 //==============================================================================
27 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 #include "SP3NavDataFactory.hpp"
40 #include "TestUtil.hpp"
41 #include "OrbitDataSP3.hpp"
42 #include "CivilTime.hpp"
43 #include "GPSWeekSecond.hpp"
44 
45 namespace gnsstk
46 {
47  std::ostream& operator<<(std::ostream& s, gnsstk::NavMessageType e)
48  {
49  s << StringUtils::asString(e);
50  return s;
51  }
52 
53  std::ostream& operator<<(std::ostream& s, gnsstk::SatelliteSystem e)
54  {
55  s << StringUtils::asString(e);
56  return s;
57  }
58 
59  std::ostream& operator<<(std::ostream& s, gnsstk::CarrierBand e)
60  {
61  s << StringUtils::asString(e);
62  return s;
63  }
64 
65  std::ostream& operator<<(std::ostream& s, gnsstk::TrackingCode e)
66  {
67  s << StringUtils::asString(e);
68  return s;
69  }
70 
71  std::ostream& operator<<(std::ostream& s, gnsstk::NavType e)
72  {
73  s << StringUtils::asString(e);
74  return s;
75  }
76 }
77 
81 {
82 public:
85  { return data; }
86 };
87 
90 {
91 public:
93  unsigned constructorTest();
95  unsigned loadIntoMapTest();
97  unsigned findExactTest();
99  unsigned findInterpTest();
101  unsigned findEdgeTest();
103  unsigned sp3cPVTest();
105  unsigned sp3cPTest();
107  unsigned gapTest();
109  unsigned nomTimeStepTest();
118  unsigned loadIntoMapFGNSSTest(bool badPos, bool badClk, bool rcBefore,
119  bool rcAfter);
121  unsigned addRinexClockTest();
127  template <class NavClass>
128  void verifyDataType(gnsstk::TestUtil& testFramework,
129  gnsstk::NavMessageMap& nmm);
130 };
131 
132 
133 unsigned SP3NavDataFactory_T ::
135 {
136  TUDEF("SP3NavDataFactory", "SP3NavDataFactory");
138  // check for expected signal support
143  TUASSERT(fact.supportedSignals.count(nsid1));
144  TURETURN();
145 }
146 
147 
148 unsigned SP3NavDataFactory_T ::
150 {
151  TUDEF("SP3NavDataFactory", "loadIntoMap");
152 
153  // test loading SP3a nav
155  std::string f2name = gnsstk::getPathData() + gnsstk::getFileSep() +
156  "test_input_SP3a.sp3";
157  // this should implicitly load into the data map
158  TUASSERT(f2.addDataSource(f2name));
159  TUASSERTE(size_t, 232, f2.size());
160 
161  // test loading SP3b nav
163  std::string f3name = gnsstk::getPathData() + gnsstk::getFileSep() +
164  "test_input_SP3b.sp3";
165  // this should implicitly load into the data map
166  TUASSERT(f3.addDataSource(f3name));
167  TUASSERTE(size_t, 232, f3.size());
168 
169  TestClass f4;
170  std::string f4name = gnsstk::getPathData() + gnsstk::getFileSep() +
171  "test_input_SP3a.sp3";
172  TUCATCH(f4.setTypeFilter({gnsstk::NavMessageType::Ephemeris}));
173  // this should implicitly load into the data map
174  TUASSERT(f4.addDataSource(f4name));
175  TUASSERTE(size_t, 116, f4.size());
176  gnsstk::NavMessageMap &nmm4(f4.getData());
177  // only one message type
178  TUASSERTE(size_t, 1, nmm4.size());
179  // and it's ephemeris.
181  nmm4.begin()->first);
182  TUCSM("convertToOrbit");
183  verifyDataType<gnsstk::OrbitDataSP3>(testFramework, nmm4);
184  TUCSM("loadIntoMap");
185 
186  TestClass f5;
187  std::string f5name = gnsstk::getPathData() + gnsstk::getFileSep() +
188  "test_input_SP3a.sp3";
189  TUCATCH(f5.setTypeFilter({gnsstk::NavMessageType::Health}));
190  // this should implicitly load into the data map
191  TUASSERT(f5.addDataSource(f5name));
192  TUASSERTE(size_t, 0, f5.size());
193  TUCSM("loadIntoMap");
194 
195  TestClass f6;
196  std::string f6name = gnsstk::getPathData() + gnsstk::getFileSep() +
197  "test_input_SP3a.sp3";
198  TUCATCH(f6.setTypeFilter({gnsstk::NavMessageType::Almanac}));
199  // this should implicitly load into the data map
200  TUASSERT(f6.addDataSource(f6name));
201  // except there isn't any data, because SP3 NAV doesn't contain almanacs
202  TUASSERTE(size_t, 0, f6.size());
203 
204  // test loading something that isn't SP3
205  TestClass f7;
206  std::string f7name = gnsstk::getPathData() + gnsstk::getFileSep() +
207  "arlm2000.15n";
208  TUASSERT(!f7.addDataSource(f7name));
209  TUASSERTE(size_t, 0, f7.size());
210 
211  TURETURN();
212 }
213 
214 
215 unsigned SP3NavDataFactory_T ::
217 {
218  TUDEF("SP3NavDataFactory", "find");
219  std::string fname;
233  fname = gnsstk::getPathData() + gnsstk::getFileSep() +
234  "test_input_SP3a.sp3";
235  TUASSERT(fact.addDataSource(fname));
236  // 116 ephemeris + 116 clock
237  TUASSERTE(size_t, 232, fact.size());
238 
239  // test find with exact epoch at start of file
240  gnsstk::CivilTime civ1(2001, 7, 22, 0, 0, 0, gnsstk::TimeSystem::GPS);
241  gnsstk::CommonTime ct1(civ1);
242  gnsstk::NavDataPtr nd1;
243  TUASSERT(fact.find(nmid1, ct1, nd1, gnsstk::SVHealth::Any,
246  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd1.get());
247  // NavData
250  uut->signal.messageType);
251  TUASSERTE(gnsstk::SatID, expSat1, uut->signal.sat);
252  TUASSERTE(gnsstk::SatID, expSat1, uut->signal.xmitSat);
254  uut->signal.system);
258  // OrbitData
259  // OrbitDataSP3
260  // Epsilon specified because of rounding errors and because of
261  // what precision is available in the source data.
262  TUASSERTFEPS(-18707.084879, uut->pos[0], 0.000001);
263  TUASSERTFEPS( 16766.780691, uut->pos[1], 0.000001);
264  TUASSERTFEPS( 8582.072924, uut->pos[2], 0.000001);
265  TUASSERTFEPS(468.885781, uut->clkBias, 0.000001);
266  TUASSERTFEPS(-10775.825536, uut->vel[0], 0.000001);
267  TUASSERTFEPS( 2077.583886, uut->vel[1], 0.000001);
268  TUASSERTFEPS(-28974.934472, uut->vel[2], 0.000001);
269  TUASSERTFEPS(-2.52832e-5, uut->clkDrift, 0.0000000001);
270  TUASSERTE(std::string, "WGS84", uut->coordSystem);
272  uut->frame);
273 
274  // test find with a different carrier/ranging code
275  TUASSERT(fact.find(nmid1b, ct1, nd1, gnsstk::SVHealth::Any,
278  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd1.get());
279  // NavData
282  uut->signal.messageType);
283  TUASSERTE(gnsstk::SatID, expSat1, uut->signal.sat);
284  TUASSERTE(gnsstk::SatID, expSat1, uut->signal.xmitSat);
286  uut->signal.system);
287  // note that we do NOT change the code/carrier on output.
291  // OrbitData
292  // OrbitDataSP3
293  // Epsilon specified because of rounding errors and because of
294  // what precision is available in the source data.
295  TUASSERTFEPS(-18707.084879, uut->pos[0], 0.000001);
296  TUASSERTFEPS( 16766.780691, uut->pos[1], 0.000001);
297  TUASSERTFEPS( 8582.072924, uut->pos[2], 0.000001);
298  TUASSERTFEPS(468.885781, uut->clkBias, 0.000001);
299  TUASSERTFEPS(-10775.825536, uut->vel[0], 0.000001);
300  TUASSERTFEPS( 2077.583886, uut->vel[1], 0.000001);
301  TUASSERTFEPS(-28974.934472, uut->vel[2], 0.000001);
302  TUASSERTFEPS(-2.52832e-5, uut->clkDrift, 0.0000000001);
303  TUASSERTE(std::string, "WGS84", uut->coordSystem);
305  uut->frame);
306 
307  // test find with exact epoch at end of file
308  gnsstk::CivilTime civ2(2001, 7, 22, 0, 45, 0, gnsstk::TimeSystem::GPS);
309  gnsstk::CommonTime ct2(civ2);
310  gnsstk::NavDataPtr nd2;
317  TUASSERT(fact.find(nmid2, ct2, nd2, gnsstk::SVHealth::Any,
320  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd2.get());
321  // NavData
324  uut->signal.messageType);
325  TUASSERTE(gnsstk::SatID, expSat2, uut->signal.sat);
326  TUASSERTE(gnsstk::SatID, expSat2, uut->signal.xmitSat);
328  uut->signal.system);
332  // OrbitData
333  // OrbitDataSP3
334  // Epsilon specified because of rounding errors and because of
335  // what precision is available in the source data.
336  TUASSERTFEPS( 21107.001443, uut->pos[0], 0.000001);
337  TUASSERTFEPS( -1108.815431, uut->pos[1], 0.000001);
338  TUASSERTFEPS( 16383.326664, uut->pos[2], 0.000001);
339  TUASSERTFEPS( -2.073849, uut->clkBias, 0.000001);
340  TUASSERTFEPS( -15090.299480, uut->vel[0], 0.000001);
341  TUASSERTFEPS( 13950.254271, uut->vel[1], 0.000001);
342  TUASSERTFEPS( 20382.028718, uut->vel[2], 0.000001);
343  TUASSERTFEPS( 8.499e-7, uut->clkDrift, 0.0000000001);
344  TUASSERTE(std::string, "WGS84", uut->coordSystem);
346  uut->frame);
347 
348  // test find with exact epoch in the middle of file
349  gnsstk::CivilTime civ3(2001, 7, 22, 0, 30, 0, gnsstk::TimeSystem::GPS);
350  gnsstk::CommonTime ct3(civ3);
351  gnsstk::NavDataPtr nd3;
358  TUASSERT(fact.find(nmid3, ct3, nd3, gnsstk::SVHealth::Any,
361  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd3.get());
362  // NavData
365  uut->signal.messageType);
366  TUASSERTE(gnsstk::SatID, expSat3, uut->signal.sat);
367  TUASSERTE(gnsstk::SatID, expSat3, uut->signal.xmitSat);
369  uut->signal.system);
373  // OrbitData
374  // OrbitDataSP3
375  // Epsilon specified because of rounding errors and because of
376  // what precision is available in the source data.
377  TUASSERTFEPS( -20916.443568, uut->pos[0], 0.000001);
378  TUASSERTFEPS( -14840.885192, uut->pos[1], 0.000001);
379  TUASSERTFEPS( -6804.522988, uut->pos[2], 0.000001);
380  TUASSERTFEPS( 2.966233, uut->clkBias, 0.000001);
381  TUASSERTFEPS( 9547.031126, uut->vel[0], 0.000001);
382  TUASSERTFEPS( -35.054953, uut->vel[1], 0.000001);
383  TUASSERTFEPS( -29243.893155, uut->vel[2], 0.000001);
384  TUASSERTFEPS( 2.133e-7, uut->clkDrift, 0.0000000001);
385  TUASSERTE(std::string, "WGS84", uut->coordSystem);
387  uut->frame);
388 
389  // Test using data where velocity is missing and must be interpolated.
390  // This test makes sure we're getting velocity data when there
391  // isn't any in the original "exact" record.
393  fname = gnsstk::getPathData() + gnsstk::getFileSep() +
394  "test_input_sp3_nav_ephemerisData.sp3";
395  TUASSERT(fact4.addDataSource(fname));
396  TUASSERTE(size_t, 4800, fact4.size());
397  gnsstk::CommonTime ct4 = gnsstk::CivilTime(1997, 4, 6, 1, 15, 0,
399  gnsstk::NavDataPtr nd4;
406  TUASSERT(fact4.find(nmid4, ct4, nd4, gnsstk::SVHealth::Any,
409  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd4.get());
410  // NavData
413  uut->signal.messageType);
414  TUASSERTE(gnsstk::SatID, expSat4, uut->signal.sat);
415  TUASSERTE(gnsstk::SatID, expSat4, uut->signal.xmitSat);
417  uut->signal.system);
421  // OrbitData
422  // OrbitDataSP3
423  TUASSERTFE(-10012.152394, uut->pos[0]);
424  TUASSERTFE(-14853.431997, uut->pos[1]);
425  TUASSERTFE(-19726.785509, uut->pos[2]);
426  TUASSERTFE(-33.642019, uut->clkBias);
427  TUASSERTFE(24978.879448941785085, uut->vel[0]);
428  TUASSERTFE(237.71409059520243545, uut->vel[1]);
429  TUASSERTFE(-12599.181107279617208, uut->vel[2]);
430  TUASSERTFE(8.4786249559075835378e-05, uut->clkDrift);
431  TUASSERTE(std::string, "ITR94", uut->coordSystem);
433  uut->frame);
434  TURETURN();
435 }
436 
437 
438 unsigned SP3NavDataFactory_T ::
440 {
441  TUDEF("SP3NavDataFactory", "find");
450  std::string fname = gnsstk::getPathData() + gnsstk::getFileSep() +
451  "test_input_sp3_nav_ephemerisData.sp3";
452  TUASSERT(fact.addDataSource(fname));
453  // 2400 ephemeris + 2400 clock
454  TUASSERTE(size_t, 4800, fact.size());
455  ct = gnsstk::CivilTime(1997,4,6,0,45,2,gnsstk::TimeSystem::GPS);
456  gnsstk::NavDataPtr nd1;
457  TUASSERT(!fact.find(nmid1, ct, nd1, gnsstk::SVHealth::Any,
460 
461  ct = gnsstk::CivilTime(1997,4,6,6,17,36,gnsstk::TimeSystem::GPS);
462  gnsstk::NavDataPtr nd2;
463  TUASSERT(fact.find(nmid1, ct, nd2, gnsstk::SVHealth::Any,
466  gnsstk::OrbitDataSP3 *uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd2.get());
467  if (uut == nullptr)
468  TURETURN();
469  // NavData
472  uut->signal.messageType);
473  TUASSERTE(gnsstk::SatID, expSat1, uut->signal.sat);
474  TUASSERTE(gnsstk::SatID, expSat1, uut->signal.xmitSat);
476  uut->signal.system);
480  // OrbitData
481  // OrbitDataSP3
482  TUASSERTFE(-15643.515779275317982, uut->pos[0]);
483  TUASSERTFE(17046.376009584488202, uut->pos[1]);
484  TUASSERTFE(12835.522993916223641, uut->pos[2]);
485  TUASSERTFE(0, uut->posSig[0]);
486  TUASSERTFE(0, uut->posSig[1]);
487  TUASSERTFE(0, uut->posSig[2]);
488  TUASSERTFE(4118.735914736347695, uut->vel[0]);
489  TUASSERTFE(-16208.344018608038823, uut->vel[1]);
490  TUASSERTFE(26087.591273316520528, uut->vel[2]);
491  TUASSERTFE(0, uut->velSig[0]);
492  TUASSERTFE(0, uut->velSig[1]);
493  TUASSERTFE(0, uut->velSig[2]);
494  TUASSERTFE(0, uut->acc[0]);
495  TUASSERTFE(0, uut->acc[1]);
496  TUASSERTFE(0, uut->acc[2]);
497  TUASSERTFE(0, uut->accSig[0]);
498  TUASSERTFE(0, uut->accSig[1]);
499  TUASSERTFE(0, uut->accSig[2]);
500  TUASSERTFE(411.55797411176871492, uut->clkBias);
501  TUASSERTFE(0, uut->biasSig);
502  TUASSERTFE(2.2909472663417080121e-06, uut->clkDrift);
503  TUASSERTFE(0, uut->driftSig);
504  TUASSERTFE(0, uut->clkDrRate);
505  TUASSERTFE(0, uut->drRateSig);
506  TUASSERTE(std::string, "ITR94", uut->coordSystem);
508  uut->frame);
509  TURETURN();
510 }
511 
512 
513 unsigned SP3NavDataFactory_T ::
515 {
516  TUDEF("SP3NavDataFactory", "find");
526  gnsstk::OrbitDataSP3 *uut = nullptr;
527  std::string fname = gnsstk::getPathData() + gnsstk::getFileSep() +
528  "test_input_sp3_nav_ephemerisData.sp3";
529  TUASSERT(fact.addDataSource(fname));
530  TUASSERTE(size_t, 4800, fact.size());
531 
532  // test really early time
533  ct = gnsstk::CivilTime(1996,4,6,0,0,0,gnsstk::TimeSystem::GPS);
534  TUASSERT(!fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
537  // test just before data start
538  ct = gnsstk::CivilTime(1997,4,5,23,59,59,gnsstk::TimeSystem::GPS);
539  TUASSERT(!fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
542  // exactly at start
543  // SP3EphemerisStore rejects this case
544  ct = gnsstk::CivilTime(1997,4,6,0,0,0,gnsstk::TimeSystem::GPS);
545  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
548  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
549  TUASSERTFE(-21401.653416, uut->pos[0]);
550  TUASSERTFE(15729.974324, uut->pos[1]);
551  TUASSERTFE(36.858903, uut->pos[2]);
552  TUASSERTFE(0, uut->posSig[0]);
553  TUASSERTFE(0, uut->posSig[1]);
554  TUASSERTFE(0, uut->posSig[2]);
555  TUASSERTFE(0, uut->vel[0]);
556  TUASSERTFE(0, uut->vel[1]);
557  TUASSERTFE(0, uut->vel[2]);
558  TUASSERTFE(0, uut->velSig[0]);
559  TUASSERTFE(0, uut->velSig[1]);
560  TUASSERTFE(0, uut->velSig[2]);
561  TUASSERTFE(0, uut->acc[0]);
562  TUASSERTFE(0, uut->acc[1]);
563  TUASSERTFE(0, uut->acc[2]);
564  TUASSERTFE(0, uut->accSig[0]);
565  TUASSERTFE(0, uut->accSig[1]);
566  TUASSERTFE(0, uut->accSig[2]);
567  TUASSERTFE(16.836506, uut->clkBias);
568  TUASSERTFE(0, uut->biasSig);
569  TUASSERTFE(0, uut->clkDrift);
570  TUASSERTFE(0, uut->driftSig);
571  TUASSERTFE(0, uut->clkDrRate);
572  TUASSERTFE(0, uut->drRateSig);
573  TUASSERTE(std::string, "ITR94", uut->coordSystem);
575  uut->frame);
576  // Just after start - can't interpolate
577  ct = gnsstk::CivilTime(1997,4,6,0,0,2,gnsstk::TimeSystem::GPS);
578  TUASSERT(!fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
581  // exact match but too early to interpolate
582  // SP3EphemerisStore rejects this case
583  ct = gnsstk::CivilTime(1997,4,6,0,15,0,gnsstk::TimeSystem::GPS);
584  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
587  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
588  TUASSERTFE(-21435.113111, uut->pos[0]);
589  TUASSERTFE(15409.762699, uut->pos[1]);
590  TUASSERTFE(-2801.263736, uut->pos[2]);
591  TUASSERTFE(0, uut->posSig[0]);
592  TUASSERTFE(0, uut->posSig[1]);
593  TUASSERTFE(0, uut->posSig[2]);
594  TUASSERTFE(0, uut->vel[0]);
595  TUASSERTFE(0, uut->vel[1]);
596  TUASSERTFE(0, uut->vel[2]);
597  TUASSERTFE(0, uut->velSig[0]);
598  TUASSERTFE(0, uut->velSig[1]);
599  TUASSERTFE(0, uut->velSig[2]);
600  TUASSERTFE(0, uut->acc[0]);
601  TUASSERTFE(0, uut->acc[1]);
602  TUASSERTFE(0, uut->acc[2]);
603  TUASSERTFE(0, uut->accSig[0]);
604  TUASSERTFE(0, uut->accSig[1]);
605  TUASSERTFE(0, uut->accSig[2]);
606  TUASSERTFE(16.869907, uut->clkBias);
607  TUASSERTFE(0, uut->biasSig);
608  TUASSERTFE(0, uut->clkDrift);
609  TUASSERTFE(0, uut->driftSig);
610  TUASSERTFE(0, uut->clkDrRate);
611  TUASSERTFE(0, uut->drRateSig);
612  TUASSERTE(std::string, "ITR94", uut->coordSystem);
614  uut->frame);
615  // Still not enough data to interpolate
616  ct = gnsstk::CivilTime(1997,4,6,0,15,2,gnsstk::TimeSystem::GPS);
617  TUASSERT(!fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
620  // exact match but too early to interpolate
621  // SP3EphemerisStore rejects this case
622  ct = gnsstk::CivilTime(1997,4,6,0,30,0,gnsstk::TimeSystem::GPS);
623  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
626  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
627  TUASSERTFE(-21246.756641, uut->pos[0]);
628  TUASSERTFE(14879.740466, uut->pos[1]);
629  TUASSERTFE(-5591.090702, uut->pos[2]);
630  TUASSERTFE(0, uut->posSig[0]);
631  TUASSERTFE(0, uut->posSig[1]);
632  TUASSERTFE(0, uut->posSig[2]);
633  TUASSERTFE(0, uut->vel[0]);
634  TUASSERTFE(0, uut->vel[1]);
635  TUASSERTFE(0, uut->vel[2]);
636  TUASSERTFE(0, uut->velSig[0]);
637  TUASSERTFE(0, uut->velSig[1]);
638  TUASSERTFE(0, uut->velSig[2]);
639  TUASSERTFE(0, uut->acc[0]);
640  TUASSERTFE(0, uut->acc[1]);
641  TUASSERTFE(0, uut->acc[2]);
642  TUASSERTFE(0, uut->accSig[0]);
643  TUASSERTFE(0, uut->accSig[1]);
644  TUASSERTFE(0, uut->accSig[2]);
645  TUASSERTFE(16.861797, uut->clkBias);
646  TUASSERTFE(0, uut->biasSig);
647  TUASSERTFE(0, uut->clkDrift);
648  TUASSERTFE(0, uut->driftSig);
649  TUASSERTFE(0, uut->clkDrRate);
650  TUASSERTFE(0, uut->drRateSig);
651  TUASSERTE(std::string, "ITR94", uut->coordSystem);
653  uut->frame);
654  // Still not enough data to interpolate
655  ct = gnsstk::CivilTime(1997,4,6,0,30,2,gnsstk::TimeSystem::GPS);
656  TUASSERT(!fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
659  // Still not enough data to interpolate
660  ct = gnsstk::CivilTime(1997,4,6,0,45,2,gnsstk::TimeSystem::GPS);
661  TUASSERT(!fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
664  // exact match but too early to interpolate
665  // SP3EphemerisStore rejects this case
666  ct = gnsstk::CivilTime(1997,4,6,1,0,0,gnsstk::TimeSystem::GPS);
667  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
670  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
671  TUASSERTFE(-20332.738063, uut->pos[0]);
672  TUASSERTFE(13115.151460, uut->pos[1]);
673  TUASSERTFE(-10834.501567, uut->pos[2]);
674  TUASSERTFE(0, uut->posSig[0]);
675  TUASSERTFE(0, uut->posSig[1]);
676  TUASSERTFE(0, uut->posSig[2]);
677  TUASSERTFE(0, uut->vel[0]);
678  TUASSERTFE(0, uut->vel[1]);
679  TUASSERTFE(0, uut->vel[2]);
680  TUASSERTFE(0, uut->velSig[0]);
681  TUASSERTFE(0, uut->velSig[1]);
682  TUASSERTFE(0, uut->velSig[2]);
683  TUASSERTFE(0, uut->acc[0]);
684  TUASSERTFE(0, uut->acc[1]);
685  TUASSERTFE(0, uut->acc[2]);
686  TUASSERTFE(0, uut->accSig[0]);
687  TUASSERTFE(0, uut->accSig[1]);
688  TUASSERTFE(0, uut->accSig[2]);
689  TUASSERTFE(16.770325, uut->clkBias);
690  TUASSERTFE(0, uut->biasSig);
691  TUASSERTFE(0, uut->clkDrift);
692  TUASSERTFE(0, uut->driftSig);
693  TUASSERTFE(0, uut->clkDrRate);
694  TUASSERTFE(0, uut->drRateSig);
695  TUASSERTE(std::string, "ITR94", uut->coordSystem);
697  uut->frame);
698  // now we can interpolate
699  ct = gnsstk::CivilTime(1997,4,6,1,0,2,gnsstk::TimeSystem::GPS);
700  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
703  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
704  TUASSERTFE(-20331.405273885055067, uut->pos[0]);
705  TUASSERTFE(13112.643368661305431, uut->pos[1]);
706  TUASSERTFE(-10839.975527923066693, uut->pos[2]);
707  TUASSERTFE(0, uut->posSig[0]);
708  TUASSERTFE(0, uut->posSig[1]);
709  TUASSERTFE(0, uut->posSig[2]);
710  TUASSERTFE(6665.3850065908245597, uut->vel[0]);
711  TUASSERTFE(-12543.536761410498002, uut->vel[1]);
712  TUASSERTFE(-27367.485483716285671, uut->vel[2]);
713  TUASSERTFE(0, uut->velSig[0]);
714  TUASSERTFE(0, uut->velSig[1]);
715  TUASSERTFE(0, uut->velSig[2]);
716  TUASSERTFE(0, uut->acc[0]);
717  TUASSERTFE(0, uut->acc[1]);
718  TUASSERTFE(0, uut->acc[2]);
719  TUASSERTFE(0, uut->accSig[0]);
720  TUASSERTFE(0, uut->accSig[1]);
721  TUASSERTFE(0, uut->accSig[2]);
722  TUASSERTFE(16.770692382796031694, uut->clkBias);
723  TUASSERTFE(0, uut->biasSig);
724  TUASSERTFE(0.00018445880134187152277, uut->clkDrift);
725  TUASSERTFE(0, uut->driftSig);
726  TUASSERTFE(0, uut->clkDrRate);
727  TUASSERTFE(0, uut->drRateSig);
728  TUASSERTE(std::string, "ITR94", uut->coordSystem);
730  uut->frame);
731  // interpolating near the end of the data set
732  ct = gnsstk::CivilTime(1997,4,6,22,30,2,gnsstk::TimeSystem::GPS);
733  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
736  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
737  TUASSERTFE(-16143.2374434571866, uut->pos[0]);
738  TUASSERTFE(15106.62860632441334, uut->pos[1]);
739  TUASSERTFE(14841.24585356388161, uut->pos[2]);
740  TUASSERTFE(0, uut->posSig[0]);
741  TUASSERTFE(0, uut->posSig[1]);
742  TUASSERTFE(0, uut->posSig[2]);
743  TUASSERTFE(-18584.962108554645965, uut->vel[0]);
744  TUASSERTFE(2647.4717546382453293, uut->vel[1]);
745  TUASSERTFE(-23100.125997620009002, uut->vel[2]);
746  TUASSERTFE(0, uut->velSig[0]);
747  TUASSERTFE(0, uut->velSig[1]);
748  TUASSERTFE(0, uut->velSig[2]);
749  TUASSERTFE(0, uut->acc[0]);
750  TUASSERTFE(0, uut->acc[1]);
751  TUASSERTFE(0, uut->acc[2]);
752  TUASSERTFE(0, uut->accSig[0]);
753  TUASSERTFE(0, uut->accSig[1]);
754  TUASSERTFE(0, uut->accSig[2]);
755  TUASSERTFE(16.957767942749853773, uut->clkBias);
756  TUASSERTFE(0, uut->biasSig);
757  TUASSERTFE(-2.9789139950418162616e-05, uut->clkDrift);
758  TUASSERTFE(0, uut->driftSig);
759  TUASSERTFE(0, uut->clkDrRate);
760  TUASSERTFE(0, uut->drRateSig);
761  TUASSERTE(std::string, "ITR94", uut->coordSystem);
763  uut->frame);
764  // The last time we can interpolate
765  ct = gnsstk::CivilTime(1997,4,6,22,45,0,gnsstk::TimeSystem::GPS);
766  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
769  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
770  TUASSERTFE(-17689.961147, uut->pos[0]);
771  TUASSERTFE(15351.609005, uut->pos[1]);
772  TUASSERTFE(12646.527369, uut->pos[2]);
773  TUASSERTFE(0, uut->posSig[0]);
774  TUASSERTFE(0, uut->posSig[1]);
775  TUASSERTFE(0, uut->posSig[2]);
776  TUASSERTFE(-15823.931961018606671, uut->vel[0]);
777  TUASSERTFE(2741.9894129365502522, uut->vel[1]);
778  TUASSERTFE(-25711.116386300676822, uut->vel[2]);
779  TUASSERTFE(0, uut->velSig[0]);
780  TUASSERTFE(0, uut->velSig[1]);
781  TUASSERTFE(0, uut->velSig[2]);
782  TUASSERTFE(0, uut->acc[0]);
783  TUASSERTFE(0, uut->acc[1]);
784  TUASSERTFE(0, uut->acc[2]);
785  TUASSERTFE(0, uut->accSig[0]);
786  TUASSERTFE(0, uut->accSig[1]);
787  TUASSERTFE(0, uut->accSig[2]);
788  TUASSERTFE(16.892600, uut->clkBias);
789  TUASSERTFE(0, uut->biasSig);
790  TUASSERTFE(-4.1154966490297820213e-05, uut->clkDrift);
791  TUASSERTFE(0, uut->driftSig);
792  TUASSERTFE(0, uut->clkDrRate);
793  TUASSERTFE(0, uut->drRateSig);
794  TUASSERTE(std::string, "ITR94", uut->coordSystem);
796  uut->frame);
797  // no longer able to interpolate
798  ct = gnsstk::CivilTime(1997,4,6,22,45,2,gnsstk::TimeSystem::GPS);
799  TUASSERT(!fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
802  // Exact match but too late to interpolate. The last possible
803  // time we can get from the source data.
804  // SP3EphemerisStore rejects this case
805  ct = gnsstk::CivilTime(1997,4,6,23,45,0,gnsstk::TimeSystem::GPS);
806  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
809  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
810  TUASSERTFE(-21219.029296, uut->pos[0]);
811  TUASSERTFE(15851.176408, uut->pos[1]);
812  TUASSERTFE(2112.519321, uut->pos[2]);
813  TUASSERTFE(0, uut->posSig[0]);
814  TUASSERTFE(0, uut->posSig[1]);
815  TUASSERTFE(0, uut->posSig[2]);
816  TUASSERTFE(0, uut->vel[0]);
817  TUASSERTFE(0, uut->vel[1]);
818  TUASSERTFE(0, uut->vel[2]);
819  TUASSERTFE(0, uut->velSig[0]);
820  TUASSERTFE(0, uut->velSig[1]);
821  TUASSERTFE(0, uut->velSig[2]);
822  TUASSERTFE(0, uut->acc[0]);
823  TUASSERTFE(0, uut->acc[1]);
824  TUASSERTFE(0, uut->acc[2]);
825  TUASSERTFE(0, uut->accSig[0]);
826  TUASSERTFE(0, uut->accSig[1]);
827  TUASSERTFE(0, uut->accSig[2]);
828  TUASSERTFE(16.977759, uut->clkBias);
829  TUASSERTFE(0, uut->biasSig);
830  TUASSERTFE(0, uut->clkDrift);
831  TUASSERTFE(0, uut->driftSig);
832  TUASSERTFE(0, uut->clkDrRate);
833  TUASSERTFE(0, uut->drRateSig);
834  TUASSERTE(std::string, "ITR94", uut->coordSystem);
836  uut->frame);
837  TURETURN();
838 }
839 
840 
841 unsigned SP3NavDataFactory_T ::
843 {
844  TUDEF("SP3NavDataFactory", "addDataSource");
854  gnsstk::OrbitDataSP3 *uut = nullptr;
855  std::string fname = gnsstk::getPathData() + gnsstk::getFileSep() +
856  "test_input_SP3c.sp3";
857  TUASSERT(fact.addDataSource(fname));
858  TUASSERTE(size_t, 1500, fact.size());
859  // exact match
860  ct = gnsstk::CivilTime(2011,10,9,3,0,0,gnsstk::TimeSystem::GPS);
861  TUCSM("find");
862  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
865  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
866  TUASSERTFE(10376.802922, uut->pos[0]);
867  TUASSERTFE(-12375.157793, uut->pos[1]);
868  TUASSERTFE(21068.993967, uut->pos[2]);
869  TUASSERTFE(240, uut->posSig[0]);
870  TUASSERTFE(431, uut->posSig[1]);
871  TUASSERTFE(95, uut->posSig[2]);
872  TUASSERTFE(13892.969748999999865, uut->vel[0]);
873  TUASSERTFE(22939.105573000000732, uut->vel[1]);
874  TUASSERTFE(6812.2288810000000012, uut->vel[2]);
875  TUASSERTFE(3739, uut->velSig[0]);
876  TUASSERTFE(7214, uut->velSig[1]);
877  TUASSERTFE(3199, uut->velSig[2]);
879  TUASSERTFE(0.16868203840330744381, uut->acc[0]);
880  TUASSERTFE(-0.0048099658207224796347, uut->acc[1]);
881  TUASSERTFE(-0.44889948984246021979, uut->acc[2]);
882  TUASSERTFE(0, uut->accSig[0]);
883  TUASSERTFE(0, uut->accSig[1]);
884  TUASSERTFE(0, uut->accSig[2]);
885  TUASSERTFE(-103.26419599999999832, uut->clkBias);
886  TUASSERTFE(0.0010629999999999999259, uut->biasSig);
887  TUASSERTFE(1.3259000000000000871e-06, uut->clkDrift);
888  TUASSERTFE(1.0175328004541179996e-07, uut->driftSig);
889  TUASSERTE(std::string, "WGS84", uut->coordSystem);
892  uut->frame);
894  TUASSERTFE(-2.1102292768909279853e-13, uut->clkDrRate);
895  TUASSERTFE(1.130592000504575508e-10, uut->drRateSig);
896  // interpolated match
897  ct = gnsstk::CivilTime(2011,10,9,2,1,3,gnsstk::TimeSystem::GPS);
898  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
901  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
902  TUASSERTFE(6606.1838019497754431, uut->pos[0]);
903  TUASSERTFE(-20053.58342304438338, uut->pos[1]);
904  TUASSERTFE(16014.263355443908949, uut->pos[2]);
905  TUASSERTFE(196.15555052049893447, uut->posSig[0]);
906  TUASSERTFE(570.07017111931054387, uut->posSig[1]);
907  TUASSERTFE(220.51077071199944157, uut->posSig[2]);
908  TUASSERTFE(7401.8992499702417263, uut->vel[0]);
909  TUASSERTFE(19171.152303792601742, uut->vel[1]);
910  TUASSERTFE(21143.244357782645238, uut->vel[2]);
911  TUASSERTFE(4345.3593637350641075, uut->velSig[0]);
912  TUASSERTFE(8512.6561072323365806, uut->velSig[1]);
913  TUASSERTFE(13030.428695940898251, uut->velSig[2]);
914  TUASSERTFE(0.17323990334114644507, uut->acc[0]);
915  TUASSERTFE(0.21491163411773372971, uut->acc[1]);
916  TUASSERTFE(-0.34305460226999479056, uut->acc[2]);
917  TUASSERTFE(0, uut->accSig[0]);
918  TUASSERTFE(0, uut->accSig[1]);
919  TUASSERTFE(0, uut->accSig[2]);
920  TUASSERTFE(-103.26888741910860858, uut->clkBias);
921  TUASSERTFE(0.0012506254435281571272, uut->biasSig);
922  TUASSERTFE(1.3265841739403660333e-06, uut->clkDrift);
923  TUASSERTFE(9.9773393246897238821e-08, uut->driftSig);
924  TUASSERTFE(-2.5152847174005956486e-13, uut->clkDrRate);
925  TUASSERTFE(1.1085932582988582625e-10, uut->drRateSig);
926  TUASSERTE(std::string, "WGS84", uut->coordSystem);
929  uut->frame);
930  TURETURN();
931 }
932 
933 
934 unsigned SP3NavDataFactory_T ::
936 {
937  TUDEF("SP3NavDataFactory", "addDataSource");
947  gnsstk::OrbitDataSP3 *uut = nullptr;
948  std::string fname = gnsstk::getPathData() + gnsstk::getFileSep() +
949  "test_input_SP3c_pos.sp3";
950  TUASSERT(fact.addDataSource(fname));
951  TUASSERTE(size_t, 1500, fact.size());
952  // exact match
953  ct = gnsstk::CivilTime(2011,10,9,3,0,0,gnsstk::TimeSystem::GPS);
954  TUCSM("find");
955  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
958  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
959  TUASSERTFE(10376.802922, uut->pos[0]);
960  TUASSERTFE(-12375.157793, uut->pos[1]);
961  TUASSERTFE(21068.993967, uut->pos[2]);
962  TUASSERTFE(240, uut->posSig[0]);
963  TUASSERTFE(431, uut->posSig[1]);
964  TUASSERTFE(95, uut->posSig[2]);
965  TUASSERTFE(13892.970831807802824, uut->vel[0]);
966  TUASSERTFE(22939.106487579352688, uut->vel[1]);
967  TUASSERTFE(6812.2288926808514589, uut->vel[2]);
968  TUASSERTFE(0, uut->velSig[0]);
969  TUASSERTFE(0, uut->velSig[1]);
970  TUASSERTFE(0, uut->velSig[2]);
971  TUASSERTFE(0, uut->acc[0]);
972  TUASSERTFE(0, uut->acc[1]);
973  TUASSERTFE(0, uut->acc[2]);
974  TUASSERTFE(0, uut->accSig[0]);
975  TUASSERTFE(0, uut->accSig[1]);
976  TUASSERTFE(0, uut->accSig[2]);
977  TUASSERTFE(-103.26419599999999832, uut->clkBias);
978  TUASSERTFE(0.0010629999999999999259, uut->biasSig);
979  TUASSERTFE(1.3253443562296393209e-06, uut->clkDrift);
980  TUASSERTFE(1.1811111111111110024e-06, uut->driftSig);
981  TUASSERTFE(0, uut->clkDrRate);
982  TUASSERTFE(0, uut->drRateSig);
983  TUASSERTE(std::string, "WGS84", uut->coordSystem);
986  uut->frame);
987  // interpolated match
988  ct = gnsstk::CivilTime(2011,10,9,2,1,3,gnsstk::TimeSystem::GPS);
989  TUASSERT(fact.find(nmid1, ct, nd, gnsstk::SVHealth::Any,
992  uut = dynamic_cast<gnsstk::OrbitDataSP3*>(nd.get());
993 
994  TUASSERTFE(6606.1838019497745336, uut->pos[0]);
995  TUASSERTFE(-20053.583423044379742, uut->pos[1]);
996  TUASSERTFE(16014.263355443905311, uut->pos[2]);
997  TUASSERTFE(196.15555052049893447, uut->posSig[0]);
998  TUASSERTFE(570.07017111931054387, uut->posSig[1]);
999  TUASSERTFE(220.51077071199944157, uut->posSig[2]);
1000  TUASSERTFE(7401.9009258281712391, uut->vel[0]);
1001  TUASSERTFE(19171.152904308662983, uut->vel[1]);
1002  TUASSERTFE(21143.244419124275737, uut->vel[2]);
1003  TUASSERTFE(0, uut->velSig[0]);
1004  TUASSERTFE(0, uut->velSig[1]);
1005  TUASSERTFE(0, uut->velSig[2]);
1006  TUASSERTFE(0, uut->acc[0]);
1007  TUASSERTFE(0, uut->acc[1]);
1008  TUASSERTFE(0, uut->acc[2]);
1009  TUASSERTFE(0, uut->accSig[0]);
1010  TUASSERTFE(0, uut->accSig[1]);
1011  TUASSERTFE(0, uut->accSig[2]);
1012  TUASSERTFE(-103.26888741910859437, uut->clkBias);
1013  TUASSERTFE(0.0012506254435281571272, uut->biasSig);
1014  TUASSERTFE(1.3266807555790851962e-06, uut->clkDrift);
1015  TUASSERTFE(1.3895838261423968146e-06, uut->driftSig);
1016  TUASSERTFE(0, uut->clkDrRate);
1017  TUASSERTFE(0, uut->drRateSig);
1018  TUASSERTE(std::string, "WGS84", uut->coordSystem);
1021  uut->frame);
1022  TURETURN();
1023 }
1024 
1025 
1026 unsigned SP3NavDataFactory_T ::
1027 loadIntoMapFGNSSTest(bool badPos, bool badClk, bool rcBefore, bool rcAfter)
1028 {
1029  using namespace gnsstk;
1030  TUDEF("SP3NavDataFactory", "loadIntoMap");
1031 
1032  // test loading SP3c with mixed systems nav
1033  TestClass uut;
1034  ObsID
1035  expOidGPS(ObservationType::NavMsg,CarrierBand::L1,TrackingCode::CA),
1036  expOidGal(ObservationType::NavMsg,CarrierBand::L5,TrackingCode::E5aI),
1037  expOidQZS(ObservationType::NavMsg,CarrierBand::L1,TrackingCode::CA),
1038  expOidGLO(ObservationType::NavMsg,CarrierBand::G1,TrackingCode::Standard),
1039  expOidBei(ObservationType::NavMsg,CarrierBand::B1,TrackingCode::B1I),
1040  expOidOth(ObservationType::NavMsg, CarrierBand::Unknown,
1041  TrackingCode::Unknown);
1042  NavType
1043  expNTGPS(NavType::GPSLNAV),
1044  expNTGal(NavType::GalFNAV),
1045  expNTQZS(NavType::GPSLNAV),
1046  expNTGLO(NavType::GloCivilF),
1047  expNTBei(NavType::BeiDou_D1),
1048  expNTOth(NavType::Unknown);
1049 
1050  std::string fname = getPathData() + getFileSep() +
1051  "test_input_SP3c_mgex1.sp3";
1052  uut.rejectBadPositions(badPos);
1053  uut.rejectBadClocks(badClk);
1054  uut.useRinexClockData(rcBefore);
1055  // this should implicitly load into the data map
1056  TUASSERT(uut.addDataSource(fname));
1057  uut.useRinexClockData(rcAfter);
1058  unsigned gps = 0, gal = 0, qzs = 0, glo = 0, irn = 0, bei = 0, leo = 0,
1059  other = 0;
1060  unsigned gpsExp = 320, galExp = 110, qzsExp = 10, gloExp = 230, irnExp = 0,
1061  beiExp = 80, leoExp = 50, otherExp = 0, allExp = 800;
1062  if (!rcBefore && !rcAfter)
1063  {
1064  if ((badPos == false) && (badClk == false))
1065  {
1066  // default values apply to these conditions
1067  }
1068  else if ((badPos == false) && (badClk == true))
1069  {
1070  galExp = 102;
1071  beiExp = 74;
1072  allExp = 786;
1073  }
1074  else if ((badPos == true) && (badClk == false))
1075  {
1076  // all positions good?
1077  }
1078  else if ((badPos == true) && (badClk == true))
1079  {
1080  galExp = 102;
1081  beiExp = 74;
1082  allExp = 786;
1083  }
1084  }
1085  else
1086  {
1087  // end results should be the same whether the change took
1088  // place before or after the addDataSource call.
1089  if ((badPos == false) && (badClk == false))
1090  {
1091  // Lazily divide everything by 2 since you USUALLY will
1092  // have P/V in pairs.
1093  gpsExp >>= 1;
1094  galExp >>= 1;
1095  qzsExp >>= 1;
1096  gloExp >>= 1;
1097  irnExp >>= 1;
1098  beiExp >>= 1;
1099  leoExp >>= 1;
1100  otherExp >>= 1;
1101  allExp >>= 1;
1102  }
1103  else if ((badPos == false) && (badClk == true))
1104  {
1105  gpsExp >>= 1;
1106  galExp = 51;
1107  qzsExp >>= 1;
1108  gloExp >>= 1;
1109  irnExp >>= 1;
1110  beiExp = 37;
1111  leoExp >>= 1;
1112  otherExp >>= 1;
1113  allExp = 393;
1114  }
1115  else if ((badPos == true) && (badClk == false))
1116  {
1117  gpsExp >>= 1;
1118  galExp >>= 1;
1119  qzsExp >>= 1;
1120  gloExp >>= 1;
1121  irnExp >>= 1;
1122  beiExp >>= 1;
1123  leoExp >>= 1;
1124  otherExp >>= 1;
1125  allExp >>= 1;
1126  }
1127  else if ((badPos == true) && (badClk == true))
1128  {
1129  gpsExp >>= 1;
1130  galExp = 51;
1131  qzsExp >>= 1;
1132  gloExp >>= 1;
1133  irnExp >>= 1;
1134  beiExp = 37;
1135  leoExp >>= 1;
1136  otherExp >>= 1;
1137  allExp = 393;
1138  }
1139  }
1140  TUASSERTE(size_t, allExp, uut.size());
1141  for (auto& nmti : uut.getData())
1142  {
1143  for (auto& sati : nmti.second)
1144  {
1145  for (auto& ti : sati.second)
1146  {
1147  OrbitDataSP3 *od = dynamic_cast<OrbitDataSP3*>(
1148  ti.second.get());
1149  TUASSERTE(SatID, od->signal.sat, od->signal.xmitSat);
1151  od->signal.system);
1152  switch (od->signal.sat.system)
1153  {
1154  case SatelliteSystem::GPS:
1155  gps++;
1156  TUASSERTE(ObsID, expOidGPS, od->signal.obs);
1157  TUASSERTE(NavType, expNTGPS, od->signal.nav);
1158  break;
1159  case SatelliteSystem::Galileo:
1160  gal++;
1161  TUASSERTE(ObsID, expOidGal, od->signal.obs);
1162  TUASSERTE(NavType, expNTGal, od->signal.nav);
1163  break;
1164  case SatelliteSystem::Glonass:
1165  glo++;
1166  TUASSERTE(ObsID, expOidGLO, od->signal.obs);
1167  TUASSERTE(NavType, expNTGLO, od->signal.nav);
1168  break;
1169  case SatelliteSystem::BeiDou:
1170  bei++;
1171  TUASSERTE(ObsID, expOidBei, od->signal.obs);
1172  TUASSERTE(NavType, expNTBei, od->signal.nav);
1173  break;
1174  case SatelliteSystem::QZSS:
1175  qzs++;
1176  TUASSERTE(ObsID, expOidQZS, od->signal.obs);
1177  TUASSERTE(NavType, expNTQZS, od->signal.nav);
1178  break;
1179  case SatelliteSystem::IRNSS:
1180  irn++;
1181  TUASSERTE(ObsID, expOidOth, od->signal.obs);
1182  TUASSERTE(NavType, expNTOth, od->signal.nav);
1183  break;
1184  case SatelliteSystem::LEO:
1185  leo++;
1186  TUASSERTE(ObsID, expOidOth, od->signal.obs);
1187  TUASSERTE(NavType, expNTOth, od->signal.nav);
1188  break;
1189  default:
1190  other++;
1191  TUASSERTE(ObsID, expOidOth, od->signal.obs);
1192  TUASSERTE(NavType, expNTOth, od->signal.nav);
1193  break;
1194  }
1195  }
1196  }
1197  }
1198  TUASSERTE(unsigned, gpsExp, gps);
1199  TUASSERTE(unsigned, galExp, gal);
1200  TUASSERTE(unsigned, gloExp, glo);
1201  TUASSERTE(unsigned, beiExp, bei);
1202  TUASSERTE(unsigned, qzsExp, qzs);
1203  TUASSERTE(unsigned, irnExp, irn);
1204  TUASSERTE(unsigned, leoExp, leo);
1205  TUASSERTE(unsigned, otherExp, other);
1206  // make sure we can find data
1212  gnsstk::CivilTime civ1(2016, 5, 1, 0, 15, 0, gnsstk::TimeSystem::TAI);
1213  gnsstk::CommonTime ct1(civ1);
1214  gnsstk::NavDataPtr nd1;
1215  if (rcBefore || rcAfter)
1216  {
1218  TURETURN();
1219  }
1220  TUASSERT(uut.find(nmid1, ct1, nd1, gnsstk::SVHealth::Any,
1223 
1229  TUASSERT(uut.find(nmid2, ct1, nd1, gnsstk::SVHealth::Any,
1232  TURETURN();
1233 }
1234 
1235 
1236 template <class NavClass>
1239  gnsstk::NavMessageMap& nmm)
1240 {
1241  for (auto& nmti : nmm)
1242  {
1243  for (auto& sati : nmti.second)
1244  {
1245  for (auto& ti : sati.second)
1246  {
1247  TUASSERT(dynamic_cast<NavClass*>(ti.second.get()) != nullptr);
1248  }
1249  }
1250  }
1251 }
1252 
1253 
1254 unsigned SP3NavDataFactory_T ::
1256 {
1257  using namespace gnsstk;
1258  TUDEF("SP3NavDataFactory", "addRinexClockTest");
1259 
1260  // test loading SP3c with mixed systems nav
1261  TestClass uut, uut2;
1262  std::string fnameSP3 = getPathData() + getFileSep() +
1263  "test_input_SP3c_mgex1.sp3";
1264  std::string fnameClk = getPathData() + getFileSep() +
1265  "test_input_rinex3_clock_RinexClockExample.96c";
1266  // this should implicitly load into the data map
1267  TUASSERT(uut.addDataSource(fnameSP3));
1268  TUASSERTE(size_t, 786, uut.size());
1269  // this should fail because it's a different time system
1270  TUASSERT(!uut.addDataSource(fnameClk));
1271  TUASSERTE(size_t, 786, uut.size());
1272  // Make sure time system incompatibility is flagged as an error
1273  fnameSP3 = getPathData() + getFileSep() + "test_input_SP3c.sp3";
1274  fnameClk = getPathData() + getFileSep() +
1275  "test_input_rinex3_clock_RinexClockExample.96c";
1276  TUASSERT(!uut.addDataSource(fnameSP3));
1277  // First, add appropriate SP3 data (time system matching)
1278  TUASSERT(uut2.addDataSource(fnameSP3));
1279  TUASSERTE(size_t, 1500, uut2.size());
1280  // Add the RINEX clock data which should clear the SP3 clock records out
1281  TUASSERT(uut2.addDataSource(fnameClk));
1282  TUASSERTE(size_t, 751, uut2.size());
1283  TURETURN();
1284 }
1285 
1286 
1287 unsigned SP3NavDataFactory_T ::
1289 {
1290  TUDEF("SP3NavDataFactory", "setPosGapInterval");
1291  TestClass uut;
1292  std::string fname = gnsstk::getPathData() + gnsstk::getFileSep() +
1293  "test_input_sp3_nav_2015_200.sp3";
1294  TUASSERT(uut.addDataSource(fname));
1295  TUASSERTE(size_t, 17856, uut.size());
1296  gnsstk::NavDataPtr navOut;
1302  gnsstk::CommonTime when = gnsstk::GPSWeekSecond(1854,3599.926);
1303  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1306  // set a tiny position gap interval and expect failure
1307  TUCATCH(uut.setPosGapInterval(1));
1308  TUASSERT(!uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1311  // set a reasonable gap interval and expect success
1312  TUCATCH(uut.setPosGapInterval(301));
1313  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1316  // set a slightly unreasonable gap interval and expect failure
1317  TUCATCH(uut.setPosGapInterval(299));
1318  TUASSERT(!uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1321  // disable and verify
1322  TUCATCH(uut.disablePosDataGapCheck());
1323  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1326  // set a tiny clock gap interval and expect failure
1327  TUCATCH(uut.setClkGapInterval(1));
1328  TUASSERT(!uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1331  // disable and verify
1332  TUCATCH(uut.disableClkDataGapCheck());
1333  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1336  // set a tiny max interval and expect failure
1337  TUCATCH(uut.setPosMaxInterval(1));
1338  TUASSERT(!uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1341  // set a reasonable max interval and expect success
1342  TUCATCH(uut.setPosMaxInterval(2701));
1343  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1346  // set a slightly unreasonable max interval and expect failure
1347  TUCATCH(uut.setPosMaxInterval(2699));
1348  TUASSERT(!uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1351  // disable and verify
1352  TUCATCH(uut.disablePosIntervalCheck());
1353  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1356  // set a tiny clock max interval and expect failure
1357  TUCATCH(uut.setClockMaxInterval(1));
1358  TUASSERT(!uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1361  // set a reasonable clock max interval and expect success
1362  TUCATCH(uut.setClockMaxInterval(2701));
1363  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1366  // set a slightly unreasonable clock max interval and expect failure
1367  TUCATCH(uut.setClockMaxInterval(2699));
1368  TUASSERT(!uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1371  // disable and verify
1372  TUCATCH(uut.disableClockIntervalCheck());
1373  TUASSERT(uut.find(nmid, when, navOut, gnsstk::SVHealth::Any,
1376  TURETURN();
1377 }
1378 
1379 
1380 unsigned SP3NavDataFactory_T ::
1382 {
1383  TUDEF("SP3NavDataFactory", "nomTimeStep");
1384  TestClass uut;
1385  std::string fname = gnsstk::getPathData() + gnsstk::getFileSep() +
1386  "test_input_sp3_nav_2015_200.sp3";
1387  TUASSERT(uut.addDataSource(fname));
1388  TUASSERTE(size_t, 17856, uut.size());
1390  TUASSERTE(double, 300.0, uut.getPositionTimeStep(satID));
1391  TUASSERTE(double, 300.0, uut.getClockTimeStep(satID));
1392  TURETURN();
1393 }
1394 
1395 
1396 int main()
1397 {
1398  SP3NavDataFactory_T testClass;
1399  unsigned errorTotal = 0;
1400 
1401  errorTotal += testClass.constructorTest();
1402  errorTotal += testClass.loadIntoMapTest();
1403  errorTotal += testClass.findExactTest();
1404  errorTotal += testClass.findInterpTest();
1405  errorTotal += testClass.findEdgeTest();
1406  errorTotal += testClass.sp3cPVTest();
1407  errorTotal += testClass.sp3cPTest();
1408  errorTotal += testClass.loadIntoMapFGNSSTest(false, false, false, false);
1409  errorTotal += testClass.loadIntoMapFGNSSTest(false, true, false, false);
1410  errorTotal += testClass.loadIntoMapFGNSSTest(true, false, false, false);
1411  errorTotal += testClass.loadIntoMapFGNSSTest(true, true, false, false);
1412 
1413  errorTotal += testClass.loadIntoMapFGNSSTest(false, false, true, false);
1414  errorTotal += testClass.loadIntoMapFGNSSTest(false, true, true, false);
1415  errorTotal += testClass.loadIntoMapFGNSSTest(true, false, true, false);
1416  errorTotal += testClass.loadIntoMapFGNSSTest(true, true, true, false);
1417 
1418  errorTotal += testClass.loadIntoMapFGNSSTest(false, false, false, true);
1419  errorTotal += testClass.loadIntoMapFGNSSTest(false, true, false, true);
1420  errorTotal += testClass.loadIntoMapFGNSSTest(true, false, false, true);
1421  errorTotal += testClass.loadIntoMapFGNSSTest(true, true, false, true);
1422  errorTotal += testClass.addRinexClockTest();
1423  errorTotal += testClass.gapTest();
1424  errorTotal += testClass.nomTimeStepTest();
1425 
1426  std::cout << "Total Failures for " << __FILE__ << ": " << errorTotal
1427  << std::endl;
1428 
1429  return errorTotal;
1430 }
gnsstk::SP3NavDataFactory::addDataSource
bool addDataSource(const std::string &source) override
Definition: SP3NavDataFactory.cpp:556
TestClass::addDataSource
bool addDataSource(const std::string &source) override
Definition: NavDataFactory_T.cpp:76
gnsstk::NavDataPtr
std::shared_ptr< NavData > NavDataPtr
Factories instantiate these in response to find() requests.
Definition: NavData.hpp:62
gnsstk::NavSignalID::nav
NavType nav
Navigation message structure of this signal.
Definition: NavSignalID.hpp:96
gnsstk::OrbitDataSP3::posSig
Triple posSig
Standard deviation of position.
Definition: OrbitDataSP3.hpp:91
TUCSM
#define TUCSM(METHOD)
Definition: TestUtil.hpp:59
SP3NavDataFactory_T::gapTest
unsigned gapTest()
Test find with gap interval.
Definition: SP3NavDataFactory_T.cpp:1288
gnsstk::NavMessageID
Class used to identify/categorize navigation message data.
Definition: NavMessageID.hpp:52
gnsstk::OrbitDataSP3::driftSig
double driftSig
SV clock drift std deviation in microseconds/sec.
Definition: OrbitDataSP3.hpp:99
TUCATCH
#define TUCATCH(STATEMENT)
Definition: TestUtil.hpp:193
L1
gnsstk::Matrix< double > L1
Definition: Matrix_LUDecomp_T.cpp:46
SP3NavDataFactory_T::addRinexClockTest
unsigned addRinexClockTest()
Test loading of RINEX clock data.
Definition: SP3NavDataFactory_T.cpp:1255
SP3NavDataFactory_T::sp3cPVTest
unsigned sp3cPVTest()
Test find with an SP3c file which contains P/EP, V/EV records.
Definition: SP3NavDataFactory_T.cpp:842
gnsstk::NavMessageMap
std::map< NavMessageType, NavSatMap > NavMessageMap
Map nav message type to the rest of the storage.
Definition: NavData.hpp:71
gnsstk::OrbitDataSP3::vel
Triple vel
ECEF velocity (dm/s) of satellite at time.
Definition: OrbitDataSP3.hpp:92
gnsstk::RefFrameRlz::WGS84G873
@ WGS84G873
WGS84, GPS week 873 version.
gnsstk::TimeSystem::TAI
@ TAI
International Atomic Time.
TUASSERTE
#define TUASSERTE(TYPE, EXP, GOT)
Definition: TestUtil.hpp:81
gnsstk::CarrierBand
CarrierBand
Definition: CarrierBand.hpp:54
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
gnsstk::NavSatelliteID
Definition: NavSatelliteID.hpp:57
gnsstk::SatelliteSystem
SatelliteSystem
Supported satellite systems.
Definition: SatelliteSystem.hpp:55
gnsstk::OrbitDataSP3::velSig
Triple velSig
Standard deviation of velocity.
Definition: OrbitDataSP3.hpp:93
gnsstk::TrackingCode::Y
@ Y
Encrypted legacy GPS precise code.
main
int main()
Definition: SP3NavDataFactory_T.cpp:1396
gnsstk::SatID
Definition: SatID.hpp:89
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::OrbitDataSP3::clkBias
double clkBias
SV clock bias in microseconds.
Definition: OrbitDataSP3.hpp:96
gnsstk::ObsID::band
CarrierBand band
Definition: ObsID.hpp:200
gnsstk::OrbitDataSP3::accSig
Triple accSig
Standard deviation of acceleration.
Definition: OrbitDataSP3.hpp:95
gnsstk::RefFrame
Definition: RefFrame.hpp:53
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::NavType::GPSLNAV
@ GPSLNAV
gnsstk::CarrierBand::L2
@ L2
GPS L2, QZSS L2.
gnsstk::GPSWeekSecond
Definition: GPSWeekSecond.hpp:56
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
SP3NavDataFactory_T::sp3cPTest
unsigned sp3cPTest()
Test find with an SP3c file which contains P/EP records (no V)
Definition: SP3NavDataFactory_T.cpp:935
gnsstk::TrackingCode::E5aI
@ E5aI
Galileo E5a I code.
gnsstk::SatelliteSystem::GPS
@ GPS
gnsstk::SVHealth::Any
@ Any
Use in searches when you don't care about the SV health.
gnsstk::TrackingCode::CA
@ CA
Legacy GPS civil code.
SP3NavDataFactory_T::nomTimeStepTest
unsigned nomTimeStepTest()
Test nomTimeStep via the friendlier wrapper methods.
Definition: SP3NavDataFactory_T.cpp:1381
gnsstk::SP3NavDataFactory::find
bool find(const NavMessageID &nmid, const CommonTime &when, NavDataPtr &navOut, SVHealth xmitHealth, NavValidityType valid, NavSearchOrder order) override
Definition: SP3NavDataFactory.cpp:238
gnsstk::NavSignalID::obs
ObsID obs
Carrier, tracking code, etc.
Definition: NavSignalID.hpp:95
gnsstk::NavSignalID::system
SatelliteSystem system
GNSS for this signal.
Definition: NavSignalID.hpp:94
SP3NavDataFactory_T::findEdgeTest
unsigned findEdgeTest()
Test find with edge cases.
Definition: SP3NavDataFactory_T.cpp:514
TUASSERT
#define TUASSERT(EXPR)
Definition: TestUtil.hpp:63
SP3NavDataFactory_T
Automated tests for gnsstk::SP3NavDataFactory.
Definition: SP3NavDataFactory_T.cpp:89
TestUtil.hpp
SP3NavDataFactory_T::findExactTest
unsigned findExactTest()
Test find where the time stamps exactly match epochs in source data.
Definition: SP3NavDataFactory_T.cpp:216
gnsstk::OrbitDataSP3::coordSystem
std::string coordSystem
Copy of SP3Header::coordSystem since it might not translate.
Definition: OrbitDataSP3.hpp:103
SP3NavDataFactory_T::constructorTest
unsigned constructorTest()
Make sure the constructor does what it's supposed to.
Definition: SP3NavDataFactory_T.cpp:134
SP3NavDataFactory_T::loadIntoMapTest
unsigned loadIntoMapTest()
Exercise loadIntoMap by loading data with different options in place.
Definition: SP3NavDataFactory_T.cpp:149
gnsstk::OrbitDataSP3::pos
Triple pos
ECEF position (km) of satellite at time.
Definition: OrbitDataSP3.hpp:90
gnsstk::NavDataFactoryWithStore::size
virtual size_t size() const
Return the number of nav messages in data.
Definition: NavDataFactoryWithStore.cpp:1005
TURETURN
#define TURETURN()
Definition: TestUtil.hpp:232
SP3NavDataFactory_T::loadIntoMapFGNSSTest
unsigned loadIntoMapFGNSSTest(bool badPos, bool badClk, bool rcBefore, bool rcAfter)
Definition: SP3NavDataFactory_T.cpp:1027
gnsstk::NavValidityType::ValidOnly
@ ValidOnly
Only load/find nav messages that pass validity checks.
TestClass::getData
gnsstk::NavMessageMap & getData()
Grant access to protected data.
Definition: SP3NavDataFactory_T.cpp:84
gnsstk::ObsID
Definition: ObsID.hpp:82
nd
int nd
Definition: IERS1996NutationData.hpp:44
gnsstk::NavType::GPSCNAVL2
@ GPSCNAVL2
gnsstk::NavSatelliteID::sat
SatID sat
ID of satellite to which the nav data applies.
Definition: NavSatelliteID.hpp:169
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
SP3NavDataFactory_T::findInterpTest
unsigned findInterpTest()
Test find where interpolation is required.
Definition: SP3NavDataFactory_T.cpp:439
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::TrackingCode::L2CML
@ L2CML
Modernized GPS L2 civil M+L combined tracking.
TUASSERTFEPS
#define TUASSERTFEPS(EXP, GOT, EPS)
Definition: TestUtil.hpp:126
gnsstk::ObsID::code
TrackingCode code
Definition: ObsID.hpp:201
gnsstk::CarrierBand::L1
@ L1
GPS L1, Galileo E1, SBAS L1, QZSS L1, BeiDou L1.
CivilTime.hpp
TUDEF
#define TUDEF(CLASS, METHOD)
Definition: TestUtil.hpp:56
gnsstk::SatID::system
SatelliteSystem system
System for this satellite.
Definition: SatID.hpp:156
SP3NavDataFactory_T::verifyDataType
void verifyDataType(gnsstk::TestUtil &testFramework, gnsstk::NavMessageMap &nmm)
Definition: SP3NavDataFactory_T.cpp:1238
example3.data
data
Definition: example3.py:22
gnsstk::OrbitDataSP3::clkDrift
double clkDrift
SV clock drift in s/s.
Definition: OrbitDataSP3.hpp:98
OrbitDataSP3.hpp
gnsstk::OrbitDataSP3::acc
Triple acc
Acceleration (m/s/s) of satellite at time.
Definition: OrbitDataSP3.hpp:94
gnsstk::CivilTime
Definition: CivilTime.hpp:55
gnsstk::NavSignalID
Class used to identify navigation data signal types.
Definition: NavSignalID.hpp:54
GPSWeekSecond.hpp
gnsstk::RefFrameRlz::WGS84G1150
@ WGS84G1150
WGS84, GPS week 1150 version.
gnsstk::TrackingCode
TrackingCode
Definition: TrackingCode.hpp:64
gnsstk::TimeSystem::GPS
@ GPS
GPS system time.
gnsstk::SP3NavDataFactory
Definition: SP3NavDataFactory.hpp:58
gnsstk::NavMessageType
NavMessageType
Identify different types of navigation message data.
Definition: NavMessageType.hpp:59
gnsstk::OrbitDataSP3::clkDrRate
double clkDrRate
SV clock drift rate in s/s**2.
Definition: OrbitDataSP3.hpp:100
gnsstk::NavMessageType::Ephemeris
@ Ephemeris
Precision orbits for the transmitting SV.
TestClass
Make GroupPathCorrector instantiatable for testing.
Definition: GroupPathCorrector_T.cpp:56
gnsstk::OrbitDataSP3::biasSig
double biasSig
SV clock bias std deviation in microseconds.
Definition: OrbitDataSP3.hpp:97
TUASSERTFE
#define TUASSERTFE(EXP, GOT)
Definition: TestUtil.hpp:103
gnsstk::RefFrameRlz::ITRF94
@ ITRF94
ITRF, 1994 version.
gnsstk::OrbitDataSP3
Class for orbit information using SP3 data tables.
Definition: OrbitDataSP3.hpp:51
SP3NavDataFactory.hpp
gnsstk::NavDataFactory::supportedSignals
NavSignalSet supportedSignals
Definition: NavDataFactory.hpp:379
gnsstk::NavSearchOrder::User
@ User
Return the latest message before the search time.
gnsstk::NavType
NavType
Supported navigation types.
Definition: NavType.hpp:58
gnsstk::OrbitDataSP3::frame
RefFrame frame
Translation of coordSystem into an enum, if possible.
Definition: OrbitDataSP3.hpp:105
gnsstk::SatelliteSystem::QZSS
@ QZSS
gnsstk::NavSatelliteID::xmitSat
SatID xmitSat
ID of the satellite transmitting the nav data.
Definition: NavSatelliteID.hpp:170
gnsstk::TestUtil
Definition: TestUtil.hpp:265
gnsstk::OrbitDataSP3::drRateSig
double drRateSig
Definition: OrbitDataSP3.hpp:101
TestClass::find
bool find(const gnsstk::NavMessageID &nmid, const gnsstk::CommonTime &when, gnsstk::NavDataPtr &navData, gnsstk::SVHealth xmitHealth, gnsstk::NavValidityType valid, gnsstk::NavSearchOrder order) override
Definition: NavDataFactory_T.cpp:67
gnsstk::SatelliteSystem::Galileo
@ Galileo
gnsstk::NavType::GalFNAV
@ GalFNAV
gnsstk::CarrierBand::L5
@ L5
GPS L5, Galileo E5a, SBAS L5, QZSS L5, BeiDou B2a, NavIC L5.


gnsstk
Author(s):
autogenerated on Wed Oct 25 2023 02:40:41