Xvt.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 // 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 #include <tuple>
45 #include <iostream>
46 #include "Xvt.hpp"
47 #include "RawRange.hpp"
48 
49 namespace gnsstk
50 {
51 
52  std::ostream& operator<<(std::ostream& os, const gnsstk::Xvt& xvt) noexcept
53  {
54  os << "x:" << xvt.x
55  << ", v:" << xvt.v
56  << ", clk bias:" << xvt.clkbias
57  << ", clk drift:" << xvt.clkdrift
58  << ", relcorr:" << xvt.relcorr
59  << ", health:" << xvt.health
60  << ", frame:" << xvt.frame;
61  return os;
62  }
63 
64  std::ostream& operator<<(std::ostream& os, const Xvt::HealthStatus& health)
65  noexcept
66  {
67  switch (health)
68  {
69  case Xvt::Uninitialized:
70  os << "Uninitialized";
71  break;
72  case Xvt::Unavailable:
73  os << "Unavailable";
74  break;
75  case Xvt::Unused:
76  os << "Unused";
77  break;
78  case Xvt::Unknown:
79  os << "Unknown";
80  break;
81  case Xvt::Unhealthy:
82  os << "Unhealthy";
83  break;
84  case Xvt::Degraded:
85  os << "Degraded";
86  break;
87  case Xvt::Healthy:
88  os << "Healthy";
89  break;
90  default:
91  os << "???";
92  break;
93  }
94  return os;
95  }
96 
97  // compute the relativity correction
99  {
100  relcorr = -2.0*( (x[0]/C_MPS)*(v[0]/C_MPS)
101  +(x[1]/C_MPS)*(v[1]/C_MPS)
102  +(x[2]/C_MPS)*(v[2]/C_MPS) );
103  return relcorr;
104  }
105 
106  // Function to find the range and position from a ground
107  // location, rxPos, to the spacecraft position (*this).x
108  // Use the pseudorange corrected for SV clock effects to get a
109  // rough time of flight (dt). Account directly for Earth
110  // rotation, then compute a rough receiver bias by differencing
111  // the initial time of flight with the new estimate. Then
112  // correct the rotation by a small amount.
113  double Xvt::preciseRho(const Triple& rxPos,
114  const EllipsoidModel& ellips,
115  double correction) const
116  noexcept
117  {
118  // Compute initial time of flight estimate using the
119  // geometric range at transmit time. This fails to account
120  // for the rotation of the earth, but should be good to
121  // within about 40 m
122  double tofEstimate = rxPos.slantRange(x) / ellips.c();
123 
124  double range;
125  std::tie(std::ignore, range, std::ignore) =
126  RawRange::fromSvPos(rxPos, *this, ellips, true, tofEstimate, 0, 2);
127 
128  return range - (clkbias + relcorr) * ellips.c() - correction;
129  }
130 
131 } // end of gnsstk namespace
gnsstk::RawRange::fromSvPos
static std::tuple< bool, double, Xvt > fromSvPos(const Position &rxPos, const Xvt &svXvt, const EllipsoidModel &ellipsoid, bool smallAngleApprox=false, double seed=0.07, double threshold=1.e-13, int maxIter=5)
Definition: RawRange.cpp:57
gnsstk::Xvt::Unknown
@ Unknown
Health state is unknown.
Definition: Xvt.hpp:93
Xvt.hpp
gnsstk::Xvt::Healthy
@ Healthy
Satellite is healthy, PVT valid.
Definition: Xvt.hpp:96
gnsstk::Xvt::Unavailable
@ Unavailable
Orbit information was not available, PVT invalid.
Definition: Xvt.hpp:91
gnsstk::Xvt::v
Triple v
satellite velocity in ECEF Cartesian, meters/second
Definition: Xvt.hpp:152
gnsstk::Triple
Definition: Triple.hpp:68
gnsstk
For Sinex::InputHistory.
Definition: BasicFramework.cpp:50
gnsstk::Xvt::relcorr
double relcorr
relativity correction (standard 2R.V/c^2 term), seconds
Definition: Xvt.hpp:155
gnsstk::Xvt::Uninitialized
@ Uninitialized
Health status has not been set.
Definition: Xvt.hpp:90
gnsstk::Xvt::x
Triple x
Sat position ECEF Cartesian (X,Y,Z) meters.
Definition: Xvt.hpp:151
gnsstk::Xvt::preciseRho
double preciseRho(const Triple &rxPos, const EllipsoidModel &ellipsoid, double correction=0) const noexcept
Definition: Xvt.cpp:113
gnsstk::C_MPS
const double C_MPS
m/s, speed of light; this value defined by GPS but applies to GAL and GLO.
Definition: GNSSconstants.hpp:74
gnsstk::operator<<
std::ostream & operator<<(std::ostream &s, const ObsEpoch &oe) noexcept
Definition: ObsEpochMap.cpp:54
RawRange.hpp
gnsstk::Xvt
Definition: Xvt.hpp:60
gnsstk::Xvt::HealthStatus
HealthStatus
Definition: Xvt.hpp:87
gnsstk::range
double range(const Position &A, const Position &B)
Definition: Position.cpp:1273
gnsstk::Xvt::Degraded
@ Degraded
Sat is in a degraded state, recommend do not use.
Definition: Xvt.hpp:95
gnsstk::EllipsoidModel
Definition: EllipsoidModel.hpp:56
gnsstk::Xvt::computeRelativityCorrection
virtual double computeRelativityCorrection(void)
Definition: Xvt.cpp:98
gnsstk::Xvt::Unhealthy
@ Unhealthy
Sat is marked unhealthy, do not use PVT.
Definition: Xvt.hpp:94
gnsstk::Xvt::Unused
@ Unused
Sat health is not used in computing this PVT.
Definition: Xvt.hpp:92


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