BaseRangeRateTroposphericDelayModifier.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.estimation.measurements.GroundStation;
  24. import org.orekit.models.earth.troposphere.TroposphericModel;
  25. import org.orekit.propagation.FieldSpacecraftState;
  26. import org.orekit.propagation.SpacecraftState;
  27. import org.orekit.utils.FieldTrackingCoordinates;
  28. import org.orekit.utils.ParameterDriver;
  29. import org.orekit.utils.TrackingCoordinates;

  30. /** Baselass modifying theoretical range-rate measurements with tropospheric delay.
  31.  * The effect of tropospheric correction on the range-rate is directly computed
  32.  * through the computation of the tropospheric delay difference with respect to
  33.  * time.
  34.  *
  35.  * In general, for GNSS, VLBI, ... there is hardly any frequency dependence in the delay.
  36.  * For SLR techniques however, the frequency dependence is sensitive.
  37.  *
  38.  * @author Joris Olympio
  39.  * @since 11.2
  40.  */
  41. public abstract class BaseRangeRateTroposphericDelayModifier {

  42.     /** Tropospheric delay model. */
  43.     private final TroposphericModel tropoModel;

  44.     /** Constructor.
  45.      *
  46.      * @param model  Tropospheric delay model appropriate for the current range-rate measurement method.
  47.      * @deprecated as of 12.1, replaced by {@link #BaseRangeRateTroposphericDelayModifier(TroposphericModel)}
  48.      */
  49.     @Deprecated
  50.     protected BaseRangeRateTroposphericDelayModifier(final org.orekit.models.earth.troposphere.DiscreteTroposphericModel model) {
  51.         this(new org.orekit.models.earth.troposphere.TroposphericModelAdapter(model));
  52.     }

  53.     /** Constructor.
  54.      *
  55.      * @param model  Tropospheric delay model appropriate for the current range-rate measurement method.
  56.      * @since 12.1
  57.      */
  58.     protected BaseRangeRateTroposphericDelayModifier(final TroposphericModel model) {
  59.         tropoModel = model;
  60.     }

  61.     /** Get the tropospheric delay model.
  62.      * @return tropospheric delay model
  63.      */
  64.     protected TroposphericModel getTropoModel() {
  65.         return tropoModel;
  66.     }

  67.     /** Compute the measurement error due to Troposphere.
  68.      * @param station station
  69.      * @param state spacecraft state
  70.      * @return the measurement error due to Troposphere
  71.      */
  72.     public double rangeRateErrorTroposphericModel(final GroundStation station,
  73.                                                   final SpacecraftState state) {
  74.         // The effect of tropospheric correction on the range rate is
  75.         // computed using finite differences.

  76.         final double dt = 10; // s

  77.         // spacecraft position and elevation as seen from the ground station
  78.         final Vector3D position = state.getPosition();

  79.         // tracking
  80.         final TrackingCoordinates trackingCoordinates1 =
  81.                         station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());

  82.         // only consider measures above the horizon
  83.         if (trackingCoordinates1.getElevation() > 0) {
  84.             // tropospheric delay in meters
  85.             final double d1 = tropoModel.pathDelay(trackingCoordinates1,
  86.                                                    station.getOffsetGeodeticPoint(state.getDate()),
  87.                                                    station.getPressureTemperatureHumidity(state.getDate()),
  88.                                                    tropoModel.getParameters(state.getDate()), state.getDate()).
  89.                               getDelay();

  90.             // propagate spacecraft state forward by dt
  91.             final SpacecraftState state2 = state.shiftedBy(dt);

  92.             // spacecraft position and elevation as seen from the ground station
  93.             final Vector3D position2 = state2.getPosition();

  94.             // tracking
  95.             final TrackingCoordinates trackingCoordinates2 =
  96.                             station.getBaseFrame().getTrackingCoordinates(position2, state2.getFrame(), state2.getDate());

  97.             // tropospheric delay dt after
  98.             final double d2 = tropoModel.pathDelay(trackingCoordinates2,
  99.                                                    station.getOffsetGeodeticPoint(state.getDate()),
  100.                                                    station.getPressureTemperatureHumidity(state.getDate()),
  101.                                                    tropoModel.getParameters(state2.getDate()), state2.getDate()).
  102.                               getDelay();

  103.             return (d2 - d1) / dt;
  104.         }

  105.         return 0;
  106.     }


  107.     /** Compute the measurement error due to Troposphere.
  108.      * @param <T> type of the element
  109.      * @param station station
  110.      * @param state spacecraft state
  111.      * @param parameters tropospheric model parameters
  112.      * @return the measurement error due to Troposphere
  113.      */
  114.     public <T extends CalculusFieldElement<T>> T rangeRateErrorTroposphericModel(final GroundStation station,
  115.                                                                                  final FieldSpacecraftState<T> state,
  116.                                                                                  final T[] parameters) {
  117.         // Field
  118.         final Field<T> field = state.getDate().getField();
  119.         final T zero         = field.getZero();

  120.         // The effect of tropospheric correction on the range rate is
  121.         // computed using finite differences.

  122.         final double dt = 10; // s

  123.         // spacecraft position and elevation as seen from the ground station
  124.         final FieldVector3D<T> position     = state.getPosition();
  125.         final FieldTrackingCoordinates<T> trackingCoordinates1 =
  126.                         station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());

  127.         // only consider measures above the horizon
  128.         if (trackingCoordinates1.getElevation().getReal() > 0) {
  129.             // tropospheric delay in meters
  130.             final T d1 = tropoModel.pathDelay(trackingCoordinates1,
  131.                                               station.getOffsetGeodeticPoint(state.getDate()),
  132.                                               station.getPressureTemperatureHumidity(state.getDate()),
  133.                                               parameters, state.getDate()).
  134.                          getDelay();

  135.             // propagate spacecraft state forward by dt
  136.             final FieldSpacecraftState<T> state2 = state.shiftedBy(dt);

  137.             // spacecraft position and elevation as seen from the ground station
  138.             final FieldVector3D<T> position2     = state2.getPosition();

  139.             // elevation
  140.             final FieldTrackingCoordinates<T> trackingCoordinates2 =
  141.                             station.getBaseFrame().getTrackingCoordinates(position2, state2.getFrame(), state2.getDate());


  142.             // tropospheric delay dt after
  143.             final T d2 = tropoModel.pathDelay(trackingCoordinates2,
  144.                                               station.getOffsetGeodeticPoint(state.getDate()),
  145.                                               station.getPressureTemperatureHumidity(state.getDate()),
  146.                                               parameters, state2.getDate()).
  147.                          getDelay();

  148.             return d2.subtract(d1).divide(dt);
  149.         }

  150.         return zero;
  151.     }

  152.     /** Get the drivers for this modifier parameters.
  153.      * @return drivers for this modifier parameters
  154.      */
  155.     public List<ParameterDriver> getParametersDrivers() {
  156.         return tropoModel.getParametersDrivers();
  157.     }

  158. }