AngularIonosphericDelayModifier.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.Collections;
  19. import java.util.List;

  20. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  21. import org.hipparchus.util.MathUtils;
  22. import org.orekit.estimation.measurements.AngularAzEl;
  23. import org.orekit.estimation.measurements.EstimatedMeasurement;
  24. import org.orekit.estimation.measurements.EstimationModifier;
  25. import org.orekit.estimation.measurements.GroundStation;
  26. import org.orekit.frames.Frame;
  27. import org.orekit.models.earth.IonosphericModel;
  28. import org.orekit.propagation.SpacecraftState;
  29. import org.orekit.time.AbsoluteDate;
  30. import org.orekit.utils.Constants;
  31. import org.orekit.utils.ParameterDriver;

  32. /** Class modifying theoretical angular measurement with ionospheric delay.
  33.  * The effect of ionospheric correction on the angular measurement is computed
  34.  * through the computation of the ionospheric delay. The spacecraft state
  35.  * is shifted by the computed delay time and elevation and azimuth are computed
  36.  * again with the new spacecraft state.
  37.  *
  38.  * The ionospheric delay depends on the frequency of the signal (GNSS, VLBI, ...).
  39.  * For optical measurements (e.g. SLR), the ray is not affected by ionosphere charged particles.
  40.  *
  41.  * @author Thierry Ceolin
  42.  * @since 8.0
  43.  */
  44. public class AngularIonosphericDelayModifier implements EstimationModifier<AngularAzEl> {
  45.     /** Ionospheric delay model. */
  46.     private final IonosphericModel ionoModel;

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

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

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

  62.         // elevation in radians
  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.0) {

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

  76.             // Take into account one way measurement
  77.             return delay;
  78.         }

  79.         return 0;
  80.     }

  81.     /** {@inheritDoc} */
  82.     @Override
  83.     public List<ParameterDriver> getParametersDrivers() {
  84.         return Collections.emptyList();
  85.     }

  86.     @Override
  87.     public void modify(final EstimatedMeasurement<AngularAzEl> estimated) {
  88.         final AngularAzEl     measure = estimated.getObservedMeasurement();
  89.         final GroundStation   station = measure.getStation();
  90.         final SpacecraftState state   = estimated.getStates()[0];

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

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

  96.         // Update estimated value taking into account the ionospheric delay.
  97.         final AbsoluteDate date     = transitState.getDate();
  98.         final Vector3D     position = transitState.getPVCoordinates().getPosition();
  99.         final Frame        inertial = transitState.getFrame();

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

  105.         // Update estimated value taking into account the ionospheric delay.
  106.         // Azimuth - elevation values
  107.         estimated.setEstimatedValue(azimuth, elevation);
  108.     }
  109. }