Exemplo n.º 1
0
   // Method to print solution values
void example9::printSolution( ofstream& outfile,
                              const SolverLMS& solver,
                              const DayTime& time,
                              const ComputeDOP& cDOP,
                              bool  useNEU,
                              int   numSats,
                              double dryTropo,
                              int   precision )
{

      // Prepare for printing
   outfile << fixed << setprecision( precision );


      // Print results
   outfile << time.year()        << "  ";    // Year           - #1
   outfile << time.DOY()         << "  ";    // DayOfYear      - #2
   outfile << time.DOYsecond()   << "  ";    // SecondsOfDay   - #3

   if( useNEU )
   {

      outfile << solver.getSolution(TypeID::dLat) << "  ";       // dLat  - #4
      outfile << solver.getSolution(TypeID::dLon) << "  ";       // dLon  - #5
      outfile << solver.getSolution(TypeID::dH) << "  ";         // dH    - #6
         // We add 0.1 meters to 'wetMap' because 'NeillTropModel' sets a
         // nominal value of 0.1 m. Also to get the total we have to add the
         // dry tropospheric delay value
                                                                 // ztd - #7
      outfile << solver.getSolution(TypeID::wetMap) + 0.1 + dryTropo << "  ";

      outfile << solver.getVariance(TypeID::dLat) << "  ";   // Cov dLat  - #8
      outfile << solver.getVariance(TypeID::dLon) << "  ";   // Cov dLon  - #9
      outfile << solver.getVariance(TypeID::dH) << "  ";     // Cov dH    - #10
      outfile << solver.getVariance(TypeID::wetMap) << "  "; // Cov ztd   - #11

   }
   else
   {

      outfile << solver.getSolution(TypeID::dx) << "  ";         // dx    - #4
      outfile << solver.getSolution(TypeID::dy) << "  ";         // dy    - #5
      outfile << solver.getSolution(TypeID::dz) << "  ";         // dz    - #6
         // We add 0.1 meters to 'wetMap' because 'NeillTropModel' sets a
         // nominal value of 0.1 m. Also to get the total we have to add the
         // dry tropospheric delay value
                                                                 // ztd - #7
      outfile << solver.getSolution(TypeID::wetMap) + 0.1 + dryTropo << "  ";

      outfile << solver.getVariance(TypeID::dx) << "  ";     // Cov dx    - #8
      outfile << solver.getVariance(TypeID::dy) << "  ";     // Cov dy    - #9
      outfile << solver.getVariance(TypeID::dz) << "  ";     // Cov dz    - #10
      outfile << solver.getVariance(TypeID::wetMap) << "  "; // Cov ztd   - #11

   }

   outfile << numSats << "  ";    // Number of satellites - #12

   outfile << cDOP.getGDOP()        << "  ";  // GDOP - #13
   outfile << cDOP.getPDOP()        << "  ";  // PDOP - #14
   outfile << cDOP.getTDOP()        << "  ";  // TDOP - #15
   outfile << cDOP.getHDOP()        << "  ";  // HDOP - #16
   outfile << cDOP.getVDOP()        << "  ";  // VDOP - #17

      // Add end-of-line
   outfile << endl;


   return;


}  // End of method 'example9::printSolution()'
Exemplo n.º 2
0
double IonoModel::getCorrection(const DayTime& time,
                                const Geodetic& rxgeo,
                                double svel,
                                double svaz,
                                Frequency freq) const
throw(IonoModel::InvalidIonoModel)
{

    if (!valid)
    {
        InvalidIonoModel e("Alpha and beta parameters invalid.");
        GPSTK_THROW(e);
    }

    // all angle units are in semi-circles (radians / TWO_PI)
    // Note: math functions (cos, sin, etc.) require arguments in
    // radians so all semi-circles must be multiplied by TWO_PI

    double azRad = svaz * DEG_TO_RAD;
    double svE = svel / 180.0;

    double phi_u = rxgeo.getLatitude() / 180.0;
    double lambda_u = rxgeo.getLongitude() / 180.0;

    double psi = (0.0137 / (svE + 0.11)) - 0.022;

    double phi_i = phi_u + psi * cos(azRad);
    if (phi_i > 0.416)
        phi_i = 0.416;
    if (phi_i < -0.416)
        phi_i = -0.416;

    double lambda_i = lambda_u + psi * sin(azRad) / cos(phi_i*PI);

    double phi_m = phi_i + 0.064 * cos((lambda_i - 1.617)*PI);

    double iAMP = 0.0;
    double iPER = 0.0;
    iAMP = alpha[0]+phi_m*(alpha[1]+phi_m*(alpha[2]+phi_m*alpha[3]));
    iPER =  beta[0]+phi_m*( beta[1]+phi_m*( beta[2]+phi_m* beta[3]));

    if (iAMP < 0.0)
        iAMP = 0.0;
    if (iPER < 72000.0)
        iPER = 72000.0;

    double t = 43200.0 * lambda_i + time.DOYsecond();
    if (t >= 86400.0)
        t -= 86400.0;
    if (t < 0)
        t += 86400.0;

    double x = TWO_PI * (t - 50400.0) / iPER; // x is in radians

    double iF = 1.0 + 16.0 * (0.53 - svE)*(0.53 - svE)*(0.53 - svE);

    double t_iono = 0.0;
    if (fabs(x) < 1.57)
        t_iono = iF * (5.0e-9 + iAMP * (1 + x*x * (-0.5 + x*x/24.0)));
    else
        t_iono = iF * 5.0e-9;

    if (freq == L2)
    {
        // see ICD-GPS-200 20.3.3.3.3.2
        t_iono *= GAMMA_GPS;  //  GAMMA_GPS = (fL1 / fL2)^2
    }

    double correction = t_iono * C_GPS_M;

    return correction;
}