CodeKalmanSolver Class Reference
[Mathematical algorithmsGPS solution algorithms and Tropospheric]

#include <CodeKalmanSolver.hpp>

Inheritance diagram for CodeKalmanSolver:

Inheritance graph
[legend]
Collaboration diagram for CodeKalmanSolver:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class computes the code-based solution using a simple Kalman solver.

This class may be used either in a Vector- and Matrix-oriented way, or with GNSS data structure objects from "DataStructures" class.

A typical way to use this class with GNSS data structures follows:

      // Data stream
   RinexObsStream rin("ebre0300.02o");

      // More declarations here: Ionospheric and tropospheric models,
      // ephemeris, etc.

      // Declare the modeler object, setting all the parameters in
      // one pass
   ModelObs model( ionoStore,
                   mopsTM,
                   bceStore,
                   TypeID::C1 );

      // Set initial position (Bancroft method)
   model.Prepare();

      // Declare a CodeKalmanSolver object
   CodeKalmanSolver kSolver;

      // This object will compute the appropriate MOPS weights
   ComputeMOPSWeights mopsW(nominalPos, bceStore);

   gnssRinex gRin;

   while(rin >> gRin)
   {
      gRin >> model >> mopsW >> kSolver;
   }

The "CodeKalmanSolver" object will extract all the data it needs from the GNSS data structure that is "gRin" and will try to solve the code-based system of equations using a simple Kalman filter. It will also insert back postfit residual data into "gRin" if it successfully solves the equation system.

This class may optionally use weights assigned to each satellite. This can be achieved with objects from classes such as "ComputeIURAWeights", "ComputeMOPSWeights", etc., but in any case this is not mandatory.

By default, it will build the geometry matrix from the values of coefficients dx, dy, dz and cdt, and the independent vector will be composed of the code prefit residuals (TypeID::prefitC) values.

You may change the former by redefining the default equation definition to be used. For instance:

      // Define our own set of unknowns
   TypeIDSet unknownsSet;
   unknownsSet.insert(TypeID::dLat);
   unknownsSet.insert(TypeID::dLon);
   unknownsSet.insert(TypeID::dH);
   unknownsSet.insert(TypeID::cdt);

      // Create a new equation definition
      // newEq(independent value, set of unknowns)
   gnssEquationDefinition newEq(TypeID::prefitC, unknownsSet);

      // Reconfigure solver
   kSolver.setDefaultEqDefinition(newEq);

By default, this class assigns a 'constant' stochastic model (StochasticModel) to coordinates and a 'white noise' stochastic model (WhiteNoiseModel) to the receiver clock (cdt). This may be changed at will using the appropriate methods.

For instance, in orden to use a 'full kinematic' mode we assign a white noise model to all the coordinates:

      // Define a white noise model with 100 m of sigma
   WhiteNoiseModel wnM(100.0);

      // Configure the solver to use this model for all coordinates
   kSolver.setCoordinatesModel(&wnM);

Be aware, however, that you MUST NOT use this method to set a state-aware stochastic model (like RandomWalkModel, for instance) to ALL coordinates, because the results will certainly be erroneous. Use this method ONLY with non-state-aware stochastic models like 'StochasticModel' (constant coordinates) or 'WhiteNoiseModel'.

In order to overcome the former limitation, this class provides methods to set different, specific stochastic models for each coordinate, like:

      // Define a white noise model with 2 m of sigma for horizontal
      // coordinates (in this case, the solver is previously set to use
      // dLat, dLon and dH).
   WhiteNoiseModel wnHorizontalModel(2.0);

      // Define a random walk model with 0.04 m*m/s of process spectral
      // density for vertical coordinates.
   RandomWalkModel rwVerticalModel(0.04);

      // Configure the solver to use these models
   kSolver.setXCoordinatesModel(&wnHorizontalModel);
   kSolver.setYCoordinatesModel(&wnHorizontalModel);
   kSolver.setZCoordinatesModel(&rwVerticalModel);

Warning:
Kalman filters are objets that store their internal state, so you MUST NOT use the SAME object to process DIFFERENT data streams.
See also:
SolverBase.hpp and SolverLMS for base classes.

Definition at line 169 of file CodeKalmanSolver.hpp.

Public Member Functions

 CodeKalmanSolver ()
 Default constructor.
 CodeKalmanSolver (const gnssEquationDefinition &eqDef)
 Explicit constructor.
virtual int Compute (const Vector< double > &prefitResiduals, const Matrix< double > &designMatrix, const Matrix< double > &weightMatrix) throw (InvalidSolver)
 Compute the code-based Kalman solution of the given equations set.
virtual int Compute (const Vector< double > &prefitResiduals, const Matrix< double > &designMatrix, const Vector< double > &weightVector) throw (InvalidSolver)
 Compute the code-based Kalman solution of the given equations set.
virtual gnssSatTypeValueProcess (gnssSatTypeValue &gData) throw (ProcessingException)
 Returns a reference to a gnnsSatTypeValue object after solving the previously defined equation system.
virtual gnssRinexProcess (gnssRinex &gData) throw (ProcessingException)
 Returns a reference to a gnnsRinex object after solving the previously defined equation system.
StochasticModelgetXCoordinatesModel () const
 Get stochastic model pointer for dx (or dLat) coordinate.
CodeKalmanSolversetXCoordinatesModel (StochasticModel *pModel)
 Set coordinates stochastic model for dx (or dLat) coordinate.
StochasticModelgetYCoordinatesModel () const
 Get stochastic model pointer for dy (or dLon) coordinate.
CodeKalmanSolversetYCoordinatesModel (StochasticModel *pModel)
 Set coordinates stochastic model for dy (or dLon) coordinate.
StochasticModelgetZCoordinatesModel () const
 Get stochastic model pointer for dz (or dH) coordinate.
CodeKalmanSolversetZCoordinatesModel (StochasticModel *pModel)
 Set coordinates stochastic model for dz (or dH) coordinate.
CodeKalmanSolversetCoordinatesModel (StochasticModel *pModel)
 Set a single coordinates stochastic model to ALL coordinates.
StochasticModelgetReceiverClockModel () const
 Get receiver clock stochastic model pointer.
CodeKalmanSolversetReceiverClockModel (StochasticModel *pModel)
 Set receiver clock stochastic model.
Matrix< double > getPhiMatrix () const
 Get the State Transition Matrix (phiMatrix).
CodeKalmanSolversetPhiMatrix (const Matrix< double > &pMatrix)
 Set the State Transition Matrix (phiMatrix).
Matrix< double > getQMatrix () const
 Get the Noise covariance matrix (QMatrix).
CodeKalmanSolversetQMatrix (const Matrix< double > &pMatrix)
 Set the Noise Covariance Matrix (QMatrix).
virtual std::string getClassName (void) const
 Returns a string identifying this object.
virtual ~CodeKalmanSolver ()
 Destructor.


Constructor & Destructor Documentation

CodeKalmanSolver  ) 
 

Default constructor.

Definition at line 44 of file CodeKalmanSolver.cpp.

References gnssData::body, gnssData::header, and gpstk::TypeIDSet.

CodeKalmanSolver const gnssEquationDefinition eqDef  ) 
 

Explicit constructor.

Sets the default equation definition to be used when fed with GNSS data structures.

Parameters:
eqDef gnssEquationDefinition to be used

Definition at line 104 of file CodeKalmanSolver.cpp.

References SolverLMS::setDefaultEqDefinition().

virtual ~CodeKalmanSolver  )  [inline, virtual]
 

Destructor.

Definition at line 361 of file CodeKalmanSolver.hpp.


Member Function Documentation

int Compute const Vector< double > &  prefitResiduals,
const Matrix< double > &  designMatrix,
const Vector< double > &  weightVector
throw (InvalidSolver) [virtual]
 

Compute the code-based Kalman solution of the given equations set.

Parameters:
prefitResiduals Vector of prefit residuals
designMatrix Design matrix for the equation system
weightVector Vector of weights assigned to each satellite.
Warning:
A typical Kalman filter works with the measurements noise covariance matrix, instead of the vector of weights. Beware of this detail, because this method uses the later.

If you use this method, be sure you previously set phiMatrix and qMatrix using the appropriate methods.

Returns:
0 if OK -1 if problems arose

Reimplemented in SolverPPP.

Definition at line 133 of file CodeKalmanSolver.cpp.

References GPSTK_THROW.

int Compute const Vector< double > &  prefitResiduals,
const Matrix< double > &  designMatrix,
const Matrix< double > &  weightMatrix
throw (InvalidSolver) [virtual]
 

Compute the code-based Kalman solution of the given equations set.

Parameters:
prefitResiduals Vector of prefit residuals
designMatrix Design matrix for the equation system
weightMatrix Matrix of weights
Warning:
A typical Kalman filter works with the measurements noise covariance matrix, instead of the matrix of weights. Beware of this detail, because this method uses the later.

If you use this method, be sure you previously set phiMatrix and qMatrix using the appropriate methods.

Returns:
0 if OK -1 if problems arose

Reimplemented in SolverPPP.

Definition at line 188 of file CodeKalmanSolver.cpp.

References GPSTK_RETHROW, GPSTK_THROW, and gpstk::inverseChol().

std::string getClassName void   )  const [virtual]
 

Returns a string identifying this object.

Reimplemented from SolverLMS.

Reimplemented in SolverPPP, and SolverPPPFB.

Definition at line 39 of file CodeKalmanSolver.cpp.

Matrix<double> getPhiMatrix void   )  const [inline]
 

Get the State Transition Matrix (phiMatrix).

Reimplemented in SolverPPP.

Definition at line 321 of file CodeKalmanSolver.hpp.

Matrix<double> getQMatrix void   )  const [inline]
 

Get the Noise covariance matrix (QMatrix).

Reimplemented in SolverPPP.

Definition at line 339 of file CodeKalmanSolver.hpp.

StochasticModel* getReceiverClockModel void   )  const [inline]
 

Get receiver clock stochastic model pointer.

Reimplemented in SolverPPP.

Definition at line 307 of file CodeKalmanSolver.hpp.

StochasticModel* getXCoordinatesModel  )  const [inline]
 

Get stochastic model pointer for dx (or dLat) coordinate.

Reimplemented in SolverPPP.

Definition at line 251 of file CodeKalmanSolver.hpp.

StochasticModel* getYCoordinatesModel  )  const [inline]
 

Get stochastic model pointer for dy (or dLon) coordinate.

Reimplemented in SolverPPP.

Definition at line 265 of file CodeKalmanSolver.hpp.

StochasticModel* getZCoordinatesModel  )  const [inline]
 

Get stochastic model pointer for dz (or dH) coordinate.

Reimplemented in SolverPPP.

Definition at line 279 of file CodeKalmanSolver.hpp.

gnssRinex & Process gnssRinex gData  )  throw (ProcessingException) [virtual]
 

Returns a reference to a gnnsRinex object after solving the previously defined equation system.

Parameters:
gData Data object holding the data.

Reimplemented from SolverLMS.

Reimplemented in SolverPPP, and SolverPPPFB.

Definition at line 348 of file CodeKalmanSolver.cpp.

References satTypeValueMap::getVectorOfTypeID(), GPSTK_THROW, and satTypeValueMap::numSats().

gnssSatTypeValue & Process gnssSatTypeValue gData  )  throw (ProcessingException) [virtual]
 

Returns a reference to a gnnsSatTypeValue object after solving the previously defined equation system.

Parameters:
gData Data object holding the data.

Reimplemented from SolverLMS.

Reimplemented in SolverPPP, and SolverPPPFB.

Definition at line 308 of file CodeKalmanSolver.cpp.

References gnssData::body, GPSTK_THROW, and gnssRinex::header.

CodeKalmanSolver & setCoordinatesModel StochasticModel pModel  ) 
 

Set a single coordinates stochastic model to ALL coordinates.

Parameters:
pModel Pointer to StochasticModel associated with coordinates.
Warning:
Do NOT use this method to set the SAME state-aware stochastic model (like RandomWalkModel, for instance) to ALL coordinates, because the results will certainly be erroneous. Use this method only with non-state-aware stochastic models like 'StochasticModel' (constant coordinates) or 'WhiteNoiseModel'.

Reimplemented in SolverPPP.

Definition at line 468 of file CodeKalmanSolver.cpp.

CodeKalmanSolver& setPhiMatrix const Matrix< double > &  pMatrix  )  [inline]
 

Set the State Transition Matrix (phiMatrix).

Parameters:
pMatrix State Transition matrix.
Warning:
Process() methods set phiMatrix and qMatrix according to the stochastic models already defined. Therefore, you must use the Compute() methods directly if you use this method.

Reimplemented in SolverPPP.

Definition at line 334 of file CodeKalmanSolver.hpp.

CodeKalmanSolver& setQMatrix const Matrix< double > &  pMatrix  )  [inline]
 

Set the Noise Covariance Matrix (QMatrix).

Parameters:
pMatrix Noise Covariance matrix.
Warning:
Process() methods set phiMatrix and qMatrix according to the stochastic models already defined. Therefore, you must use the Compute() methods directly if you use this method.

Reimplemented in SolverPPP.

Definition at line 352 of file CodeKalmanSolver.hpp.

CodeKalmanSolver& setReceiverClockModel StochasticModel pModel  )  [inline]
 

Set receiver clock stochastic model.

Parameters:
pModel Pointer to StochasticModel associated with receiver clock.

Reimplemented in SolverPPP.

Definition at line 316 of file CodeKalmanSolver.hpp.

CodeKalmanSolver& setXCoordinatesModel StochasticModel pModel  )  [inline]
 

Set coordinates stochastic model for dx (or dLat) coordinate.

Parameters:
pModel Pointer to StochasticModel associated with dx (or dLat) coordinate.

Reimplemented in SolverPPP.

Definition at line 260 of file CodeKalmanSolver.hpp.

CodeKalmanSolver& setYCoordinatesModel StochasticModel pModel  )  [inline]
 

Set coordinates stochastic model for dy (or dLon) coordinate.

Parameters:
pModel Pointer to StochasticModel associated with dy (or dLon) coordinate.

Reimplemented in SolverPPP.

Definition at line 274 of file CodeKalmanSolver.hpp.

CodeKalmanSolver& setZCoordinatesModel StochasticModel pModel  )  [inline]
 

Set coordinates stochastic model for dz (or dH) coordinate.

Parameters:
pModel Pointer to StochasticModel associated with dz (or dH) coordinate.

Reimplemented in SolverPPP.

Definition at line 288 of file CodeKalmanSolver.hpp.


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