Exemplo n.º 1
0
        public GpsConstellation()
        {
            // URL template from where the GPS ephemerides should be downloaded
            string IGN_NAVIGATION_HOURLY_ZIM2  = "ftp://igs.ensg.ign.fr/pub/igs/data/hourly/${yyyy}/${ddd}/zim2${ddd}${h}.${yy}n.Z";
            string NASA_NAVIGATION_HOURLY      = "ftp://cddis.gsfc.nasa.gov/pub/gps/data/hourly/${yyyy}/${ddd}/hour${ddd}0.${yy}n.Z";
            string GARNER_NAVIGATION_AUTO_HTTP = "http://garner.ucsd.edu/pub/rinex/${yyyy}/${ddd}/auto${ddd}0.${yy}n.Z";
            string BKG_HOURLY_SUPER_SEVER      = "ftp://igs.bkg.bund.de/IGS/BRDC/${yyyy}/${ddd}/brdc${ddd}0.${yy}n.Z";

            // Declare a RinexNavigation type object
            if (rinexNavGps == null)
            {
                var rn = new RinexNavigationGps(BKG_HOURLY_SUPER_SEVER);
                rinexNavGps = rn;
            }
        }
Exemplo n.º 2
0
        public override void calculateCorrection(Time currentTime, Coordinates <Matrix> approximatedPose, SatellitePosition satelliteCoordinates, NavigationProducer navigationProducer, Location initialLocation)
        {
            DateTime foo      = DateTime.Now;
            long     unixTime = ((DateTimeOffset)foo).ToUnixTimeSeconds();
            IonoGps  iono     = navigationProducer.getIono(unixTime, initialLocation);

            if (iono.getBeta(0) == 0)
            {
                correctionValue = 0.0;
            }
            else
            {
                // Compute the elevation and azimuth angles for each satellite
                TopocentricCoordinates <Matrix> topo = new TopocentricCoordinates <Matrix>();
                topo.computeTopocentric(approximatedPose, satelliteCoordinates);

                // Assign the elevation and azimuth information to new variables
                double elevation = topo.getElevation();
                double azimuth   = topo.getAzimuth();

                double ionoCorr = 0;

                if (iono == null)
                {
                    return;
                }
                //		    double a0 = navigation.getIono(currentTime.getMsec(),0);
                //		    double a1 = navigation.getIono(currentTime.getMsec(),1);
                //		    double a2 = navigation.getIono(currentTime.getMsec(),2);
                //		    double a3 = navigation.getIono(currentTime.getMsec(),3);
                //		    double b0 = navigation.getIono(currentTime.getMsec(),4);
                //		    double b1 = navigation.getIono(currentTime.getMsec(),5);
                //		    double b2 = navigation.getIono(currentTime.getMsec(),6);
                //		    double b3 = navigation.getIono(currentTime.getMsec(),7);

                elevation = Math.Abs(elevation);

                // Parameter conversion to semicircles
                double lon = approximatedPose.getGeodeticLongitude() / 180; // geod.get(0)
                double lat = approximatedPose.getGeodeticLatitude() / 180;  //geod.get(1)
                azimuth   = azimuth / 180;
                elevation = elevation / 180;

                // Klobuchar algorithm

                // Compute the slant factor
                double f = 1 + 16 * Math.Pow((0.53 - elevation), 3);

                // Compute the earth-centred angle
                double psi = 0.0137 / (elevation + 0.11) - 0.022;

                // Compute the latitude of the Ionospheric Pierce Point (IPP)
                double phi = lat + psi * Math.Cos(azimuth * Math.PI);

                if (phi > 0.416)
                {
                    phi = 0.416;
                }
                if (phi < -0.416)
                {
                    phi = -0.416;
                }

                // Compute the longitude of the IPP
                double lambda = lon + (psi * Math.Sin(azimuth * Math.PI))
                                / Math.Cos(phi * Math.PI);

                // Find the geomagnetic latitude of the IPP
                double ro = phi + 0.064 * Math.Cos((lambda - 1.617) * Math.PI);

                // Find the local time at the IPP
                double t = lambda * 43200 + unixTime;

                while (t >= 86400)
                {
                    t = t - 86400;
                }

                while (t < 0)
                {
                    t = t + 86400;
                }

                // Compute the period of ionospheric delay
                double p = iono.getBeta(0) + iono.getBeta(1) * ro + iono.getBeta(2) * Math.Pow(ro, 2) + iono.getBeta(3) * Math.Pow(ro, 3);

                if (p < 72000)
                {
                    p = 72000;
                }

                // Compute the amplitude of ionospheric delay
                double a = iono.getAlpha(0) + iono.getAlpha(1) * ro + iono.getAlpha(2) * Math.Pow(ro, 2) + iono.getAlpha(3) * Math.Pow(ro, 3);

                if (a < 0)
                {
                    a = 0;
                }

                // Compute the phase of ionospheric delay
                double x = (2 * Math.PI * (t - 50400)) / p;

                // Compute the ionospheric correction
                if (Math.Abs(x) < 1.57)
                {
                    ionoCorr = Constants.SPEED_OF_LIGHT
                               * f
                               * (5e-9 + a
                                  * (1 - (Math.Pow(x, 2)) / 2 + (Math.Pow(x, 4)) / 24));
                }
                else
                {
                    ionoCorr = Constants.SPEED_OF_LIGHT * f * 5e-9;
                }

                correctionValue = ionoCorr;
            }
        }
Exemplo n.º 3
0
        public override void calculateCorrection(Time currentTime, Coordinates <Matrix> approximatedPose, SatellitePosition satelliteCoordinates, NavigationProducer navigationProducer, Location initialLocation)
        {
            // Compute the difference vector between the receiver and the satellite
            SimpleMatrix <Matrix> diff = approximatedPose.minusXYZ(satelliteCoordinates);

            // Compute the geometric distance between the receiver and the satellite

            double geomDist = Math.Sqrt(Math.Pow(diff.get(0), 2) + Math.Pow(diff.get(1), 2) + Math.Pow(diff.get(2), 2));

            // Compute the geocentric distance of the receiver
            double geoDistRx = Math.Sqrt(Math.Pow(approximatedPose.getX(), 2) + Math.Pow(approximatedPose.getY(), 2) + Math.Pow(approximatedPose.getZ(), 2));

            // Compute the geocentric distance of the satellite
            double geoDistSv = Math.Sqrt(Math.Pow(satelliteCoordinates.getX(), 2) + Math.Pow(satelliteCoordinates.getY(), 2) + Math.Pow(satelliteCoordinates.getZ(), 2));


            // Compute the shapiro correction
            correctionValue = ((2.0 * Constants.EARTH_GRAVITATIONAL_CONSTANT) / Math.Pow(Constants.SPEED_OF_LIGHT, 2)) * Math.Log((geoDistSv + geoDistRx + geomDist) / (geoDistSv + geoDistRx - geomDist));
        }
Exemplo n.º 4
0
        public override void calculateCorrection(Time currentTime, Coordinates <Matrix> approximatedPose, SatellitePosition satelliteCoordinates, NavigationProducer navigationProducer, Location initialLocation)
        {
            // Compute also the geodetic version of the user position (latitude, longitude, height)
            approximatedPose.computeGeodetic();

            // Get the user's height
            double height = approximatedPose.getGeodeticHeight();

            // Compute the elevation and azimuth angles for each satellite
            TopocentricCoordinates <Matrix> topo = new TopocentricCoordinates <Matrix>();

            topo.computeTopocentric(approximatedPose, satelliteCoordinates);

            // Assign the elevation information to a new variable
            double elevation = topo.getElevation();

            double tropoCorr = 0;

            if (height > 5000)
            {
                return;
            }

            elevation = Math.Abs(elevation) / 180.0 * Math.PI;
            if (elevation == 0)
            {
                elevation = elevation + 0.01;
            }

            // Numerical constants and tables for Saastamoinen algorithm
            // (troposphere correction)
            double hr = 50.0;

            int[]    ha = { 0, 500, 1000, 1500, 2000, 2500, 3000, 4000, 5000 };
            double[] ba = { 1.156, 1.079, 1.006, 0.938, 0.874, 0.813, 0.757, 0.654, 0.563 };

            // Saastamoinen algorithm
            double P = Constants.STANDARD_PRESSURE * Math.Pow((1 - 0.0000226 * height), 5.225);
            double T = Constants.STANDARD_TEMPERATURE - 0.0065 * height;
            double H = hr * Math.Exp(-0.0006396 * height);

            // If height is below zero, keep the maximum correction value
            double B = ba[0];

            // Otherwise, interpolate the tables
            if (height >= 0)
            {
                int i = 1;
                while (height > ha[i])
                {
                    i++;
                }
                double m = (ba[i] - ba[i - 1]) / (ha[i] - ha[i - 1]);
                B = ba[i - 1] + m * (height - ha[i - 1]);
            }

            double e = 0.01
                       * H
                       * Math.Exp(-37.2465 + 0.213166 * T - 0.000256908
                                  * Math.Pow(T, 2));

            tropoCorr = ((0.002277 / Math.Sin(elevation))
                         * (P - (B / Math.Pow(Math.Tan(elevation), 2))) + (0.002277 / Math.Sin(elevation))
                         * (1255 / T + 0.05) * e);

            correctionValue = tropoCorr;
        }
 /**
  * Calculates current correction for given parameters
  * @param currentTime current timestamp
  * @param approximatedPose approximate pose of the receiver
  * @param satelliteCoordinates satellite coordinates
  * @param navigationProducer Klobuchar coefficients from the naivgation message (ephemeris)
  * @return calculated correction to be applied to the pseudorange
  */
 public abstract void calculateCorrection(
     Time currentTime,
     Coordinates <Matrix> approximatedPose,
     SatellitePosition satelliteCoordinates,
     NavigationProducer navigationProducer,
     Location initialLocation);