GLOCNavUT1TimeOffset.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 "GLOCNavUT1TimeOffset.hpp"
40 #include "TimeString.hpp"
41 
42 using namespace std;
43 
44 namespace gnsstk
45 {
46  GLOCNavUT1TimeOffset ::
47  GLOCNavUT1TimeOffset()
48  : NB(-1),
49  UTCTAI(std::numeric_limits<double>::quiet_NaN())
50  {
51  msgLenSec = 3.0;
52  weekFmt = "";
53  }
54 
55 
57  dump(std::ostream& s, DumpDetail dl) const
58  {
59  const ios::fmtflags oldFlags = s.flags();
60  if (dl == DumpDetail::OneLine)
61  {
62  NavData::dump(s,dl);
63  return;
64  }
65  if (dl == DumpDetail::Brief)
66  {
67  double offset;
69  // brief just shows the offset as of the reference time.
72  << " offset = " << offset << endl;
73  return;
74  }
75  s << "****************************************************************"
76  << "************" << endl
77  << "Time System Offset" << endl << endl
78  << "PRN : " << setw(2) << signal.sat << " / "
79  << "SVN : " << setw(2);
80  std::string svn;
81  if (getSVN(signal.sat, timeStamp, svn))
82  {
83  s << svn;
84  }
85 
86  s << endl << endl
87  << " TIMES OF INTEREST" << endl << endl
88  << " " << getDumpTimeHdr(dl) << endl
89  << "Transmit: " << getDumpTime(dl, timeStamp)
90  << endl << endl
91  << " " << StringUtils::asString(TimeSystem::GLO) << " "
92  << StringUtils::asString(TimeSystem::UTC) << " PARAMETERS" << endl
93  << "Parameter Value" << endl
94  << "Reference "
95  << printTime(refTime,"%Y/%02m/%02d %02H:%02M:%02S") << endl
96  << right << uppercase << fixed << setprecision(0) << setfill(' ')
97  << scientific << setprecision(9)
98  << "B0 " << setw(16) << B0 << " sec" << endl
99  << "B1 " << setw(16) << B1 << " sec/sec" << endl
100  << "B2 " << setw(16) << B2 << " sec/sec**2" << endl
101  << fixed << setprecision(0)
102  << "UTC-TAI " << setw(16) << UTCTAI << " sec" << endl;
103  s.flags(oldFlags);
104  }
105 
106 
108  dumpTerse(ostream& s) const
109  {
110  const ios::fmtflags oldFlags = s.flags();
111  s << std::setw(4) << signal.sat.id
112  << printTime(timeStamp,"%02m/%02d/%04Y %03j %02H:%02M:%02S") << "! ";
113  s.setf(ios::scientific, ios::floatfield);
114  s.setf(ios::right, ios::adjustfield);
115  s.setf(ios::uppercase);
116  s.precision(9);
117  s.fill(' ');
118  s << "B0:" << B0 << " s, B1:" << B1 << " s/s, B2:" << B2 << "s/s**2 ";
119  s.flags(oldFlags);
120  }
121 
122 
125  const CommonTime& when, double& offset)
126  const
127  {
128  if (((fromSys == TimeSystem::GLO) && (toSys == TimeSystem::UTC)) ||
129  ((fromSys == TimeSystem::UTC) && (toSys == TimeSystem::GLO)))
130  {
131  GNSSTK_ASSERT(when.getTimeSystem() == fromSys);
132  double dt = (when - refTime) / 86400.0;
133  double tauUT1 = B0 + B1*dt + (B2/2.0)*dt*dt;
134  offset = tauUT1;
135  if (fromSys == TimeSystem::UTC)
136  {
137  offset = -offset;
138  }
139  return true;
140  }
141  return false;
142  }
143 
144 
147  {
150  return TimeCvtSet({ keyF, keyR });
151  }
152 
153 
155  validate() const
156  {
158  return true;
159  }
160 }
161 
gnsstk::NavData::msgLenSec
double msgLenSec
Definition: NavData.hpp:199
gnsstk::SatID::id
int id
Satellite identifier, e.g. PRN.
Definition: SatID.hpp:154
gnsstk::NavData::dump
virtual void dump(std::ostream &s, DumpDetail dl) const
Definition: NavData.cpp:79
gnsstk::TimeCvtKey
std::pair< TimeSystem, TimeSystem > TimeCvtKey
Definition: TimeOffsetData.hpp:53
gnsstk::GLOCNavUT1TimeOffset::B1
double B1
Time drift in s/s.
Definition: GLOCNavUT1TimeOffset.hpp:104
gnsstk::GLOCNavUT1TimeOffset::getConversions
TimeCvtSet getConversions() const override
Definition: GLOCNavUT1TimeOffset.cpp:146
gnsstk::GLOCNavUT1TimeOffset::B0
double B0
Time bias in seconds.
Definition: GLOCNavUT1TimeOffset.hpp:103
gnsstk::NavData::getDumpTime
std::string getDumpTime(DumpDetail dl, const CommonTime &t) const
Definition: NavData.cpp:145
gnsstk::GLOCNavUT1TimeOffset::dumpTerse
void dumpTerse(std::ostream &s) const
Definition: GLOCNavUT1TimeOffset.cpp:108
gnsstk::StringUtils::asString
std::string asString(IonexStoreStrategy e)
Convert a IonexStoreStrategy to a whitespace-free string name.
Definition: IonexStoreStrategy.cpp:46
gnsstk::NavData::getDumpTimeHdr
std::string getDumpTimeHdr(DumpDetail dl) const
Definition: NavData.cpp:127
gnsstk::GLOCNavUT1TimeOffset::dump
void dump(std::ostream &s, DumpDetail dl) const override
Definition: GLOCNavUT1TimeOffset.cpp:57
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::TimeCvtSet
std::set< TimeCvtKey > TimeCvtSet
Define a unique set of time system conversions.
Definition: TimeOffsetData.hpp:55
gnsstk::NavData::timeStamp
CommonTime timeStamp
Definition: NavData.hpp:173
gnsstk::NavData::weekFmt
std::string weekFmt
Definition: NavData.hpp:193
gnsstk::GLOCNavUT1TimeOffset::validate
bool validate() const override
Definition: GLOCNavUT1TimeOffset.cpp:155
gnsstk::GLOCNavUT1TimeOffset::B2
double B2
Time drift rate in s/s**2.
Definition: GLOCNavUT1TimeOffset.hpp:105
gnsstk::NavSatelliteID::sat
SatID sat
ID of satellite to which the nav data applies.
Definition: NavSatelliteID.hpp:169
gnsstk::CommonTime
Definition: CommonTime.hpp:84
gnsstk::TimeSystem
TimeSystem
Definition of various time systems.
Definition: TimeSystem.hpp:51
gnsstk::GLOCNavUT1TimeOffset::getOffset
bool getOffset(TimeSystem fromSys, TimeSystem toSys, const CommonTime &when, double &offset) const override
Definition: GLOCNavUT1TimeOffset.cpp:124
gnsstk::TimeSystem::GLO
@ GLO
GLONASS system time (aka UTC(SU))
gnsstk::TimeSystem::UTC
@ UTC
Coordinated Universal Time (e.g., from NTP)
GNSSTK_ASSERT
#define GNSSTK_ASSERT(CONDITION)
Provide an "ASSERT" type macro.
Definition: Exception.hpp:373
gnsstk::CommonTime::getTimeSystem
TimeSystem getTimeSystem() const
Obtain time system info (enum).
Definition: CommonTime.cpp:288
gnsstk::DumpDetail
DumpDetail
Specify level of detail for dump output.
Definition: DumpDetail.hpp:51
gnsstk::GLOCNavUT1TimeOffset::UTCTAI
double UTCTAI
Leap seconds - not really used.
Definition: GLOCNavUT1TimeOffset.hpp:106
gnsstk::printTime
std::string printTime(const CommonTime &t, const std::string &fmt)
Definition: TimeString.cpp:64
gnsstk::DumpDetail::Brief
@ Brief
Limit output to <= 5 lines of minimal information.
std
Definition: Angle.hpp:142
gnsstk::DumpDetail::OneLine
@ OneLine
Limit output to minimal information on a single line.
gnsstk::NavData::getSVN
bool getSVN(const SatID &sat, const gnsstk::CommonTime &when, std::string &svn) const
Definition: NavData.hpp:150
GLOCNavUT1TimeOffset.hpp
gnsstk::GLOCNavUT1TimeOffset::refTime
CommonTime refTime
Reference time for computation.
Definition: GLOCNavUT1TimeOffset.hpp:101
TimeString.hpp


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