StochasticModel.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: StochasticModel.hpp 2580 2011-04-28 14:53:04Z architest $"
00002 
00009 #ifndef GPSTK_STOCHASTICMODEL_HPP
00010 #define GPSTK_STOCHASTICMODEL_HPP
00011 
00012 //============================================================================
00013 //
00014 //  This file is part of GPSTk, the GPS Toolkit.
00015 //
00016 //  The GPSTk is free software; you can redistribute it and/or modify
00017 //  it under the terms of the GNU Lesser General Public License as published
00018 //  by the Free Software Foundation; either version 2.1 of the License, or
00019 //  any later version.
00020 //
00021 //  The GPSTk is distributed in the hope that it will be useful,
00022 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00023 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00024 //  GNU Lesser General Public License for more details.
00025 //
00026 //  You should have received a copy of the GNU Lesser General Public
00027 //  License along with GPSTk; if not, write to the Free Software Foundation,
00028 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00029 //
00030 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2007, 2008
00031 //
00032 //============================================================================
00033 
00034 
00035 
00036 #include "DayTime.hpp"
00037 #include "DataStructures.hpp"
00038 
00039 
00040 
00041 namespace gpstk
00042 {
00043 
00046 
00047 
00055    class StochasticModel
00056    {
00057    public:
00058 
00060       StochasticModel() {};
00061 
00062 
00064       virtual double getPhi()
00065       { return 1.0; };
00066 
00067 
00069       virtual double getQ()
00070       { return 0.0; };
00071 
00072 
00081       virtual void Prepare( const SatID& sat,
00082                             gnssSatTypeValue& gData )
00083       { return; };
00084 
00085 
00094       virtual void Prepare( const SatID& sat,
00095                             gnssRinex& gData )
00096       { return; };
00097 
00098 
00100       virtual ~StochasticModel() {};
00101 
00102 
00103    }; // End of class 'StochasticModel'
00104 
00105 
00106 
00116    class RandomWalkModel : public StochasticModel
00117    {
00118    public:
00119 
00122       RandomWalkModel()
00123          : qprime(90000000000.0), previousTime(DayTime::BEGINNING_OF_TIME),
00124            currentTime(DayTime::BEGINNING_OF_TIME) {};
00125 
00126 
00139       RandomWalkModel( double qp,
00140                        const DayTime& prevTime=DayTime::BEGINNING_OF_TIME,
00141                        const DayTime& currentTime=DayTime::BEGINNING_OF_TIME )
00142          : qprime(qp), previousTime(prevTime), currentTime(prevTime) {};
00143 
00144 
00150       virtual RandomWalkModel& setPreviousTime(const DayTime& prevTime)
00151       { previousTime = prevTime; return (*this); }
00152 
00153 
00159       virtual RandomWalkModel& setCurrentTime(const DayTime& currTime)
00160       { currentTime = currTime; return (*this); }
00161 
00162 
00174       virtual RandomWalkModel& setQprime(double qp)
00175       { qprime = qp; return (*this); }
00176 
00177 
00179       virtual double getQ();
00180 
00181 
00189       virtual void Prepare( const SatID& sat,
00190                             gnssSatTypeValue& gData );
00191 
00192 
00200       virtual void Prepare( const SatID& sat,
00201                             gnssRinex& gData );
00202 
00203 
00205       virtual ~RandomWalkModel() {};
00206 
00207 
00208    private:
00209 
00210 
00212       double qprime;
00213 
00214 
00216       DayTime previousTime;
00217 
00218 
00220       DayTime currentTime;
00221 
00222 
00223    }; // End of class 'RandomWalkModel'
00224 
00225 
00226 
00233    class WhiteNoiseModel : public StochasticModel
00234    {
00235    public:
00236 
00237 
00243       WhiteNoiseModel( double sigma = 300000.0 )
00244          : variance(sigma*sigma) {};
00245 
00246 
00248       virtual WhiteNoiseModel& setSigma(double sigma)
00249       { variance = sigma*sigma; return (*this); }
00250 
00251 
00253       virtual double getPhi()
00254       { return 0.0; };
00255 
00256 
00258       virtual double getQ()
00259       { return variance; };
00260 
00261 
00263       virtual ~WhiteNoiseModel() {};
00264 
00265 
00266    private:
00267 
00268 
00270       double variance;
00271 
00272 
00273    }; // End of class 'WhiteNoiseModel'
00274 
00275 
00276 
00290    class PhaseAmbiguityModel : public StochasticModel
00291    {
00292    public:
00293 
00294 
00300       PhaseAmbiguityModel( double sigma = 2e7 )
00301          : variance(sigma*sigma), cycleSlip(false), watchSatArc(true),
00302            csFlagType(TypeID::CSL1) {};
00303 
00304 
00306       virtual PhaseAmbiguityModel& setSigma(double sigma)
00307       { variance = sigma*sigma; return (*this); }
00308 
00309 
00316       virtual PhaseAmbiguityModel& setCS(bool cs)
00317       { cycleSlip = cs; return (*this); };
00318 
00319 
00321       virtual PhaseAmbiguityModel& setWatchSatArc(bool watchArc)
00322       { watchSatArc = watchArc; return (*this); };
00323 
00324 
00332       virtual PhaseAmbiguityModel& setCycleSlipFlag( const TypeID& type )
00333       { csFlagType = type; return (*this); };
00334 
00335 
00337       virtual TypeID getCycleSlipFlag( void )
00338       { return csFlagType; };
00339 
00340 
00342       virtual double getPhi();
00343 
00344 
00346       virtual double getQ();
00347 
00348 
00356       virtual void Prepare( const SatID& sat,
00357                             gnssSatTypeValue& gData )
00358       { checkCS(sat, gData.body, gData.header.source); return; };
00359 
00360 
00368       virtual void Prepare( const SatID& sat,
00369                             gnssRinex& gData )
00370       { checkCS(sat, gData.body, gData.header.source); return; };
00371 
00372 
00374       virtual ~PhaseAmbiguityModel() {};
00375 
00376 
00377    private:
00378 
00379 
00381       double variance;
00382 
00384       bool cycleSlip;
00385 
00387       bool watchSatArc;
00388 
00390       TypeID csFlagType;
00391 
00393       std::map<SourceID, std::map<SatID, double> > satArcMap;
00394 
00395 
00403       virtual void checkCS( const SatID& sat,
00404                             satTypeValueMap& data,
00405                             SourceID& source );
00406 
00407 
00408    }; // End of class 'PhaseAmbiguityModel'
00409 
00410 
00411 
00421    class TropoRandomWalkModel : public StochasticModel
00422    {
00423    public:
00424 
00426       TropoRandomWalkModel() {};
00427 
00428 
00435       virtual TropoRandomWalkModel& setPreviousTime( const SourceID& source,
00436                                                      const DayTime& prevTime )
00437       { tmData[source].previousTime = prevTime; return (*this); };
00438 
00439 
00446       virtual TropoRandomWalkModel& setCurrentTime( const SourceID& source,
00447                                                     const DayTime& currTime )
00448       { tmData[source].currentTime = currTime; return (*this); };
00449 
00450 
00467       virtual TropoRandomWalkModel& setQprime(double qp);
00468 
00469 
00488       virtual TropoRandomWalkModel& setQprime( const SourceID& source,
00489                                                double qp )
00490       { tmData[source].qprime = qp; return (*this); };
00491 
00492 
00493 
00501       virtual double getQ()
00502       { return variance; };
00503 
00504 
00512       virtual void Prepare( const SatID& sat,
00513                             gnssSatTypeValue& gData );
00514 
00515 
00523       virtual void Prepare( const SatID& sat,
00524                             gnssRinex& gData );
00525 
00526 
00528       virtual ~TropoRandomWalkModel() {};
00529 
00530 
00531    private:
00532 
00533 
00535       struct tropModelData
00536       {
00537             // Default constructor initializing the data in the structure
00538          tropModelData() : qprime(3e-8),
00539                            previousTime(DayTime::BEGINNING_OF_TIME) {};
00540 
00541          double qprime;          
00542          DayTime previousTime;   
00543          DayTime currentTime;    
00544 
00545       }; // End of struct 'tropModelData'
00546 
00547 
00549       std::map<SourceID, tropModelData> tmData;
00550 
00551 
00553       double variance;
00554 
00555 
00564       virtual void computeQ( const SatID& sat,
00565                              satTypeValueMap& data,
00566                              SourceID& source );
00567 
00568 
00569    }; // End of class 'TropoRandomWalkModel'
00570 
00572 
00573 }  // End of namespace gpstk
00574 #endif // GPSTK_STOCHASTICMODEL_HPP

Generated on Tue May 22 03:31:02 2012 for GPS ToolKit Software Library by  doxygen 1.3.9.1