IonoModelStore.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: IonoModelStore.cpp 3140 2012-06-18 15:03:02Z susancummins $"
00002 
00009 //============================================================================
00010 //
00011 //  This file is part of GPSTk, the GPS Toolkit.
00012 //
00013 //  The GPSTk is free software; you can redistribute it and/or modify
00014 //  it under the terms of the GNU Lesser General Public License as published
00015 //  by the Free Software Foundation; either version 2.1 of the License, or
00016 //  any later version.
00017 //
00018 //  The GPSTk is distributed in the hope that it will be useful,
00019 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00020 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021 //  GNU Lesser General Public License for more details.
00022 //
00023 //  You should have received a copy of the GNU Lesser General Public
00024 //  License along with GPSTk; if not, write to the Free Software Foundation,
00025 //  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
00026 //  
00027 //  Copyright 2004, The University of Texas at Austin
00028 //
00029 //============================================================================
00030 
00031 //============================================================================
00032 //
00033 //This software developed by Applied Research Laboratories at the University of
00034 //Texas at Austin, under contract to an agency or agencies within the U.S. 
00035 //Department of Defense. The U.S. Government retains all rights to use,
00036 //duplicate, distribute, disclose, or release this software. 
00037 //
00038 //Pursuant to DoD Directive 523024 
00039 //
00040 // DISTRIBUTION STATEMENT A: This software has been approved for public 
00041 //                           release, distribution is unlimited.
00042 //
00043 //=============================================================================
00044 
00045 
00046 #include "IonoModelStore.hpp"
00047 
00048 using namespace std;
00049 
00050 namespace gpstk
00051 {
00052 
00053       /* Get the ionospheric correction value.
00054        *
00055        * \param time the time of the observation
00056        * \param rxgeo the WGS84 geodetic position of the receiver
00057        * \param svel the elevation angle between the rx and SV (degrees)
00058        * \param svaz the azimuth angle between the rx and SV (degrees)
00059        * \param freq the GPS frequency the observation was made from
00060        * \return the ionospheric correction (meters)
00061        */
00062    double IonoModelStore::getCorrection(const CommonTime& time,
00063                                         const Position& rxgeo,
00064                                         double svel,
00065                                         double svaz,
00066                                         IonoModel::Frequency freq) const
00067       throw(IonoModelStore::NoIonoModelFound)
00068    {
00069 
00070       IonoModelMap::const_iterator i = ims.upper_bound(time);
00071       if (!ims.empty() && i != ims.begin())
00072       {
00073          i--;
00074          return i->second.getCorrection(time, rxgeo, svel, svaz, freq);
00075       }
00076       else
00077       {
00078          NoIonoModelFound e;
00079          GPSTK_THROW(e);
00080       }
00081 
00082    }  // End of method 'IonoModelStore::getCorrection()'
00083 
00084 
00085       /* Add an IonoModel to this collection
00086        *
00087        * \param mt the time the model is valid from
00088        * \param im the IonoModel to add
00089        * \return true if the model was added, false otherwise
00090        */
00091    bool IonoModelStore::addIonoModel(const CommonTime& mt, const IonoModel& im)
00092       throw()
00093    {
00094 
00095       if (!im.isValid())
00096          return false;
00097 
00098       IonoModelMap::const_iterator i = ims.upper_bound(mt);
00099       if (!ims.empty() && i != ims.begin())
00100       {
00101             // compare to previous stored model and if they have the
00102             // the same alpha and beta parameters don't store it
00103          i--;
00104          if (im == i->second)
00105             return false;
00106       }
00107 
00108       ims[mt] = im;
00109 
00110       return true;
00111 
00112    }  // End of method 'IonoModelStore::addIonoModel()'
00113 
00114 
00115 }  // End of namespace gpstk

Generated on Tue May 21 03:31:10 2013 for GPS ToolKit Software Library by  doxygen 1.3.9.1