SVNumXRef.hpp
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 // This software was developed by Applied Research Laboratories at the
28 // University of Texas at Austin, under contract to an agency or agencies
29 // within the U.S. Department of Defense. The U.S. Government retains all
30 // rights to use, duplicate, distribute, disclose, or release this software.
31 //
32 // Pursuant to DoD Directive 523024
33 //
34 // DISTRIBUTION STATEMENT A: This software has been approved for public
35 // release, distribution is unlimited.
36 //
37 //==============================================================================
38 
39 /* SVNumXRef.hpp
40 *
41 * Applied Research Laboratories, The University of Texas at Austin
42 * June 2007
43 *
44 * This class implements a cross-reference between PRN numbers and NAVSTAR IDs.
45 * Since PRN numbers are re-used (historically, there's a limit of 1-32 in
46 * the PRN IDs) it's necessary provide a several->one PRN ID ->NAVSTAR mapping.
47 * Originally, the NAVSTAR->PRN ID mapping is unique. However, this is no longer
48 * true and several -> one mapping now necessary in both directions.
49 *
50 * As a result, the cross reference methods support the ability to provide a
51 * date so the method can select between multiple options.
52 *
53 * Note: Thie information is not contained anywhere in the navigation message.
54 * Therefore, it needs to come from "outside the system". The information
55 * contained in the class constructor will also need to updated with each
56 * new launch and disposal. This is a sore point, but there appears to be
57 * no easy way around it.
58 *
59 * Note: The data in the module is derived from several sources and there
60 * are some issues of interpretation.
61 * - The USNO website ftp://tycho.usno.navy.mil/pub/gps/gpsb2.txt contains
62 * a very helpful history
63 * - This class only attempts to track the relationship between PRN ID and
64 * NAVSTAR numbers. There's no guarantee a SV was operationally, broadcasting,
65 * or healthy.
66 *
67 * MEMBER METHODS
68 * SVNumXRef( ); - Constructor. Works from a fixed table that is compiled
69 * into the code.
70 * int getNAVSTAR( const int PRNID, const gnsstk::CommonTime dt ) const; -
71 * Given a PRNID and a date, return the NAVSTAR number
72 * related to thsat PRNID at the date provided. May
73 * throw "NoNAVSTARNumFound" error. The date defaults to
74 * the current date if one is not provided.
75 * int getPRNID( const int NAVSTARID, const gnsstk::CommonTime dt ) const; -
76 * Given a NAVSTAR Number and a date, return the corresponding
77 * PRNID related to the NAVSTAR Number on the specified date.
78 * May throw "No PRNNumberFound" error." The date defaults to
79 * the current date if one is not provided.
80 *
81 * The following four members parallel the preceding four and provide a
82 * means of determining is the specified information is available prior to
83 * making a "get" call. This is useful if you want to avoid writing
84 * "try/catch" blocks.
85 * bool PRNIDavailable( const int NAVSTARID, const gnsstk::CommonTime dt ) const;
86 * bool NAVSTARIDAvailable( const int PRNID, const gnsstk::CommonTime dt ) const;
87 *
88 *
89 * bool NAVSTARIDActive( const int NAVSTARID, const gnsstk::CommonTime dt ) const; -
90 * Given a NAVSTAR ID and a date, return true if the specified NAVSTAR ID was
91 * active on the date provided. The date defaults to the current date if one
92 * is not provided.
93 *
94 */
95 #ifndef SVNUMXREF_HPP
96 #define SVNUMXREF_HPP
97 
98 #include <map>
99 #include <utility>
100 
101 #include "CommonTime.hpp"
102 #include "SystemTime.hpp"
103 #include "gps_constants.hpp"
104 #include "Exception.hpp"
105 #include "TimeRange.hpp"
106 
107 
108 namespace gnsstk
109 {
110 
111  NEW_EXCEPTION_CLASS( NoPRNNumberFound, gnsstk::Exception);
112  NEW_EXCEPTION_CLASS( NoNAVSTARNumberFound, gnsstk::Exception);
113 
114 
115  class XRefNode
116  {
117  public:
118  XRefNode( const int NumArg,
119  const gnsstk::TimeRange tr );
120  XRefNode( const int NumArg,
121  const gnsstk::CommonTime begDT,
122  const gnsstk::CommonTime endDT );
123  int getNAVSTARNum() const;
124  int getPRNNum() const;
128  bool isApplicable( gnsstk::CommonTime dt ) const;
129  std::string toString() const;
130 
131  protected:
132  int Num;
134  };
135 
136  typedef std::multimap<int, XRefNode>::const_iterator SVNumXRefListCI;
137  typedef std::pair<SVNumXRefListCI,SVNumXRefListCI> SVNumXRefPair;
138  typedef std::multimap<int, XRefNode>::const_iterator NAVNumXRefCI;
139  typedef std::pair<NAVNumXRefCI,NAVNumXRefCI> NAVNumXRefPair;
140 
141  class SVNumXRef
142  {
143  public:
144 
146  {
147  I,
148  II,
154  };
155  SVNumXRef( );
157  BlockType getBlockType( const int NAVSTARID ) const;
158  std::string getBlockTypeString( const int NAVSTARID ) const;
159  int getNAVSTAR( const int PRNID, const gnsstk::CommonTime dt ) const;
160  int getPRNID( const int NAVSTARID, const gnsstk::CommonTime dt ) const;
161  bool PRNIDAvailable( const int NAVSTARID, const gnsstk::CommonTime dt ) const;
162  bool NAVSTARIDAvailable( const int PRNID, const gnsstk::CommonTime dt ) const;
163  bool BlockTypeAvailable( const int NAVSTARID ) const;
164  bool NAVSTARIDActive( const int NAVSTARID, const gnsstk::CommonTime dt ) const;
165  void dump(std::ostream& out=std::cout) const;
166  bool isConsistent() const;
167 
168  const std::multimap<int, XRefNode>& getPtoNMap()
169  { return PtoNMap; }
170 
171  protected:
172  std::multimap<int,XRefNode> NtoPMap;
173  std::multimap<int,XRefNode> PtoNMap;
174  std::map<int,BlockType> NtoBMap;
175  };
176 
177  inline int XRefNode::getNAVSTARNum() const { return(Num); }
178  inline int XRefNode::getPRNNum() const { return(Num); }
179  inline gnsstk::CommonTime XRefNode::getBeginTime() const { return( valid.getStart() ); }
180  inline gnsstk::CommonTime XRefNode::getEndTime() const { return( valid.getEnd() ); }
181  inline gnsstk::TimeRange XRefNode::getTimeRange() const { return( valid ); }
182 
183 
184  }
185 #endif
gnsstk::SVNumXRefPair
std::pair< SVNumXRefListCI, SVNumXRefListCI > SVNumXRefPair
Definition: SVNumXRef.hpp:137
gnsstk::SVNumXRef
Definition: SVNumXRef.hpp:141
gnsstk::SVNumXRef::NAVSTARIDActive
bool NAVSTARIDActive(const int NAVSTARID, const gnsstk::CommonTime dt) const
Definition: SVNumXRef.cpp:594
gnsstk::SVNumXRef::IIR
@ IIR
Definition: SVNumXRef.hpp:150
gnsstk::SVNumXRef::PRNIDAvailable
bool PRNIDAvailable(const int NAVSTARID, const gnsstk::CommonTime dt) const
Definition: SVNumXRef.cpp:656
gnsstk::SVNumXRef::NtoPMap
std::multimap< int, XRefNode > NtoPMap
Definition: SVNumXRef.hpp:172
gps_constants.hpp
gnsstk::SVNumXRef::getNAVSTAR
int getNAVSTAR(const int PRNID, const gnsstk::CommonTime dt) const
Definition: SVNumXRef.cpp:565
gnsstk::SVNumXRef::III
@ III
Definition: SVNumXRef.hpp:153
gnsstk::SVNumXRef::II
@ II
Definition: SVNumXRef.hpp:148
gnsstk::SVNumXRef::getBlockTypeString
std::string getBlockTypeString(const int NAVSTARID) const
Definition: SVNumXRef.cpp:616
gnsstk::SVNumXRefListCI
std::multimap< int, XRefNode >::const_iterator SVNumXRefListCI
Definition: SVNumXRef.hpp:136
gnsstk::SVNumXRef::dump
void dump(std::ostream &out=std::cout) const
Definition: SVNumXRef.cpp:677
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::SVNumXRef::PtoNMap
std::multimap< int, XRefNode > PtoNMap
Definition: SVNumXRef.hpp:173
gnsstk::SVNumXRef::NAVSTARIDAvailable
bool NAVSTARIDAvailable(const int PRNID, const gnsstk::CommonTime dt) const
Definition: SVNumXRef.cpp:584
gnsstk::TimeRange
Definition: TimeRange.hpp:59
gnsstk::Exception
Definition: Exception.hpp:151
gnsstk::NEW_EXCEPTION_CLASS
NEW_EXCEPTION_CLASS(FileSpecException, gnsstk::Exception)
gnsstk::XRefNode::getEndTime
gnsstk::CommonTime getEndTime() const
Definition: SVNumXRef.hpp:180
gnsstk::XRefNode::Num
int Num
Definition: SVNumXRef.hpp:132
gnsstk::NAVNumXRefCI
std::multimap< int, XRefNode >::const_iterator NAVNumXRefCI
Definition: SVNumXRef.hpp:138
gnsstk::NAVNumXRefPair
std::pair< NAVNumXRefCI, NAVNumXRefCI > NAVNumXRefPair
Definition: SVNumXRef.hpp:139
SystemTime.hpp
gnsstk::XRefNode::getBeginTime
gnsstk::CommonTime getBeginTime() const
Definition: SVNumXRef.hpp:179
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::XRefNode::getNAVSTARNum
int getNAVSTARNum() const
Definition: SVNumXRef.hpp:177
gnsstk::XRefNode::getPRNNum
int getPRNNum() const
Definition: SVNumXRef.hpp:178
gnsstk::SVNumXRef::IIA
@ IIA
Definition: SVNumXRef.hpp:149
gnsstk::XRefNode::getTimeRange
gnsstk::TimeRange getTimeRange() const
Definition: SVNumXRef.hpp:181
gnsstk::SVNumXRef::getBlockType
BlockType getBlockType(const int NAVSTARID) const
Definition: SVNumXRef.cpp:599
gnsstk::XRefNode::isApplicable
bool isApplicable(gnsstk::CommonTime dt) const
Definition: SVNumXRef.cpp:729
Exception.hpp
CommonTime.hpp
gnsstk::XRefNode::XRefNode
XRefNode(const int NumArg, const gnsstk::TimeRange tr)
Definition: SVNumXRef.cpp:714
gnsstk::TimeRange::getEnd
CommonTime getEnd() const
Definition: TimeRange.hpp:91
gnsstk::SVNumXRef::IIF
@ IIF
Definition: SVNumXRef.hpp:152
gnsstk::SVNumXRef::I
@ I
Definition: SVNumXRef.hpp:147
gnsstk::XRefNode
Definition: SVNumXRef.hpp:115
gnsstk::SVNumXRef::getPtoNMap
const std::multimap< int, XRefNode > & getPtoNMap()
Definition: SVNumXRef.hpp:168
gnsstk::SVNumXRef::IIR_M
@ IIR_M
Definition: SVNumXRef.hpp:151
TimeRange.hpp
gnsstk::XRefNode::valid
gnsstk::TimeRange valid
Definition: SVNumXRef.hpp:133
gnsstk::SVNumXRef::~SVNumXRef
~SVNumXRef()
Definition: SVNumXRef.hpp:156
gnsstk::SVNumXRef::SVNumXRef
SVNumXRef()
Definition: SVNumXRef.cpp:55
gnsstk::SVNumXRef::getPRNID
int getPRNID(const int NAVSTARID, const gnsstk::CommonTime dt) const
Definition: SVNumXRef.cpp:637
gnsstk::TimeRange::getStart
CommonTime getStart() const
Definition: TimeRange.hpp:90
gnsstk::SVNumXRef::BlockType
BlockType
Definition: SVNumXRef.hpp:145
gnsstk::SVNumXRef::BlockTypeAvailable
bool BlockTypeAvailable(const int NAVSTARID) const
Definition: SVNumXRef.cpp:666
gnsstk::SVNumXRef::isConsistent
bool isConsistent() const
Definition: SVNumXRef.cpp:753
gnsstk::XRefNode::toString
std::string toString() const
Definition: SVNumXRef.cpp:735
gnsstk::SVNumXRef::NtoBMap
std::map< int, BlockType > NtoBMap
Definition: SVNumXRef.hpp:174


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