BaseRangeTroposphericDelayModifier.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. /** Base class modifying theoretical range measurements with tropospheric delay.
  31.  * The effect of tropospheric correction on the range is directly computed
  32.  * through the computation of the tropospheric delay.
  33.  *
  34.  * In general, for GNSS, VLBI, ... there is hardly any frequency dependence in the delay.
  35.  * For SLR techniques however, the frequency dependence is sensitive.
  36.  *
  37.  * @author Joris Olympio
  38.  * @since 11.2
  39.  */
  40. public abstract class BaseRangeTroposphericDelayModifier {

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

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

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

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

  66.     /** Compute the measurement error due to Troposphere.
  67.      * @param station station
  68.      * @param state spacecraft state
  69.      * @return the measurement error due to Troposphere
  70.      */
  71.     public double rangeErrorTroposphericModel(final GroundStation station,
  72.                                               final SpacecraftState state) {

  73.         // spacecraft position and elevation as seen from the ground station
  74.         final Vector3D position = state.getPosition();
  75.         final TrackingCoordinates trackingCoordinates =
  76.                         station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());

  77.         // only consider measures above the horizon
  78.         if (trackingCoordinates.getElevation() > 0) {
  79.             // tropospheric delay in meters
  80.             final double delay = tropoModel.pathDelay(trackingCoordinates,
  81.                                                       station.getOffsetGeodeticPoint(state.getDate()),
  82.                                                       station.getPressureTemperatureHumidity(state.getDate()),
  83.                                                       tropoModel.getParameters(), state.getDate()).
  84.                                  getDelay();

  85.             return delay;
  86.         }

  87.         return 0;
  88.     }


  89.     /** Compute the measurement error due to Troposphere.
  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
  95.      */
  96.     public <T extends CalculusFieldElement<T>> T rangeErrorTroposphericModel(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.         // spacecraft position and elevation as seen from the ground station
  103.         final FieldVector3D<T> position = state.getPosition();
  104.         final FieldTrackingCoordinates<T> trackingCoordinates =
  105.                         station.getBaseFrame().getTrackingCoordinates(position, state.getFrame(), state.getDate());

  106.         // only consider measures above the horizon
  107.         if (trackingCoordinates.getElevation() .getReal() > 0) {
  108.             // tropospheric 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;
  115.         }

  116.         return zero;
  117.     }

  118.     /** Get the drivers for this modifier parameters.
  119.      * @return drivers for this modifier parameters
  120.      */
  121.     public List<ParameterDriver> getParametersDrivers() {
  122.         return tropoModel.getParametersDrivers();
  123.     }

  124. }