TDOATroposphericDelayModifier.java

  1. /* Copyright 2002-2022 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.InertialProvider;
  24. import org.orekit.estimation.measurements.EstimatedMeasurement;
  25. import org.orekit.estimation.measurements.EstimationModifier;
  26. import org.orekit.estimation.measurements.GroundStation;
  27. import org.orekit.estimation.measurements.TDOA;
  28. import org.orekit.models.earth.troposphere.DiscreteTroposphericModel;
  29. import org.orekit.propagation.FieldSpacecraftState;
  30. import org.orekit.propagation.SpacecraftState;
  31. import org.orekit.utils.Constants;
  32. import org.orekit.utils.ParameterDriver;

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

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

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

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

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

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

  72.         return 0;
  73.     }

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

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

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

  100.         return zero;
  101.     }

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

  107.     /** {@inheritDoc} */
  108.     @Override
  109.     public void modify(final EstimatedMeasurement<TDOA> estimated) {

  110.         final TDOA            measurement   = estimated.getObservedMeasurement();
  111.         final GroundStation   primeStation  = measurement.getPrimeStation();
  112.         final GroundStation   secondStation = measurement.getSecondStation();
  113.         final SpacecraftState state         = estimated.getStates()[0];

  114.         TDOAModifierUtil.modify(estimated, tropoModel,
  115.                                 new ModifierGradientConverter(state, 6, new InertialProvider(state.getFrame())),
  116.                                 primeStation, secondStation,
  117.                                 this::timeErrorTroposphericModel,
  118.                                 this::timeErrorTroposphericModel);

  119.     }

  120. }