BaseRangeTroposphericDelayModifier.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.estimation.measurements.GroundStation;
  24. import org.orekit.models.earth.troposphere.DiscreteTroposphericModel;
  25. import org.orekit.propagation.FieldSpacecraftState;
  26. import org.orekit.propagation.SpacecraftState;
  27. import org.orekit.utils.ParameterDriver;

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

  39.     /** Tropospheric delay model. */
  40.     private final DiscreteTroposphericModel tropoModel;

  41.     /** Constructor.
  42.      *
  43.      * @param model  Tropospheric delay model appropriate for the current range measurement method.
  44.      */
  45.     protected BaseRangeTroposphericDelayModifier(final DiscreteTroposphericModel model) {
  46.         tropoModel = model;
  47.     }

  48.     /** Get the tropospheric delay model.
  49.      * @return tropospheric delay model
  50.      */
  51.     protected DiscreteTroposphericModel getTropoModel() {
  52.         return tropoModel;
  53.     }

  54.     /** Compute the measurement error due to Troposphere.
  55.      * @param station station
  56.      * @param state spacecraft state
  57.      * @return the measurement error due to Troposphere
  58.      */
  59.     public double rangeErrorTroposphericModel(final GroundStation station,
  60.                                               final SpacecraftState state) {

  61.         // spacecraft position and elevation as seen from the ground station
  62.         final Vector3D position = state.getPVCoordinates().getPosition();
  63.         final double elevation  = station.getBaseFrame().getElevation(position,
  64.                                                                       state.getFrame(),
  65.                                                                       state.getDate());

  66.         // only consider measures above the horizon
  67.         if (elevation > 0) {
  68.             // tropospheric delay in meters
  69.             final double delay = tropoModel.pathDelay(elevation, station.getBaseFrame().getPoint(),
  70.                                                       tropoModel.getParameters(), state.getDate());

  71.             return delay;
  72.         }

  73.         return 0;
  74.     }


  75.     /** Compute the measurement error due to Troposphere.
  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
  81.      */
  82.     public <T extends CalculusFieldElement<T>> T rangeErrorTroposphericModel(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.         // spacecraft position and elevation as seen from the ground station
  89.         final FieldVector3D<T> position = state.getPVCoordinates().getPosition();
  90.         final T elevation               = station.getBaseFrame().getElevation(position,
  91.                                                                               state.getFrame(),
  92.                                                                               state.getDate());

  93.         // only consider measures above the horizon
  94.         if (elevation .getReal() > 0) {
  95.             // tropospheric delay in meters
  96.             final T delay = tropoModel.pathDelay(elevation, station.getBaseFrame().getPoint(field),
  97.                                                  parameters, state.getDate());

  98.             return delay;
  99.         }

  100.         return zero;
  101.     }

  102.     /** Get the drivers for this modifier parameters.
  103.      * @return drivers for this modifier parameters
  104.      */
  105.     public List<ParameterDriver> getParametersDrivers() {
  106.         return tropoModel.getParametersDrivers();
  107.     }

  108. }