AngularIonosphericDelayModifier.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.IonosphericModel;
  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 ionospheric delay.
  34.  * The effect of ionospheric correction on the angular measurement is computed
  35.  * through the computation of the ionospheric 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.  * The ionospheric delay depends on the frequency of the signal (GNSS, VLBI, ...).
  40.  * For optical measurements (e.g. SLR), the ray is not affected by ionosphere charged particles.
  41.  *
  42.  * @author Thierry Ceolin
  43.  * @since 8.0
  44.  */
  45. public class AngularIonosphericDelayModifier implements EstimationModifier<AngularAzEl> {
  46.     /** Ionospheric delay model. */
  47.     private final IonosphericModel ionoModel;

  48.     /** Constructor.
  49.      *
  50.      * @param model  Ionospheric delay model appropriate for the current angular measurement method.
  51.      */
  52.     public AngularIonosphericDelayModifier(final IonosphericModel model) {
  53.         ionoModel = model;
  54.     }

  55.     /** Compute the measurement error due to ionosphere.
  56.      * @param station station
  57.      * @param state spacecraft state
  58.      * @return the measurement error due to ionosphere
  59.      * @throws OrekitException  if frames transformations cannot be computed
  60.      */
  61.     private double angularErrorIonosphericModel(final GroundStation station,
  62.                                                 final SpacecraftState state)
  63.         throws OrekitException {

  64.         final Vector3D position = state.getPVCoordinates().getPosition();

  65.         // elevation in radians
  66.         final double elevation = station.getBaseFrame().getElevation(position,
  67.                                                                      state.getFrame(),
  68.                                                                      state.getDate());
  69.         // only consider measures above the horizon
  70.         if (elevation > 0.0) {

  71.             // compute azimuth
  72.             final double azimuth = station.getBaseFrame().getAzimuth(position,
  73.                                                                      state.getFrame(),
  74.                                                                      state.getDate());
  75.             // delay in meters
  76.             final double delay = ionoModel.pathDelay(state.getDate(),
  77.                                                      station.getBaseFrame().getPoint(),
  78.                                                      elevation, azimuth);

  79.             // Take into account one way measurement
  80.             return delay;
  81.         }

  82.         return 0;
  83.     }

  84.     /** {@inheritDoc} */
  85.     @Override
  86.     public List<ParameterDriver> getParametersDrivers() {
  87.         return Collections.emptyList();
  88.     }

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

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

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

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

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

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