EngNav.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 
44 #ifndef GNSSTK_ENGNAV_HPP
45 #define GNSSTK_ENGNAV_HPP
46 
47 
48 #include <sys/types.h>
49 #include <ostream>
50 
51 #include "gnsstkplatform.h"
52 #include "BinUtils.hpp"
53 #include "GPSWeekSecond.hpp"
54 #include "NMCTMeta.hpp"
55 
56 namespace gnsstk
57 {
59 
60 
61  struct DecodeQuant;
62 
69  class EngNav
70  {
71  public:
74  {
75  BITS8 = 0,
76  BITS10 = 1
77  };
78 
80  EngNav() noexcept;
81 
83  virtual ~EngNav() {}
84 
85 
99  static uint32_t computeParity(uint32_t sfword,
100  uint32_t psfword,
101  bool knownUpright=true);
102 
115  static uint32_t fixParity(uint32_t sfword,
116  uint32_t psfword,
117  bool nib,
118  bool knownUpright = true);
119 
124  static bool checkParity(const uint32_t input[10], bool knownUpright=true);
125  static bool checkParity(const std::vector<uint32_t>& v, bool knownUpright=true);
126 
127 
129  static bool subframeParity(const long input[10]);
130 
131 
134  static inline uint32_t getd30(uint32_t sfword)
135  {
136  return (sfword & 0x01);
137  }
138 
140  static inline uint32_t getd29(uint32_t sfword)
141  {
142  return ((sfword & 0x02) >> 1);
143  }
144 
146  static inline unsigned long getHOWTime(uint32_t word2)
147  {
148  word2 >>= 13;
149  word2 &= 0x0001FFFFL;
150  return word2 * 6;
151  }
152 
154  static inline unsigned long getTOW(uint32_t word2)
155  {
156  // It is assumed that the upper 2 bits of word2 are
157  // appropriately zero. If that's not the case, you have
158  // other problems.
159  return (word2 >> 13);
160  }
161 
163  static inline short getSFID(uint32_t word2)
164  {
165  word2 >>= 8;
166  word2 &= 0x00000007L;
167  return word2 ;
168  }
169 
170 
188  static bool subframeConvert(const long input[10],
189  int gpsWeek,
190  double output[60])
191  noexcept;
192 
210  static bool subframeConvert(const uint32_t input[10],
211  short gpsWeek,
212  double output[60])
213  noexcept;
214 
222  static bool convert8bit(int gpsWeek, double *out)
223  noexcept;
224 
232  static bool convert10bit(int gpsWeek, double *out)
233  noexcept;
234 
244  static short convertXBit( short fullGPSWeek,
245  short incompleteGPSWeek,
246  BitConvertType type);
247 
272  static short getSubframePattern(const long input[10])
273  noexcept;
274  static short getSubframePattern(const uint32_t input[10])
275  noexcept;
276 
289  static bool sv2page(short svpgid, short& subframe, short& page)
290  noexcept;
291 
292 
303  static bool sfpage2svid(short subframe, short page, short& svpgid)
304  noexcept;
305 
306 
316  static bool zcount2page(unsigned long zcount,
317  short& subframe, short& page)
318  noexcept;
319 
324  static void dump(std::ostream& s = std::cout);
325 
341  static bool getNMCTValidity(const uint32_t sf2[10],
342  unsigned howWeek,
343  uint32_t &aodo,
344  CommonTime &tnmct,
345  CommonTime &toe,
346  CommonTime &tot);
347 
361  static bool getNMCTValidity(const uint32_t sf2[10],
362  unsigned howWeek,
363  NMCTMeta &meta)
364  {
365  return getNMCTValidity(sf2, howWeek, meta.aodo, meta.tnmct, meta.toe,
366  meta.tot);
367  }
368 
369  private:
370 
390  static void convertQuant(const uint32_t input[10],
391  double output[60],
392  const DecodeQuant& dq)
393  noexcept;
394  }; // class EngNav
395 
397 
398 } // namespace
399 
400 #endif
gnsstk::EngNav::convert10bit
static bool convert10bit(int gpsWeek, double *out) noexcept
Definition: EngNav.cpp:448
gnsstk::NMCTMeta::aodo
uint32_t aodo
Age-of-data offset (in seconds).
Definition: NMCTMeta.hpp:60
gnsstk::EngNav::getTOW
static unsigned long getTOW(uint32_t word2)
Get the TOW count from the provided HOW.
Definition: EngNav.hpp:154
gnsstkplatform.h
gnsstk::EngNav::getd29
static uint32_t getd29(uint32_t sfword)
Get bit 29 from the given subframe word.
Definition: EngNav.hpp:140
gnsstk::EngNav::subframeParity
static bool subframeParity(const long input[10])
This is the old routine only left around for compatibility.
Definition: EngNav.cpp:714
gnsstk::EngNav
Definition: EngNav.hpp:69
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::EngNav::EngNav
EngNav() noexcept
default constructor
Definition: EngNav.cpp:369
gnsstk::EngNav::sv2page
static bool sv2page(short svpgid, short &subframe, short &page) noexcept
Definition: EngNav.cpp:524
gnsstk::EngNav::convert8bit
static bool convert8bit(int gpsWeek, double *out) noexcept
Definition: EngNav.cpp:436
gnsstk::NMCTMeta::tnmct
CommonTime tnmct
NMCT validity time.
Definition: NMCTMeta.hpp:61
gnsstk::EngNav::convertXBit
static short convertXBit(short fullGPSWeek, short incompleteGPSWeek, BitConvertType type)
Definition: EngNav.cpp:461
gnsstk::EngNav::zcount2page
static bool zcount2page(unsigned long zcount, short &subframe, short &page) noexcept
Definition: EngNav.cpp:608
gnsstk::EngNav::getSubframePattern
static short getSubframePattern(const long input[10]) noexcept
Definition: EngNav.cpp:478
gnsstk::bds::sf2
@ sf2
Definition: BDSD1Bits.hpp:192
gnsstk::EngNav::dump
static void dump(std::ostream &s=std::cout)
Definition: EngNav.cpp:800
gnsstk::NMCTMeta
Definition: NMCTMeta.hpp:53
gnsstk::EngNav::getHOWTime
static unsigned long getHOWTime(uint32_t word2)
Get the HOW time from the provided HOW.
Definition: EngNav.hpp:146
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::EngNav::fixParity
static uint32_t fixParity(uint32_t sfword, uint32_t psfword, bool nib, bool knownUpright=true)
Definition: EngNav.cpp:685
gnsstk::EngNav::BITS10
@ BITS10
Definition: EngNav.hpp:76
gnsstk::EngNav::sfpage2svid
static bool sfpage2svid(short subframe, short page, short &svpgid) noexcept
Definition: EngNav.cpp:583
gnsstk::EngNav::subframeConvert
static bool subframeConvert(const long input[10], int gpsWeek, double output[60]) noexcept
Definition: EngNav.cpp:375
gnsstk::NMCTMeta::toe
CommonTime toe
Ephemeris validity time.
Definition: NMCTMeta.hpp:62
gnsstk::EngNav::getSFID
static short getSFID(uint32_t word2)
Get the subframe ID from the provided HOW.
Definition: EngNav.hpp:163
BinUtils.hpp
gnsstk::DecodeQuant
Definition: EngNav.cpp:68
GPSWeekSecond.hpp
gnsstk::EngNav::computeParity
static uint32_t computeParity(uint32_t sfword, uint32_t psfword, bool knownUpright=true)
Definition: EngNav.cpp:637
gnsstk::EngNav::checkParity
static bool checkParity(const uint32_t input[10], bool knownUpright=true)
Definition: EngNav.cpp:727
gnsstk::EngNav::BitConvertType
BitConvertType
This enumeration is used by the convertXBit() method.
Definition: EngNav.hpp:73
gnsstk::EngNav::getNMCTValidity
static bool getNMCTValidity(const uint32_t sf2[10], unsigned howWeek, uint32_t &aodo, CommonTime &tnmct, CommonTime &toe, CommonTime &tot)
Definition: EngNav.cpp:851
gnsstk::EngNav::BITS8
@ BITS8
Definition: EngNav.hpp:75
gnsstk::NMCTMeta::tot
CommonTime tot
Time of transmission of subframe 2.
Definition: NMCTMeta.hpp:59
NMCTMeta.hpp
gnsstk::EngNav::convertQuant
static void convertQuant(const uint32_t input[10], double output[60], const DecodeQuant &dq) noexcept
Definition: EngNav.cpp:742
gnsstk::EngNav::getd30
static uint32_t getd30(uint32_t sfword)
Definition: EngNav.hpp:134
gnsstk::EngNav::getNMCTValidity
static bool getNMCTValidity(const uint32_t sf2[10], unsigned howWeek, NMCTMeta &meta)
Definition: EngNav.hpp:361


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