Пример #1
0
        /* (non-Javadoc)
         * @see org.gogpsproject.Streamable#write(java.io.DataOutputStream)
         */
        public int write(DataOutputStream dos)
        {
            int size = 5;

            dos.WriteUTF(Streamable.MESSAGE_EPHEMERIS); // 5
            dos.WriteInt(STREAM_V); size += 4;          // 4

            dos.WriteLong(refTime == null?-1:refTime.getMsec());  size += 8;
            dos.Write(satID);  size  += 1;
            dos.WriteInt(week); size += 4;

            dos.WriteInt(L2Code); size += 4;
            dos.WriteInt(L2Flag); size += 4;

            dos.WriteInt(svAccur); size  += 4;
            dos.WriteInt(svHealth); size += 4;

            dos.WriteInt(iode); size += 4;
            dos.WriteInt(iodc); size += 4;

            dos.WriteDouble(toc); size += 8;
            dos.WriteDouble(toe); size += 8;

            dos.WriteDouble(af0); size += 8;
            dos.WriteDouble(af1); size += 8;
            dos.WriteDouble(af2); size += 8;
            dos.WriteDouble(tgd); size += 8;


            dos.WriteDouble(rootA); size  += 8;
            dos.WriteDouble(e); size      += 8;
            dos.WriteDouble(i0); size     += 8;
            dos.WriteDouble(iDot); size   += 8;
            dos.WriteDouble(omega); size  += 8;
            dos.WriteDouble(omega0); size += 8;

            dos.WriteDouble(omegaDot); size += 8;
            dos.WriteDouble(M0); size       += 8;
            dos.WriteDouble(deltaN); size   += 8;
            dos.WriteDouble(crc); size      += 8;
            dos.WriteDouble(crs); size      += 8;
            dos.WriteDouble(cuc); size      += 8;
            dos.WriteDouble(cus); size      += 8;
            dos.WriteDouble(cic); size      += 8;
            dos.WriteDouble(cis); size      += 8;

            dos.WriteDouble(fitInt); size += 8;

            return(size);
        }
Пример #2
0
        public override void calculateSatPosition(Location initialLocation, Coordinates <Matrix> position)
        {
            // Make a list to hold the satellites that are to be excluded based on elevation/CN0 masking criteria
            List <SatelliteParameters> excludedSatellites = new List <SatelliteParameters>();

            lock (this) {
                rxPos = Coordinates <Matrix> .globalXYZInstance(position.getX(), position.getY(), position.getZ());

                foreach (SatelliteParameters observedSatellite in observedSatellites)
                {
                    /*
                     * Computation of the Galileo satellite coordinates in ECEF frame
                     */

                    // Determine the current Galileo week number (info: is the same as GPS week number)
                    // todo: confirm difference to github fork
                    int galileoWeek = (int)weekNumber;

                    // Time of signal reception in Galileo Seconds of the Week (SoW)
                    double galileoSow = (tRxGalileoTOW) * 1e-9;
                    Time   tGalileo   = new Time(galileoWeek, galileoSow);

                    // Convert the time of reception from GPS SoW to UNIX time (milliseconds)
                    long timeRx = tGalileo.getMsec();


                    /*Compute the Galileo satellite coordinates
                     *
                     * INPUT:
                     * @param timeRx         = time of measurement reception - UNIX        [milliseconds]
                     * @param pseudorange    = pseudorange measuremnent                          [meters]
                     * @param satID          = satellite ID
                     * @param satType        = satellite type indicating the constellation (E: Galileo)
                     *
                     */
                    SatellitePosition rnp = ((RinexNavigationGalileo)rinexNavGalileo).getGalileoSatPosition(
                        timeRx,
                        observedSatellite.getPseudorange(),
                        observedSatellite.getSatId(),
                        satType,
                        0.0,
                        initialLocation);

                    if (rnp == null)
                    {
                        excludedSatellites.Add(observedSatellite);
                        GnssCoreService.notifyUser("Failed getting ephemeris data!", Snackbar.LengthShort, RNP_NULL_MESSAGE);
                        continue;
                    }

                    //observedSatellite.setSatellitePosition(rnp);


                    /* Compute the azimuth and elevation w.r.t the user's approximate location
                     *
                     * INPUT:
                     * @param rxPos                = user's approximate ECEF coordinates       [cartesian]
                     * @param satellitePosition    = satellite ECEF coordinates                [cartesian]
                     *
                     */
                    observedSatellite.setRxTopo(
                        new TopocentricCoordinates <Matrix>(
                            rxPos,
                            observedSatellite.getSatellitePosition()));


                    // Add to the exclusion list the satellites that do not pass the masking criteria
                    if (observedSatellite.getRxTopo().getElevation() < MASK_ELEVATION)
                    {
                        excludedSatellites.Add(observedSatellite);
                        continue;
                    }

                    // Initialize the variable to hold the results of the entire pseudorange correction models
                    double accumulatedCorrection = 0;

                    /* Compute the accumulated corrections for the pseudorange measurements
                     * Currently the accumulated corrections contain the following effects:
                     *                  - Ionosphere
                     *                  - Troposphere
                     *                  - Shapiro delay (i.e, relativistic path range correction)
                     *
                     * INPUT:
                     * @param timeRx               = time of measurement reception - UNIX   [milliseconds]
                     * @param rxPos                = user's approximate ECEF coordinates       [cartesian]
                     * @param satellitePosition    = satellite ECEF coordinates                [cartesian]
                     * @param rinexNavGalileo      = RinexNavigationGalileo type object
                     */
                    //foreach (Correction correction in corrections)
                    //{

                    //    correction.calculateCorrection(
                    //            new Time(timeRx),
                    //            rxPos,
                    //            observedSatellite.getSatellitePosition(),
                    //            rinexNavGalileo,
                    //            initialLocation);

                    //    accumulatedCorrection += correction.getCorrection();
                    //}

                    observedSatellite.setAccumulatedCorrection(accumulatedCorrection);
                }

                // Remove from the list all the satellites that did not pass the masking criteria
                visibleButNotUsed += excludedSatellites.Count();
                //observedSatellites.removeAll(excludedSatellites);
                unusedSatellites.AddRange(excludedSatellites);
            }
        }
Пример #3
0
        override public void calculateSatPosition(Location initialLocation, Coordinates <Matrix> position)
        {
            //// Make a list to hold the satellites that are to be excluded based on elevation/CN0 masking criteria
            List <SatelliteParameters> excludedSatellites = new List <SatelliteParameters>();

            lock (this) {
                rxPos = Coordinates <Matrix> .globalXYZInstance(position.getX(), position.getY(), position.getZ());

                foreach (SatelliteParameters observedSatellite in observedSatellites)
                {
                    // Computation of the GPS satellite coordinates in ECEF frame

                    // Determine the current GPS week number
                    int gpsWeek = (int)(weekNumberNanos / Constants.NUMBER_NANO_SECONDS_PER_WEEK);

                    // Time of signal reception in GPS Seconds of the Week (SoW)
                    double gpsSow = (tRxGPS - weekNumberNanos) * 1e-9;
                    Time   tGPS   = new Time(gpsWeek, gpsSow);

                    // Convert the time of reception from GPS SoW to UNIX time (milliseconds)
                    long timeRx = tGPS.getMsec();

                    SatellitePosition rnp = ((RinexNavigationGps)rinexNavGps).getSatPositionAndVelocities(
                        timeRx,
                        observedSatellite.getPseudorange(),
                        observedSatellite.getSatId(),
                        satType,
                        0.0,
                        initialLocation);

                    if (rnp == null)
                    {
                        excludedSatellites.Add(observedSatellite);
                        //GnssCoreService.notifyUser("Failed getting ephemeris data!", Snackbar.LengthShort, RNP_NULL_MESSAGE);
                        continue;
                    }

                    observedSatellite.setSatellitePosition(rnp);

                    observedSatellite.setRxTopo(
                        new TopocentricCoordinates <Matrix>(
                            rxPos,
                            observedSatellite.getSatellitePosition()));

                    //        // Add to the exclusion list the satellites that do not pass the masking criteria
                    if (observedSatellite.getRxTopo().getElevation() < MASK_ELEVATION)
                    {
                        excludedSatellites.Add(observedSatellite);
                    }

                    double accumulatedCorrection = 0;

                    foreach (Correction correction in corrections)
                    {
                        correction.calculateCorrection(
                            new Java.Sql.Time(timeRx),
                            rxPos,
                            observedSatellite.getSatellitePosition(),
                            rinexNavGps,
                            initialLocation);

                        accumulatedCorrection += correction.getCorrection();
                    }

                    observedSatellite.setAccumulatedCorrection(accumulatedCorrection);
                }

                // Remove from the list all the satellites that did not pass the masking criteria
                visibleButNotUsed += excludedSatellites.Count();
                foreach (SatelliteParameters sp in excludedSatellites)
                {
                    observedSatellites.Remove(sp);
                }
                unusedSatellites.AddRange(excludedSatellites);
            }
        }