PRSolution Class Reference
[GPS solution algorithms and Tropospheric]

#include <PRSolution.hpp>

Collaboration diagram for PRSolution:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class defines an interface to routines which compute a position and time solution from pseudorange data, with a data editing algorithm based on Receiver Autonomous Integrity Monitoring (RAIM) concepts.

RAIM ref. "A Baseline GPS RAIM Scheme and a Note on the Equivalence of Three RAIM Methods," by R. Grover Brown, Journal of the Institute of Navigation, Vol. 39, No. 3, Fall 1992, pg 301.

The main point of entry is RAIMCompute(); it will compute a solution given the pseudoranges from a number of satellites, using a RAIM-based algorithm to detect and exclude 'bad' data from the solution. Alternately, the user may compute a straightforward solution using all the input data, without the RAIM algorithm; this is done by first calling PreparePRSolution() and then SimplePRSolution().

The class is able to use GPS and/or Glonass satellite data, and assumes that the Glonass ephemeris is in the GPS frame but the Glonass clocks are in the Glonass time frame. If the input data is mixed (both GPS and GLO) then the solution has a 5th element, namely the GPS-GLO time offset, as estimated by the algorithm. If the data is not mixed (either all-GPS or all-GLO), this element is zero and has no meaning. An all-GLO solution will have clock bias in Glonass time; otherwise it will be in GPS time.

Note that a problem can arise when processing a timeseries of mixed data by calling RAIMCompute at each epoch; it is possible that the RAIM algorithm may, at some epochs, happen to reject all the Glonass satellites or all the GPS satellites. In this case the GPS-GLO timeoffset is undefined (and returned as zero).

Definition at line 310 of file PRSolution.hpp.

Public Member Functions

 PRSolution () throw ()
 Constructor.
bool isValid () const throw ()
 Return the status of solution.
int PreparePRSolution (const CommonTime &Tr, std::vector< SatID > &Sats, std::vector< SatID::SatelliteSystem > &Syss, const std::vector< double > &Pseudorange, const XvtStore< SatID > *pEph, Matrix< double > &SVP) const throw ()
 Compute the satellite position / corrected range matrix (SVP) which is used by SimplePRSolution().
int SimplePRSolution (const CommonTime &Tr, const std::vector< SatID > &Sats, const Matrix< double > &SVP, const Matrix< double > &invMC, TropModel *pTropModel, const int &niterLimit, const double &convLimit, const std::vector< SatID::SatelliteSystem > &Syss, const Vector< double > &APSol, Vector< double > &Resids, Vector< double > &Slopes) throw (Exception)
 Compute a single autonomous pseudorange solution.
int RAIMCompute (const CommonTime &Tr, std::vector< SatID > &Satellites, std::vector< SatID::SatelliteSystem > &Systems, const std::vector< double > &Pseudorange, const Matrix< double > &invMC, const XvtStore< SatID > *pEph, TropModel *pTropModel) throw (Exception)
 Compute a position/time solution, given satellite PRNs and pseudoranges using a RAIM algorithm.
int DOPCompute (void) throw (Exception)
 Compute DOPs using the partials matrix from the last successful solution.
std::string outputPOSString (std::string tag, int iret=-99, const Vector< double > &Vec=PRSNullVector) throw ()
 conveniences for printing the results of the pseudorange solution algorithm output position, error code and V/NV
std::string outputCLKString (std::string tag, int iret=-99) throw ()
 output {SYS clock} for all systems, error code and V/NV
std::string outputNAVString (std::string tag, int iret=-99, const Vector< double > &Vec=PRSNullVector) throw ()
 output info in POS and CLK
std::string outputRMSString (std::string tag, int iret=-99) throw ()
 output NSVdropped, Nsvs, RMS residual, TDOP, PDOP, GDOP, Slope, niter, conv, satellites, error code and V/NV
std::string outputValidString (int iret=-99) throw ()
std::string outputString (std::string tag, int iret=-99, const Vector< double > &Vec=PRSNullVector) throw ()
 output POS, CLK and RMS strings
std::string errorCodeString (int iret) throw ()
 A convenience for printing the error code (return value).
std::string configString (std::string tag) throw ()
 A convenience for printing the current configuarion.

Public Attributes

double RMSLimit
 RMS limit (m) on residual of fit.
double SlopeLimit
 Slope limit (dimensionless).
bool Algebraic
 Use an algebraic (if true) or linearized least squares (if false) algorithm.
bool ResidualCriterion
 Use a rejection criterion based on RMS residual of fit (true) or RMS distance from an a priori position.
bool ReturnAtOnce
 Return as soon as a solution meeting the limit requirements is found (this makes it a non-RAIM algorithm).
int NSatsReject
 Maximum number of satellites that may be rejected in the RAIM algorithm; if this = -1, as many as possible will be rejected (RAIM requires at least 5 satellites).
bool Debug
 If true, RAIMCompute() will output solution information to *pDebugStream.
std::ostream * pDebugStream
 Pointer to an ostream, default &std::cout; if Debug is true, RAIMCompute() will print all preliminary solutions to this stream.
int MaxNIterations
 Maximum number of iterations allowed in the linearized least squares algorithm.
double ConvergenceLimit
 Convergence limit (m): continue iteration loop while RSS change in solution exceeds this.
std::vector< SatID::SatelliteSystemSystemIDs
 vector<SatID> containing the satellite systems included in the solution.
bool hasMemory
 This determines whether this object will maintain a "memory" of all the solutions it has computed.
std::vector< SatIDSatelliteIDs
 vector<SatID> containing satellite IDs for all the satellites input, with bad (excluded) ones identified by (Satellite[.] < 0).
Vector< double > Solution
 Vector<double> containing the computed position solution (3 components, ECEF in the frame of the ephemeris, meter), the receiver clock bias (m), and the GPS-GLO time offset (m).
Matrix< double > Covariance
 Matrix<double> containing the computed solution covariance (meter^2); see doc.
Matrix< double > invMeasCov
 Matrix<double> containing the inverse measurement covariance matrix (m^-2) that was used in computing the final solution.
Matrix< double > Partials
 Matrix<double> containing the partials matrix used in the final solution.
PRSMemory memory
 The "memory" object, used only when hasMemory is true.
Vector< double > PreFitResidual
 Prefit residuals; only valid if memory exists b/c it needs apriori solution.
double RMSResidual
 Root mean square residual of fit (except when RMSDistanceFlag is set, then RMS distance from apriori position); in meters.
double MaxSlope
 Slope computed in the RAIM algorithm (largest of all satellite values) for the returned solution, dimensionless.
double TDOP
 DOPs computed in a call to DOPCompute() or outputString().
double PDOP
 DOPs computed in a call to DOPCompute() or outputString().
double GDOP
 DOPs computed in a call to DOPCompute() or outputString().
int NIterations
 the actual number of iterations used
double Convergence
 the RSS change in solution at the end of iterations.
int Nsvs
 the number of good satellites used in the final computation
bool Mixed
 if true, the solution was constructed from a mixed dataset, including both GPS and Glonass satellites.
bool TropFlag
 if true, the returned solution may be degraded because the tropospheric correction was not applied to one or more satellites; applies after calls to both SimplePRSolution() and RAIMCompute().
bool RMSFlag
 if true, the returned solution may be degraded because the RMS residual or the slope is large; applies only after calls to RAIMCompute().
bool SlopeFlag
 if true, the returned solution may be degraded because the RMS residual or the slope is large; applies only after calls to RAIMCompute().


Constructor & Destructor Documentation

PRSolution  )  throw () [inline]
 

Constructor.

Definition at line 314 of file PRSolution.hpp.


Member Function Documentation

string configString std::string  tag  )  throw ()
 

A convenience for printing the current configuarion.

Definition at line 894 of file PRSolution.cpp.

References gpstk::printTime().

int DOPCompute void   )  throw (Exception)
 

Compute DOPs using the partials matrix from the last successful solution.

RAIMCompute(), if successful, calls this before returning. Results stored in PRSolution::TDOP,PDOP,GDOP.

Definition at line 753 of file PRSolution.cpp.

References PRSolution::GDOP, GPSTK_RETHROW, gpstk::inverseLUD(), PRSolution::Partials, PRSolution::PDOP, Matrix::rows(), gpstk::RSS(), SQRT, PRSolution::TDOP, and gpstk::transpose().

string errorCodeString int  iret  )  throw ()
 

A convenience for printing the error code (return value).

Definition at line 882 of file PRSolution.cpp.

bool isValid void   )  const throw () [inline]
 

Return the status of solution.

Definition at line 329 of file PRSolution.hpp.

string outputCLKString std::string  tag,
int  iret = -99
throw ()
 

output {SYS clock} for all systems, error code and V/NV

Definition at line 827 of file PRSolution.cpp.

References gpstk::printTime(), and RinexSatID::systemString3().

string outputNAVString std::string  tag,
int  iret = -99,
const Vector< double > &  Vec = PRSNullVector
throw ()
 

output info in POS and CLK

Definition at line 790 of file PRSolution.cpp.

References gpstk::printTime(), and RinexSatID::systemString3().

string outputPOSString std::string  tag,
int  iret = -99,
const Vector< double > &  Vec = PRSNullVector
throw ()
 

conveniences for printing the results of the pseudorange solution algorithm output position, error code and V/NV

Definition at line 811 of file PRSolution.cpp.

References gpstk::printTime().

string outputRMSString std::string  tag,
int  iret = -99
throw ()
 

output NSVdropped, Nsvs, RMS residual, TDOP, PDOP, GDOP, Slope, niter, conv, satellites, error code and V/NV

Definition at line 844 of file PRSolution.cpp.

References gpstk::abs(), and gpstk::printTime().

string outputString std::string  tag,
int  iret = -99,
const Vector< double > &  Vec = PRSNullVector
throw ()
 

output POS, CLK and RMS strings

Definition at line 872 of file PRSolution.cpp.

string outputValidString int  iret = -99  )  throw ()
 

Definition at line 774 of file PRSolution.cpp.

int PreparePRSolution const CommonTime Tr,
std::vector< SatID > &  Sats,
std::vector< SatID::SatelliteSystem > &  Syss,
const std::vector< double > &  Pseudorange,
const XvtStore< SatID > *  pEph,
Matrix< double > &  SVP
const throw ()
 

Compute the satellite position / corrected range matrix (SVP) which is used by SimplePRSolution().

SVP is output, dimensioned (N,4) where N is the number of satellites and the length of both Satellite and Pseudorange. Data is ignored whenever Sats[i].id is < 0. NB caller should verify that the number of good entries (Satellite[.] > 0) is > 4 before proceeding. Even though this is a member function, it changes none of the member data.

Parameters:
Tr input Measured time of reception of the data.
Sats input std::vector<SatID> of satellites; satellites that are to be excluded by the algorithm are marked by a negative 'id' member; this call will mark satellites for which there is no ephemeris.
Syss std::vector<SatID::SatelliteSystem> of systems to be used in the computation; determines order of clocks in Sol. If empty, it will be filled with all systems in Sats.
Pseudorange input std::vector<double> of raw pseudoranges (parallel to Sats), in meters
pEph input pointer to gpstk::XvtStore<SatID> to be used
SVP output gpstk::Matrix<double> of dimension (N,4), N is the number of satellites in Sats[] (marked or not), on output this contains the satellite positions at transmit time (cols 0-2), the corrected pseudorange (1).
Returns:
Return values: >= 0 number of good satellites found -4 ephemeris not found for all the satellites

Definition at line 54 of file PRSolution.cpp.

References gpstk::C_MPS, Xvt::clkbias, DEBUG, LOG, gpstk::printTime(), Xvt::relcorr, gpstk::vectorindex(), and Xvt::x.

int RAIMCompute const CommonTime Tr,
std::vector< SatID > &  Satellites,
std::vector< SatID::SatelliteSystem > &  Systems,
const std::vector< double > &  Pseudorange,
const Matrix< double > &  invMC,
const XvtStore< SatID > *  pEph,
TropModel pTropModel
throw (Exception)
 

Compute a position/time solution, given satellite PRNs and pseudoranges using a RAIM algorithm.

This is the main computation done by this class.

Parameters:
Tr Measured time of reception of the data.
Satellites std::vector<SatID> of satellites; on successful return, satellites that were excluded by the algorithm are marked by a negative 'id' member.
Systems std::vector<SatID::SatelliteSystem> of systems to be allowed in the computation. On output, systems actually used are stored in member SystemIDs; this determines the order of clock biases in Solution and Covariance.
Pseudorange std::vector<double> of raw pseudoranges (parallel to Satellite), in meters.
invMC gpstk::Matrix<double> NXN measurement covariance matrix inverse (meter^-2) of the pseudorange data (for N see Sats). If this matrix has dimension 0, no weighting of the data is done.
pEph pointer to gpstk::XvtStore to be used in the algorithm.
pTropModel pointer to gpstk::TropModel for trop correction.
Returns:
Return values: 1 solution is ok, but may be degraded; check TropFlag, RMSFlag, SlopeFlag 0 ok -1 algorithm failed to converge -2 singular problem, no solution is possible -3 not enough good data (> 4) to form a (RAIM) solution (the 4 satellite solution might be ok) -4 ephemeris not found for all the satellites

Definition at line 459 of file PRSolution.cpp.

References gpstk::abs(), Matrix::cols(), DEBUG, GPSTK_RETHROW, Combinations::isSelected(), ConfigureLOG::Level(), LOG, LOGlevel, Combinations::Next(), Matrix::rows(), and Vector::size().

int SimplePRSolution const CommonTime Tr,
const std::vector< SatID > &  Sats,
const Matrix< double > &  SVP,
const Matrix< double > &  invMC,
TropModel pTropModel,
const int &  niterLimit,
const double &  convLimit,
const std::vector< SatID::SatelliteSystem > &  Syss,
const Vector< double > &  APSol,
Vector< double > &  Resids,
Vector< double > &  Slopes
throw (Exception)
 

Compute a single autonomous pseudorange solution.

On output, all the member data is filled with results. Input only (first 3 should be just as returned from PreparePRSolution()):

Parameters:
Tr const. Measured time of reception of the data. On output member currTime set to this.
Sats const std::vector<SatID> of satellites. Satellites that are to be excluded by the algorithm are marked by a negative 'id' member. Length N. On output member SatelliteIDs set to this.
SVP const Matrix<double> of dimension (N,5) contains sat. direction cosines and corrected pseudorange data.
invMC const gpstk::Matrix<double> NXN measurement covariance matrix inverse (meter^-2) of the pseudorange data (for N see Sats). If this matrix has dimension 0, no weighting of the data is done.
pTropModel pointer to a gpstk::TropModel for trop correction.
niterLimit integer limit on the number of iterations. On output, member NIterations = number of iterations actually used.
convLimit double convergence criterion, = RSS change in solution, in meters. On output, member Convergence = final value.
Syss std::vector<SatID::SatelliteSystem> of systems to be used in the computation. On output, systems actually used stored in member SystemIDs; this determines order of clock biases in Solution.
APSol gpstk::Vector<double> solution (ECEF X,Y,Z, clock biases for systems [parallel to Syss], all in meters), containing an apriori solution (perhaps all 0's). On output member Solution contains the final solution, and member Covariance contains its covariance. Output: (these will be resized within the function)
Resids gpstk::Vector<double> post-fit range residuals for each satellite (m), the length of this Vector is the number of satellites actually used (see Sats).
Slopes gpstk::Vector<double> slope value used in RAIM for each good satellite, length m.
Returns:
Return values: 0 ok (but check TropFlag to see if trop. correction was not applied) -1 failed to converge -2 singular problem -3 not enough good data to form a solution (at least 4 satellites required)

Definition at line 153 of file PRSolution.cpp.

References GPSEllipsoid::angVelocity(), GPSEllipsoid::c(), DEBUG, Position::elevation(), ERROR, Position::getHeight(), GPSTK_RETHROW, GPSTK_THROW, gpstk::inverseSVD(), LOG, gpstk::norm(), gpstk::printTime(), Matrix::resize(), gpstk::RMS(), gpstk::RSS(), Position::setECEF(), Vector::size(), Triple::size(), SQRT, gpstk::transpose(), gpstk::vectorindex(), and Xvt::x.


Member Data Documentation

bool Algebraic
 

Use an algebraic (if true) or linearized least squares (if false) algorithm.

Definition at line 340 of file PRSolution.hpp.

double Convergence
 

the RSS change in solution at the end of iterations.

Definition at line 444 of file PRSolution.hpp.

double ConvergenceLimit
 

Convergence limit (m): continue iteration loop while RSS change in solution exceeds this.

Definition at line 374 of file PRSolution.hpp.

Matrix<double> Covariance
 

Matrix<double> containing the computed solution covariance (meter^2); see doc.

for Solution for the components; valid only when isValid() is true.

Definition at line 414 of file PRSolution.hpp.

bool Debug
 

If true, RAIMCompute() will output solution information to *pDebugStream.

Definition at line 360 of file PRSolution.hpp.

double GDOP
 

DOPs computed in a call to DOPCompute() or outputString().

Definition at line 438 of file PRSolution.hpp.

Referenced by PRSolution::DOPCompute().

bool hasMemory
 

This determines whether this object will maintain a "memory" of all the solutions it has computed.

This is used for several things, including the computation of pre-fit residuals, and thus of the aposteriori variance of unit weight (APV), the number of data, solutions and degrees of freedom and a combined weighted average solution.

Definition at line 390 of file PRSolution.hpp.

Matrix<double> invMeasCov
 

Matrix<double> containing the inverse measurement covariance matrix (m^-2) that was used in computing the final solution.

Definition at line 418 of file PRSolution.hpp.

int MaxNIterations
 

Maximum number of iterations allowed in the linearized least squares algorithm.

Definition at line 370 of file PRSolution.hpp.

double MaxSlope
 

Slope computed in the RAIM algorithm (largest of all satellite values) for the returned solution, dimensionless.

Definition at line 435 of file PRSolution.hpp.

PRSMemory memory
 

The "memory" object, used only when hasMemory is true.

Definition at line 424 of file PRSolution.hpp.

bool Mixed
 

if true, the solution was constructed from a mixed dataset, including both GPS and Glonass satellites.

This means the Solution vector will have length 5, with the last element being the estimated GPS-GLO time offset.

Definition at line 452 of file PRSolution.hpp.

int NIterations
 

the actual number of iterations used

Definition at line 441 of file PRSolution.hpp.

int NSatsReject
 

Maximum number of satellites that may be rejected in the RAIM algorithm; if this = -1, as many as possible will be rejected (RAIM requires at least 5 satellites).

A (single) non-RAIM solution can be obtained by setting this to 0 before calling RAIMCompute().

Definition at line 357 of file PRSolution.hpp.

int Nsvs
 

the number of good satellites used in the final computation

Definition at line 447 of file PRSolution.hpp.

Matrix<double> Partials
 

Matrix<double> containing the partials matrix used in the final solution.

Definition at line 421 of file PRSolution.hpp.

Referenced by PRSolution::DOPCompute().

std::ostream* pDebugStream
 

Pointer to an ostream, default &std::cout; if Debug is true, RAIMCompute() will print all preliminary solutions to this stream.

Definition at line 364 of file PRSolution.hpp.

double PDOP
 

DOPs computed in a call to DOPCompute() or outputString().

Definition at line 438 of file PRSolution.hpp.

Referenced by PRSolution::DOPCompute().

Vector<double> PreFitResidual
 

Prefit residuals; only valid if memory exists b/c it needs apriori solution.

Definition at line 427 of file PRSolution.hpp.

bool ResidualCriterion
 

Use a rejection criterion based on RMS residual of fit (true) or RMS distance from an a priori position.

If false, member Vector Solution must be defined as this a priori position when RAIMCompute() is called.

Definition at line 346 of file PRSolution.hpp.

bool ReturnAtOnce
 

Return as soon as a solution meeting the limit requirements is found (this makes it a non-RAIM algorithm).

Definition at line 351 of file PRSolution.hpp.

bool RMSFlag
 

if true, the returned solution may be degraded because the RMS residual or the slope is large; applies only after calls to RAIMCompute().

Definition at line 461 of file PRSolution.hpp.

double RMSLimit
 

RMS limit (m) on residual of fit.

Definition at line 334 of file PRSolution.hpp.

double RMSResidual
 

Root mean square residual of fit (except when RMSDistanceFlag is set, then RMS distance from apriori position); in meters.

Definition at line 431 of file PRSolution.hpp.

std::vector<SatID> SatelliteIDs
 

vector<SatID> containing satellite IDs for all the satellites input, with bad (excluded) ones identified by (Satellite[.] < 0).

This vector is saved after each call to the computation routines (SimplePRSolution and RAIMCompute) and used for printing.

Definition at line 398 of file PRSolution.hpp.

bool SlopeFlag
 

if true, the returned solution may be degraded because the RMS residual or the slope is large; applies only after calls to RAIMCompute().

Definition at line 461 of file PRSolution.hpp.

double SlopeLimit
 

Slope limit (dimensionless).

Definition at line 337 of file PRSolution.hpp.

Vector<double> Solution
 

Vector<double> containing the computed position solution (3 components, ECEF in the frame of the ephemeris, meter), the receiver clock bias (m), and the GPS-GLO time offset (m).

In the case of GPS-only or GLO-only data, the last element is zero and has no meaning. This vector is valid only when isValid() is true. If this vector is defined on input, it is used as an apriori position, both to initialized the iterative algorithm, and to compute position residuals after a good solution is found.

Definition at line 410 of file PRSolution.hpp.

std::vector<SatID::SatelliteSystem> SystemIDs
 

vector<SatID> containing the satellite systems included in the solution.

It should be defined before the first solution call; if it is empty at that time it will be determined by the input SatelliteIDs. It is used to determine which clock biases are included in the solution; ordering of this vector determines ordering of the clock states in the RAIM solution: Solution ~ X,Y,Z,(clks ~ SystemIDs). The SimplePRSolution is similarly defined by the vector which is returned by that routine.

Definition at line 383 of file PRSolution.hpp.

double TDOP
 

DOPs computed in a call to DOPCompute() or outputString().

Definition at line 438 of file PRSolution.hpp.

Referenced by PRSolution::DOPCompute().

bool TropFlag
 

if true, the returned solution may be degraded because the tropospheric correction was not applied to one or more satellites; applies after calls to both SimplePRSolution() and RAIMCompute().

Definition at line 457 of file PRSolution.hpp.


The documentation for this class was generated from the following files:
Generated on Wed May 22 03:31:57 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1