OneWayGNSSRangeRate.java

  1. /* Copyright 2022-2025 Thales Alenia Space
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.estimation.measurements.gnss;

  18. import java.util.Arrays;

  19. import org.hipparchus.analysis.differentiation.Gradient;
  20. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  21. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  22. import org.orekit.estimation.measurements.EstimatedMeasurement;
  23. import org.orekit.estimation.measurements.EstimatedMeasurementBase;
  24. import org.orekit.estimation.measurements.ObservableSatellite;
  25. import org.orekit.estimation.measurements.QuadraticClockModel;
  26. import org.orekit.propagation.SpacecraftState;
  27. import org.orekit.time.AbsoluteDate;
  28. import org.orekit.utils.Constants;
  29. import org.orekit.utils.FieldPVCoordinates;
  30. import org.orekit.utils.PVCoordinates;
  31. import org.orekit.utils.PVCoordinatesProvider;
  32. import org.orekit.utils.ParameterDriver;
  33. import org.orekit.utils.TimeSpanMap.Span;
  34. import org.orekit.utils.TimeStampedPVCoordinates;

  35. /** One-way GNSS range rate measurement.
  36.  * <p>
  37.  * This class can be used in precise orbit determination applications
  38.  * for modeling a range rate measurement between a GNSS satellite (emitter)
  39.  * and a LEO satellite (receiver).
  40.  * <p>
  41.  * The one-way GNSS range rate measurement assumes knowledge of the orbit and
  42.  * the clock offset of the emitting GNSS satellite. For instance, it is
  43.  * possible to use a SP3 file or a GNSS navigation message to recover
  44.  * the satellite's orbit and clock.
  45.  * <p>
  46.  * This class is very similar to {@link InterSatellitesOneWayRangeRate} measurement
  47.  * class. However, using the one-way GNSS range measurement, the orbit and clock
  48.  * of the emitting GNSS satellite are <b>NOT</b> estimated simultaneously with
  49.  * LEO satellite coordinates.
  50.  *
  51.  * @author Luc Maisonobe
  52.  * @since 12.1
  53.  */
  54. public class OneWayGNSSRangeRate extends AbstractOneWayGNSSMeasurement<OneWayGNSSRangeRate> {

  55.     /** Type of the measurement. */
  56.     public static final String MEASUREMENT_TYPE = "OneWayGNSSRangeRate";

  57.     /** Simple constructor.
  58.      * @param remote provider for GNSS satellite which simply emits the signal
  59.      * @param dtRemote clock offset of the GNSS satellite, in seconds
  60.      * @param date date of the measurement
  61.      * @param rangeRate observed value
  62.      * @param sigma theoretical standard deviation
  63.      * @param baseWeight base weight
  64.      * @param local satellite which receives the signal and perform the measurement
  65.      */
  66.     public OneWayGNSSRangeRate(final PVCoordinatesProvider remote,
  67.                                final double dtRemote,
  68.                                final AbsoluteDate date,
  69.                                final double rangeRate, final double sigma,
  70.                                final double baseWeight, final ObservableSatellite local) {
  71.         this(remote, new QuadraticClockModel(date, dtRemote, 0.0, 0.0), date, rangeRate, sigma, baseWeight, local);
  72.     }

  73.     /** Simple constructor.
  74.      * @param remote provider for GNSS satellite which simply emits the signal
  75.      * @param remoteClock clock offset of the GNSS satellite
  76.      * @param date date of the measurement
  77.      * @param rangeRate observed value
  78.      * @param sigma theoretical standard deviation
  79.      * @param baseWeight base weight
  80.      * @param local satellite which receives the signal and perform the measurement
  81.      * @since 12.1
  82.      */
  83.     public OneWayGNSSRangeRate(final PVCoordinatesProvider remote,
  84.                                final QuadraticClockModel remoteClock,
  85.                                final AbsoluteDate date,
  86.                                final double rangeRate, final double sigma,
  87.                                final double baseWeight, final ObservableSatellite local) {
  88.         // Call super constructor
  89.         super(remote, remoteClock, date, rangeRate, sigma, baseWeight, local);
  90.     }

  91.     /** {@inheritDoc} */
  92.     @Override
  93.     protected EstimatedMeasurementBase<OneWayGNSSRangeRate> theoreticalEvaluationWithoutDerivatives(final int iteration,
  94.                                                                                                     final int evaluation,
  95.                                                                                                     final SpacecraftState[] states) {


  96.         final OnBoardCommonParametersWithoutDerivatives common = computeCommonParametersWithout(states, false);

  97.         // Estimated measurement
  98.         final EstimatedMeasurementBase<OneWayGNSSRangeRate> estimatedRangeRate =
  99.                         new EstimatedMeasurementBase<>(this, iteration, evaluation,
  100.                                                        new SpacecraftState[] {
  101.                                                            common.getState()
  102.                                                        }, new TimeStampedPVCoordinates[] {
  103.                                                            common.getRemotePV(),
  104.                                                            common.getTransitPV()
  105.                                                        });

  106.         // Range rate value
  107.         final PVCoordinates delta = new PVCoordinates(common.getRemotePV(), common.getTransitPV());
  108.         final double rangeRate = Vector3D.dotProduct(delta.getVelocity(), delta.getPosition().normalize()) +
  109.                                  Constants.SPEED_OF_LIGHT * (common.getLocalRate() - common.getRemoteRate());

  110.         // Set value of the estimated measurement
  111.         estimatedRangeRate.setEstimatedValue(rangeRate);

  112.         // Return the estimated measurement
  113.         return estimatedRangeRate;

  114.     }

  115.     /** {@inheritDoc} */
  116.     @Override
  117.     protected EstimatedMeasurement<OneWayGNSSRangeRate> theoreticalEvaluation(final int iteration,
  118.                                                                               final int evaluation,
  119.                                                                               final SpacecraftState[] states) {

  120.         final OnBoardCommonParametersWithDerivatives common = computeCommonParametersWith(states, false);

  121.         // Estimated measurement
  122.         final EstimatedMeasurement<OneWayGNSSRangeRate> estimatedRangeRate =
  123.                         new EstimatedMeasurement<>(this, iteration, evaluation,
  124.                                                    new SpacecraftState[] {
  125.                                                        common.getState()
  126.                                                    }, new TimeStampedPVCoordinates[] {
  127.                                                        common.getRemotePV().toTimeStampedPVCoordinates(),
  128.                                                        common.getTransitPV().toTimeStampedPVCoordinates()
  129.                                                    });

  130.         // Range rate value
  131.         final FieldPVCoordinates<Gradient> delta = new FieldPVCoordinates<>(common.getRemotePV(), common.getTransitPV());
  132.         final Gradient rangeRate = FieldVector3D.dotProduct(delta.getVelocity(), delta.getPosition().normalize()).
  133.                                    add(common.getLocalRate().subtract(common.getRemoteRate()).multiply(Constants.SPEED_OF_LIGHT));
  134.         final double[] rangeRateDerivatives = rangeRate.getGradient();

  135.         // Set value and state first order derivatives of the estimated measurement
  136.         estimatedRangeRate.setEstimatedValue(rangeRate.getValue());
  137.         estimatedRangeRate.setStateDerivatives(0, Arrays.copyOfRange(rangeRateDerivatives, 0,  6));

  138.         // Set first order derivatives with respect to parameters
  139.         for (final ParameterDriver measurementDriver : getParametersDrivers()) {
  140.             for (Span<String> span = measurementDriver.getNamesSpanMap().getFirstSpan(); span != null; span = span.next()) {

  141.                 final Integer index = common.getIndices().get(span.getData());
  142.                 if (index != null) {
  143.                     estimatedRangeRate.setParameterDerivatives(measurementDriver, span.getStart(), rangeRateDerivatives[index]);
  144.                 }
  145.             }
  146.         }

  147.         // Return the estimated measurement
  148.         return estimatedRangeRate;

  149.     }

  150. }