SolverGeneral.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: SolverGeneral.hpp 2648 2011-06-09 08:01:41Z yanweignss $"
00002 
00008 #ifndef GPSTK_SOLVERGENERAL_HPP
00009 #define GPSTK_SOLVERGENERAL_HPP
00010 
00011 //============================================================================
00012 //
00013 //  This file is part of GPSTk, the GPS Toolkit.
00014 //
00015 //  The GPSTk is free software; you can redistribute it and/or modify
00016 //  it under the terms of the GNU Lesser General Public License as published
00017 //  by the Free Software Foundation; either version 2.1 of the License, or
00018 //  any later version.
00019 //
00020 //  The GPSTk is distributed in the hope that it will be useful,
00021 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 //  GNU Lesser General Public License for more details.
00024 //
00025 //  You should have received a copy of the GNU Lesser General Public
00026 //  License along with GPSTk; if not, write to the Free Software Foundation,
00027 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00028 //
00029 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2009
00030 //
00031 //============================================================================
00032 
00033 
00034 #include "SolverBase.hpp"
00035 #include "TypeID.hpp"
00036 #include "ProcessingClass.hpp"
00037 #include "EquationSystem.hpp"
00038 #include "StochasticModel.hpp"
00039 #include "SimpleKalmanFilter.hpp"
00040 
00041 
00042 namespace gpstk
00043 {
00044 
00046 
00047 
00048       class GeneralConstraint;
00049 
00051 
00164    class SolverGeneral : public SolverBase, public ProcessingClass
00165    {
00166    public:
00167 
00172       SolverGeneral( const Equation& equation ) : firstTime(true)
00173       { equSystem.addEquation(equation); };
00174 
00175 
00181       SolverGeneral( const std::list<Equation>& equationList );
00182 
00183 
00189       SolverGeneral( const EquationSystem& equationSys ) : firstTime(true)
00190       { equSystem = equationSys; };
00191 
00192 
00194       virtual EquationSystem getEquationSystem() const
00195       { return equSystem; };
00196 
00197 
00203       virtual SolverGeneral& setEquationSystem(
00204                                              const EquationSystem& equationSys )
00205       { equSystem = equationSys; return (*this); };
00206 
00207 
00209       virtual ConstraintSystem getEquationSystemConstraints() const
00210       { return equSystem.getConstraintSystem(); };
00211 
00212 
00218       virtual SolverGeneral& setEquationSystemConstraints(
00219                                          const ConstraintSystem& constraintSys )
00220       { equSystem.setConstraintSystem(constraintSys); return (*this); };
00221 
00222 
00227       virtual SolverGeneral& addEquation( const Equation& equation )
00228       { equSystem.addEquation(equation); return (*this); };
00229 
00230 
00240       virtual SolverGeneral& removeEquation( const Variable& indterm )
00241       { equSystem.removeEquation(indterm); return (*this); };
00242 
00243 
00250       virtual SolverGeneral& clearEquations()
00251       { equSystem.clearEquations(); return (*this); };
00252 
00253 
00256       virtual SolverGeneral& reset(void)
00257       { firstTime = true; return (*this); };
00258 
00259 
00265       virtual gnssSatTypeValue& Process( gnssSatTypeValue& gData )
00266          throw(ProcessingException);
00267 
00268 
00274       virtual gnssRinex& Process( gnssRinex& gData )
00275          throw(ProcessingException);
00276 
00277 
00283       virtual gnssDataMap& Process( gnssDataMap& gdsMap )
00284          throw(ProcessingException);
00285 
00286 
00291       virtual double getSolution( const Variable& variable ) const
00292          throw(InvalidRequest);
00293 
00294 
00302       virtual double getSolution( const TypeID& type ) const
00303          throw(InvalidRequest);
00304 
00305 
00314       virtual double getSolution( const TypeID& type,
00315                                   const SourceID& source ) const
00316          throw(InvalidRequest);
00317 
00318    
00328       virtual double getSolution( const TypeID& type,
00329                                   const SatID& sat ) const
00330          throw(InvalidRequest);
00331 
00332 
00343       virtual double getSolution( const TypeID& type,
00344                                   const SourceID& source,
00345                                   const SatID& sat ) const
00346          throw(InvalidRequest);
00347 
00348 
00354       virtual double getCovariance( const Variable& var1, 
00355                                     const Variable& var2 ) const 
00356          throw(InvalidRequest);
00357 
00358 
00363       virtual double getVariance( const Variable& variable ) const
00364          throw(InvalidRequest);
00365 
00366 
00374       virtual double getVariance( const TypeID& type ) const 
00375          throw(InvalidRequest);
00376 
00377 
00386       virtual double getVariance( const TypeID& type,
00387                                   const SourceID& source ) const 
00388          throw(InvalidRequest);
00389 
00390 
00400       virtual double getVariance( const TypeID& type,
00401                                   const SatID& sat ) const 
00402          throw(InvalidRequest);
00403 
00404 
00414       virtual double getVariance( const TypeID& type,
00415                                   const SourceID& source,
00416                                   const SatID& sat ) const 
00417          throw(InvalidRequest);
00418 
00419 
00420 
00422       virtual Matrix<double> getPhiMatrix(void) const
00423       { return phiMatrix; };
00424 
00425 
00427       virtual Matrix<double> getQMatrix(void) const
00428       { return qMatrix; };
00429 
00430 
00432       virtual int getIndex(void) const;
00433 
00434 
00436       virtual std::string getClassName(void) const;
00437 
00438 
00440       virtual ~SolverGeneral() {};
00441 
00442 
00443    protected:
00444 
00445 
00447       EquationSystem equSystem;
00448 
00449 
00454       virtual gnssDataMap& preCompute( gnssDataMap& gdsMap )
00455          throw(ProcessingException);
00456 
00457 
00462       virtual gnssDataMap& postCompute( gnssDataMap& gdsMap )
00463          throw(ProcessingException);
00464 
00465 
00471       virtual SolverGeneral& setSolution( const Variable& variable,
00472                                           const double& val )
00473          throw(InvalidRequest);
00474 
00475 
00482       virtual SolverGeneral& setCovariance( const Variable& var1, 
00483                                             const Variable& var2,
00484                                             const double& cov)
00485          throw(InvalidRequest);
00486 
00487    private:
00488 
00489 
00491       Matrix<double> phiMatrix;
00492 
00493 
00495       Matrix<double> qMatrix;
00496 
00497 
00499       Matrix<double> hMatrix;
00500 
00501 
00503       Matrix<double> rMatrix;
00504 
00505 
00507       Vector<double> measVector;
00508 
00509 
00511       VariableDataMap stateMap;
00512 
00513 
00515       std::map<Variable, VariableDataMap > covarianceMap;
00516 
00517 
00519       SimpleKalmanFilter kFilter;
00520 
00521 
00523       bool firstTime;
00524 
00525 
00527       static int classIndex;
00528 
00530       int index;
00531 
00533       void setIndex(void)
00534       { index = classIndex++; };
00535 
00536 
00537          // Do not allow the use of the default constructor.
00538       SolverGeneral();
00539 
00540 
00555       virtual int Compute( const Vector<double>& prefitResiduals,
00556                            const Matrix<double>& designMatrix,
00557                            const Matrix<double>& weightMatrix )
00558          throw(InvalidSolver);
00559 
00560 
00561       friend class GeneralConstraint;
00562 
00563    }; // End of class 'SolverGeneral'
00564 
00566 
00567 }  // End of namespace gpstk
00568 #endif   // GPSTK_SOLVERGENERAL_HPP

Generated on Wed Feb 8 03:31:02 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1