BDSD1NavEph.cpp
Go to the documentation of this file.
1 //==============================================================================
2 //
3 // This file is part of GNSSTk, the ARL:UT GNSS Toolkit.
4 //
5 // The GNSSTk is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU Lesser General Public License as published
7 // by the Free Software Foundation; either version 3.0 of the License, or
8 // any later version.
9 //
10 // The GNSSTk is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public
16 // License along with GNSSTk; if not, write to the Free Software Foundation,
17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
18 //
19 // This software was developed by Applied Research Laboratories at the
20 // University of Texas at Austin.
21 // Copyright 2004-2022, The Board of Regents of The University of Texas System
22 //
23 //==============================================================================
24 
25 
26 //==============================================================================
27 //
28 // This software was developed by Applied Research Laboratories at the
29 // University of Texas at Austin, under contract to an agency or agencies
30 // within the U.S. Department of Defense. The U.S. Government retains all
31 // rights to use, duplicate, distribute, disclose, or release this software.
32 //
33 // Pursuant to DoD Directive 523024
34 //
35 // DISTRIBUTION STATEMENT A: This software has been approved for public
36 // release, distribution is unlimited.
37 //
38 //==============================================================================
39 #include "BDSD1NavEph.hpp"
40 #include "BDSWeekSecond.hpp"
41 #include "TimeString.hpp"
42 #include "GPS_URA.hpp"
43 #include "BDSconsts.hpp"
44 
45 using namespace std;
46 
47 namespace gnsstk
48 {
49  BDSD1NavEph ::
50  BDSD1NavEph()
51  : pre2(0),
52  pre3(0),
53  rev2(0),
54  rev3(0),
55  sow2(0),
56  sow3(0),
57  satH1(true),
58  aodc(0xff),
59  aode(0xff),
60  uraIndex(15),
63  tgd1(std::numeric_limits<double>::quiet_NaN()),
64  tgd2(std::numeric_limits<double>::quiet_NaN())
65  {
67  }
68 
69 
70  bool BDSD1NavEph ::
71  validate() const
72  {
73  return BDSD1NavData::validate() &&
74  ((pre2 == 0) || (pre2 == bds::Preamble)) &&
75  ((pre2 == 0) || (pre3 == bds::Preamble));
76  }
77 
78 
80  getUserTime() const
81  {
82  return std::max({xmitTime, xmit2, xmit3}) + 6.0;
83  }
84 
85 
86  void BDSD1NavEph ::
88  {
89  beginFit = Toe - 7200.0; // Default case
90  // If elements were updated during the hour, then
91  // we want to use the later time.
93  if (xmitTime > Toe)
95  endFit = Toe + 7200;
96  }
97 
98 
99  void BDSD1NavEph ::
100  dumpSVStatus(std::ostream& s) const
101  {
102  const ios::fmtflags oldFlags = s.flags();
103  s.setf(ios::fixed, ios::floatfield);
104  s.setf(ios::right, ios::adjustfield);
105  s.setf(ios::uppercase);
106  s.precision(0);
107  s.fill(' ');
108  // Use these to print subframe SOW in a formatted fashion.
109  // We're not printing the week so setting the week to 0 is
110  // fine.
111  BDSWeekSecond ws1(0,sow), ws2(0,sow2), ws3(0,sow3);
112  s << " SV STATUS" << endl << endl
113  << "Health bit (SatH1) : 0x" << hex << (unsigned)satH1 << dec
114  << endl
115  << "AODC : " << setw(6) << getAOD(aodc) << " hours ("
116  << (unsigned)aodc << ")" << endl
117  << "AODE : " << setw(6) << getAOD(aode) << " hours ("
118  << (unsigned)aode << ")" << endl
119  << "URA index : " << setw(6) << (unsigned)uraIndex << endl
120  << "URA (nominal) : " << setw(6) << fixed
121  << SV_ACCURACY_GPS_NOMINAL_INDEX[uraIndex] << " m" << endl
122  << "Health : " << setw(9)
124  << "Tgd1 : " << setw(13) << setprecision(6)
125  << scientific << tgd1 << " sec" << endl
126  << "Tgd2 : " << setw(13) << setprecision(6)
127  << scientific << tgd2 << " sec" << endl << endl
128  << " SUBFRAME OVERHEAD" << endl << endl
129  << " SOW DOW:HH:MM:SS" << endl
130  << printTime(ws1, "SF1 SOW: %6.0g %3a-%w:%02H:%02M:%02S\n")
131  << printTime(ws2, "SF2 SOW: %6.0g %3a-%w:%02H:%02M:%02S\n")
132  << printTime(ws3, "SF3 SOW: %6.0g %3a-%w:%02H:%02M:%02S\n");
133  s.flags(oldFlags);
134  }
135 
136  unsigned BDSD1NavEph ::
137  getAOD(uint8_t aod)
138  {
139  if (aod < 25)
140  return aod;
141  if (aod < 32)
142  return 24 * (aod-23);
143  return (unsigned)-1;
144  }
145 }
gnsstk::BDSD1NavData::validate
bool validate() const override
Definition: BDSD1NavData.cpp:57
gnsstk::BDSD1NavEph::validate
bool validate() const override
Definition: BDSD1NavEph.cpp:71
BDSconsts.hpp
gnsstk::BDSD1NavEph::satH1
bool satH1
Autonomous satellite health flag.
Definition: BDSD1NavEph.hpp:103
gnsstk::BDSD1NavEph::xmit3
CommonTime xmit3
Transmit time for subframe 3.
Definition: BDSD1NavEph.hpp:112
gnsstk::BEGINNING_OF_TIME
const Epoch BEGINNING_OF_TIME(CommonTime::BEGINNING_OF_TIME)
Earliest representable Epoch.
gnsstk::SV_ACCURACY_GPS_NOMINAL_INDEX
const double SV_ACCURACY_GPS_NOMINAL_INDEX[]
Definition: GPS_URA.hpp:65
gnsstk::BDSD1NavEph::dumpSVStatus
void dumpSVStatus(std::ostream &s) const override
Definition: BDSD1NavEph.cpp:100
gnsstk::NavMessageID::messageType
NavMessageType messageType
Definition: NavMessageID.hpp:97
GPS_URA.hpp
gnsstk::max
T max(const SparseMatrix< T > &SM)
Maximum element - return 0 if empty.
Definition: SparseMatrix.hpp:881
gnsstk::BDSD1NavEph::uraIndex
uint8_t uraIndex
4-bit URA index from subframe 1.
Definition: BDSD1NavEph.hpp:110
gnsstk::BDSD1NavEph::getAOD
static unsigned getAOD(uint8_t aod)
Definition: BDSD1NavEph.cpp:137
gnsstk::NavFit::endFit
CommonTime endFit
Time at end of fit interval.
Definition: NavFit.hpp:55
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::BDSD1NavEph::aodc
uint8_t aodc
Age of data - clock.
Definition: BDSD1NavEph.hpp:104
gnsstk::BDSD1NavEph::fixFit
void fixFit()
Definition: BDSD1NavEph.cpp:87
gnsstk::OrbitDataKepler::Toe
CommonTime Toe
Orbit epoch.
Definition: OrbitDataKepler.hpp:171
gnsstk::NavData::signal
NavMessageID signal
Source signal identification for this navigation message data.
Definition: NavData.hpp:175
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::OrbitDataKepler::xmitTime
CommonTime xmitTime
Time of transmission of the start of the data.
Definition: OrbitDataKepler.hpp:170
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::BDSD1NavEph::sow2
uint32_t sow2
Seconds of week from word 1-2 of subframe 2.
Definition: BDSD1NavEph.hpp:100
gnsstk::BDSD1NavEph::getUserTime
CommonTime getUserTime() const override
Definition: BDSD1NavEph.cpp:80
gnsstk::NavFit::beginFit
CommonTime beginFit
Time at beginning of fit interval.
Definition: NavFit.hpp:54
gnsstk::BDSD1NavEph::tgd1
double tgd1
Group delay differential on B1I.
Definition: BDSD1NavEph.hpp:113
gnsstk::BDSD1NavEph::pre2
uint32_t pre2
The preamble from the start of subframe 2.
Definition: BDSD1NavEph.hpp:96
gnsstk::BDSD1NavEph::pre3
uint32_t pre3
The preamble from the start of subframe 3.
Definition: BDSD1NavEph.hpp:97
gnsstk::printTime
std::string printTime(const CommonTime &t, const std::string &fmt)
Definition: TimeString.cpp:64
gnsstk::BDSD1NavEph::aode
uint8_t aode
Age of data - ephemeris.
Definition: BDSD1NavEph.hpp:105
std
Definition: Angle.hpp:142
gnsstk::NavMessageType::Ephemeris
@ Ephemeris
Precision orbits for the transmitting SV.
BDSWeekSecond.hpp
gnsstk::BDSD1NavEph::tgd2
double tgd2
Group delay differential on B2I.
Definition: BDSD1NavEph.hpp:114
gnsstk::BDSWeekSecond
Definition: BDSWeekSecond.hpp:56
gnsstk::bds::Preamble
@ Preamble
Nav message preamble value.
Definition: BDSconsts.hpp:57
gnsstk::OrbitDataKepler::health
SVHealth health
SV health status.
Definition: OrbitDataKepler.hpp:173
gnsstk::BDSD1NavEph::xmit2
CommonTime xmit2
Transmit time for subframe 2.
Definition: BDSD1NavEph.hpp:111
gnsstk::BDSD1NavEph::sow3
uint32_t sow3
Definition: BDSD1NavEph.hpp:101
BDSD1NavEph.hpp
TimeString.hpp
gnsstk::BDSD1NavData::sow
uint32_t sow
Seconds of week from word 1-2 of the subframe.
Definition: BDSD1NavData.hpp:73


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