InterSatellitesOneWayRangeRate.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 org.hipparchus.analysis.differentiation.Gradient;
  19. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  21. import org.orekit.estimation.measurements.EstimatedMeasurement;
  22. import org.orekit.estimation.measurements.EstimatedMeasurementBase;
  23. import org.orekit.estimation.measurements.ObservableSatellite;
  24. import org.orekit.propagation.SpacecraftState;
  25. import org.orekit.time.AbsoluteDate;
  26. import org.orekit.utils.Constants;
  27. import org.orekit.utils.FieldPVCoordinates;
  28. import org.orekit.utils.PVCoordinates;
  29. import org.orekit.utils.ParameterDriver;
  30. import org.orekit.utils.TimeSpanMap.Span;
  31. import org.orekit.utils.TimeStampedPVCoordinates;

  32. import java.util.Arrays;

  33. /** One way range-rate measurement between two satellites.
  34.  * @author Luc Maisonobe
  35.  * @since 12.1
  36.  */
  37. public class InterSatellitesOneWayRangeRate
  38.     extends AbstractInterSatellitesMeasurement<InterSatellitesOneWayRangeRate> {

  39.     /** Type of the measurement. */
  40.     public static final String MEASUREMENT_TYPE = "InterSatellitesOneWayRangeRate";

  41.     /** Constructor.
  42.      * @param local satellite which receives the signal and performs the measurement
  43.      * @param remote remote satellite which simply emits the signal
  44.      * @param date date of the measurement
  45.      * @param rangeRate observed value (m/s)
  46.      * @param sigma theoretical standard deviation
  47.      * @param baseWeight base weight
  48.      */
  49.     public InterSatellitesOneWayRangeRate(final ObservableSatellite local,
  50.                                           final ObservableSatellite remote,
  51.                                           final AbsoluteDate date, final double rangeRate,
  52.                                           final double sigma, final double baseWeight) {
  53.         // Call to super constructor
  54.         super(date, rangeRate, sigma, baseWeight, local, remote);
  55.     }

  56.     /** {@inheritDoc} */
  57.     @Override
  58.     protected EstimatedMeasurementBase<InterSatellitesOneWayRangeRate> theoreticalEvaluationWithoutDerivatives(final int iteration,
  59.                                                                                                                final int evaluation,
  60.                                                                                                                final SpacecraftState[] states) {

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

  62.         // prepare the evaluation
  63.         final EstimatedMeasurementBase<InterSatellitesOneWayRangeRate> estimatedPhase =
  64.                         new EstimatedMeasurementBase<>(this, iteration, evaluation,
  65.                                                        new SpacecraftState[] {
  66.                                                            common.getState(),
  67.                                                            states[1]
  68.                                                        }, new TimeStampedPVCoordinates[] {
  69.                                                            common.getRemotePV(),
  70.                                                            common.getTransitPV()
  71.                                                        });

  72.         // Range rate value
  73.         final PVCoordinates delta = new PVCoordinates(common.getRemotePV(), common.getTransitPV());
  74.         final double rangeRate = Vector3D.dotProduct(delta.getVelocity(), delta.getPosition().normalize()) +
  75.                                  Constants.SPEED_OF_LIGHT * (common.getLocalRate() - common.getRemoteRate());

  76.         estimatedPhase.setEstimatedValue(rangeRate);

  77.         // Return the estimated measurement
  78.         return estimatedPhase;

  79.     }

  80.     /** {@inheritDoc} */
  81.     @Override
  82.     protected EstimatedMeasurement<InterSatellitesOneWayRangeRate> theoreticalEvaluation(final int iteration,
  83.                                                                                          final int evaluation,
  84.                                                                                          final SpacecraftState[] states) {

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

  86.         // prepare the evaluation
  87.         final EstimatedMeasurement<InterSatellitesOneWayRangeRate> estimatedPhase =
  88.                         new EstimatedMeasurement<>(this, iteration, evaluation,
  89.                                                    new SpacecraftState[] {
  90.                                                        common.getState(),
  91.                                                        states[1]
  92.                                                    }, new TimeStampedPVCoordinates[] {
  93.                                                        common.getRemotePV().toTimeStampedPVCoordinates(),
  94.                                                        common.getTransitPV().toTimeStampedPVCoordinates()
  95.                                                    });

  96.         // Range rate value
  97.         final FieldPVCoordinates<Gradient> delta = new FieldPVCoordinates<>(common.getRemotePV(), common.getTransitPV());
  98.         final Gradient rangeRate = FieldVector3D.dotProduct(delta.getVelocity(), delta.getPosition().normalize()).
  99.                                    add(common.getLocalRate().subtract(common.getRemoteRate()).multiply(Constants.SPEED_OF_LIGHT));

  100.         estimatedPhase.setEstimatedValue(rangeRate.getValue());

  101.         // Range first order derivatives with respect to states
  102.         final double[] derivatives = rangeRate.getGradient();
  103.         estimatedPhase.setStateDerivatives(0, Arrays.copyOfRange(derivatives, 0,  6));
  104.         estimatedPhase.setStateDerivatives(1, Arrays.copyOfRange(derivatives, 6, 12));

  105.         // Set first order derivatives with respect to parameters
  106.         for (final ParameterDriver driver : getParametersDrivers()) {
  107.             for (Span<String> span = driver.getNamesSpanMap().getFirstSpan(); span != null; span = span.next()) {
  108.                 final Integer index = common.getIndices().get(span.getData());
  109.                 if (index != null) {
  110.                     estimatedPhase.setParameterDerivatives(driver, span.getStart(), derivatives[index]);
  111.                 }
  112.             }
  113.         }

  114.         // Return the estimated measurement
  115.         return estimatedPhase;

  116.     }

  117. }