ComputeMelbourneWubbena.cpp

Go to the documentation of this file.
00001 #pragma ident "$Id: ComputeMelbourneWubbena.cpp 1325 2008-07-29 14:33:43Z architest $"
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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00026 //
00027 //  Dagoberto Salazar - gAGE ( http://www.gage.es ). 2007, 2008
00028 //
00029 //============================================================================
00030 
00031 
00032 #include "ComputeMelbourneWubbena.hpp"
00033 
00034 
00035 namespace gpstk
00036 {
00037 
00038       // Index initially assigned to this class
00039    int ComputeMelbourneWubbena::classIndex = 2200000;
00040 
00041 
00042       // Returns an index identifying this object.
00043    int ComputeMelbourneWubbena::getIndex() const
00044    { return index; }
00045 
00046 
00047       // Returns a string identifying this object.
00048    std::string ComputeMelbourneWubbena::getClassName() const
00049    { return "ComputeMelbourneWubbena"; }
00050 
00051 
00052       // Default constructor
00053    ComputeMelbourneWubbena::ComputeMelbourneWubbena()
00054       : type3(TypeID::L1), type4(TypeID::L2), DEN1(L1_FREQ + L2_FREQ),
00055         DEN2(L1_FREQ - L2_FREQ)
00056    {
00057       type1 = TypeID::P1;
00058       type2 = TypeID::P2;
00059       resultType = TypeID::MWubbena;
00060       setIndex();
00061    }
00062 
00063 
00064       /* Returns a satTypeValueMap object, adding the new data generated
00065        *  when calling this object.
00066        *
00067        * @param gData     Data object holding the data.
00068        */
00069    satTypeValueMap& ComputeMelbourneWubbena::Process(satTypeValueMap& gData)
00070       throw(ProcessingException)
00071    {
00072 
00073       try
00074       {
00075 
00076          double value1(0.0);
00077          double value2(0.0);
00078          double value3(0.0);
00079          double value4(0.0);
00080 
00081          SatIDSet satRejectedSet;
00082 
00083             // Loop through all the satellites
00084          satTypeValueMap::iterator it;
00085          for (it = gData.begin(); it != gData.end(); ++it) 
00086          {
00087             try
00088             {
00089                   // Try to extract the values
00090                value1 = (*it).second(type1);
00091                value2 = (*it).second(type2);
00092                value3 = (*it).second(type3);
00093                value4 = (*it).second(type4);
00094             }
00095             catch(...)
00096             {
00097                   // If some value is missing, then schedule this satellite
00098                   // for removal
00099                satRejectedSet.insert( (*it).first );
00100                continue;
00101             }
00102 
00103                // If everything is OK, then get the new value inside
00104                // the structure
00105             (*it).second[resultType] = getCombination( value1,
00106                                                        value2,
00107                                                        value3,
00108                                                        value4 );
00109          }
00110 
00111             // Remove satellites with missing data
00112          gData.removeSatID(satRejectedSet);
00113 
00114          return gData;
00115 
00116       }
00117       catch(Exception& u)
00118       {
00119             // Throw an exception if something unexpected happens
00120          ProcessingException e( getClassName() + ":"
00121                                 + StringUtils::asString( getIndex() ) + ":"
00122                                 + u.what() );
00123 
00124          GPSTK_THROW(e);
00125 
00126       }
00127 
00128    }  // End of method 'ComputeMelbourneWubbena::Process()'
00129 
00130 
00131 
00132       // Compute the combination of observables.
00133    double ComputeMelbourneWubbena::getCombination( const double& p1,
00134                                                    const double& p2,
00135                                                    const double& l1,
00136                                                    const double& l2 )
00137    {
00138 
00139       return (   ( L1_FREQ*l1 - L2_FREQ*l2 ) / ( DEN2 )
00140                - ( L1_FREQ*p1 + L2_FREQ*p2 ) / ( DEN1 ) );
00141 
00142    }  // End of method 'ComputeMelbourneWubbena::getCombination()'
00143 
00144 
00145 
00146 } // End of namespace gpstk

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