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.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.      * @deprecated as of 12.1, replaced by {@link #TDOATroposphericDelayModifier(TroposphericModel)}
  53.      */
  54.     @Deprecated
  55.     public TDOATroposphericDelayModifier(final org.orekit.models.earth.troposphere.DiscreteTroposphericModel model) {
  56.         this(new org.orekit.models.earth.troposphere.TroposphericModelAdapter(model));
  57.     }

  58.     /** Constructor.
  59.      *
  60.      * @param model tropospheric model appropriate for the current TDOA measurement method.
  61.      * @since 12.1
  62.      */
  63.     public TDOATroposphericDelayModifier(final TroposphericModel model) {
  64.         tropoModel = model;
  65.     }

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

  73.         // tracking
  74.         final TrackingCoordinates trackingCoordinates =
  75.                         station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());

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

  87.         return 0;
  88.     }

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

  102.         // tracking
  103.         final FieldVector3D<T> pos = state.getPosition();
  104.         final FieldTrackingCoordinates<T> trackingCoordinates =
  105.                         station.getBaseFrame().getTrackingCoordinates(pos, state.getFrame(), state.getDate());

  106.         // only consider measurements above the horizon
  107.         if (trackingCoordinates.getElevation().getReal() > 0) {
  108.             // delay in meters
  109.             final T delay = tropoModel.pathDelay(trackingCoordinates,
  110.                                                  station.getOffsetGeodeticPoint(state.getDate()),
  111.                                                  station.getPressureTemperatureHumidity(state.getDate()),
  112.                                                  parameters, state.getDate()).
  113.                             getDelay();
  114.             // return delay in seconds
  115.             return delay.divide(Constants.SPEED_OF_LIGHT);
  116.         }

  117.         return zero;
  118.     }

  119.     /** {@inheritDoc} */
  120.     @Override
  121.     public List<ParameterDriver> getParametersDrivers() {
  122.         return tropoModel.getParametersDrivers();
  123.     }

  124.     /** {@inheritDoc} */
  125.     @Override
  126.     public void modifyWithoutDerivatives(final EstimatedMeasurementBase<TDOA> estimated) {

  127.         final TDOA            measurement   = estimated.getObservedMeasurement();
  128.         final GroundStation   primeStation  = measurement.getPrimeStation();
  129.         final GroundStation   secondStation = measurement.getSecondStation();

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

  132.     }

  133.     /** {@inheritDoc} */
  134.     @Override
  135.     public void modify(final EstimatedMeasurement<TDOA> estimated) {

  136.         final TDOA            measurement   = estimated.getObservedMeasurement();
  137.         final GroundStation   primeStation  = measurement.getPrimeStation();
  138.         final GroundStation   secondStation = measurement.getSecondStation();
  139.         final SpacecraftState state         = estimated.getStates()[0];

  140.         TDOAModifierUtil.modify(estimated, tropoModel,
  141.                                 new ModifierGradientConverter(state, 6, new FrameAlignedProvider(state.getFrame())),
  142.                                 primeStation, secondStation,
  143.                                 this::timeErrorTroposphericModel,
  144.                                 this::timeErrorTroposphericModel,
  145.                                 this);

  146.     }

  147. }