AngularTroposphericDelayModifier.java

  1. /* Copyright 2002-2018 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.Collections;
  19. import java.util.List;

  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  21. import org.hipparchus.util.MathUtils;
  22. import org.orekit.errors.OrekitException;
  23. import org.orekit.estimation.measurements.AngularAzEl;
  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.frames.Frame;
  28. import org.orekit.models.earth.TroposphericModel;
  29. import org.orekit.propagation.SpacecraftState;
  30. import org.orekit.time.AbsoluteDate;
  31. import org.orekit.utils.Constants;
  32. import org.orekit.utils.ParameterDriver;

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

  46.     /** Tropospheric delay model. */
  47.     private final TroposphericModel tropoModel;

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

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

  65.     /** Compute the measurement error due to Troposphere.
  66.      * @param station station
  67.      * @param state spacecraft state
  68.      * @return the measurement error due to Troposphere
  69.      * @throws OrekitException  if frames transformations cannot be computed
  70.      */
  71.     private double angularErrorTroposphericModel(final GroundStation station,
  72.                                                  final SpacecraftState state)
  73.         throws OrekitException {
  74.         //
  75.         final Vector3D position = state.getPVCoordinates().getPosition();

  76.         // elevation
  77.         final double elevation = station.getBaseFrame().getElevation(position,
  78.                                                                      state.getFrame(),
  79.                                                                      state.getDate());

  80.         // only consider measures above the horizon
  81.         if (elevation > 0.0) {
  82.             // altitude AMSL in meters
  83.             final double height = getStationHeightAMSL(station);

  84.             // delay in meters
  85.             final double delay = tropoModel.pathDelay(elevation, height);

  86.             // one-way measurement.
  87.             return delay;
  88.         }

  89.         return 0;
  90.     }

  91.     /** {@inheritDoc} */
  92.     @Override
  93.     public List<ParameterDriver> getParametersDrivers() {
  94.         return Collections.emptyList();
  95.     }

  96.     @Override
  97.     public void modify(final EstimatedMeasurement<AngularAzEl> estimated)
  98.         throws OrekitException {
  99.         final AngularAzEl     measure = estimated.getObservedMeasurement();
  100.         final GroundStation   station = measure.getStation();
  101.         final SpacecraftState state   = estimated.getStates()[0];

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

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

  107.         // Update measurement value taking into account the ionospheric delay.
  108.         final AbsoluteDate date      = transitState.getDate();
  109.         final Vector3D     position  = transitState.getPVCoordinates().getPosition();
  110.         final Frame        inertial  = transitState.getFrame();

  111.         // Elevation and azimuth in radians
  112.         final double elevation   = station.getBaseFrame().getElevation(position, inertial, date);
  113.         final double baseAzimuth = station.getBaseFrame().getAzimuth(position, inertial, date);
  114.         final double twoPiWrap   = MathUtils.normalizeAngle(baseAzimuth, measure.getObservedValue()[0]) - baseAzimuth;
  115.         final double azimuth     = baseAzimuth + twoPiWrap;

  116.         // Update estimated value taking into account the tropospheric delay.
  117.         // Azimuth - elevation values
  118.         estimated.setEstimatedValue(azimuth, elevation);
  119.     }
  120. }