Example #1
0
      // This method checks the limits and modifies 'gData' accordingly.
   void SolverPPPFB::checkLimits( gnssRinex& gData,
                                  double codeLimit,
                                  double phaseLimit )
   {

         // Set to store rejected satellites
      SatIDSet satRejectedSet;

         // Let's check limits
      for( satTypeValueMap::iterator it = gData.body.begin();
           it != gData.body.end();
           ++it )
      {

            // Check postfit values and mark satellites as rejected
         if( std::abs((*it).second( TypeID::postfitC )) > codeLimit )
         {
            satRejectedSet.insert( (*it).first );
         }

         if( std::abs((*it).second( TypeID::postfitL )) > phaseLimit )
         {
            satRejectedSet.insert( (*it).first );
         }

      }  // End of 'for( satTypeValueMap::iterator it = gds.body.begin();...'


         // Update the number of rejected measurements
      rejectedMeasurements += satRejectedSet.size();

         // Remove satellites with missing data
      gData.removeSatID(satRejectedSet);

   }  // End of method 'SolverPPPFB::checkLimits()'
Example #2
0
      // Returns a satTypeValueMap object, filtering the target observables.
      //
      // @param gData     Data object holding the data.
      //
   satTypeValueMap& SimpleFilter::Process(satTypeValueMap& gData)
      throw(ProcessingException)
   {

      try
      {

         SatIDSet satRejectedSet;

            // Check all the indicated TypeID's
         TypeIDSet::const_iterator pos;
         for (pos = filterTypeSet.begin(); pos != filterTypeSet.end(); ++pos)
         {

            double value(0.0);

               // Loop through all the satellites
            satTypeValueMap::iterator it;
            for (it = gData.begin(); it != gData.end(); ++it) 
            {
               try
               {
                     // Try to extract the values
                  value = (*it).second(*pos);

                     // Now, check that the value is within bounds
                  if ( !( checkValue(value) ) )
                  {
                        // If value is out of bounds, then schedule this
                        // satellite for removal
                      satRejectedSet.insert( (*it).first );
                  }
               }
               catch(...)
               {
                     // If some value is missing, then schedule this satellite
                     // for removal
                  satRejectedSet.insert( (*it).first );
               }
            }

               // Before checking next TypeID, let's remove satellites with
               // data out of bounds
            gData.removeSatID(satRejectedSet);
         }

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of 'SimpleFilter::Process()'
      /* Returns a satTypeValueMap object, adding the new data generated
       *  when calling this object.
       *
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& ComputeMelbourneWubbena::Process(satTypeValueMap& gData)
      throw(ProcessingException)
   {

      try
      {

         double value1(0.0);
         double value2(0.0);
         double value3(0.0);
         double value4(0.0);

         SatIDSet satRejectedSet;

            // Loop through all the satellites
         satTypeValueMap::iterator it;
         for (it = gData.begin(); it != gData.end(); ++it) 
         {
            try
            {
                  // Try to extract the values
               value1 = (*it).second(type1);
               value2 = (*it).second(type2);
               value3 = (*it).second(type3);
               value4 = (*it).second(type4);
            }
            catch(...)
            {
                  // If some value is missing, then schedule this satellite
                  // for removal
               satRejectedSet.insert( (*it).first );
               continue;
            }

               // If everything is OK, then get the new value inside
               // the structure
            (*it).second[resultType] = getCombination( value1,
                                                       value2,
                                                       value3,
                                                       value4 );
         }

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + StringUtils::asString( getIndex() ) + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'ComputeMelbourneWubbena::Process()'
Example #4
0
   int GeneralConstraint::findIndexOfSat( const SatIDSet& satSet,
                                          const SatID& sat )
   {
      int indexOfSat(-1);

      int i(0);
      for(SatIDSet::const_iterator it=satSet.begin();
          it!=satSet.end();
          ++it)
      {
         if((*it)==sat) indexOfSat = i;

         i++;
      }

      return indexOfSat;

   }  // End of method 'GeneralConstraint::findIndexOfSat()'
Example #5
0
   VariableSet GeneralConstraint::getVariables( const SourceID& source, 
                                                const SatIDSet& satSet, 
                                                const TypeID& type )
   {
      VariableSet vset;

      VariableSet varSet = getVariables(source,type);
      for(VariableSet::iterator itv=varSet.begin();
         itv!=varSet.end();
         ++itv)
      {
         SatIDSet::const_iterator it = satSet.find(itv->getSatellite());
         if( it != satSet.end() ) vset.insert(*itv);
      }

      return vset;

   }  // End of method 'GeneralConstraint::getVariables(...'
Example #6
0
      /* Returns a satTypeValueMap object, adding the new data generated
       * when calling this object.
       *
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& ComputeIURAWeights::Process( const DayTime& time,
                                                 satTypeValueMap& gData )
      throw(ProcessingException)
   {

      try
      {

            // By default set the wight as a very small value
         double weight(0.000001);

         SatIDSet satRejectedSet;

               // Loop through all the satellites
         satTypeValueMap::iterator it;
         for( it = gData.begin(); it != gData.end(); ++it )
         {

            try
            {

                  // Try to extract the weight value
               if( pBCEphemeris != NULL )
               {
                  weight = getWeight( ((*it).first), time, pBCEphemeris );
               }
               else
               {

                  if( pTabEphemeris != NULL )
                  {
                     weight = getWeight( ((*it).first), time, pTabEphemeris );
                  }
               }
            }
            catch(...)
            {

                  // If some value is missing, then schedule this
                  // satellite for removal
               satRejectedSet.insert( (*it).first );

               continue;

            }

               // If everything is OK, then get the new value inside
               // the GDS structure
            (*it).second[TypeID::weight] = weight;

         }  // End of 'for( it = gData.begin(); it != gData.end(); ++it )'


            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + StringUtils::asString( getIndex() ) + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'ComputeIURAWeights::Process()'
Example #7
0
      /* Returns a reference to a satTypeValueMap object after differencing
       * data type values given in 'diffTypes' field with respect to
       * reference station data in 'refData' field.
       *
       * @param gData      Data object holding the data.
       */
   satTypeValueMap& DeltaOp::Process(satTypeValueMap& gData)
      throw(ProcessingException)
   {

      try
      {

         SatIDSet satRejectedSet;

            // Loop through all the satellites in the station data set
         satTypeValueMap::iterator it;
         for (it = gData.begin(); it != gData.end(); ++it)
         {

               // Let's find if the same satellite is present in refData
            satTypeValueMap::const_iterator itref;
            itref = refData.find((*it).first);

               // If we found the satellite, let's proceed with the differences
            if (itref != refData.end())
            {

                  // We must compute the difference for all the types in
                  // 'diffTypes' set
               TypeIDSet::const_iterator itType;
               for( itType = diffTypes.begin();
                    itType != diffTypes.end();
                    ++itType )
               {

                  double value1(0.0);
                  double value2(0.0);

                  try
                  {

                        // Let's try to compute the difference
                     value1 = gData((*it).first)(*itType);
                     value2 = refData((*it).first)(*itType);

                        // Get difference into data structure
                     gData((*it).first)((*itType)) =  value1 - value2;

                  }
                  catch(...)
                  {

                        // If some value is missing, then schedule this
                        // satellite for removal
                     satRejectedSet.insert( (*it).first );

                        // Skip this value if problems arise
                     continue;

                  }

               }  // End of 'for( itType = diffTypes.begin(); ...'

                  // update CSFlag
               if(updateCSFlag)
               {
                  double CSValue1 = gData[it->first][TypeID::CSL1] 
                                   +refData[it->first][TypeID::CSL1];
                  double CSValue2 = gData[it->first][TypeID::CSL2] 
                                   +refData[it->first][TypeID::CSL2];


                  gData[it->first][TypeID::CSL1] = (CSValue1 > 0.0) ? 1.0 : 0.0;
                  
                  gData[it->first][TypeID::CSL2] = (CSValue2 > 0.0) ? 1.0 : 0.0;

               }  // End of 'if(updateCSFlag)'

            }
            else
            {

                  // If we didn't find the same satellite in both sets, mark
                  // it for deletion
               satRejectedSet.insert( (*it).first );

               continue;

            }  // End of 'if (itref != refData.end())'

         }  // End of 'for (it = gData.begin(); it != gData.end(); ++it)'

            // If ordered so, delete the missing satellites
         if (deleteMissingSats)
         {
            gData.removeSatID(satRejectedSet);
         }

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'DeltaOp::Process()'
Example #8
0
      /* Returns a satTypeValueMap object, adding the new data generated when
       * calling this object.
       *
       * @param time      Epoch corresponding to the data.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& ComputeSatPCenter::Process(const DayTime& time,
                                           satTypeValueMap& gData)
      throw(ProcessingException)
   {

      try
      {

            // Compute Sun position at this epoch
         SunPosition sunPosition;
         Triple sunPos(sunPosition.getPosition(time));

            // Define a Triple that will hold satellite position, in ECEF
         Triple svPos(0.0, 0.0, 0.0);

         SatIDSet satRejectedSet;

            // Loop through all the satellites
         satTypeValueMap::iterator it;
         for (it = gData.begin(); it != gData.end(); ++it)
         {

               // Use ephemeris if satellite position is not already computed
            if( ( (*it).second.find(TypeID::satX) == (*it).second.end() ) ||
                ( (*it).second.find(TypeID::satY) == (*it).second.end() ) ||
                ( (*it).second.find(TypeID::satZ) == (*it).second.end() ) )
            {

               if(pEphemeris==NULL)
               {

                     // If ephemeris is missing, then remove all satellites
                  satRejectedSet.insert( (*it).first );

                  continue;
               }
               else
               {

                     // Try to get satellite position
                     // if it is not already computed
                  try
                  {
                        // For our purposes, position at receive time
                        // is fine enough
                     Xvt svPosVel(pEphemeris->getXvt( (*it).first, time ));

                        // If everything is OK, then continue processing.
                     svPos[0] = svPosVel.x.theArray[0];
                     svPos[1] = svPosVel.x.theArray[1];
                     svPos[2] = svPosVel.x.theArray[2];

                  }
                  catch(...)
                  {

                        // If satellite is missing, then schedule it
                        // for removal
                     satRejectedSet.insert( (*it).first );

                     continue;
                  }

               }

            }
            else
            {

                  // Get satellite position out of GDS
               svPos[0] = (*it).second[TypeID::satX];
               svPos[1] = (*it).second[TypeID::satY];
               svPos[2] = (*it).second[TypeID::satZ];

            }  // End of 'if( ( (*it).second.find(TypeID::satX) == ...'


               // Let's get the satellite antenna phase correction value in
               // meters, and insert it in the GNSS data structure.
            (*it).second[TypeID::satPCenter] =
               getSatPCenter((*it).first, time, svPos, sunPos);

         }  // End of 'for (it = gData.begin(); it != gData.end(); ++it)'

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {

            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + StringUtils::asString( getIndex() ) + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'ComputeSatPCenter::Process()'
Example #9
0
      /* Returns a satTypeValueMap object, adding the new data
       * generated when calling this object.
       *
       * @param time      Epoch corresponding to the data.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& ComputeSimpleWeights::Process( const CommonTime& time,
                                                 satTypeValueMap& gData )
      throw(ProcessingException)
   {

      try
      {

            // If we are using a 5th order Taylor-based differencing filter, the
            // corresponding scale factor to convert from covariance matrix to
            // double-differenced covariance matrix is 1.509551839.
         double scaleFact( 1.509551839 );

            // Declare some important constants
         double tropoVar( 0.0004 );    // (0.02 m)^2
         double multiVar( 0.000025 );  // (0.005 m)^2

            // We need a NBTropModel initialized with dummy values
         NBTropModel tropoObj(0.0, 0.0, 1);

         SatIDSet satRejectedSet;


            // Loop through all the satellites
         for( satTypeValueMap::iterator it = gData.begin();
              it != gData.end();
              ++it )
         {

            double elevP( 0.0 );

            try
            {
               elevP = gData.getValue( (*it).first, TypeID::elevation );
            }
            catch(...)
            {

                  // If some value is missing, then schedule this satellite
                  // for removal
               satRejectedSet.insert( (*it).first );

               continue;

            }

               // If everything is OK, then compute the weight value and
               // put it into the GDS structure
            double mt( tropoObj.dry_mapping_function(elevP) );

            double weight( 1.0 / ( scaleFact*( mt*mt*tropoVar + multiVar ) ) );

            (*it).second[TypeID::weight] = weight;

         }

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'ComputeSimpleWeightsWeights::Process()'
Example #10
0
    // Returns a reference to a gnssSatTypeValue object after differencing the
    // data type values given in the diffTypes field with respect to reference
    // satellite data.
    //
    // @param gData     Data object holding the data.
    //
    satTypeValueMap& NablaOp::Process(satTypeValueMap& gData)
      throw(ProcessingException)
   {

      try
      {

         double maxElevation(0.0);


            // If configured to do so, let's look for reference satellite
         if (lookReferenceSat)
         {

               // Loop through all satellites in reference station data set,
               // looking for reference satellite
            satTypeValueMap::iterator it;
            for (it = gData.begin(); it != gData.end(); ++it)
            {

                  // The satellite with the highest elevation will usually be
                  // the reference satellite
               if ( gData((*it).first)(TypeID::elevation) > maxElevation )
               {

                  refSat = (*it).first;
                  maxElevation = gData((*it).first)(TypeID::elevation);

               }

            }

         }  // End of 'if (lookReferenceSat)'


            // We will use reference satellite data as reference data
         satTypeValueMap refData(gData.extractSatID(refSat));

            // We must remove reference satellite data from data set
         gData.removeSatID(refSat);


         SatIDSet satRejectedSet;


            // Loop through all the satellites in station data set
         satTypeValueMap::iterator it;
         for (it = gData.begin(); it != gData.end(); ++it)
         {

               // We must compute the difference for all types in
               // 'diffTypes' set
            TypeIDSet::const_iterator itType;
            for(itType = diffTypes.begin(); itType != diffTypes.end(); ++itType)
            {

               double value1(0.0);
               double value2(0.0);

               try
               {

                     // Let's try to compute the difference
                  value1 = gData((*it).first)(*itType);
                  value2 = refData(refSat)(*itType);

                     // Get difference into data structure
                  gData((*it).first)((*itType)) =  value1 - value2;

               }
               catch(...)
               {

                     // If some value is missing, then schedule this satellite
                     // for removal
                  satRejectedSet.insert( (*it).first );

                  continue;

               }

            }  // End of 'for(itType = diffTypes.begin(); ...'

         }  // End of 'for (it = gData.begin(); it != gData.end(); ++it)'


            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'NablaOp::Process()'
Example #11
0
      /* Returns a satTypeValueMap object, adding the new data generated
       *  when calling this object.
       *
       * @param epoch     Time of observations.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& EclipsedSatFilter::Process( const CommonTime& epoch,
                                                satTypeValueMap& gData )
      throw(ProcessingException)
   {

      try
      {

         SatIDSet satRejectedSet;

            // Set the threshold to declare that satellites are in eclipse
            // threshold = cos(180 - coneAngle/2)
         double threshold( std::cos(PI - coneAngle/2.0*DEG_TO_RAD) );

            // Compute Sun position at this epoch, and store it in a Triple
         SunPosition sunPosition;
         Triple sunPos(sunPosition.getPosition(epoch));

            // Define a Triple that will hold satellite position, in ECEF
         Triple svPos(0.0, 0.0, 0.0);

            // Loop through all the satellites
         satTypeValueMap::iterator it;
         for (it = gData.begin(); it != gData.end(); ++it) 
         {
               // Check if satellite position is not already computed
            if( ( (*it).second.find(TypeID::satX) == (*it).second.end() ) ||
                ( (*it).second.find(TypeID::satY) == (*it).second.end() ) ||
                ( (*it).second.find(TypeID::satZ) == (*it).second.end() ) )
            {

                  // If satellite position is missing, then schedule this 
                  // satellite for removal
               satRejectedSet.insert( (*it).first );
               continue;
            }
            else
            {
                  // Get satellite position out of GDS
               svPos[0] = (*it).second[TypeID::satX];
               svPos[1] = (*it).second[TypeID::satY];
               svPos[2] = (*it).second[TypeID::satZ];
            }

               // Unitary vector from Earth mass center to satellite
            Triple rk( svPos.unitVector() );

               // Unitary vector from Earth mass center to Sun
            Triple ri( sunPos.unitVector() );

               // Get dot product between unitary vectors = cosine(angle)
            double cosAngle(ri.dot(rk));

               // Check if satellite is within shadow
            if(cosAngle <= threshold)
            {
                  // If satellite is eclipsed, then schedule it for removal
               satRejectedSet.insert( (*it).first );

                  // Keep track of last known epoch the satellite was in eclipse
               shadowEpoch[(*it).first] = epoch;

               continue;
            }
            else
            {
                  // Maybe the satellite is out fo shadow, but it was recently
                  // in eclipse. Check also that.
               if( shadowEpoch.find( (*it).first ) != shadowEpoch.end() )
               {
                     // If satellite was recently in eclipse, check if elapsed
                     // time is less or equal than postShadowPeriod
                  if( std::abs( ( epoch - shadowEpoch[(*it).first] ) ) <=
                                postShadowPeriod )
                  {
                        // Satellite left shadow, but too recently. Delete it
                     satRejectedSet.insert( (*it).first );
                  }
                  else
                  {
                        // If satellite left shadow a long time ago, set it free
                     shadowEpoch.erase( (*it).first );
                  }
               }
            }

         }

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of 'EclipsedSatFilter::Process()'
Example #12
0
      // Prepare set of current unknowns and list of current equations
   VariableSet EquationSystem::prepareCurrentUnknownsAndEquations(
                                                         gnssDataMap& gdsMap )
   {

         // Let's clear the current equations list
      currentEquationsList.clear();

         // Let's create 'currentUnkSet' set
      VariableSet currentUnkSet;

         // Get "currentSatSet" and "currentSourceSet"
         // and stored in currentSourceSet and currentSatSet
      prepareCurrentSourceSat( gdsMap );


         // Visit each "Equation" in "equationDescriptionList"
      for( std::list<Equation>::const_iterator itEq =
                                                equationDescriptionList.begin();
           itEq != equationDescriptionList.end();
           ++itEq )
      {

            // First, get the SourceID set for this equation description
         SourceIDSet equSourceSet;

            // Check if current equation description is valid for all sources
         if ( (*itEq).getEquationSource() == Variable::allSources )
         {
            equSourceSet = currentSourceSet;
         }
         else
         {

               // Check if equation description is valid for some sources
            if ( (*itEq).getEquationSource() == Variable::someSources )
            {

                  // We have to find the intersection between equation
                  // description SourceID's and available SourceID's.
               SourceIDSet tempSourceSet( (*itEq).getSourceSet() );

                  // Declare an 'insert_iterator' to be used by
                  // 'set_intersection' algorithm (provided by STL)
               std::insert_iterator< SourceIDSet >
                                 itOut( equSourceSet, equSourceSet.begin() );

                  // Let's intersect both sets
               set_intersection( tempSourceSet.begin(), tempSourceSet.end(),
                              currentSourceSet.begin(), currentSourceSet.end(),
                              itOut );

            }
            else
            {
                  // In this case, we take directly the source into the
                  // equation source set
               equSourceSet.insert( (*itEq).getEquationSource() );
            }

         }  // End of 'if ( (*itEq).getEquationSource() == ...'
         
            // Second, get the SatID set for this equation description
         SatIDSet equSatSet = (*itEq).getSatSet();
         

            // We have the SourceID set that is applicable to this
            // equation description.

            // Now we must get the satellites visible from each
            // particular SourceID
         for( SourceIDSet::const_iterator itSource = equSourceSet.begin();
              itSource != equSourceSet.end();
              ++itSource )
         {

               // Get visible satellites from this SourceID
            SatIDSet visibleSatSet;

               // Iterate through all items in the gnssDataMap
            for( gnssDataMap::const_iterator it = gdsMap.begin();
                 it != gdsMap.end();
                 ++it )
            {

                  // Look for current SourceID
               sourceDataMap::const_iterator sdmIter(
                                             (*it).second.find( (*itSource) ) );

                  // If SourceID was found, then look for satellites
               if( sdmIter != (*it).second.end() )
               {

                     // Iterate through corresponding 'satTypeValueMap'
                  for( satTypeValueMap::const_iterator stvmIter =
                                                      (*sdmIter).second.begin();
                       stvmIter != (*sdmIter).second.end();
                       stvmIter++ )
                  {
                        // for some sat   
                     if((equSatSet.size() > 0)                           &&
                        (equSatSet.find((*stvmIter).first) == equSatSet.end()))
                     {
                        continue;
                     }

                        // Add current SatID to 'visibleSatSet'
                     visibleSatSet.insert( (*stvmIter).first );

                  }  // End of 'for( satTypeValueMap::const_iterator ...'

               }  // End of 'for( sourceDataMap::const_iterator sdmIter = ...'

            }  // End of 'for( gnssDataMap::const_iterator it = ...'

               // We have the satellites visible from this SourceID

               
               // We need a copy of current Equation object description
            Equation tempEquation( (*itEq) );

               // Remove all variables from current equation
            tempEquation.clear();

               // Update equation independent term with SourceID information
            tempEquation.header.equationSource = (*itSource);

               // Now, let's visit all Variables in this equation description
            for( VariableSet::const_iterator itVar = (*itEq).body.begin();
                 itVar != (*itEq).body.end();
                 ++itVar )
            {

                  // We will work with a copy of current Variable
               Variable var( (*itVar) );

                  // Check what type of variable we are working on

                  // If variable is source-indexed, set SourceID
               if( var.getSourceIndexed() )
               {
                  var.setSource( (*itSource) );
               }

                  // Add this variable to current equation description. Please
                  // be aware that satellite-indexed variables inside current
                  // equations will be handled later
               tempEquation.addVariable(var);

                  // If variable is not satellite-indexed, we just need to
                  // add it to "currentUnkSet
               if( !var.getSatIndexed() )
               {
                     // Insert the result in "currentUnkSet" and
                     // current equation
                  currentUnkSet.insert(var);
                  //tempEquation.addVariable(var);
               }
               else
               {
                     // If variable IS satellite-indexed, we have to visit all
                     // visible satellites (from current SourceID) and set the
                     // satellite before adding variable to "currentUnkSet
                  for( SatIDSet::const_iterator itSat = visibleSatSet.begin();
                       itSat != visibleSatSet.end();
                       ++itSat )
                  {

                        // Set satellite
                     var.setSatellite( (*itSat) );

                        // Insert the result in "currentUnkSet" and
                        // current equation
                     currentUnkSet.insert(var);
                  }

               }  // End of 'if( !var.getSatIndexed() )...'

            }  // End of 'for( VariableSet::const_iterator itVar = ...'


               // Let's generate the current equations starting from this
               // equation description. Therefore, we update equation
               // independent term with SatID information and add each instance
               // to 'currentEquationsList'.
            for( SatIDSet::const_iterator itSat = visibleSatSet.begin();
                 itSat != visibleSatSet.end();
                 ++itSat )
            {
               tempEquation.header.equationSat = (*itSat);

                  // New equation is complete: Add it to 'currentEquationsList'
               currentEquationsList.push_back( tempEquation );
            }

         }  // End of 'for( SourceIDSet::const_iterator itSource = ...'

      }  // End of 'for( std::list<Equation>::const_iterator itEq = ...'


         // Now we will take care of satellite-indexed variables inside each
         // specific "Equation" in "currentEquationsList"
      const size_t eqListSize( currentEquationsList.size() );
      for( size_t i = 0; i < eqListSize; ++i )
      {

            // Get a copy of first equation on 'currentEquationsList'
         Equation tempEqu( currentEquationsList.front() );

            // Remove the original equation at the beginning of the list.
         currentEquationsList.pop_front();

            // Get a copy of variables inside this equation
         VariableSet varSet( tempEqu.body );

            // Clear the variables from this equation
         tempEqu.clear();

            // Visit each variable inside 'varSet', check if it is
            // satellite-indexed, and add it to equation
         for( VariableSet::iterator itVar = varSet.begin();
              itVar != varSet.end();
              ++itVar )
         {

               // Check if it is satellite-indexed
            if( !(*itVar).getSatIndexed() )
            {
                  // If not satellite-indexed, just add it back
               tempEqu.addVariable( (*itVar) );
            }
            else
            {
               // If 'itVar' is satellite-indexed, let's index a copy of it
               // and add it to equation
               Variable var( (*itVar) );
               var.setSatellite( tempEqu.header.equationSat );

               tempEqu.addVariable( var );
            }

         }  // End of 'for( VariableSet::iterator itVar = varSet.begin(); ...'

            // Our equation is ready, let's add it to the end of the list
         currentEquationsList.push_back( tempEqu );

      }  // End of 'for( int i = 0; i < eqListSize; ++i ) ...'


         // Return set of current unknowns
      return currentUnkSet;

   }  // End of method 'EquationSystem::prepareCurrentUnknownsAndEquations()'
Example #13
0
      /* Returns a satTypeValueMap object, adding the new data generated
       *  when calling this object.
       *
       * @param epoch     Time of observations.
       * @param gData     Data object holding the data.
       * @param epochflag Epoch flag.
       */
   satTypeValueMap& LICSDetector::Process( const CommonTime& epoch,
                                           satTypeValueMap& gData,
                                           const short& epochflag )
      throw(ProcessingException)
   {

      try
      {

         double value1(0.0);
         double lli1(0.0);
         double lli2(0.0);

         SatIDSet satRejectedSet;

            // Loop through all the satellites
         satTypeValueMap::iterator it;
         for (it = gData.begin(); it != gData.end(); ++it)
         {
            try
            {
                  // Try to extract the values
               value1 = (*it).second(obsType);
            }
            catch(...)
            {
                  // If some value is missing, then schedule this satellite
                  // for removal
               satRejectedSet.insert( (*it).first );
               continue;
            }

            if (useLLI)
            {
               try
               {
                     // Try to get the LLI1 index
                  lli1  = (*it).second(lliType1);
               }
               catch(...)
               {
                     // If LLI #1 is not found, set it to zero
                     // You REALLY want to have BOTH LLI indexes properly set
                  lli1 = 0.0;
               }

               try
               {
                     // Try to get the LLI2 index
                  lli2  = (*it).second(lliType2);
               }
               catch(...)
               {
                     // If LLI #2 is not found, set it to zero
                     // You REALLY want to have BOTH LLI indexes properly set
                  lli2 = 0.0;
               }
            }

               // If everything is OK, then get the new values inside the
               // structure. This way of computing it allows concatenation of
               // several different cycle slip detectors
            (*it).second[resultType1] += getDetection( epoch,
                                                       (*it).first,
                                                       (*it).second,
                                                       epochflag,
                                                       value1,
                                                       lli1,
                                                       lli2 );

            if ( (*it).second[resultType1] > 1.0 )
            {
               (*it).second[resultType1] = 1.0;
            }

               // We will mark both cycle slip flags
            (*it).second[resultType2] = (*it).second[resultType1];

         }

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'LICSDetector::Process()'
Example #14
0
      /* Returns a satTypeValueMap object, adding the new data generated
       * when calling this object.
       *
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& CodeSmoother::Process(satTypeValueMap& gData)
      throw(ProcessingException)
   {

      try
      {

         double codeObs(0.0);
         double phaseObs(0.0);
         double flagObs(0.0);

         SatIDSet satRejectedSet;

            // Loop through all satellites
         satTypeValueMap::iterator it;
         for (it = gData.begin(); it != gData.end(); ++it)
         {

            try
            {

                  // Try to extract the values
               codeObs  = (*it).second(codeType);
               phaseObs = (*it).second(phaseType);
               flagObs  = (*it).second(csFlag);

            }
            catch(...)
            {

                  // If some value is missing, then schedule this satellite
                  // for removal
               satRejectedSet.insert( (*it).first );

               continue;

            }

               // If everything is OK, then call smoothing function
            (*it).second[resultType] = getSmoothing( (*it).first,
                                                     codeObs,
                                                     phaseObs,
                                                     flagObs );
         }

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + StringUtils::asString( getIndex() ) + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'CodeSmoother::Process()'
Example #15
0
      /* Returns a satTypeValueMap object, adding the new data generated
       *  when calling this object.
       *
       * @param epoch     Time of observations.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& PhaseCodeAlignment::Process( const CommonTime& epoch,
                                           satTypeValueMap& gData )
      throw(ProcessingException)
   {

      try
      {

         SatIDSet satRejectedSet;

            // Loop through all the satellites
         for( satTypeValueMap::iterator it = gData.begin();
              it != gData.end();
              ++it )
         {

               // Check if satellite currently has entries
            std::map<SatID, alignData>::const_iterator itDat(
                                                svData.find( (*it).first ) );
            if( itDat == svData.end() )
            {

                  // If it doesn't have an entry, insert one
               alignData aData;

               svData[ (*it).first ] = aData;

            }


               // Place to store if there was a cycle slip. False by default
            bool csflag(false);


               // Check if we want to use satellite arcs of cycle slip flags
            if(useSatArcs)
            {

               double arcN(0.0);

               try
               {

                     // Try to extract the satellite arc value
                  arcN = (*it).second(TypeID::satArc);

               }
               catch(...)
               {

                     // If satellite arc is missing, then schedule this
                     // satellite for removal
                  satRejectedSet.insert( (*it).first );

                  continue;

               }


                  // Check if satellite arc has changed
               if( svData[(*it).first].arcNumber != arcN )
               {

                     // Set flag
                  csflag = true;

                     // Update satellite arc information
                  svData[(*it).first].arcNumber = arcN;
               }

            }  // End of first part of 'if(useSatArcs)'
            else
            {

               double flag(0.0);

               try
               {

                     // Try to extract the CS flag value
                  flag = (*it).second(watchCSFlag);

               }
               catch(...)
               {

                     // If flag is missing, then schedule this satellite
                     // for removal
                  satRejectedSet.insert( (*it).first );

                  continue;

               }

                  // Check if there was a cycle slip
               if( flag > 0.0)
               {
                     // Set flag
                  csflag = true;
               }

            }  // End of second part of 'if(useSatArcs)...'


               // If there was an arc change or cycle slip, let's
               // compute the new offset
            if(csflag)
            {

                  // Compute difference between code and phase measurements
               double diff( (*it).second(codeType) - (*it).second(phaseType) );

                  // Convert 'diff' to cycles
               diff = diff/phaseWavelength;

                  // Convert 'diff' to an INTEGER number of cycles
               diff = std::floor(diff);

                  // The new offset is the INTEGER number of cycles, in meters
               svData[(*it).first].offset = diff * phaseWavelength;

            }

               // Let's align the phase measurement using the
               // corresponding offset
            (*it).second[phaseType] = (*it).second[phaseType]
                                      + svData[(*it).first].offset;

         }

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of 'PhaseCodeAlignment::Process()'
Example #16
0
      /** Returns a satTypeValueMap object, adding the new data generated when
       * calling a modeling object.
       *
       * @param time      Epoch.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& IonexModel::Process( const DayTime& time,
                                         satTypeValueMap& gData )
      throw(Exception)
   {

      SatIDSet satRejectedSet;

      try
      {

            // Loop through all the satellites
         satTypeValueMap::iterator stv;
         for(stv = gData.begin(); stv != gData.end(); ++stv)
         {

               // First check if ionex maps were set
            if(pDefaultMaps==NULL)
            {

                  // If ionex maps are missing, then remove all satellites
               satRejectedSet.insert( stv->first );

               continue;

            }

               // If elevation or azimuth is missing, then remove satellite
            if( stv->second.find(TypeID::elevation) == stv->second.end() ||
                stv->second.find(TypeID::azimuth)   == stv->second.end() )
            {

               satRejectedSet.insert( stv->first );

               continue;

            }
            else
            {

                  // Scalars to hold satellite elevation, azimuth, ionospheric 
                  // map and ionospheric slant delays
               double elevation( stv->second(TypeID::elevation) );
               double azimuth(   stv->second(TypeID::azimuth)   );
               double ionoMap(0.0);
               double ionexL1(0.0), ionexL2(0.0), ionexL5(0.0);   // GPS
               double ionexL6(0.0), ionexL7(0.0), ionexL8(0.0);   // Galileo

                  //	calculate the position of the ionospheric pierce-point 
                  // corresponding to the receiver-satellite ray
               Position IPP = rxPos.getIonosphericPiercePoint( elevation,
                                                               azimuth,
                                                               ionoHeight);

                  // TODO
                  // Checking the collinearity of rxPos, IPP and SV


                  // Let's get TEC, RMS and ionosphere height for IPP 
                  // at current epoch
               Position pos(IPP);
               pos.transformTo(Position::Geocentric);
               Triple val = pDefaultMaps->getIonexValue( time, pos );

                  // just to make it handy for useage
               double tecval = val[0];

               try
               {

                  ionoMap = pDefaultMaps->iono_mapping_function( elevation,
                                                                 ionoMapType);

                     // Compute ionospheric slant correction
                  ionexL1 = pDefaultMaps->getIonoL1( elevation,
                                                     tecval,
                                                     ionoMapType);

                  ionexL2 = pDefaultMaps->getIonoL2( elevation,
                                                     tecval,
                                                     ionoMapType);

                  ionexL5 = pDefaultMaps->getIonoL5( elevation,
                                                     tecval,
                                                     ionoMapType);

                  ionexL6 = pDefaultMaps->getIonoL6( elevation,
                                                     tecval,
                                                     ionoMapType);

                  ionexL7 = pDefaultMaps->getIonoL7( elevation,
                                                     tecval,
                                                     ionoMapType);

                  ionexL8 = pDefaultMaps->getIonoL8( elevation,
                                                     tecval,
                                                     ionoMapType);

               }
               catch(InvalidRequest)
               {

                     // If some problem appears, then schedule this
                     // satellite for removal
                  satRejectedSet.insert( stv->first );

                  continue;    // Skip this SV if problems arise

               }

                  // Now we have to add the new values (i.e., ionosphere delays)
                  // to the data structure
               (*stv).second[TypeID::ionoTEC] = tecval;
               (*stv).second[TypeID::ionoMap] = ionoMap;
               (*stv).second[TypeID::ionoL1]  = ionexL1;
               (*stv).second[TypeID::ionoL2]  = ionexL2;
               (*stv).second[TypeID::ionoL5]  = ionexL5;
               (*stv).second[TypeID::ionoL6]  = ionexL6;
               (*stv).second[TypeID::ionoL7]  = ionexL7;
               (*stv).second[TypeID::ionoL8]  = ionexL8;


                  // DCB corrections for P1 measurements and satellite clock
                  // values should be considered because precise ephemerides
                  // and satellite clock information for SP3 orbit file always
                  // refers to the ionosphere-free linear combination (LC)
                  // see Appendix B, pg.14 of the Ionex manual
                  // Useful link:

      // http://www.ngs.noaa.gov/IGSWorkshop2008/docs/Schaer_DCB_IGSWS2008.ppt

                  // Computing Differential Code Biases (DCB - nanoseconds)
               double tempDCB( getDCBCorrections( time,
                                                 (*pDefaultMaps),
                                                  stv->first) );


                  // add to the GDS the  corresponding correction, 
                  // if appropriate
               if(useDCB)
               {

                     // the second LC factor (see gpstk::LinearCombinations.cpp)
                     // see pg.14, Ionex manual
                  double kappa2(-1.0/0.646944444);
                  double dcb(tempDCB * C_GPS_M * 1e-9);  // meters

                  if( stv->second.find(TypeID::instC1) == stv->second.end() )
                  {
                     stv->second[TypeID::instC1] = (kappa2 * dcb);
                  }
                  else
                  {
                     stv->second[TypeID::instC1] += (kappa2 * dcb);
                  }

               }  // End of 'if(useDCB)...'

            }  // End of 'if( stv->second.find(TypeID::elevation) == ... '

         }  // End of loop 'for(stv = gData.begin()...'


            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }   // End of try...
      catch(Exception& e)
      {

         GPSTK_RETHROW(e);

      }

   }  // End of method 'IonexModel::Process()'
Example #17
0
      /* Returns a satTypeValueMap object, adding the new data generated
       *  when calling this object.
       *
       * @param epoch     Time of observations.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& SatArcMarker::Process( const CommonTime& epoch,
                                           satTypeValueMap& gData )
      throw(ProcessingException)
   {

      try
      {

         double flag(0.0);

         SatIDSet satRejectedSet;

            // Loop through all the satellites
         for ( satTypeValueMap::iterator it = gData.begin();
               it != gData.end();
               ++it )
         {
            try
            {
                  // Try to extract the CS flag value
               flag = (*it).second(watchCSFlag);
            }
            catch(...)
            {
                  // If flag is missing, then schedule this satellite
                  // for removal
               satRejectedSet.insert( (*it).first );
               continue;
            }

               // Check if satellite currently has entries
            std::map<SatID, double>::const_iterator itArc(
                                                satArcMap.find( (*it).first ) );
            if( itArc == satArcMap.end() )
            {
                  // If it doesn't have an entry, insert one
               satArcMap[ (*it).first ] = 0.0;
               satArcChangeMap[ (*it).first ] = CommonTime::BEGINNING_OF_TIME;

                  // This is a new satellite
               satIsNewMap[ (*it).first ] = true;
            }

               // Check if we are inside unstable period
            bool insideUnstable(std::abs(epoch-satArcChangeMap[(*it).first]) <=
                                                               unstablePeriod );

               // Satellites can be new only once, and having at least once a
               // flag > 0.0 outside 'unstablePeriod' will make them old.
            if( satIsNewMap[ (*it).first ] &&
                !insideUnstable            &&
                flag <= 0.0 )
            {
               satIsNewMap[ (*it).first ] = false;
            }


               // Check if there was a cycle slip
            if ( flag > 0.0 )
            {
                  // Increment the value of "TypeID::satArc"
               satArcMap[ (*it).first ] = satArcMap[ (*it).first ] + 1.0;

                  // Update arc change epoch
               satArcChangeMap[ (*it).first ] = epoch;

                  // If we want to delete unstable satellites, we must do it
                  // also when arc changes, but only if this SV is not new
               if ( deleteUnstableSats  &&
                    (!satIsNewMap[ (*it).first ]) )
               {
                  satRejectedSet.insert( (*it).first );
               }

            }


               // Test if we want to delete unstable satellites. Only do it
               // if satellite is NOT new and we are inside unstable period
            if ( insideUnstable &&
                 deleteUnstableSats &&
                 ( !satIsNewMap[ (*it).first ] ) )
            {
               satRejectedSet.insert( (*it).first );
            }

               // We will insert satellite arc number
            (*it).second[TypeID::satArc] = satArcMap[ (*it).first ];

         }

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'SatArcMarker::Process()'
Example #18
0
      /* Returns a satTypeValueMap object, adding the new data generated when
       * calling a modeling object.
       *
       * @param time      Epoch.
       * @param gData     Data object holding the data.
       */
   satTypeValueMap& BasicModel::Process( const DayTime& time,
                                         satTypeValueMap& gData )
      throw(ProcessingException)
   {

      try
      {

         SatIDSet satRejectedSet;

            // Loop through all the satellites
         satTypeValueMap::iterator stv;
         for( stv = gData.begin();
              stv != gData.end();
              ++stv )
         {
               // Scalar to hold temporal value
            double observable( (*stv).second(defaultObservable) );

               // A lot of the work is done by a CorrectedEphemerisRange object
            CorrectedEphemerisRange cerange;

            try
            {
                  // Compute most of the parameters
               cerange.ComputeAtTransmitTime( time,
                                              observable,
                                              rxPos,
                                              (*stv).first,
                                              *(getDefaultEphemeris()) );
            }
            catch(InvalidRequest& e)
            {

                  // If some problem appears, then schedule this satellite
                  // for removal
               satRejectedSet.insert( (*stv).first );

               continue;    // Skip this SV if problems arise

            }

               // Let's test if satellite has enough elevation over horizon
            if ( rxPos.elevationGeodetic(cerange.svPosVel) < minElev )
            {

                  // Mark this satellite if it doesn't have enough elevation
               satRejectedSet.insert( (*stv).first );

               continue;

            }

               // Computing Total Group Delay (TGD - meters), if possible
            double tempTGD(getTGDCorrections( time,
                                              (*pDefaultEphemeris),
                                              (*stv).first ) );

               // Now we have to add the new values to the data structure
            (*stv).second[TypeID::dtSat] = cerange.svclkbias;

               // Now, lets insert the geometry matrix
            (*stv).second[TypeID::dx] = cerange.cosines[0];
            (*stv).second[TypeID::dy] = cerange.cosines[1];
            (*stv).second[TypeID::dz] = cerange.cosines[2];
               // When using pseudorange method, this is 1.0
            (*stv).second[TypeID::cdt] = 1.0;

               // Now we have to add the new values to the data structure
            (*stv).second[TypeID::rho] = cerange.rawrange;
            (*stv).second[TypeID::rel] = -cerange.relativity;
            (*stv).second[TypeID::elevation] = cerange.elevationGeodetic;
            (*stv).second[TypeID::azimuth] = cerange.azimuthGeodetic;

               // Let's insert satellite position at transmission time
            (*stv).second[TypeID::satX] = cerange.svPosVel.x[0];
            (*stv).second[TypeID::satY] = cerange.svPosVel.x[1];
            (*stv).second[TypeID::satZ] = cerange.svPosVel.x[2];

               // Let's insert satellite velocity at transmission time
            (*stv).second[TypeID::satVX] = cerange.svPosVel.v[0];
            (*stv).second[TypeID::satVY] = cerange.svPosVel.v[1];
            (*stv).second[TypeID::satVZ] = cerange.svPosVel.v[2];

               // Apply correction to C1 observable, if appropriate
            if(useTGD)
            {
                  // Look for C1
               if( (*stv).second.find(TypeID::C1) != (*stv).second.end() )
               {
                  (*stv).second[TypeID::C1] =
                                       (*stv).second[TypeID::C1] - tempTGD;
               };
            };

            (*stv).second[TypeID::instC1] = tempTGD;

         } // End of loop for(stv = gData.begin()...

            // Remove satellites with missing data
         gData.removeSatID(satRejectedSet);

         return gData;

      }   // End of try...
      catch(Exception& u)
      {
            // Throw an exception if something unexpected happens
         ProcessingException e( getClassName() + ":"
                                + StringUtils::asString( getIndex() ) + ":"
                                + u.what() );

         GPSTK_THROW(e);

      }

   }  // End of method 'BasicModel::Process()'