TropModel.hpp

Go to the documentation of this file.
00001 #pragma ident "$Id: TropModel.hpp 1144 2008-03-23 21:21:05Z architest $"
00002 
00003 //============================================================================
00004 //
00005 //  This file is part of GPSTk, the GPS Toolkit.
00006 //
00007 //  The GPSTk is free software; you can redistribute it and/or modify
00008 //  it under the terms of the GNU Lesser General Public License as published
00009 //  by the Free Software Foundation; either version 2.1 of the License, or
00010 //  any later version.
00011 //
00012 //  The GPSTk is distributed in the hope that it will be useful,
00013 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 //  GNU Lesser General Public License for more details.
00016 //
00017 //  You should have received a copy of the GNU Lesser General Public
00018 //  License along with GPSTk; if not, write to the Free Software Foundation,
00019 //  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //  
00021 //  Copyright 2004, The University of Texas at Austin
00022 //
00023 //============================================================================
00024 
00025 //============================================================================
00026 //
00027 //This software developed by Applied Research Laboratories at the University of
00028 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00029 //Department of Defense. The U.S. Government retains all rights to use,
00030 //duplicate, distribute, disclose, or release this software. 
00031 //
00032 //Pursuant to DoD Directive 523024 
00033 //
00034 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00035 //                           release, distribution is unlimited.
00036 //
00037 //=============================================================================
00038 
00039 #ifndef TROPOSPHERIC_MODELS_GPSTK
00040 #define TROPOSPHERIC_MODELS_GPSTK
00041 
00048 #include "Exception.hpp"
00049 #include "ObsEpochMap.hpp"
00050 #include "WxObsMap.hpp"
00051 #include "Xvt.hpp"
00052 #include "Position.hpp"
00053 #include "Matrix.hpp"
00054 #include "icd_200_constants.hpp"
00055 
00056 
00057 // Model of the troposphere, used to compute non-dispersive delay of
00058 // satellite signal as function of satellite elevation as seen at the
00059 // receiver. Both wet and dry components are computed.
00060 //
00061 // The default model (implemented here) is a simple Black model.
00062 //
00063 // In this model (and many others), the wet and dry components are
00064 // independent, the zenith delays depend only on the weather
00065 // (temperature, pressure and humidity), and the mapping functions
00066 // depend only on the elevation of the satellite as seen at the
00067 // receiver. In general, this is not true; other models depend on,
00068 // for example, latitude or day of year.
00069 //
00070 // Other models may be implemented by inheriting this class and
00071 // redefining the virtual functions, and (perhaps) adding other
00072 // 'set...()' routines as needed.
00073 
00074 namespace gpstk
00075 {
00078 
00093    class TropModel
00094    {
00095    public:
00099       NEW_EXCEPTION_CLASS(InvalidTropModel, gpstk::Exception);
00100 
00102       virtual ~TropModel() {}
00103 
00105       bool isValid(void)
00106          { return valid; }
00107 
00110       virtual double correction(double elevation) const
00111          throw(InvalidTropModel);
00112 
00124       virtual double correction(const Position& RX,
00125                                 const Position& SV,
00126                                 const DayTime& tt)
00127          throw(InvalidTropModel);
00128 
00140       virtual double correction(const Xvt& RX,
00141                                 const Xvt& SV,
00142                                 const DayTime& tt)
00143          throw(InvalidTropModel)
00144       { Position R(RX),S(SV);  return TropModel::correction(R,S,tt); }
00145 
00147       virtual double dry_zenith_delay(void) const
00148          throw(InvalidTropModel) = 0;
00149 
00151       virtual double wet_zenith_delay(void) const
00152          throw(InvalidTropModel) = 0;
00153 
00157       virtual double dry_mapping_function(double elevation)
00158          const throw(InvalidTropModel) = 0;
00159 
00163       virtual double wet_mapping_function(double elevation)
00164          const throw(InvalidTropModel) = 0;
00165 
00171       virtual void setWeather(const double& T,
00172                               const double& P,
00173                               const double& H)
00174          throw(InvalidParameter);
00175 
00179       virtual void setWeather(const WxObservation& wx)
00180          throw(InvalidParameter);
00181 
00185       virtual void setReceiverHeight(const double& ht) {};
00186 
00191       virtual void setReceiverLatitude(const double& lat) {};
00192 
00196       virtual void setDayOfYear(const int& d) {};
00197 
00198    protected:
00199       bool valid;                 // true only if current model parameters are valid
00200       double temp;                // latest value of temperature (kelvin or celsius)
00201       double press;               // latest value of pressure (millibars)
00202       double humid;               // latest value of relative humidity (percent)
00203 
00204    }; // end class TropModel
00205    
00206 
00207    //---------------------------------------------------------------------------------
00209    class ZeroTropModel : public TropModel
00210    {
00211    public:
00214       virtual double correction(double elevation) const
00215          throw(InvalidTropModel)
00216          { return 0.0; }
00217 
00229       virtual double correction(const Position& RX,
00230                                 const Position& SV,
00231                                 const DayTime& tt)
00232          throw(InvalidTropModel)
00233          { return 0.0; }
00234 
00246       virtual double correction(const Xvt& RX,
00247                                 const Xvt& SV,
00248                                 const DayTime& tt)
00249          throw(InvalidTropModel)
00250          { return 0.0; }
00251 
00253       virtual double dry_zenith_delay(void) const
00254          throw(InvalidTropModel)
00255          { return 0.0; }
00256 
00258       virtual double wet_zenith_delay(void) const
00259          throw(InvalidTropModel)
00260          { return 0.0; }
00261 
00265       virtual double dry_mapping_function(double elevation)
00266          const throw(InvalidTropModel)
00267          { return 0.0; }
00268 
00272       virtual double wet_mapping_function(double elevation)
00273          const throw(InvalidTropModel)
00274          { return 0.0; }
00275 
00276    }; // end class ZeroTropModel
00277 
00278 
00279    //---------------------------------------------------------------------------------
00281    class SimpleTropModel : public TropModel
00282    {
00283    public:
00285       SimpleTropModel(void);
00286 
00289       SimpleTropModel(const WxObservation& wx)
00290          throw(InvalidParameter);
00291 
00296       SimpleTropModel(const double& T,
00297                       const double& P,
00298                       const double& H)
00299          throw(InvalidParameter);
00300 
00302       virtual double dry_zenith_delay(void) const
00303          throw(InvalidTropModel);
00304 
00306       virtual double wet_zenith_delay(void) const
00307          throw(InvalidTropModel);
00308 
00312       virtual double dry_mapping_function(double elevation) const
00313          throw(InvalidTropModel);
00314 
00318       virtual double wet_mapping_function(double elevation) const
00319          throw(InvalidTropModel);
00320 
00326       virtual void setWeather(const double& T,
00327                               const double& P,
00328                               const double& H)
00329          throw(InvalidParameter);
00330 
00334       virtual void setWeather(const WxObservation& wx)
00335          throw(InvalidParameter);
00336 
00337    private:
00338       double Cdrydelay;
00339       double Cwetdelay;
00340       double Cdrymap;
00341       double Cwetmap;
00342 
00343    };    // end class SimpleTropModel
00344 
00345    //---------------------------------------------------------------------------------
00352    class GGTropModel : public TropModel
00353    {
00354    public:
00356       GGTropModel(void);
00357 
00360       GGTropModel(const WxObservation& wx)
00361          throw(InvalidParameter);
00362 
00367       GGTropModel(const double& T,
00368                   const double& P,
00369                   const double& H)
00370          throw(InvalidParameter);
00371 
00374       virtual double dry_zenith_delay(void) const
00375          throw(InvalidTropModel);
00376 
00379       virtual double wet_zenith_delay(void) const
00380          throw(InvalidTropModel);
00381 
00385       virtual double dry_mapping_function(double elevation) const
00386          throw(InvalidTropModel);
00387 
00391       virtual double wet_mapping_function(double elevation) const
00392          throw(InvalidTropModel);
00393 
00399       virtual void setWeather(const double& T,
00400                               const double& P,
00401                               const double& H)
00402          throw(InvalidParameter);
00403 
00407       virtual void setWeather(const WxObservation& wx)
00408          throw(InvalidParameter);
00409 
00410    private:
00411       double Cdrydelay;
00412       double Cwetdelay;
00413       double Cdrymap;
00414       double Cwetmap;
00415 
00416    };    // end class GGTropModel
00417 
00418    //---------------------------------------------------------------------------------
00448    class GGHeightTropModel : public TropModel
00449    {
00450    public:
00452       GGHeightTropModel(void);
00453 
00456       GGHeightTropModel(const WxObservation& wx)
00457          throw(InvalidParameter);
00458 
00463       GGHeightTropModel(const double& T,
00464                         const double& P,
00465                         const double& H)
00466          throw(InvalidParameter);
00467 
00475       GGHeightTropModel(const double& T,
00476                         const double& P,
00477                         const double& H,
00478                         const double hT,
00479                         const double hP,
00480                         const double hH)
00481          throw(InvalidParameter);
00482 
00485       virtual double correction(double elevation) const
00486          throw(InvalidTropModel);
00487 
00499       virtual double correction(const Position& RX,
00500                                 const Position& SV,
00501                                 const DayTime& tt)
00502          throw(InvalidTropModel);
00503 
00515       virtual double correction(const Xvt& RX,
00516                                 const Xvt& SV,
00517                                 const DayTime& tt)
00518          throw(InvalidTropModel);
00519 
00522       virtual double dry_zenith_delay(void) const
00523          throw(InvalidTropModel);
00524 
00526       virtual double wet_zenith_delay(void) const
00527          throw(InvalidTropModel);
00528 
00532       virtual double dry_mapping_function(double elevation) const
00533          throw(InvalidTropModel);
00534 
00538       virtual double wet_mapping_function(double elevation) const
00539          throw(InvalidTropModel);
00540 
00546       virtual void setWeather(const double& T,
00547                               const double& P,
00548                               const double& H)
00549          throw(InvalidParameter);
00550 
00554       virtual void setWeather(const WxObservation& wx)
00555          throw(InvalidParameter);
00556 
00562       void setHeights(const double& hT,
00563                       const double& hP,
00564                       const double& hH);
00565 
00568       void setReceiverHeight(const double& ht);
00569 
00570    private:
00571       double height;                // height (m) of the receiver
00572       double htemp;                 // height (m) at which temp applies
00573       double hpress;                // height (m) at which press applies
00574       double hhumid;                // height (m) at which humid applies
00575       bool validWeather;
00576       bool validHeights;
00577       bool validRxHeight;
00578 
00579    };    // end class GGHeightTropModel
00580 
00581 
00582    //---------------------------------------------------------------------------------
00618    class NBTropModel : public TropModel
00619    {
00620    public:
00622       NBTropModel(void);
00623 
00628       NBTropModel(const double& lat,
00629                   const int& day);
00630 
00635       NBTropModel(const double& lat,
00636                   const int& day,
00637                   const WxObservation& wx)
00638          throw(InvalidParameter);
00639 
00646       NBTropModel(const double& lat,
00647                   const int& day,
00648                   const double& T,
00649                   const double& P,
00650                   const double& H)
00651          throw(InvalidParameter);
00652 
00658       NBTropModel(const double& ht,
00659                   const double& lat,
00660                   const int& day);
00661 
00664       virtual double correction(double elevation) const
00665          throw(InvalidTropModel);
00666 
00678       virtual double correction(const Position& RX,
00679                                 const Position& SV,
00680                                 const DayTime& tt)
00681          throw(InvalidTropModel);
00682 
00694       virtual double correction(const Xvt& RX,
00695                                 const Xvt& SV,
00696                                 const DayTime& tt)
00697          throw(InvalidTropModel);
00698 
00701       virtual double dry_zenith_delay(void) const
00702          throw(InvalidTropModel);
00703 
00706       virtual double wet_zenith_delay(void) const
00707          throw(InvalidTropModel);
00708 
00712       virtual double dry_mapping_function(double elevation) const
00713          throw(InvalidTropModel);
00714 
00718       virtual double wet_mapping_function(double elevation) const
00719          throw(InvalidTropModel);
00720 
00724       virtual void setWeather(const WxObservation& wx)
00725          throw(InvalidParameter);
00726 
00731       virtual void setWeather(const double& T,
00732                               const double& P,
00733                               const double& H)
00734          throw(InvalidParameter);
00735 
00737       void setWeather()
00738          throw(InvalidTropModel);
00739 
00743       void setReceiverHeight(const double& ht);
00744 
00748       void setReceiverLatitude(const double& lat);
00749 
00753       void setDayOfYear(const int& d);
00754 
00755    private:
00756       bool interpolateWeather;      // if true, compute T,P,H from latitude,doy
00757       double height;                // height (m) of the receiver
00758       double latitude;              // latitude (deg) of receiver
00759       int doy;                      // day of year
00760       bool validWeather;
00761       bool validRxLatitude;
00762       bool validRxHeight;
00763       bool validDOY;
00764 
00765    };    // end class NBTropModel
00766 
00767    //---------------------------------------------------------------------------------
00793    class SaasTropModel : public TropModel
00794    {
00795    public:
00797       SaasTropModel(void);
00798 
00802       SaasTropModel(const double& lat,
00803                     const int& day);
00804 
00809       SaasTropModel(const double& lat,
00810                     const int& day,
00811                     const WxObservation& wx)
00812          throw(InvalidParameter);
00813 
00820       SaasTropModel(const double& lat,
00821                     const int& day,
00822                     const double& T,
00823                     const double& P,
00824                     const double& H)
00825          throw(InvalidParameter);
00826 
00829       virtual double correction(double elevation) const
00830          throw(InvalidTropModel);
00831 
00843       virtual double correction(const Position& RX,
00844                                 const Position& SV,
00845                                 const DayTime& tt)
00846          throw(InvalidTropModel);
00847 
00859       virtual double correction(const Xvt& RX,
00860                                 const Xvt& SV,
00861                                 const DayTime& tt)
00862          throw(InvalidTropModel);
00863 
00866       virtual double dry_zenith_delay(void) const
00867          throw(InvalidTropModel);
00868 
00871       virtual double wet_zenith_delay(void) const
00872          throw(InvalidTropModel);
00873 
00877       virtual double dry_mapping_function(double elevation) const
00878          throw(InvalidTropModel);
00879 
00883       virtual double wet_mapping_function(double elevation) const
00884          throw(InvalidTropModel);
00885 
00889       virtual void setWeather(const WxObservation& wx)
00890          throw(InvalidParameter);
00891 
00896       virtual void setWeather(const double& T,
00897                               const double& P,
00898                               const double& H)
00899          throw(InvalidParameter);
00900 
00904       void setReceiverHeight(const double& ht);
00905 
00909       void setReceiverLatitude(const double& lat);
00910 
00914       void setDayOfYear(const int& d);
00915 
00916    private:
00917       double height;                
00918       double latitude;              
00919       int doy;                      
00920       bool validWeather;
00921       bool validRxLatitude;
00922       bool validRxHeight;
00923       bool validDOY;
00924 
00925    };    // end class SaasTropModel
00926 
00927 
00928       //--------------------------------------------------------------------
00929 
00968    class GCATTropModel : public TropModel
00969    {
00970    public:
00971 
00972 
00974       GCATTropModel(void)
00975       { valid = false; };
00976 
00977 
00983       GCATTropModel(const double& ht);
00984 
00985 
00993       virtual double correction(double elevation) const
00994          throw(InvalidTropModel);
00995 
00996 
01007       virtual double correction( const Position& RX,
01008                                  const Position& SV )
01009          throw(InvalidTropModel);
01010 
01011 
01024       virtual double correction( const Position& RX,
01025                                  const Position& SV,
01026                                  const DayTime& tt )
01027          throw(InvalidTropModel)
01028       { return correction(RX, SV); };
01029 
01030 
01045       virtual double correction( const Xvt& RX,
01046                                  const Xvt& SV,
01047                                  const DayTime& tt )
01048          throw(InvalidTropModel);
01049 
01050 
01054       virtual double dry_zenith_delay(void) const
01055          throw(InvalidTropModel);
01056 
01057 
01061       virtual double wet_zenith_delay(void) const
01062          throw(InvalidTropModel)
01063       { return 0.1; };
01064 
01065 
01072       virtual double mapping_function(double elevation) const
01073          throw(InvalidTropModel);
01074 
01075 
01081       virtual double dry_mapping_function(double elevation) const
01082          throw(InvalidTropModel)
01083       { return mapping_function(elevation); };
01084 
01085 
01092       virtual double wet_mapping_function(double elevation) const
01093          throw(InvalidTropModel)
01094       { return mapping_function(elevation); };
01095 
01096 
01100       virtual void setWeather( const double& T,
01101                                const double& P,
01102                                const double& H )
01103          throw(InvalidParameter) {};
01104 
01105 
01109       virtual void setWeather(const WxObservation& wx)
01110          throw(InvalidParameter) {};
01111 
01112 
01118       virtual void setReceiverHeight(const double& ht);
01119 
01120 
01121    private:
01122 
01124       double gcatHeight;
01125 
01126    };    // end class GCATTropModel
01127 
01128 
01129       //---------------------------------------------------------------------
01130 
01165    class MOPSTropModel : public GCATTropModel
01166    {
01167    public:
01168 
01170       MOPSTropModel(void);
01171 
01172 
01180       MOPSTropModel(const double& ht)
01181       { setReceiverHeight(ht); };
01182 
01183 
01192       MOPSTropModel(const double& ht, const double& lat, const int& doy);
01193 
01194 
01201       MOPSTropModel(const Position& RX, const DayTime& time);
01202 
01203 
01211       virtual double correction(double elevation) const 
01212          throw(InvalidTropModel);
01213 
01214 
01227       virtual double correction( const Position& RX,
01228                                  const Position& SV )
01229          throw(InvalidTropModel);
01230 
01231 
01244       virtual double correction( const Position& RX,
01245                                  const Position& SV,
01246                                  const DayTime& tt )
01247          throw(InvalidTropModel);
01248 
01249 
01262       virtual double correction( const Position& RX,
01263                                  const Position& SV,
01264                                  const int& doy )
01265          throw(InvalidTropModel);
01266 
01267 
01278       virtual double correction( const Xvt& RX,
01279                                  const Xvt& SV )
01280          throw(InvalidTropModel);
01281 
01282 
01297       virtual double correction( const Xvt& RX,
01298                                  const Xvt& SV,
01299                                  const DayTime& tt )
01300          throw(InvalidTropModel);
01301 
01302 
01317       virtual double correction( const Xvt& RX,
01318                                  const Xvt& SV,
01319                                  const int& doy )
01320          throw(InvalidTropModel);
01321 
01322 
01325       virtual double dry_zenith_delay(void) const
01326          throw(InvalidTropModel);
01327 
01328 
01331       virtual double wet_zenith_delay(void) const
01332          throw(InvalidTropModel);
01333 
01334 
01339       void setWeather()
01340          throw(InvalidTropModel);
01341 
01342 
01345       virtual void setWeather( const double& T,
01346                                const double& P,
01347                                const double& H )
01348          throw(InvalidParameter) {};
01349 
01350 
01353       virtual void setWeather(const WxObservation& wx)
01354          throw(InvalidParameter) {};
01355 
01356 
01362       virtual void setReceiverHeight(const double& ht);
01363 
01364 
01370       virtual void setReceiverLatitude(const double& lat);
01371 
01372 
01378       virtual void setDayOfYear(const int& doy);
01379 
01380 
01386       virtual void setDayOfYear(const DayTime& time);
01387 
01388 
01394       virtual void setAllParameters( const DayTime& time,
01395                                      const Position& rxPos );
01396 
01397 
01404       double MOPSsigma2(double elevation) 
01405          throw(TropModel::InvalidTropModel);
01406 
01407 
01408    private:
01409 
01410       double MOPSHeight;
01411       double MOPSLat;
01412       int MOPSTime;
01413       bool validHeight;
01414       bool validLat;
01415       bool validTime;
01416       Matrix<double> avr;
01417       Matrix<double> svr;
01418       Vector<double> fi0;
01419       Vector<double> MOPSParameters;
01420 
01421 
01422          // The MOPS tropospheric model needs to compute several extra
01423          // parameters
01424       virtual void prepareParameters(void) throw(TropModel::InvalidTropModel);
01425 
01426 
01427          // The MOPS tropospheric model uses several predefined data tables
01428       virtual void prepareTables(void);
01429 
01430    };    // end class MOPSTropModel
01431 
01432 
01433       //--------------------------------------------------------------------
01434 
01473    class NeillTropModel : public TropModel
01474    {
01475    public:
01476 
01478       NeillTropModel(void) 
01479       { validHeight=false; validLat=false; validDOY=false; valid=false; };
01480 
01481 
01489       NeillTropModel(const double& ht)
01490       { setReceiverHeight(ht); };
01491 
01492 
01501       NeillTropModel( const double& ht,
01502                       const double& lat,
01503                       const int& doy )
01504       { setReceiverHeight(ht); setReceiverLatitude(lat); setDayOfYear(doy); };
01505 
01506 
01512       NeillTropModel( const Position& RX,
01513                       const DayTime& time );
01514 
01515 
01522       virtual double correction(double elevation) const
01523          throw(InvalidTropModel);
01524 
01525 
01540       virtual double correction( const Position& RX,
01541                                  const Position& SV )
01542          throw(InvalidTropModel);
01543 
01544 
01557       virtual double correction( const Position& RX,
01558                                  const Position& SV,
01559                                  const DayTime& tt )
01560         throw(InvalidTropModel);
01561 
01562 
01575       virtual double correction( const Position& RX,
01576                                  const Position& SV,
01577                                  const int& doy )
01578          throw(InvalidTropModel);
01579 
01580 
01591       virtual double correction( const Xvt& RX,
01592                                  const Xvt& SV  )
01593          throw(InvalidTropModel);
01594 
01595 
01610       virtual double correction( const Xvt& RX,
01611                                  const Xvt& SV,
01612                                  const DayTime& tt )
01613          throw(InvalidTropModel);
01614 
01615 
01630       virtual double correction( const Xvt& RX,
01631                                  const Xvt& SV,
01632                                  const int& doy )
01633          throw(InvalidTropModel);
01634 
01635 
01638       virtual double dry_zenith_delay(void) const
01639          throw(InvalidTropModel);
01640 
01641 
01644       virtual double wet_zenith_delay(void) const
01645          throw(InvalidTropModel)
01646       { return 0.1; };           // Returns a nominal value
01647 
01648 
01654       virtual double dry_mapping_function(double elevation) const
01655          throw(InvalidTropModel);
01656 
01657 
01663       virtual double wet_mapping_function(double elevation) const
01664          throw(InvalidTropModel);
01665 
01666 
01670       void setWeather()
01671          throw(InvalidTropModel);
01672 
01673 
01676       virtual void setWeather( const double& T,
01677                                const double& P,
01678                                const double& H )
01679          throw(InvalidParameter) {};
01680 
01681 
01684       virtual void setWeather(const WxObservation& wx)
01685          throw(InvalidParameter) {};
01686 
01687 
01693       virtual void setReceiverHeight(const double& ht);
01694 
01695 
01700       virtual void setReceiverLatitude(const double& lat);
01701 
01702 
01707       virtual void setDayOfYear(const int& doy);
01708 
01709 
01714       virtual void setDayOfYear(const DayTime& time);
01715 
01716 
01722       virtual void setAllParameters( const DayTime& time,
01723                                      const Position& rxPos );
01724 
01725 
01726    private:
01727 
01728 
01729       double NeillHeight;
01730       double NeillLat;
01731       int NeillDOY;
01732       bool validHeight;
01733       bool validLat;
01734       bool validDOY;
01735 
01736 
01737    };    // end class NeillTropModel
01738    
01740    
01741 }
01742 #endif   // TROPOSPHERIC_MODELS_GPSTK

Generated on Tue Jan 6 03:31:28 2009 for GPS ToolKit Software Library by  doxygen 1.3.9.1