AbstractInterSatellitesMeasurement.java

  1. /* Copyright 2022-2025 Luc Maisonobe
  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.orekit.estimation.measurements.ObservableSatellite;
  21. import org.orekit.estimation.measurements.ObservedMeasurement;
  22. import org.orekit.estimation.measurements.QuadraticClockModel;
  23. import org.orekit.propagation.SpacecraftState;
  24. import org.orekit.time.AbsoluteDate;
  25. import org.orekit.utils.FieldPVCoordinatesProvider;
  26. import org.orekit.utils.PVCoordinatesProvider;
  27. import org.orekit.utils.ShiftingPVCoordinatesProvider;
  28. import org.orekit.utils.TimeStampedFieldPVCoordinates;

  29. /** Base class for measurement between two satellites that are both estimated.
  30.  * <p>
  31.  * The measurement is considered to be a signal emitted from
  32.  * a remote satellite and received by a local satellite.
  33.  * Its value is the number of cycles between emission and reception.
  34.  * The motion of both spacecraft during the signal flight time
  35.  * are taken into account. The date of the measurement corresponds to the
  36.  * reception on ground of the emitted signal.
  37.  * </p>
  38.  * @param <T> type of the measurement
  39.  * @author Luc Maisonobe
  40.  * @since 12.1
  41.  */
  42. public abstract class AbstractInterSatellitesMeasurement<T extends ObservedMeasurement<T>> extends AbstractOnBoardMeasurement<T> {

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

  58.     /** {@inheritDoc} */
  59.     @Override
  60.     protected PVCoordinatesProvider getRemotePV(final SpacecraftState[] states) {
  61.         return new ShiftingPVCoordinatesProvider(states[1].getPVCoordinates(), states[1].getFrame());
  62.     }

  63.     /** {@inheritDoc} */
  64.     @Override
  65.     protected QuadraticClockModel getRemoteClock() {
  66.         return getSatellites().get(1).getQuadraticClockModel();
  67.     }

  68.     /** {@inheritDoc} */
  69.     @Override
  70.     protected FieldPVCoordinatesProvider<Gradient> getRemotePV(final SpacecraftState[] states,
  71.                                                                final int freeParameters) {
  72.         // convert the SpacecraftState to a FieldPVCoordinatesProvider<Gradient>
  73.         return (date, frame) -> {

  74.             // set up the derivatives with respect to remote state at its date
  75.             final TimeStampedFieldPVCoordinates<Gradient> pv0 = getCoordinates(states[1], 6, freeParameters);

  76.             // shift to desired date
  77.             final TimeStampedFieldPVCoordinates<Gradient> shifted = pv0.shiftedBy(date.durationFrom(states[1].getDate()));

  78.             // transform to desired frame
  79.             return states[1].getFrame().getTransformTo(frame, states[1].getDate()).transformPVCoordinates(shifted);

  80.         };
  81.     }

  82. }