diff --git a/core/lib/GNSSCore/SVNumXRef.cpp b/core/lib/GNSSCore/SVNumXRef.cpp index 8aa46f7d2..3508224de 100644 --- a/core/lib/GNSSCore/SVNumXRef.cpp +++ b/core/lib/GNSSCore/SVNumXRef.cpp @@ -1,789 +1,710 @@ -//============================================================================ -// -// This file is part of GPSTk, the GPS Toolkit. -// -// The GPSTk is free software; you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as published -// by the Free Software Foundation; either version 2.1 of the License, or -// any later version. -// -// The GPSTk is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with GPSTk; if not, write to the Free Software Foundation, -// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA -// // Copyright 2004, The University of Texas at Austin -// -//============================================================================ -/* SVNumXRefMap.cpp -* -* Applied Research Laboratories, The University of Texas at Austin -* -*/ - // Language Headers - - // Library Headers - // Project Headers -#include "SVNumXRef.hpp" -#include "CivilTime.hpp" -#include "TimeString.hpp" - -#include -#include -#include - -using namespace std; -using namespace gpstk; - -SVNumXRef::SVNumXRef( ) -{ - NtoBMap.insert( make_pair( 1, I )); - NtoBMap.insert( make_pair( 2, I )); - NtoBMap.insert( make_pair( 3, I )); - NtoBMap.insert( make_pair( 4, I )); - NtoBMap.insert( make_pair( 5, I )); - NtoBMap.insert( make_pair( 6, I )); - // no NAVSTAR 07, I-7 was a launch failure - NtoBMap.insert( make_pair( 8, I )); - NtoBMap.insert( make_pair( 9, I )); - NtoBMap.insert( make_pair( 10, I )); - NtoBMap.insert( make_pair( 11, I )); - // no NAVSTAR 12, was never launched - NtoBMap.insert( make_pair( 13, II )); - NtoBMap.insert( make_pair( 14, II )); - NtoBMap.insert( make_pair( 15, II )); - NtoBMap.insert( make_pair( 16, II )); - NtoBMap.insert( make_pair( 17, II )); - NtoBMap.insert( make_pair( 18, II )); - NtoBMap.insert( make_pair( 19, II )); - NtoBMap.insert( make_pair( 20, II )); - NtoBMap.insert( make_pair( 21, II )); - NtoBMap.insert( make_pair( 22,IIA )); - NtoBMap.insert( make_pair( 23,IIA )); - NtoBMap.insert( make_pair( 24,IIA )); - NtoBMap.insert( make_pair( 25,IIA )); - NtoBMap.insert( make_pair( 26,IIA )); - NtoBMap.insert( make_pair( 27,IIA )); - NtoBMap.insert( make_pair( 28,IIA )); - NtoBMap.insert( make_pair( 29,IIA )); - NtoBMap.insert( make_pair( 30,IIA )); - NtoBMap.insert( make_pair( 31,IIA )); - NtoBMap.insert( make_pair( 32,IIA )); - NtoBMap.insert( make_pair( 33,IIA )); - NtoBMap.insert( make_pair( 34,IIA )); - NtoBMap.insert( make_pair( 35,IIA )); - NtoBMap.insert( make_pair( 36,IIA )); - NtoBMap.insert( make_pair( 37,IIA )); - NtoBMap.insert( make_pair( 38,IIA )); - NtoBMap.insert( make_pair( 39,IIA )); - NtoBMap.insert( make_pair( 40,IIA )); - NtoBMap.insert( make_pair( 41,IIR )); - // no NAVSTAR 42, IIR-1 was a launch failure - NtoBMap.insert( make_pair( 43,IIR )); - NtoBMap.insert( make_pair( 44,IIR )); - NtoBMap.insert( make_pair( 45,IIR )); - NtoBMap.insert( make_pair( 46,IIR )); - NtoBMap.insert( make_pair( 47,IIR )); - NtoBMap.insert( make_pair( 48,IIR_M)); - NtoBMap.insert( make_pair( 49,IIR_M)); - NtoBMap.insert( make_pair( 50,IIR_M)); - NtoBMap.insert( make_pair( 51,IIR )); - NtoBMap.insert( make_pair( 52,IIR_M)); - NtoBMap.insert( make_pair( 53,IIR_M)); - NtoBMap.insert( make_pair( 54,IIR )); - NtoBMap.insert( make_pair( 55,IIR_M)); - NtoBMap.insert( make_pair( 56,IIR )); - NtoBMap.insert( make_pair( 57,IIR_M)); - NtoBMap.insert( make_pair( 58,IIR_M)); - NtoBMap.insert( make_pair( 59,IIR )); - NtoBMap.insert( make_pair( 60,IIR )); - NtoBMap.insert( make_pair( 61,IIR )); - NtoBMap.insert( make_pair( 62,IIF )); - NtoBMap.insert( make_pair( 63,IIF )); - NtoBMap.insert( make_pair( 64,IIF )); - NtoBMap.insert( make_pair( 65,IIF )); - NtoBMap.insert( make_pair( 66,IIF )); - NtoBMap.insert( make_pair( 67,IIF )); - NtoBMap.insert( make_pair( 68,IIF )); - NtoBMap.insert( make_pair( 69,IIF )); - NtoBMap.insert( make_pair( 71,IIF )); - NtoBMap.insert( make_pair( 72,IIF )); - NtoBMap.insert( make_pair( 73,IIF )); - - - // Note: This table start with Block I values - // Set up NAVSTAR -> PRN ID relationship - // NAVSTAR ID first, PRN ID second - NtoPMap.insert( std::pair( 1, XRefNode( 4, - CivilTime( 1978, 2, 22, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1985, 7, 17, 17, 30, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 2, XRefNode( 7, - CivilTime( 1978, 6, 13, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1988, 2, 12, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 3, XRefNode( 6, - CivilTime( 1978, 10, 6, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1992, 5, 18, 23, 41, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 4, XRefNode( 8, - CivilTime( 1978, 12, 10, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1990, 5, 31, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 5, XRefNode( 5, - CivilTime( 1980, 2, 9, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1984, 5, 11, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 6, XRefNode( 9, - CivilTime( 1980, 4, 26, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1991, 3, 6, 3, 42, 0.0, TimeSystem::GPS)))); - // no NAVSTAR 07, I-7 was a launch failure - NtoPMap.insert( std::pair( 8, XRefNode( 11, - CivilTime( 1983, 7, 14, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1993, 5, 4, 0, 20, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 9, XRefNode( 13, - CivilTime( 1984, 6, 13, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1993, 5, 4, 18, 17, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 10, XRefNode( 12, - CivilTime( 1984, 9, 8, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1996, 3, 26, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 11, XRefNode( 3, - CivilTime( 1985, 10, 30, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1994, 4, 14, 21, 0, 0.0, TimeSystem::GPS)))); - // no NAVSTAR 12, was never launched - NtoPMap.insert( std::pair( 13, XRefNode( 2, - CivilTime( 1989, 6, 10, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2004, 5, 12, 17, 1, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 14, XRefNode( 14, - CivilTime( 1989, 2, 14, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2000, 4, 14, 13, 47, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 15, XRefNode( 15, - CivilTime( 1990, 10, 1, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2007, 3, 15, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 16, XRefNode( 16, - CivilTime( 1989, 8, 18, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2000, 10, 13, 0, 45, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 17, XRefNode( 17, - CivilTime( 1989, 12, 11, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2005, 2, 23, 22, 0, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 18, XRefNode( 18, - CivilTime( 1990, 1, 24, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2000, 8, 18, 7, 42, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 19, XRefNode( 19, - CivilTime( 1989, 10, 21, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2001, 9, 11, 22, 0, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 20, XRefNode( 20, - CivilTime( 1990, 3, 26, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1996, 12, 13, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 21, XRefNode( 21, - CivilTime( 1990, 8, 2, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2003, 1, 27, 22, 0, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 22, XRefNode( 22, - CivilTime( 1993, 2, 3, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2003, 8, 6, 22, 0, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 23, XRefNode( 23, - CivilTime( 1990, 11, 26, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2004, 2, 13, 22, 0, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 23, XRefNode( 32, - CivilTime( 2006, 12, 1, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 24, XRefNode( 24, - CivilTime( 1991, 7, 4, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2011, 9, 30, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 25, XRefNode( 25, - CivilTime( 1992, 2, 23, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2009, 12, 18, 22, 28, 0.0, TimeSystem::GPS)))); - // NANU 2015005 (end) - extended due to additional data. - NtoPMap.insert( std::pair( 26, XRefNode( 26, - CivilTime( 1992, 7, 7, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2015, 1, 20, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU # (start). NANU 2012061 (end) - // NANU #(start). NANU 2011059 (end). - NtoPMap.insert( std::pair( 27, XRefNode( 27, - CivilTime( 1992, 9, 9, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2011, 8, 10, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2011105 (start). NANU 2012063 (end) - NtoPMap.insert( std::pair( 27, XRefNode( 27, - CivilTime( 2011, 12, 16, 22, 38, 0.0, TimeSystem::GPS), - CivilTime( 2012, 10, 6, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2013074 (start). NANU 2013080 (end) - NtoPMap.insert( std::pair( 27, XRefNode( 30, - CivilTime( 2013, 12, 3, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2013, 12, 17, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2015010 (start). NANU 2013019 (end) plus actual received data. - NtoPMap.insert( std::pair( 27, XRefNode( 26, - CivilTime( 2015, 2, 26, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2015, 3, 16, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 28, XRefNode( 28, - CivilTime( 1992, 4, 10, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 1997, 8, 15, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 29, XRefNode( 29, - CivilTime( 1992, 12, 18, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2007, 10, 23, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 30, XRefNode( 30, - CivilTime( 1996, 9, 12, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2011, 8, 4, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 31, XRefNode( 31, - CivilTime( 1993, 3, 30, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2005, 10, 24, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 32, XRefNode( 1, - CivilTime( 1992, 11, 22, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2008, 3, 17, 22, 0, 0.0, TimeSystem::GPS)))); - // NANU 2012018 (start). NANU 2012024 (end) - NtoPMap.insert( std::pair( 32, XRefNode( 24, - CivilTime( 2012, 3, 14, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2012, 4, 24, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2013049 (start). NANU 2013054 (end) - NtoPMap.insert( std::pair( 32, XRefNode( 30, - CivilTime( 2013, 8, 22, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2013, 9, 18, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2015007 (start). NANU 2015101 (end) plus actual received data - NtoPMap.insert( std::pair( 32, XRefNode( 26, - CivilTime( 2015, 2, 5, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2015, 2, 24, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2014063 (end). - // NANU claimed 8/2 end date. SV continued to broadcast until 8/18/2014. - NtoPMap.insert( std::pair( 33, XRefNode( 3, - CivilTime( 1996, 3, 28, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 8, 18 , 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 34, XRefNode( 4, - CivilTime( 1993, 10, 26, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 35, XRefNode( 5, - CivilTime( 1993, 8, 30, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2009, 3, 26, 20, 31, 0.0, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 35, XRefNode( 1, - CivilTime( 2011, 6, 1, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2011, 7, 12, 23, 59, 59.9, TimeSystem::GPS)))); - // See PRN 30 notes below for how we arrived at the end time. - NtoPMap.insert( std::pair( 35, XRefNode( 30, - CivilTime( 2011, 8, 6, 20, 0, 0.0, TimeSystem::GPS), - CivilTime( 2013, 5, 1, 22, 00, 0.0, TimeSystem::GPS)))); - // NANU 2013029 (start), NANU 2013049 (end-IMPLIED) - // Note: NANU 2013029 says Approximately 5/8/13 SVN 49 will continue - - // broadcasting as PRN 30. Signal evidence indicates that SVN 49 used PRN 27 until - // about 5/9/2013 1600 Therefore. In the meantime SOME SVN was transmitting - // PRN 30 through 5/6/2013 2000+. Therefore, we've added an "extension" to the - // SVN 35 decommissioning and moved the SVN49/PRN30 start time. - - NtoPMap.insert( std::pair( 35, XRefNode( 30, - CivilTime( 2013, 5, 2, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2013, 5, 6, 22, 00, 0.0, TimeSystem::GPS)))); - - NtoPMap.insert( std::pair( 35, XRefNode( 3, - CivilTime( 2014, 9, 5, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 10, 22, 0, 00, 0.0, TimeSystem::GPS)))); - - // NANU 2014015/2014019 (end) - // NANU claimed 2/21 end date. SV continued to broadcast until 3/3/2014. - NtoPMap.insert( std::pair( 36, XRefNode( 6, - CivilTime( 1995, 3, 10, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 3, 3, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2015080 (start) - NtoPMap.insert( std::pair( 36, XRefNode( 10, - CivilTime( 2015, 9, 16, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2015, 10, 26, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 37, XRefNode( 7, - CivilTime( 1993, 5, 13, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2007, 7, 20, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 37, XRefNode( 1, - CivilTime( 2008, 10, 23, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2009, 1, 6, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2012024 (start). NANU 201249 (end) - NtoPMap.insert( std::pair( 37, XRefNode( 24, - CivilTime( 2012, 4, 25, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2012, 8, 7, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2013054 (start). NANU 2013074 (end) - NtoPMap.insert( std::pair( 37, XRefNode( 30, - CivilTime( 2013, 9, 19, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2013, 12, 2, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2015021 (end) - NtoPMap.insert( std::pair( 38, XRefNode( 8, - CivilTime( 1997, 11, 6, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2015, 4, 13, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2014046 (end) - // NANU claimed 5/19 end date. SV continued tp broadcast until 5/27/2014. - NtoPMap.insert( std::pair( 39, XRefNode( 9, - CivilTime( 1993, 6, 26, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 5, 27, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2014050 (start) - NtoPMap.insert( std::pair( 39, XRefNode( 9, - CivilTime( 2014, 6, 13, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 8, 1, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 40, XRefNode( 10, - CivilTime( 1996, 7, 16, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2015, 8, 3, 23, 59, 59.9, TimeSystem::GPS)))); - NtoPMap.insert( std::pair( 41, XRefNode( 14, - CivilTime( 2000, 11, 10, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - // no NAVSTAR 42, IIR-1 was a launch failure - NtoPMap.insert( std::pair( 43, XRefNode( 13, - CivilTime( 1997, 7, 23, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 44, XRefNode( 28, - CivilTime( 2000, 7, 16, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 45, XRefNode( 21, - CivilTime( 2003, 3, 31, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 46, XRefNode( 11, - CivilTime( 1999, 10, 7, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 47, XRefNode( 22, - CivilTime( 2003, 12, 21, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 48, XRefNode( 7, - CivilTime( 2008, 3, 15, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 49, XRefNode( 1, - CivilTime( 2009, 3, 24, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2011, 5, 6, 16, 0, 0.0, TimeSystem::GPS)))); - // NANU 2012003 (start). NANU 2012018 (end) - NtoPMap.insert( std::pair( 49, XRefNode( 24, - CivilTime( 2012, 2, 1, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2012, 3, 13, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2012049 (start). NANU # (end) - NtoPMap.insert( std::pair( 49, XRefNode( 24, - CivilTime( 2012, 8, 8, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2012, 8, 22, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2012064 (start). - // We don't know exactly WHEN this relationship stopped. NANU 2013021 states when - // it resumes. - NtoPMap.insert( std::pair( 49, XRefNode( 27, - CivilTime( 2012, 10, 18, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2012, 12, 31, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2013021 (start), 2013031 (end-IMPLIED) - // See PRN30/SVN49 notes below for how we derived this end time. - NtoPMap.insert( std::pair( 49, XRefNode( 27, - CivilTime( 2013, 3, 27, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2013, 5, 9, 16, 44, 59.9, TimeSystem::GPS)))); - // NANU 2013029 (start), 2013049 (end-IMPLIED) - NtoPMap.insert( std::pair( 49, XRefNode( 30, - CivilTime( 2013, 5, 9, 16, 45, 0.0, TimeSystem::GPS), - CivilTime( 2013, 8, 21, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2013080 (start), 2014018 (end-IMPLIED) - NtoPMap.insert( std::pair( 49, XRefNode( 30, - CivilTime( 2013, 12, 18, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 2, 20, 23, 59, 0.0, TimeSystem::GPS)))); - // NANU 2014032 (start), 2014045 (end-IMPLIED) - NtoPMap.insert( std::pair( 49, XRefNode( 6, - CivilTime( 2014, 4, 3, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2014, 5, 15, 23, 59, 59.9, TimeSystem::GPS)))); - // NANU 2015032 (start) - NtoPMap.insert( std::pair( 49, XRefNode( 8, - CivilTime( 2015, 4, 30, 0, 0, 0.0, TimeSystem::GPS), - CivilTime( 2015, 7, 1, 16, 0, 0.0, TimeSystem::GPS)))); - - NtoPMap.insert( std::pair( 50, XRefNode( 5, - CivilTime( 2009, 8, 27, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 51, XRefNode( 20, - CivilTime( 2000, 5, 11, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 52, XRefNode( 31, - CivilTime( 2006, 9, 25, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 53, XRefNode( 17, - CivilTime( 2005, 9, 26, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 54, XRefNode( 18, - CivilTime( 2001, 1, 30, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 55, XRefNode( 15, - CivilTime( 2007, 10, 17, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 56, XRefNode( 16, - CivilTime( 2003, 1, 29, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 57, XRefNode( 29, - CivilTime( 2007, 12, 21, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 58, XRefNode( 12, - CivilTime( 2006, 11, 17, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 59, XRefNode( 19, - CivilTime( 2004, 3, 20, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 60, XRefNode( 23, - CivilTime( 2004, 6, 23, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 61, XRefNode( 2, - CivilTime( 2004, 6, 6, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 62, XRefNode( 25, - CivilTime( 2010, 5, 28, 3, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - NtoPMap.insert( std::pair( 63, XRefNode( 1, - CivilTime( 2011, 7, 20, 9, 36, 36.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - // NANU 2014018 - NtoPMap.insert( std::pair( 64, XRefNode( 30, - CivilTime( 2014, 2, 21, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - - NtoPMap.insert( std::pair( 65, XRefNode( 24, - CivilTime( 2012, 10, 4, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - - NtoPMap.insert( std::pair( 66, XRefNode( 27, - CivilTime( 2013, 5, 15, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - //NANU 2014045 (start) - NtoPMap.insert( std::pair( 67, XRefNode( 6, - CivilTime( 2014, 5, 17, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - // - NtoPMap.insert( std::pair( 68, XRefNode( 9, - CivilTime( 2014, 8, 2, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - - NtoPMap.insert( std::pair( 69, XRefNode( 3, - CivilTime( 2014, 10, 29, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - //NANU 2015019 LAUNCH - NtoPMap.insert( std::pair( 71, XRefNode( 26, - CivilTime( 2015, 3, 25, 18, 36, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - //NANU 2015068 LAUNCH - NtoPMap.insert( std::pair( 72, XRefNode( 8, - CivilTime( 2015, 7, 15, 0, 0, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - //Added before NANU was sent. - NtoPMap.insert( std::pair( 73, XRefNode( 10, - CivilTime( 2015, 10, 31, 16, 23, 0.0, TimeSystem::GPS), - CommonTime::END_OF_TIME ))); - - //Iterate through the data to produce the PtoNMap - multimap::const_iterator itate; - //Iterates through Navstar by PRN map for each relationship building the corresponding map - for (itate=NtoPMap.begin(); itate != NtoPMap.end(); itate++) - { - std::pair values = *itate; - //Grabs the values to then insert into PtoN - int navNum = values.first; - int prnNum = values.second.getPRNNum(); - CommonTime beginningTime = values.second.getBeginTime(); - CommonTime endingTime = values.second.getEndTime(); - //Insert to tree - PtoNMap.insert( std::pair( prnNum, XRefNode( navNum, beginningTime, endingTime ))); - } - -} - -int SVNumXRef::getNAVSTAR( const int PRNID, const gpstk::CommonTime dt ) const -{ - SVNumXRefPair p = PtoNMap.equal_range( PRNID ); - for (SVNumXRefListCI ci=p.first; ci != p.second; ++ci ) - { - if (ci->second.isApplicable( dt )) return( ci->second.getNAVSTARNum() ); - } - - // We didn't find a NAVSTAR # for this PRN ID and date, so throw an - // exception. - char textOut[80]; - sprintf(textOut,"No NAVSTAR # found associated with PRN ID %d at requested date: %s.", - PRNID,printTime(dt,"%02m/%02d/%04Y").c_str() ); - std::string sout = textOut; - NoNAVSTARNumberFound noFound( sout ); - GPSTK_THROW(noFound); -} - -bool SVNumXRef::NAVSTARIDAvailable( const int PRNID, const gpstk::CommonTime dt ) const -{ - SVNumXRefPair p = PtoNMap.equal_range( PRNID ); - for (SVNumXRefListCI ci=p.first; ci != p.second; ++ci ) - { - if (ci->second.isApplicable( dt )) return( true ); - } - return( false ); -} - -bool SVNumXRef::NAVSTARIDActive( const int NAVSTARID, const gpstk::CommonTime dt ) const -{ - for (SVNumXRefListCI ci=PtoNMap.begin(); ci != PtoNMap.end(); ++ci ) - { - if (ci->second.getNAVSTARNum()==NAVSTARID && - ci->second.isApplicable( dt ) ) return( true ); - } - return( false ); -} - -SVNumXRef::BlockType SVNumXRef::getBlockType( const int NAVSTARID ) const -{ - map::const_iterator i; - i = NtoBMap.find( NAVSTARID ); - if (i!=NtoBMap.end()) return(i->second); - - // We didn't find a BlockType for this NAVSTAR #, so throw an - // exception. - char textOut[80]; - sprintf(textOut,"No BlockType found associated with NAVSTAR Num %d.", - NAVSTARID); - std::string sout = textOut; - NoNAVSTARNumberFound noFound( sout ); - GPSTK_THROW(noFound); - throw( noFound ); -} - -std::string SVNumXRef::getBlockTypeString( const int NAVSTARID ) const -{ - std::map::const_iterator i; - i = NtoBMap.find( NAVSTARID ); - if (i!=NtoBMap.end()) - { - switch( getBlockType( NAVSTARID ) ) - { - case I: return("Block I"); break; - case II: return("Block II"); break; - case IIA: return("Block IIA"); break; - case IIR: return("Block IIR"); break; - case IIR_M: return("Block IIR_M"); break; - case IIF: return("Block IIF"); break; - } - - } - return("unknown"); -} - -int SVNumXRef::getPRNID( const int NAVSTARID, const gpstk::CommonTime dt ) const -{ - NAVNumXRefPair p = NtoPMap.equal_range( NAVSTARID ); - // If there is only one PRNID for this SVN number return it to maintain - // compatability with previous versions - if( p.first == (--p.second) ) return ( p.first->second.getPRNNum() ); - ++p.second; - for (NAVNumXRefCI ci=p.first; ci != p.second; ++ci ) - { - if (ci->second.isApplicable( dt )) return( ci->second.getPRNNum() ); - } - - // We didn't find a PRN ID for this NAVSTAR # and date, so throw an - // exception. - char textOut[80]; - sprintf(textOut,"No PRN ID found associated with NAVSTAR Num %d at requested date: %s.", - NAVSTARID,printTime(dt,"%02m/%02d/%04Y").c_str() ); - std::string sout = textOut; - NoNAVSTARNumberFound noFound( sout ); - GPSTK_THROW(noFound); - throw( noFound ); -} - -bool SVNumXRef::PRNIDAvailable( const int NAVSTARID, const gpstk::CommonTime dt ) const -{ - NAVNumXRefPair p = NtoPMap.equal_range( NAVSTARID ); - if( p.first == (--p.second) ) return ( true ); - ++p.second; - for (NAVNumXRefCI ci=p.first; ci != p.second; ++ci ) - { - if (ci->second.isApplicable( dt )) return( true ); - } - return( false ); -} - -bool SVNumXRef::BlockTypeAvailable( const int NAVSTARID ) const -{ - map::const_iterator i; - i = NtoBMap.find( NAVSTARID ); - if (i!=NtoBMap.end()) return(true); - return(false); -} - -//----------Dumps out a List of and ALSO checks for Overlaps is overlap is set to true -//----------Navstar #s---PRN---start time---end time--- -//----------PRN---Navstar #s---start time---end time--- -int SVNumXRef::dump(std::ostream& out, bool checkOverlap) const -{ - //iterate through the data - multimap::const_iterator it; - bool pastCurrent = false; - //header - cout << "NAVASTAR #'s PRN t1 t2" << endl; - //Iterates through Navstar by PRN - for (it=NtoPMap.begin(); it != NtoPMap.end(); it++) - { - std::pair mm = *it; - out << " " << setw(2) << mm.first - << " " << mm.second.toString() << endl; - //Checks for overlap of time from NtoP against PtoN - if( checkOverlap ) - { - multimap::const_iterator navIt; - //compares Navstar map to the prn map - for (navIt = PtoNMap.begin(); navIt != PtoNMap.end(); navIt++) - { - std::pair navP = *navIt; - int navNum = navP.second.getNAVSTARNum(); - //if this navstar equals that navstar and the prns arent the same - if((mm.first == navNum) && (mm.second.getPRNNum() != navP.first)) - { - //if this beginTime is less than that endTime AND this endTime is greater than that beginTime - if((mm.second.getBeginTime() < navP.second.getEndTime()) && (mm.second.getEndTime() > navP.second.getBeginTime())) - { - out << "OVERLAP \n" << "Nav " << mm.first << " PRN " << mm.second.toString() << endl; - out << "PRN " << navP.first << " Nav " << navP.second.toString() << endl; - out << "WITH" << endl; - } - } - //if BOTH the Nav# and the PRN# equals then you either are looking at the same entry or an overlap - if((mm.first == navNum) && (mm.second.getPRNNum() == navP.first)) - { - //if this beginTime is less than that endTime AND this endTime is greater than that beginTime AND you have already found the same entry - if((mm.second.getBeginTime() < navP.second.getEndTime()) && (mm.second.getEndTime() > navP.second.getBeginTime()) && pastCurrent) - { - out << "OVERLAP \n" << "Nav " << mm.first << " PRN " << mm.second.toString() << endl; - out << "PRN " << navP.first << " Nav " << navP.second.toString() << endl; - out << "WITH" << endl; - } - //if the times are all the same and you have not yet seen the same entry then you set pastCurrent to true - if((mm.second.getBeginTime() == navP.second.getBeginTime()) && (mm.second.getEndTime() == navP.second.getEndTime()) && !pastCurrent) - { - pastCurrent = true; - } - } - } - } - pastCurrent = false; - } - out << "\n\n" << endl; - //iterate through the data - multimap::const_iterator iter; - //resest pastCurrent - pastCurrent = false; - //header - out << " PRN NAVASTAR #'s t1 t2" << endl; - //Iterates through PRN by Navstar - for (iter = PtoNMap.begin(); iter != PtoNMap.end(); iter++) - { - std::pair pp = *iter; - out << " " << setw(2) << pp.first - << " " << pp.second.toString() <::const_iterator prnIt; - //compares prn map to the Navstar map - for (prnIt = NtoPMap.begin(); prnIt != NtoPMap.end(); prnIt++) - { - std::pair prnN = *prnIt; - int prnNum = prnN.second.getPRNNum(); - //if this prn equals that prn and the navstar arent the same - if((pp.first == prnNum) && (pp.second.getNAVSTARNum() != prnN.first)) - { - //if this beginTime is less than that endTime AND this endTime is greater than that beginTime - if(pp.second.getBeginTime() < prnN.second.getEndTime() && pp.second.getEndTime() > prnN.second.getBeginTime()) - { - out << "OVERLAP \n" << "PRN " << pp.first << " Nav " << pp.second.toString() << endl; - out << "Nav " << prnN.first << " PRN " << prnN.second.toString() << endl; - out << "WITH" << endl; - } - } - //if BOTH the Nav# and the PRN# equals then you either are looking at the same entry or an overlap - if((pp.first == prnNum) && (pp.second.getPRNNum() == prnN.first)) - { - //if this beginTime is less than that endTime AND this endTime is greater than that beginTime AND you have already found the same entry - if(pp.second.getBeginTime() < prnN.second.getEndTime() && pp.second.getEndTime() > prnN.second.getBeginTime() && pastCurrent) - { - out << "OVERLAP \n" << "Nav " << pp.first << " PRN " << pp.second.toString() << endl; - out << "PRN " << prnN.first << " Nav " << prnN.second.toString() << endl; - out << "WITH" << endl; - } - //if the times are all the same and you have not yet seen the same entry then you set pastCurrent to true - if(pp.second.getBeginTime() == prnN.second.getBeginTime() && pp.second.getEndTime() == prnN.second.getEndTime() && !pastCurrent) - { - pastCurrent = true; - } - } - } - } - pastCurrent = false; - } - return(2); -} - -//-------------- Methods for XRefNode ----------------- -XRefNode::XRefNode( const int NumArg, - const gpstk::CommonTime begDT, - const gpstk::CommonTime endDT ) -{ - Num = NumArg; - begValid = begDT; - endValid = endDT; -} - -bool XRefNode::isApplicable( gpstk::CommonTime dt ) const -{ - if (dt>=begValid && dt<=endValid) return(true); - return(false); -} - -std::string XRefNode::toString() const -{ - std::string sout; - std::string tform = "%02m/%02d/9.4Y %03j %02H:%02M:%05.2f"; - //create stringstream to convert Num to a string to concatinate to sout - std::stringstream ss; - ss << Num; - std::string numOut; - ss >> numOut; - sout += " "+numOut; - //sout += " "+string(begValid begDt); - if( Num < 10 ){//used to create correct spacing - sout += " "+printTime(begValid, tform/*"%02m/%02d/%04Y"*/); - }else{ - sout += " "+printTime(begValid, tform/*"%02m/%02d/%04Y"*/); - } - std::string endTime = printTime(endValid, tform/*"%02m/%02d/%04Y"*/); - if(endTime == "01/01/4713"){//used to detect end of time - sout += " End Of Time"; - }else{ - sout += " "+printTime(endValid, tform/*"%02m/%02d/%04Y"*/); - } - return sout; -} - -// Returns true if there are no overlaps, and false otherwise -bool SVNumXRef::isConsistent() const -{ - // Defining iterators - multimap::const_iterator cit1; - multimap::const_iterator cit2; - // loops through the multimap - for (cit1 = NtoPMap.begin(); cit1 != NtoPMap.end(); cit1++) - { - cit2 = cit1; - cit2++; // cit2 always starts the nested loop one higher than cit1 - for (; cit2 != NtoPMap.end(); cit2++) - { - int key1 = cit1->first; // keys represent the SVN numbers - int key2 = cit2->first; - const XRefNode xr1 = cit1->second; // these const xr variables represent the XRefNode so we can access the begin and end times - const XRefNode xr2 = cit2->second; // of each SVN/PRN pair - int val1 = xr1.getPRNNum(); // vals represent the PRN numbers - int val2 = xr2.getPRNNum(); - if ((key1 == key2) || (val1 == val2)) // checks initial condition for an overlap; if neither are true, there is no overlap - { - cout << "key 1 & 2: " << key1 << ", " << key2 << endl - << "val 1 & 2: " << val1 << ", " << val2 << endl - << "xr1:" << xr1.toString() << endl - << "xr2:" << xr2.toString() << endl; - - if (overlap(xr1, xr2)) // if overlap() returns true, return false and exit - return false; - } - } - } - return true; // if we reach this point, we know there are no overlaps -} - -// Returns true if there is an overlap, returns false otherwise -bool SVNumXRef::overlap (const XRefNode& xr1, const XRefNode& xr2) const -{ - //if ((xr1.getBeginTime() > xr2.getEndTime()) || (xr1.getEndTime() < xr2.getBeginTime())) - if ((xr1.getBeginTime() < xr2.getEndTime()) && (xr1.getEndTime() > xr2.getBeginTime())) - { - cout << xr1.getBeginTime() << xr1.getEndTime() << endl - << xr2.getBeginTime() << xr2.getEndTime() << endl; - return true; - } - return false; -} - +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 2.1 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// // Copyright 2004, The University of Texas at Austin +// +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//=========================================================================== +/* SVNumXRefMap.cpp +* +* Applied Research Laboratories, The University of Texas at Austin +* +*/ +#include "SVNumXRef.hpp" +#include "CivilTime.hpp" +#include "TimeString.hpp" + +#include +#include +#include + +using namespace std; +using namespace gpstk; + +SVNumXRef::SVNumXRef( ) +{ + NtoBMap.insert( make_pair( 1, I )); + NtoBMap.insert( make_pair( 2, I )); + NtoBMap.insert( make_pair( 3, I )); + NtoBMap.insert( make_pair( 4, I )); + NtoBMap.insert( make_pair( 5, I )); + NtoBMap.insert( make_pair( 6, I )); + // no NAVSTAR 07, I-7 was a launch failure + NtoBMap.insert( make_pair( 8, I )); + NtoBMap.insert( make_pair( 9, I )); + NtoBMap.insert( make_pair( 10, I )); + NtoBMap.insert( make_pair( 11, I )); + // no NAVSTAR 12, was never launched + NtoBMap.insert( make_pair( 13, II )); + NtoBMap.insert( make_pair( 14, II )); + NtoBMap.insert( make_pair( 15, II )); + NtoBMap.insert( make_pair( 16, II )); + NtoBMap.insert( make_pair( 17, II )); + NtoBMap.insert( make_pair( 18, II )); + NtoBMap.insert( make_pair( 19, II )); + NtoBMap.insert( make_pair( 20, II )); + NtoBMap.insert( make_pair( 21, II )); + NtoBMap.insert( make_pair( 22,IIA )); + NtoBMap.insert( make_pair( 23,IIA )); + NtoBMap.insert( make_pair( 24,IIA )); + NtoBMap.insert( make_pair( 25,IIA )); + NtoBMap.insert( make_pair( 26,IIA )); + NtoBMap.insert( make_pair( 27,IIA )); + NtoBMap.insert( make_pair( 28,IIA )); + NtoBMap.insert( make_pair( 29,IIA )); + NtoBMap.insert( make_pair( 30,IIA )); + NtoBMap.insert( make_pair( 31,IIA )); + NtoBMap.insert( make_pair( 32,IIA )); + NtoBMap.insert( make_pair( 33,IIA )); + NtoBMap.insert( make_pair( 34,IIA )); + NtoBMap.insert( make_pair( 35,IIA )); + NtoBMap.insert( make_pair( 36,IIA )); + NtoBMap.insert( make_pair( 37,IIA )); + NtoBMap.insert( make_pair( 38,IIA )); + NtoBMap.insert( make_pair( 39,IIA )); + NtoBMap.insert( make_pair( 40,IIA )); + NtoBMap.insert( make_pair( 41,IIR )); + // no NAVSTAR 42, IIR-1 was a launch failure + NtoBMap.insert( make_pair( 43,IIR )); + NtoBMap.insert( make_pair( 44,IIR )); + NtoBMap.insert( make_pair( 45,IIR )); + NtoBMap.insert( make_pair( 46,IIR )); + NtoBMap.insert( make_pair( 47,IIR )); + NtoBMap.insert( make_pair( 48,IIR_M)); + NtoBMap.insert( make_pair( 49,IIR_M)); + NtoBMap.insert( make_pair( 50,IIR_M)); + NtoBMap.insert( make_pair( 51,IIR )); + NtoBMap.insert( make_pair( 52,IIR_M)); + NtoBMap.insert( make_pair( 53,IIR_M)); + NtoBMap.insert( make_pair( 54,IIR )); + NtoBMap.insert( make_pair( 55,IIR_M)); + NtoBMap.insert( make_pair( 56,IIR )); + NtoBMap.insert( make_pair( 57,IIR_M)); + NtoBMap.insert( make_pair( 58,IIR_M)); + NtoBMap.insert( make_pair( 59,IIR )); + NtoBMap.insert( make_pair( 60,IIR )); + NtoBMap.insert( make_pair( 61,IIR )); + NtoBMap.insert( make_pair( 62,IIF )); + NtoBMap.insert( make_pair( 63,IIF )); + NtoBMap.insert( make_pair( 64,IIF )); + NtoBMap.insert( make_pair( 65,IIF )); + NtoBMap.insert( make_pair( 66,IIF )); + NtoBMap.insert( make_pair( 67,IIF )); + NtoBMap.insert( make_pair( 68,IIF )); + NtoBMap.insert( make_pair( 69,IIF )); + NtoBMap.insert( make_pair( 71,IIF )); + NtoBMap.insert( make_pair( 72,IIF )); + NtoBMap.insert( make_pair( 73,IIF )); + + + // Note: This table start with Block I values + // Set up NAVSTAR -> PRN ID relationship + // NAVSTAR ID first, PRN ID second + NtoPMap.insert( std::pair( 1, XRefNode( 4, + CivilTime( 1978, 2, 22, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1985, 7, 17, 17, 30, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 2, XRefNode( 7, + CivilTime( 1978, 6, 13, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1988, 2, 12, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 3, XRefNode( 6, + CivilTime( 1978, 10, 6, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1992, 5, 18, 23, 41, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 4, XRefNode( 8, + CivilTime( 1978, 12, 10, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1990, 5, 31, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 5, XRefNode( 5, + CivilTime( 1980, 2, 9, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1984, 5, 11, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 6, XRefNode( 9, + CivilTime( 1980, 4, 26, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1991, 3, 6, 3, 42, 0.0, TimeSystem::GPS)))); + // no NAVSTAR 07, I-7 was a launch failure + NtoPMap.insert( std::pair( 8, XRefNode( 11, + CivilTime( 1983, 7, 14, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1993, 5, 4, 0, 20, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 9, XRefNode( 13, + CivilTime( 1984, 6, 13, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1993, 5, 4, 18, 17, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 10, XRefNode( 12, + CivilTime( 1984, 9, 8, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1996, 3, 26, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 11, XRefNode( 3, + CivilTime( 1985, 10, 30, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1994, 4, 14, 21, 0, 0.0, TimeSystem::GPS)))); + // no NAVSTAR 12, was never launched + NtoPMap.insert( std::pair( 13, XRefNode( 2, + CivilTime( 1989, 6, 10, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2004, 5, 12, 17, 1, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 14, XRefNode( 14, + CivilTime( 1989, 2, 14, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2000, 4, 14, 13, 47, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 15, XRefNode( 15, + CivilTime( 1990, 10, 1, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2007, 3, 15, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 16, XRefNode( 16, + CivilTime( 1989, 8, 18, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2000, 10, 13, 0, 45, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 17, XRefNode( 17, + CivilTime( 1989, 12, 11, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2005, 2, 23, 22, 0, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 18, XRefNode( 18, + CivilTime( 1990, 1, 24, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2000, 8, 18, 7, 42, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 19, XRefNode( 19, + CivilTime( 1989, 10, 21, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2001, 9, 11, 22, 0, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 20, XRefNode( 20, + CivilTime( 1990, 3, 26, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1996, 12, 13, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 21, XRefNode( 21, + CivilTime( 1990, 8, 2, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2003, 1, 27, 22, 0, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 22, XRefNode( 22, + CivilTime( 1993, 2, 3, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2003, 8, 6, 22, 0, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 23, XRefNode( 23, + CivilTime( 1990, 11, 26, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2004, 2, 13, 22, 0, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 23, XRefNode( 32, + CivilTime( 2006, 12, 1, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 24, XRefNode( 24, + CivilTime( 1991, 7, 4, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2011, 9, 30, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 25, XRefNode( 25, + CivilTime( 1992, 2, 23, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2009, 12, 18, 22, 28, 0.0, TimeSystem::GPS)))); + // NANU 2015005 (end) - extended due to additional data. + NtoPMap.insert( std::pair( 26, XRefNode( 26, + CivilTime( 1992, 7, 7, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 1, 20, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU # (start). NANU 2012061 (end) + // NANU #(start). NANU 2011059 (end). + NtoPMap.insert( std::pair( 27, XRefNode( 27, + CivilTime( 1992, 9, 9, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2011, 8, 10, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2011105 (start). NANU 2012063 (end) + NtoPMap.insert( std::pair( 27, XRefNode( 27, + CivilTime( 2011, 12, 16, 22, 38, 0.0, TimeSystem::GPS), + CivilTime( 2012, 10, 6, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2013074 (start). NANU 2013080 (end) + NtoPMap.insert( std::pair( 27, XRefNode( 30, + CivilTime( 2013, 12, 3, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2013, 12, 17, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015010 (start). NANU 2013019 (end) plus actual received data. + NtoPMap.insert( std::pair( 27, XRefNode( 26, + CivilTime( 2015, 2, 26, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 3, 16, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 28, XRefNode( 28, + CivilTime( 1992, 4, 10, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 1997, 8, 15, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 29, XRefNode( 29, + CivilTime( 1992, 12, 18, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2007, 10, 23, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 30, XRefNode( 30, + CivilTime( 1996, 9, 12, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2011, 8, 4, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 31, XRefNode( 31, + CivilTime( 1993, 3, 30, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2005, 10, 24, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 32, XRefNode( 1, + CivilTime( 1992, 11, 22, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2008, 3, 17, 22, 0, 0.0, TimeSystem::GPS)))); + // NANU 2012018 (start). NANU 2012024 (end) + NtoPMap.insert( std::pair( 32, XRefNode( 24, + CivilTime( 2012, 3, 14, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2012, 4, 24, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2013049 (start). NANU 2013054 (end) + NtoPMap.insert( std::pair( 32, XRefNode( 30, + CivilTime( 2013, 8, 22, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2013, 9, 18, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015007 (start). NANU 2015101 (end) plus actual received data + NtoPMap.insert( std::pair( 32, XRefNode( 26, + CivilTime( 2015, 2, 5, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 2, 24, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2014063 (end). + // NANU claimed 8/2 end date. SV continued to broadcast until 8/18/2014. + NtoPMap.insert( std::pair( 33, XRefNode( 3, + CivilTime( 1996, 3, 28, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2014, 8, 18 , 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 34, XRefNode( 4, + CivilTime( 1993, 10, 26, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 35, XRefNode( 5, + CivilTime( 1993, 8, 30, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2009, 3, 26, 20, 31, 0.0, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 35, XRefNode( 1, + CivilTime( 2011, 6, 1, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2011, 7, 12, 23, 59, 59.9, TimeSystem::GPS)))); + // See PRN 30 notes below for how we arrived at the end time. + NtoPMap.insert( std::pair( 35, XRefNode( 30, + CivilTime( 2011, 8, 6, 20, 0, 0.0, TimeSystem::GPS), + CivilTime( 2013, 5, 1, 22, 00, 0.0, TimeSystem::GPS)))); + // NANU 2013029 (start), NANU 2013049 (end-IMPLIED) + // Note: NANU 2013029 says Approximately 5/8/13 SVN 49 will continue + + // broadcasting as PRN 30. Signal evidence indicates that SVN 49 used PRN 27 until + // about 5/9/2013 1600 Therefore. In the meantime SOME SVN was transmitting + // PRN 30 through 5/6/2013 2000+. Therefore, we've added an "extension" to the + // SVN 35 decommissioning and moved the SVN49/PRN30 start time. + + NtoPMap.insert( std::pair( 35, XRefNode( 30, + CivilTime( 2013, 5, 2, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2013, 5, 6, 22, 00, 0.0, TimeSystem::GPS)))); + + NtoPMap.insert( std::pair( 35, XRefNode( 3, + CivilTime( 2014, 9, 5, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2014, 10, 22, 0, 00, 0.0, TimeSystem::GPS)))); + + // NANU 2014015/2014019 (end) + // NANU claimed 2/21 end date. SV continued to broadcast until 3/3/2014. + NtoPMap.insert( std::pair( 36, XRefNode( 6, + CivilTime( 1995, 3, 10, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2014, 3, 3, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015080 (start) + NtoPMap.insert( std::pair( 36, XRefNode( 10, + CivilTime( 2015, 9, 16, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 10, 26, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 37, XRefNode( 7, + CivilTime( 1993, 5, 13, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2007, 7, 20, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 37, XRefNode( 1, + CivilTime( 2008, 10, 23, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2009, 1, 6, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2012024 (start). NANU 201249 (end) + NtoPMap.insert( std::pair( 37, XRefNode( 24, + CivilTime( 2012, 4, 25, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2012, 8, 7, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2013054 (start). NANU 2013074 (end) + NtoPMap.insert( std::pair( 37, XRefNode( 30, + CivilTime( 2013, 9, 19, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2013, 12, 2, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015021 (end) + NtoPMap.insert( std::pair( 38, XRefNode( 8, + CivilTime( 1997, 11, 6, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 4, 13, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2014046 (end) + // NANU claimed 5/19 end date. SV continued tp broadcast until 5/27/2014. + NtoPMap.insert( std::pair( 39, XRefNode( 9, + CivilTime( 1993, 6, 26, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2014, 5, 27, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2014050 (start) + NtoPMap.insert( std::pair( 39, XRefNode( 9, + CivilTime( 2014, 6, 13, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2014, 8, 1, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 40, XRefNode( 10, + CivilTime( 1996, 7, 16, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 8, 3, 23, 59, 59.9, TimeSystem::GPS)))); + NtoPMap.insert( std::pair( 41, XRefNode( 14, + CivilTime( 2000, 11, 10, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + // no NAVSTAR 42, IIR-1 was a launch failure + NtoPMap.insert( std::pair( 43, XRefNode( 13, + CivilTime( 1997, 7, 23, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 44, XRefNode( 28, + CivilTime( 2000, 7, 16, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 45, XRefNode( 21, + CivilTime( 2003, 3, 31, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 46, XRefNode( 11, + CivilTime( 1999, 10, 7, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 47, XRefNode( 22, + CivilTime( 2003, 12, 21, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 48, XRefNode( 7, + CivilTime( 2008, 3, 15, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 49, XRefNode( 1, + CivilTime( 2009, 3, 24, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2011, 5, 6, 16, 0, 0.0, TimeSystem::GPS)))); + // NANU 2012003 (start). NANU 2012018 (end) + NtoPMap.insert( std::pair( 49, XRefNode( 24, + CivilTime( 2012, 2, 1, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2012, 3, 13, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2012049 (start). NANU # (end) + NtoPMap.insert( std::pair( 49, XRefNode( 24, + CivilTime( 2012, 8, 8, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2012, 8, 22, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2012064 (start). + // We don't know exactly WHEN this relationship stopped. NANU 2013021 states when + // it resumes. + NtoPMap.insert( std::pair( 49, XRefNode( 27, + CivilTime( 2012, 10, 18, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2012, 12, 31, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2013021 (start), 2013031 (end-IMPLIED) + // See PRN30/SVN49 notes below for how we derived this end time. + NtoPMap.insert( std::pair( 49, XRefNode( 27, + CivilTime( 2013, 3, 27, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2013, 5, 9, 16, 44, 59.9, TimeSystem::GPS)))); + // NANU 2013029 (start), 2013049 (end-IMPLIED) + NtoPMap.insert( std::pair( 49, XRefNode( 30, + CivilTime( 2013, 5, 9, 16, 45, 0.0, TimeSystem::GPS), + CivilTime( 2013, 8, 21, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2013080 (start), 2014018 (end-IMPLIED) + NtoPMap.insert( std::pair( 49, XRefNode( 30, + CivilTime( 2013, 12, 18, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2014, 2, 20, 23, 59, 0.0, TimeSystem::GPS)))); + // NANU 2014032 (start), 2014045 (end-IMPLIED) + NtoPMap.insert( std::pair( 49, XRefNode( 6, + CivilTime( 2014, 4, 3, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2014, 5, 15, 23, 59, 59.9, TimeSystem::GPS)))); + // NANU 2015032 (start) + NtoPMap.insert( std::pair( 49, XRefNode( 8, + CivilTime( 2015, 4, 30, 0, 0, 0.0, TimeSystem::GPS), + CivilTime( 2015, 7, 1, 16, 0, 0.0, TimeSystem::GPS)))); + + NtoPMap.insert( std::pair( 50, XRefNode( 5, + CivilTime( 2009, 8, 27, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 51, XRefNode( 20, + CivilTime( 2000, 5, 11, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 52, XRefNode( 31, + CivilTime( 2006, 9, 25, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 53, XRefNode( 17, + CivilTime( 2005, 9, 26, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 54, XRefNode( 18, + CivilTime( 2001, 1, 30, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 55, XRefNode( 15, + CivilTime( 2007, 10, 17, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 56, XRefNode( 16, + CivilTime( 2003, 1, 29, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 57, XRefNode( 29, + CivilTime( 2007, 12, 21, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 58, XRefNode( 12, + CivilTime( 2006, 11, 17, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 59, XRefNode( 19, + CivilTime( 2004, 3, 20, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 60, XRefNode( 23, + CivilTime( 2004, 6, 23, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 61, XRefNode( 2, + CivilTime( 2004, 6, 6, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 62, XRefNode( 25, + CivilTime( 2010, 5, 28, 3, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + NtoPMap.insert( std::pair( 63, XRefNode( 1, + CivilTime( 2011, 7, 20, 9, 36, 36.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + // NANU 2014018 + NtoPMap.insert( std::pair( 64, XRefNode( 30, + CivilTime( 2014, 2, 21, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + + NtoPMap.insert( std::pair( 65, XRefNode( 24, + CivilTime( 2012, 10, 4, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + + NtoPMap.insert( std::pair( 66, XRefNode( 27, + CivilTime( 2013, 5, 15, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + //NANU 2014045 (start) + NtoPMap.insert( std::pair( 67, XRefNode( 6, + CivilTime( 2014, 5, 17, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + // + NtoPMap.insert( std::pair( 68, XRefNode( 9, + CivilTime( 2014, 8, 2, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + + NtoPMap.insert( std::pair( 69, XRefNode( 3, + CivilTime( 2014, 10, 29, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + //NANU 2015019 LAUNCH + NtoPMap.insert( std::pair( 71, XRefNode( 26, + CivilTime( 2015, 3, 25, 18, 36, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + //NANU 2015068 LAUNCH + NtoPMap.insert( std::pair( 72, XRefNode( 8, + CivilTime( 2015, 7, 15, 0, 0, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + //Added before NANU was sent. + NtoPMap.insert( std::pair( 73, XRefNode( 10, + CivilTime( 2015, 10, 31, 16, 23, 0.0, TimeSystem::GPS), + CommonTime::END_OF_TIME ))); + + + //Iterate through the data to produce the PtoNMap + multimap::const_iterator itate; + //Iterates through Navstar by PRN map for each relationship building the corresponding map + for (itate=NtoPMap.begin(); itate != NtoPMap.end(); itate++) + { + std::pair values = *itate; + //Grabs the values to then insert into PtoN + int navNum = values.first; + int prnNum = values.second.getPRNNum(); + TimeRange valid = values.second.getTimeRange(); + //Insert to tree + PtoNMap.insert( std::pair( prnNum, XRefNode( navNum, valid ))); + } + +} + +int SVNumXRef::getNAVSTAR( const int PRNID, const gpstk::CommonTime dt ) const +{ + SVNumXRefPair p = PtoNMap.equal_range( PRNID ); + for (SVNumXRefListCI ci=p.first; ci != p.second; ++ci ) + { + if (ci->second.isApplicable( dt )) return ci->second.getNAVSTARNum(); + } + + // We didn't find a NAVSTAR # for this PRN ID and date, so throw an + // exception. + char textOut[80]; + sprintf(textOut,"No NAVSTAR # found associated with PRN ID %d at requested date: %s.", + PRNID,printTime(dt,"%02m/%02d/%04Y").c_str() ); + std::string sout = textOut; + NoNAVSTARNumberFound noFound( sout ); + GPSTK_THROW(noFound); + return 0; +} + +bool SVNumXRef::NAVSTARIDAvailable( const int PRNID, const gpstk::CommonTime dt ) const +{ + SVNumXRefPair p = PtoNMap.equal_range( PRNID ); + for (SVNumXRefListCI ci=p.first; ci != p.second; ++ci ) + { + if (ci->second.isApplicable( dt )) return true; + } + return false; +} + +bool SVNumXRef::NAVSTARIDActive( const int NAVSTARID, const gpstk::CommonTime dt ) const +{ + return PRNIDAvailable ( NAVSTARID, dt) ; +} + +SVNumXRef::BlockType SVNumXRef::getBlockType( const int NAVSTARID ) const +{ + map::const_iterator i; + i = NtoBMap.find( NAVSTARID ); + if (i!=NtoBMap.end()) return(i->second); + + // We didn't find a BlockType for this NAVSTAR #, so throw an + // exception. + char textOut[80]; + sprintf(textOut,"No BlockType found associated with NAVSTAR Num %d.", + NAVSTARID); + std::string sout = textOut; + NoNAVSTARNumberFound noFound( sout ); + GPSTK_THROW(noFound); + return SVNumXRef::BlockType(); +} + +std::string SVNumXRef::getBlockTypeString( const int NAVSTARID ) const +{ + std::map::const_iterator i; + i = NtoBMap.find( NAVSTARID ); + if (i!=NtoBMap.end()) + { + BlockType bt = i->second; + switch( bt ) + { + case I: return("Block I"); break; + case II: return("Block II"); break; + case IIA: return("Block IIA"); break; + case IIR: return("Block IIR"); break; + case IIR_M: return("Block IIR_M"); break; + case IIF: return("Block IIF"); break; + } + } + return "unknown"; +} + +int SVNumXRef::getPRNID( const int NAVSTARID, const gpstk::CommonTime dt ) const +{ + NAVNumXRefPair p = NtoPMap.equal_range( NAVSTARID ); + for (NAVNumXRefCI ci=p.first; ci != p.second; ++ci ) + { + if (ci->second.isApplicable( dt )) return ci->second.getPRNNum(); + } + + // We didn't find a PRN ID for this NAVSTAR # and date, so throw an + // exception. + char textOut[80]; + sprintf(textOut,"No PRN ID found associated with NAVSTAR Num %d at requested date: %s.", + NAVSTARID,printTime(dt,"%02m/%02d/%04Y").c_str() ); + std::string sout = textOut; + NoNAVSTARNumberFound noFound( sout ); + GPSTK_THROW(noFound); + return 0; +} + +bool SVNumXRef::PRNIDAvailable( const int NAVSTARID, const gpstk::CommonTime dt ) const +{ + NAVNumXRefPair p = NtoPMap.equal_range( NAVSTARID ); + for (NAVNumXRefCI ci=p.first; ci != p.second; ++ci ) + { + if (ci->second.isApplicable( dt )) return true; + } + return false; +} + +bool SVNumXRef::BlockTypeAvailable( const int NAVSTARID ) const +{ + map::const_iterator i; + i = NtoBMap.find( NAVSTARID ); + if (i!=NtoBMap.end()) return true; + return false; +} + +//----------Dumps out a List of and ALSO checks for Overlaps is overlap is set to true +//----------Navstar #s---PRN---start time---end time--- +//----------PRN---Navstar #s---start time---end time--- +void SVNumXRef::dump(std::ostream& out) const +{ + //iterate through the data + multimap::const_iterator it; + bool pastCurrent = false; + //header + std::string start_end_h = " START" + " END\n"; + std::string svn_h = " SVN PRN MM/DD/YYYY DOY HH:MM:SS" + " MM/DD/YYYY DOY HH:MM:SS\n"; + out << start_end_h << svn_h; + //Iterates through Navstar by PRN + for (it=NtoPMap.begin(); it != NtoPMap.end(); it++) + { + std::pair mm = *it; + out << " " << setw(2) << mm.first + << " " << mm.second.toString() << endl; + } + out << "\n\n\n"; + //iterate through the data + multimap::const_iterator iter; + //resest pastCurrent + pastCurrent = false; + //header + std::string prn_h = " PRN SVN MM/DD/YYYY DOY HH:MM:SS" + " MM/DD/YYYY DOY HH:MM:SS\n"; + out << start_end_h << prn_h; + //Iterates through PRN by Navstar + for (iter = PtoNMap.begin(); iter != PtoNMap.end(); iter++) + { + std::pair pp = *iter; + out << " " << setw(2) << pp.first + << " " << pp.second.toString() <::const_iterator cit1; + multimap::const_iterator cit2; + // loops through the multimap + for (cit1 = NtoPMap.begin(); cit1 != NtoPMap.end(); cit1++) + { + cit2 = cit1; + cit2++; // cit2 always starts the nested loop one higher than cit1 + for (; cit2 != NtoPMap.end(); cit2++) + { + int key1 = cit1->first; // keys represent the SVN numbers + int key2 = cit2->first; + const XRefNode xr1 = cit1->second; // these const xr variables represent the XRefNode so we can access the begin and end times + const XRefNode xr2 = cit2->second; // of each SVN/PRN pair + int val1 = xr1.getPRNNum(); // vals represent the PRN numbers + int val2 = xr2.getPRNNum(); + + if ((key1 == key2) || (val1 == val2)) // checks initial condition for an overlap; if neither are true, there is no overlap + { + const TimeRange& tr1 = xr1.getTimeRange(); + const TimeRange& tr2 = xr2.getTimeRange(); + if (tr1.overlaps(tr2)) + { + retVal = false; + std::cout << "Overlap between SV" + << setw(2) << key1 << "/PRN" + << setw(2) << val1 << "at" + << tr1.printf() << endl; + std::cout << " and" + << setw(2) << key2 << "/PRN" + << setw(2) << val2 << "at" + << tr2.printf() << endl; + } + } + + } + } + return retVal; // if we reach this point, we know there are no overlaps +} + + diff --git a/core/lib/GNSSCore/SVNumXRef.hpp b/core/lib/GNSSCore/SVNumXRef.hpp index 9ce80ed85..f22eecd53 100644 --- a/core/lib/GNSSCore/SVNumXRef.hpp +++ b/core/lib/GNSSCore/SVNumXRef.hpp @@ -18,7 +18,18 @@ // Copyright 2004, The University of Texas at Austin // //============================================================================ - +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================ /* SVNumXRef.hpp * * Applied Research Laboratories, The University of Texas at Austin @@ -78,87 +89,87 @@ #ifndef SVNUMXREF_HPP #define SVNUMXREF_HPP - // Language Headers #include #include - // Library Headers #include "CommonTime.hpp" #include "SystemTime.hpp" #include "gps_constants.hpp" #include "Exception.hpp" +#include "TimeRange.hpp" - // Project Headers namespace gpstk { -NEW_EXCEPTION_CLASS( NoPRNNumberFound, gpstk::Exception); -NEW_EXCEPTION_CLASS( NoNAVSTARNumberFound, gpstk::Exception); + NEW_EXCEPTION_CLASS( NoPRNNumberFound, gpstk::Exception); + NEW_EXCEPTION_CLASS( NoNAVSTARNumberFound, gpstk::Exception); -class XRefNode -{ - public: - XRefNode( const int NumArg, + class XRefNode + { + public: + XRefNode( const int NumArg, + const gpstk::TimeRange tr ); + XRefNode( const int NumArg, const gpstk::CommonTime begDT, const gpstk::CommonTime endDT ); - int getNAVSTARNum() const; - int getPRNNum() const; - gpstk::CommonTime getBeginTime() const; - gpstk::CommonTime getEndTime() const; - bool isApplicable( gpstk::CommonTime dt ) const; - std::string toString() const; - - protected: - int Num; - gpstk::CommonTime begValid; - gpstk::CommonTime endValid; -}; - -typedef std::multimap::const_iterator SVNumXRefListCI; -typedef std::pair SVNumXRefPair; -typedef std::multimap::const_iterator NAVNumXRefCI; -typedef std::pair NAVNumXRefPair; - -class SVNumXRef -{ - public: + int getNAVSTARNum() const; + int getPRNNum() const; + gpstk::CommonTime getBeginTime() const; + gpstk::CommonTime getEndTime() const; + gpstk::TimeRange getTimeRange() const; + bool isApplicable( gpstk::CommonTime dt ) const; + std::string toString() const; + + protected: + int Num; + gpstk::TimeRange valid; + }; + + typedef std::multimap::const_iterator SVNumXRefListCI; + typedef std::pair SVNumXRefPair; + typedef std::multimap::const_iterator NAVNumXRefCI; + typedef std::pair NAVNumXRefPair; + + class SVNumXRef + { + public: enum BlockType { - I, - II, - IIA, - IIR, - IIR_M, - IIF + I, + II, + IIA, + IIR, + IIR_M, + IIF }; SVNumXRef( ); ~SVNumXRef() {} BlockType getBlockType( const int NAVSTARID ) const; std::string getBlockTypeString( const int NAVSTARID ) const; - int getNAVSTAR( const int PRNID, const gpstk::CommonTime dt = SystemTime() ) const; - int getPRNID( const int NAVSTARID, const gpstk::CommonTime dt = SystemTime() ) const; - bool PRNIDAvailable( const int NAVSTARID, const gpstk::CommonTime dt = SystemTime() ) const; - bool NAVSTARIDAvailable( const int PRNID, const gpstk::CommonTime dt = SystemTime() ) const; + int getNAVSTAR( const int PRNID, const gpstk::CommonTime dt ) const; + int getPRNID( const int NAVSTARID, const gpstk::CommonTime dt ) const; + bool PRNIDAvailable( const int NAVSTARID, const gpstk::CommonTime dt ) const; + bool NAVSTARIDAvailable( const int PRNID, const gpstk::CommonTime dt ) const; bool BlockTypeAvailable( const int NAVSTARID ) const; - bool NAVSTARIDActive( const int NAVSTARID, const gpstk::CommonTime dt = SystemTime() ) const; - int dump(std::ostream& out=std::cout, bool checkOverlap=false) const; + bool NAVSTARIDActive( const int NAVSTARID, const gpstk::CommonTime dt ) const; + void dump(std::ostream& out=std::cout) const; bool isConsistent() const; - bool overlap( const XRefNode& xr1, const XRefNode& xr2) const; - protected: - std::multimap NtoPMap; - std::multimap PtoNMap; - std::map NtoBMap; -}; + protected: + std::multimap NtoPMap; + std::multimap PtoNMap; + std::map NtoBMap; + }; -inline int XRefNode::getNAVSTARNum() const { return(Num); } -inline int XRefNode::getPRNNum() const { return(Num); } -inline gpstk::CommonTime XRefNode::getBeginTime() const { return( begValid ); } -inline gpstk::CommonTime XRefNode::getEndTime() const { return( endValid ); } + inline int XRefNode::getNAVSTARNum() const { return(Num); } + inline int XRefNode::getPRNNum() const { return(Num); } + inline gpstk::CommonTime XRefNode::getBeginTime() const { return( valid.getStart() ); } + inline gpstk::CommonTime XRefNode::getEndTime() const { return( valid.getEnd() ); } + inline gpstk::TimeRange XRefNode::getTimeRange() const { return( valid ); } -} + } #endif diff --git a/core/tests/GNSSCore/SVNumXRef_T.cpp b/core/tests/GNSSCore/SVNumXRef_T.cpp index 4295a00d9..42f00a6b7 100644 --- a/core/tests/GNSSCore/SVNumXRef_T.cpp +++ b/core/tests/GNSSCore/SVNumXRef_T.cpp @@ -1,26 +1,155 @@ -/********************************************************************* +//============================================================================ +// +// This file is part of GPSTk, the GPS Toolkit. +// +// The GPSTk is free software; you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as published +// by the Free Software Foundation; either version 3.0 of the License, or +// any later version. +// +// The GPSTk is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with GPSTk; if not, write to the Free Software Foundation, +// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA +// +// Copyright 2004, The University of Texas at Austin +// +//============================================================================ +// +//This software developed by Applied Research Laboratories at the University of +//Texas at Austin, under contract to an agency or agencies within the U.S. +//Department of Defense. The U.S. Government retains all rights to use, +//duplicate, distribute, disclose, or release this software. +// +//Pursuant to DoD Directive 523024 +// +// DISTRIBUTION STATEMENT A: This software has been approved for public +// release, distribution is unlimited. +// +//============================================================================ + /********************************************************************* * * Test program for gpstk/core/lib/GNSSCore/SVNumXRef. -* The last line of output will be "1" if the test passes, -* and "0" if it fails. -* isConsistent() returns 1 if there are no overlaps in -* PRN-SVN relationships and 0 otherwise. +* The last line of output will calculate how many tests fail. * *********************************************************************/ -#include +#include +#include + +#include "CivilTime.hpp" #include "SVNumXRef.hpp" -using namespace std; +#include "TestUtil.hpp" + using namespace gpstk; -int main( int argc, char * argv[] ) +int main() { - cout << "Entering SVNumXRef_T" << endl; - int testVal; + TUDEF("SVNumXRef", ""); + SVNumXRef svNumXRef; - testVal = svNumXRef.isConsistent(); - if (testVal == 1) - testVal = 0; - - return(testVal); + + //Test for overlap in SVN/PRN active time range(s) + //output 0 for pass; output 1 for any fail + testFramework.changeSourceMethod(" isConsistent"); + TUASSERTE(bool, true, svNumXRef.isConsistent()); + + + //Test that correct SVN availablility is given at specific time, given PRN + //first statement intended to be true; second intended to be false + testFramework.changeSourceMethod(" NAVSTARIDAvailable"); + TUASSERTE(bool, true, svNumXRef.NAVSTARIDAvailable(8, + CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); + TUASSERTE(bool, false, svNumXRef.NAVSTARIDAvailable(8, + CivilTime(2015, 7, 14, 0, 0, 0.0, TimeSystem::GPS))); + + + //Test that correct SVN is returned, given PRN and active time range + //try-catch ensures that an exception is thrown for a nonexistent PRN + testFramework.changeSourceMethod(" getNAVSTAR"); + TUASSERTE(int, 72, svNumXRef.getNAVSTAR(8, + CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); + try + { + svNumXRef.getNAVSTAR(0, + CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS)); + TUFAIL("getNAVSTAR(0) should have failed"); + } + catch( NoNAVSTARNumberFound ) + { + TUPASS(""); + } + + + //Test that SV is correctly displayed as active, given SVN and active time range + //first statement intended to be true; second intended to be false + testFramework.changeSourceMethod(" NAVSTARIDActive"); + TUASSERTE(bool, true, svNumXRef.NAVSTARIDActive(72, + CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); + TUASSERTE(bool, false, svNumXRef.NAVSTARIDActive(72, + CivilTime(2015, 7, 14, 0, 0, 0.0, TimeSystem::GPS))); + + + //Test that exception is thrown if BlockType cannot be located for SVN input + //try-catch ensures that an exception is thrown for a nonexistent SVN + testFramework.changeSourceMethod(" getBlockType"); + TUASSERTE(SVNumXRef::BlockType, SVNumXRef::IIF, + svNumXRef.getBlockType(72)); + try + { + svNumXRef.getBlockType(0); + TUFAIL("getBlockType(0) should have failed"); + } + catch( NoNAVSTARNumberFound ) + { + TUPASS(""); + } + + + //Test string output for corresponding block type or unknown if not found + testFramework.changeSourceMethod(" getBlockTypeString"); + TUASSERTE(std::string, "Block IIF", svNumXRef.getBlockTypeString(72)); + TUASSERTE(std::string, "unknown", svNumXRef.getBlockTypeString(0)); + + + //Test that correct PRN is returned, given SVN and active time range + testFramework.changeSourceMethod(" getPRNID"); + TUASSERTE(int, 8, svNumXRef.getPRNID(72, + CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); + try + { + svNumXRef.getPRNID(0, + CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS)); + TUFAIL("getPRNID(0) did not fail"); + } + catch( NoNAVSTARNumberFound ) + { + TUPASS(""); + } + + + //Test that SV is correctly displayed as active, given PRN and active time range + //first statement intended to be true; second intended to be falst + testFramework.changeSourceMethod(" PRNIDAvailable"); + TUASSERTE(bool, true, svNumXRef.PRNIDAvailable(72, + CivilTime(2015, 10, 1, 0, 0, 0.0, TimeSystem::GPS))); + TUASSERTE(bool, false, svNumXRef.PRNIDAvailable(72, + CivilTime(2015, 7, 14, 0, 0, 0.0, TimeSystem::GPS))); + + + //Test that SVN corresponds to an available block type + //first statement intended to be true; second intended to be false + testFramework.changeSourceMethod(" BlockTypeAvailable"); + TUASSERTE(bool, true, svNumXRef.BlockTypeAvailable(72)); + TUASSERTE(bool, false, svNumXRef.BlockTypeAvailable(0)); + + + std::cout << "Total Failures for " << __FILE__ << ": " << testFramework.countFails() << std::endl; + + + return testFramework.countFails(); } diff --git a/ext/apps/misc/CMakeLists.txt b/ext/apps/misc/CMakeLists.txt index fdbd17b39..44279c0d2 100755 --- a/ext/apps/misc/CMakeLists.txt +++ b/ext/apps/misc/CMakeLists.txt @@ -1,5 +1,5 @@ # apps/misc/CMakeLists.txt -add_executable(xSVNumXRef xSVNumXRef.cpp) -target_link_libraries(xSVNumXRef gpstk) -install (TARGETS xSVNumXRef DESTINATION "${CMAKE_INSTALL_BINDIR}") +add_executable(SVNumXRefDUMP SVNumXRefDUMP.cpp) +target_link_libraries(SVNumXRefDUMP gpstk) +install (TARGETS SVNumXRefDUMP DESTINATION "${CMAKE_INSTALL_BINDIR}") diff --git a/ext/apps/misc/xSVNumXRef.cpp b/ext/apps/misc/SVNumXRefDUMP.cpp similarity index 93% rename from ext/apps/misc/xSVNumXRef.cpp rename to ext/apps/misc/SVNumXRefDUMP.cpp index b0921abaf..4d7fd74f6 100644 --- a/ext/apps/misc/xSVNumXRef.cpp +++ b/ext/apps/misc/SVNumXRefDUMP.cpp @@ -14,7 +14,7 @@ int main( int argc, char * argv[] ) cout << "Entering xSVNumXRef" << endl; SVNumXRef svNumXRef; - svNumXRef.dump(cout, true); + svNumXRef.dump(cout); return(0); }