1 //============================================================================== 2 // 3 // This file is part of GPSTk, the GPS Toolkit. 4 // 5 // The GPSTk is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU Lesser General Public License as published 7 // by the Free Software Foundation; either version 3.0 of the License, or 8 // any later version. 9 // 10 // The GPSTk is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Lesser General Public License for more details. 14 // 15 // You should have received a copy of the GNU Lesser General Public 16 // License along with GPSTk; if not, write to the Free Software Foundation, 17 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA 18 // 19 // This software was developed by Applied Research Laboratories at the 20 // University of Texas at Austin. 21 // Copyright 2004-2020, The Board of Regents of The University of Texas System 22 // 23 //============================================================================== 24 25 //============================================================================== 26 // 27 // This software was developed by Applied Research Laboratories at the 28 // University of Texas at Austin, under contract to an agency or agencies 29 // within the U.S. Department of Defense. The U.S. Government retains all 30 // rights to use, duplicate, distribute, disclose, or release this software. 31 // 32 // Pursuant to DoD Directive 523024 33 // 34 // DISTRIBUTION STATEMENT A: This software has been approved for public 35 // release, distribution is unlimited. 36 // 37 //============================================================================== 38 39 /** 40 * @file IonoModel.cpp 41 * Implementation of the ICD-GPS-200 Ionosphere model. 42 */ 43 44 #ifndef GPSTK_IONOMODEL_HPP 45 #define GPSTK_IONOMODEL_HPP 46 47 #include "CommonTime.hpp" 48 #include "CarrierBand.hpp" 49 #include "EngAlmanac.hpp" 50 #include "Position.hpp" 51 52 namespace gpstk 53 { 54 /// @ingroup GPSsolutions 55 //@{ 56 57 /** 58 * Model of the ionosphere. 59 * It is used to compute the delay of the satellite signal 60 * as seen at the receiver caused by the ionosphere for a 61 * "one frequency" user. 62 * 63 * See ICD-GPS-200, section 20.3.3.5.2.5 and Figure 20-4. 64 * 65 * Verbatim from the above section: 66 * "It is estimated that the use of this model will provide at least 67 * a 50% reduction in the single-frequency user's RMS error due to 68 * ionospheric propagation effects. During extended operations, or for 69 * the Block IIR SVs in the Autonav mode if the CS is unable to upload 70 * the SVs, the use of this model will yield unpredictable results." 71 */ 72 class IonoModel 73 { 74 public: 75 76 /// Thrown when attempting to use a model for which all necessary 77 /// parameters have not been specified. 78 /// @ingroup exceptiongroup 79 NEW_EXCEPTION_CLASS(InvalidIonoModel, gpstk::Exception); 80 81 /// default constructor, creates an invalid model IonoModel()82 IonoModel() throw() : valid(false) {} 83 84 /// destructor ~IonoModel()85 virtual ~IonoModel() throw() {} 86 87 /** 88 * constructor. 89 * Creates a valid model with satellite transmitted alpha 90 * and beta parameters provided from almanac. 91 * \param a an array containing the four alpha terms 92 * \param b an array containing the four beta terms 93 */ 94 IonoModel(const double a[4], const double b[4]) throw(); 95 96 /** 97 * EngAlmanac constructor. 98 * Creates a valid model from and EngAlmanac object 99 * \param engalm an EngAlmanac object 100 */ 101 IonoModel(const EngAlmanac& engalm) throw(); 102 103 /** Method to feed the model with satellite transmitted alpha 104 * and beta parameters provided from almanac. 105 * \param a an array containing the four alpha terms 106 * \param b an array containing the four beta terms 107 */ 108 void setModel(const double a[4], const double b[4]) throw(); 109 110 /** 111 * returns the validity of the model. 112 * \return model validity 113 */ isValid() const114 bool isValid() const throw() { return valid; } 115 116 /** 117 * get the ionospheric correction value. 118 * @param time the time of the observation 119 * @param rxgeo the WGS84 geodetic position of the receiver 120 * @param svel the elevation angle between the rx and SV (degrees) 121 * @param svaz the azimuth angle between the rx and SV (degrees) 122 * @param band the GPS frequency band the observation was made from 123 * @return the ionospheric correction (meters) 124 * @throw InvalidIonoModel 125 */ 126 double getCorrection(const CommonTime& time, 127 const Position& rxgeo, 128 double svel, 129 double svaz, 130 CarrierBand band = CarrierBand::L1) const; 131 132 /// equality operator 133 bool operator==(const IonoModel& right) const throw(); 134 135 /// inequality operator 136 bool operator!=(const IonoModel& right) const throw(); 137 138 private: 139 140 double alpha[4]; 141 double beta[4]; 142 143 bool valid; 144 }; 145 //@} 146 } 147 148 #endif 149