TDOATroposphericDelayModifier.java

  1. /* Copyright 2002-2025 CS GROUP
  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.modifiers;

  18. import java.util.List;

  19. import org.hipparchus.CalculusFieldElement;
  20. import org.hipparchus.Field;
  21. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  22. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  23. import org.orekit.attitudes.FrameAlignedProvider;
  24. import org.orekit.estimation.measurements.EstimatedMeasurement;
  25. import org.orekit.estimation.measurements.EstimatedMeasurementBase;
  26. import org.orekit.estimation.measurements.EstimationModifier;
  27. import org.orekit.estimation.measurements.GroundStation;
  28. import org.orekit.estimation.measurements.TDOA;
  29. import org.orekit.models.earth.troposphere.TroposphericModel;
  30. import org.orekit.propagation.FieldSpacecraftState;
  31. import org.orekit.propagation.SpacecraftState;
  32. import org.orekit.utils.Constants;
  33. import org.orekit.utils.FieldTrackingCoordinates;
  34. import org.orekit.utils.ParameterDriver;
  35. import org.orekit.utils.TrackingCoordinates;

  36. /** Class modifying theoretical TDOA measurements with tropospheric delay.
  37.  * <p>
  38.  * The effect of tropospheric correction on the TDOA is a time delay computed
  39.  * directly from the difference in tropospheric delays for each downlink.
  40.  * </p><p>
  41.  * Tropospheric delay is not frequency dependent for signals up to 15 GHz.
  42.  * </p>
  43.  * @author Pascal Parraud
  44.  * @since 11.2
  45.  */
  46. public class TDOATroposphericDelayModifier implements EstimationModifier<TDOA> {

  47.     /** Tropospheric delay model. */
  48.     private final TroposphericModel tropoModel;

  49.     /** Constructor.
  50.      *
  51.      * @param model tropospheric model appropriate for the current TDOA measurement method.
  52.      * @since 12.1
  53.      */
  54.     public TDOATroposphericDelayModifier(final TroposphericModel model) {
  55.         tropoModel = model;
  56.     }

  57.     /** {@inheritDoc} */
  58.     @Override
  59.     public String getEffectName() {
  60.         return "troposphere";
  61.     }

  62.     /** Compute the measurement error due to Troposphere on a single downlink.
  63.      * @param station station
  64.      * @param state spacecraft state
  65.      * @return the measurement error due to Troposphere (s)
  66.      */
  67.     private double timeErrorTroposphericModel(final GroundStation station, final SpacecraftState state) {
  68.         final Vector3D position = state.getPosition();

  69.         // tracking
  70.         final TrackingCoordinates trackingCoordinates =
  71.                         station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());

  72.         // only consider measurements above the horizon
  73.         if (trackingCoordinates.getElevation() > 0) {
  74.             // Delay in meters
  75.             final double delay = tropoModel.pathDelay(trackingCoordinates,
  76.                                                       station.getOffsetGeodeticPoint(state.getDate()),
  77.                                                       tropoModel.getParameters(state.getDate()), state.getDate()).
  78.                                  getDelay();
  79.             // return delay in seconds
  80.             return delay / Constants.SPEED_OF_LIGHT;
  81.         }

  82.         return 0;
  83.     }

  84.     /** Compute the measurement error due to Troposphere on a single downlink.
  85.      * @param <T> type of the element
  86.      * @param station station
  87.      * @param state spacecraft state
  88.      * @param parameters tropospheric model parameters
  89.      * @return the measurement error due to Troposphere (s)
  90.      */
  91.     private <T extends CalculusFieldElement<T>> T timeErrorTroposphericModel(final GroundStation station,
  92.                                                                              final FieldSpacecraftState<T> state,
  93.                                                                              final T[] parameters) {
  94.         // Field
  95.         final Field<T> field = state.getDate().getField();
  96.         final T zero         = field.getZero();

  97.         // tracking
  98.         final FieldVector3D<T> pos = state.getPosition();
  99.         final FieldTrackingCoordinates<T> trackingCoordinates =
  100.                         station.getBaseFrame().getTrackingCoordinates(pos, state.getFrame(), state.getDate());

  101.         // only consider measurements above the horizon
  102.         if (trackingCoordinates.getElevation().getReal() > 0) {
  103.             // delay in meters
  104.             final T delay = tropoModel.pathDelay(trackingCoordinates,
  105.                                                  station.getOffsetGeodeticPoint(state.getDate()),
  106.                                                  parameters, state.getDate()).
  107.                             getDelay();
  108.             // return delay in seconds
  109.             return delay.divide(Constants.SPEED_OF_LIGHT);
  110.         }

  111.         return zero;
  112.     }

  113.     /** {@inheritDoc} */
  114.     @Override
  115.     public List<ParameterDriver> getParametersDrivers() {
  116.         return tropoModel.getParametersDrivers();
  117.     }

  118.     /** {@inheritDoc} */
  119.     @Override
  120.     public void modifyWithoutDerivatives(final EstimatedMeasurementBase<TDOA> estimated) {

  121.         final TDOA            measurement   = estimated.getObservedMeasurement();
  122.         final GroundStation   primeStation  = measurement.getPrimeStation();
  123.         final GroundStation   secondStation = measurement.getSecondStation();

  124.         TDOAModifierUtil.modifyWithoutDerivatives(estimated,  primeStation, secondStation,
  125.                                                   this::timeErrorTroposphericModel, this);

  126.     }

  127.     /** {@inheritDoc} */
  128.     @Override
  129.     public void modify(final EstimatedMeasurement<TDOA> estimated) {

  130.         final TDOA            measurement   = estimated.getObservedMeasurement();
  131.         final GroundStation   primeStation  = measurement.getPrimeStation();
  132.         final GroundStation   secondStation = measurement.getSecondStation();
  133.         final SpacecraftState state         = estimated.getStates()[0];

  134.         TDOAModifierUtil.modify(estimated, tropoModel,
  135.                                 new ModifierGradientConverter(state, 6, new FrameAlignedProvider(state.getFrame())),
  136.                                 primeStation, secondStation,
  137.                                 this::timeErrorTroposphericModel,
  138.                                 this::timeErrorTroposphericModel,
  139.                                 this);

  140.     }

  141. }