AngularTroposphericDelayModifier.java

  1. /* Copyright 2002-2019 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (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.geometry.euclidean.threed.Vector3D;
  20. import org.hipparchus.util.MathUtils;
  21. import org.orekit.estimation.measurements.AngularAzEl;
  22. import org.orekit.estimation.measurements.EstimatedMeasurement;
  23. import org.orekit.estimation.measurements.EstimationModifier;
  24. import org.orekit.estimation.measurements.GroundStation;
  25. import org.orekit.frames.Frame;
  26. import org.orekit.models.earth.DiscreteTroposphericModel;
  27. import org.orekit.propagation.SpacecraftState;
  28. import org.orekit.time.AbsoluteDate;
  29. import org.orekit.utils.Constants;
  30. import org.orekit.utils.ParameterDriver;

  31. /** Class modifying theoretical angular measurement with tropospheric delay.
  32.  * The effect of tropospheric correction on the angular is computed
  33.  * through the computation of the tropospheric delay.The spacecraft state
  34.  * is shifted by the computed delay time and elevation and azimuth are computed
  35.  * again with the new spacecraft state.
  36.  *
  37.  * In general, for GNSS, VLBI, ... there is hardly any frequency dependence in the delay.
  38.  * For SLR techniques however, the frequency dependence is sensitive.
  39.  *
  40.  * @author Thierry Ceolin
  41.  * @since 8.0
  42.  */
  43. public class AngularTroposphericDelayModifier implements EstimationModifier<AngularAzEl> {

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

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

  53.     /** Get the station height above mean sea level.
  54.      *
  55.      * @param station  ground station (or measuring station)
  56.      * @return the measuring station height above sea level, m
  57.      */
  58.     private double getStationHeightAMSL(final GroundStation station) {
  59.         // FIXME heigth should be computed with respect to geoid WGS84+GUND = EGM2008 for example
  60.         final double height = station.getBaseFrame().getPoint().getAltitude();
  61.         return height;
  62.     }

  63.     /** Compute the measurement error due to Troposphere.
  64.      * @param station station
  65.      * @param state spacecraft state
  66.      * @return the measurement error due to Troposphere
  67.      */
  68.     private double angularErrorTroposphericModel(final GroundStation station,
  69.                                                  final SpacecraftState state) {
  70.         //
  71.         final Vector3D position = state.getPVCoordinates().getPosition();

  72.         // elevation
  73.         final double elevation = station.getBaseFrame().getElevation(position,
  74.                                                                      state.getFrame(),
  75.                                                                      state.getDate());

  76.         // only consider measures above the horizon
  77.         if (elevation > 0.0) {
  78.             // altitude AMSL in meters
  79.             final double height = getStationHeightAMSL(station);

  80.             // delay in meters
  81.             final double delay = tropoModel.pathDelay(elevation, height, tropoModel.getParameters(), state.getDate());

  82.             // one-way measurement.
  83.             return delay;
  84.         }

  85.         return 0;
  86.     }

  87.     /** {@inheritDoc} */
  88.     @Override
  89.     public List<ParameterDriver> getParametersDrivers() {
  90.         return tropoModel.getParametersDrivers();
  91.     }

  92.     @Override
  93.     public void modify(final EstimatedMeasurement<AngularAzEl> estimated) {
  94.         final AngularAzEl     measure = estimated.getObservedMeasurement();
  95.         final GroundStation   station = measure.getStation();
  96.         final SpacecraftState state   = estimated.getStates()[0];

  97.         final double delay = angularErrorTroposphericModel(station, state);
  98.         // Delay is taken into account to shift the spacecraft position
  99.         final double dt = delay / Constants.SPEED_OF_LIGHT;

  100.         // Position of the spacecraft shifted of dt
  101.         final SpacecraftState transitState = state.shiftedBy(-dt);

  102.         // Update measurement value taking into account the ionospheric delay.
  103.         final AbsoluteDate date      = transitState.getDate();
  104.         final Vector3D     position  = transitState.getPVCoordinates().getPosition();
  105.         final Frame        inertial  = transitState.getFrame();

  106.         // Elevation and azimuth in radians
  107.         final double elevation   = station.getBaseFrame().getElevation(position, inertial, date);
  108.         final double baseAzimuth = station.getBaseFrame().getAzimuth(position, inertial, date);
  109.         final double twoPiWrap   = MathUtils.normalizeAngle(baseAzimuth, measure.getObservedValue()[0]) - baseAzimuth;
  110.         final double azimuth     = baseAzimuth + twoPiWrap;

  111.         // Update estimated value taking into account the tropospheric delay.
  112.         // Azimuth - elevation values
  113.         estimated.setEstimatedValue(azimuth, elevation);
  114.     }
  115. }