TDOATroposphericDelayModifier.java

  1. /* Copyright 2002-2024 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.DiscreteTroposphericModel;
  30. import org.orekit.propagation.FieldSpacecraftState;
  31. import org.orekit.propagation.SpacecraftState;
  32. import org.orekit.utils.Constants;
  33. import org.orekit.utils.ParameterDriver;

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

  45.     /** Tropospheric delay model. */
  46.     private final DiscreteTroposphericModel tropoModel;

  47.     /** Constructor.
  48.      *
  49.      * @param model tropospheric model appropriate for the current TDOA measurement method.
  50.      */
  51.     public TDOATroposphericDelayModifier(final DiscreteTroposphericModel model) {
  52.         tropoModel = model;
  53.     }

  54.     /** Compute the measurement error due to Troposphere on a single downlink.
  55.      * @param station station
  56.      * @param state spacecraft state
  57.      * @return the measurement error due to Troposphere (s)
  58.      */
  59.     private double timeErrorTroposphericModel(final GroundStation station, final SpacecraftState state) {
  60.         final Vector3D position = state.getPosition();

  61.         // elevation
  62.         final double elevation =
  63.                         station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate()).
  64.                         getElevation();

  65.         // only consider measurements above the horizon
  66.         if (elevation > 0) {
  67.             // Delay in meters
  68.             final double delay = tropoModel.pathDelay(elevation, station.getBaseFrame().getPoint(),
  69.                                                       tropoModel.getParameters(state.getDate()), state.getDate());
  70.             // return delay in seconds
  71.             return delay / Constants.SPEED_OF_LIGHT;
  72.         }

  73.         return 0;
  74.     }

  75.     /** Compute the measurement error due to Troposphere on a single downlink.
  76.      * @param <T> type of the element
  77.      * @param station station
  78.      * @param state spacecraft state
  79.      * @param parameters tropospheric model parameters
  80.      * @return the measurement error due to Troposphere (s)
  81.      */
  82.     private <T extends CalculusFieldElement<T>> T timeErrorTroposphericModel(final GroundStation station,
  83.                                                                              final FieldSpacecraftState<T> state,
  84.                                                                              final T[] parameters) {
  85.         // Field
  86.         final Field<T> field = state.getDate().getField();
  87.         final T zero         = field.getZero();

  88.         // elevation
  89.         final FieldVector3D<T> pos = state.getPosition();
  90.         final T elevation =
  91.                         station.getBaseFrame().getTrackingCoordinates(pos, state.getFrame(), state.getDate()).
  92.                         getElevation();

  93.         // only consider measurements above the horizon
  94.         if (elevation.getReal() > 0) {
  95.             // delay in meters
  96.             final T delay = tropoModel.pathDelay(elevation, station.getBaseFrame().getPoint(field),
  97.                                                  parameters, state.getDate());
  98.             // return delay in seconds
  99.             return delay.divide(Constants.SPEED_OF_LIGHT);
  100.         }

  101.         return zero;
  102.     }

  103.     /** {@inheritDoc} */
  104.     @Override
  105.     public List<ParameterDriver> getParametersDrivers() {
  106.         return tropoModel.getParametersDrivers();
  107.     }

  108.     /** {@inheritDoc} */
  109.     @Override
  110.     public void modifyWithoutDerivatives(final EstimatedMeasurementBase<TDOA> estimated) {

  111.         final TDOA            measurement   = estimated.getObservedMeasurement();
  112.         final GroundStation   primeStation  = measurement.getPrimeStation();
  113.         final GroundStation   secondStation = measurement.getSecondStation();

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

  115.     }

  116.     /** {@inheritDoc} */
  117.     @Override
  118.     public void modify(final EstimatedMeasurement<TDOA> estimated) {

  119.         final TDOA            measurement   = estimated.getObservedMeasurement();
  120.         final GroundStation   primeStation  = measurement.getPrimeStation();
  121.         final GroundStation   secondStation = measurement.getSecondStation();
  122.         final SpacecraftState state         = estimated.getStates()[0];

  123.         TDOAModifierUtil.modify(estimated, tropoModel,
  124.                                 new ModifierGradientConverter(state, 6, new FrameAlignedProvider(state.getFrame())),
  125.                                 primeStation, secondStation,
  126.                                 this::timeErrorTroposphericModel,
  127.                                 this::timeErrorTroposphericModel);

  128.     }

  129. }