AngularIonosphericDelayModifier.java

  1. /* Copyright 2002-2024 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.geometry.euclidean.threed.Vector3D;
  20. import org.hipparchus.util.MathUtils;
  21. import org.orekit.estimation.measurements.AngularAzEl;
  22. import org.orekit.estimation.measurements.EstimatedMeasurementBase;
  23. import org.orekit.estimation.measurements.EstimationModifier;
  24. import org.orekit.estimation.measurements.GroundStation;
  25. import org.orekit.frames.Frame;
  26. import org.orekit.frames.TopocentricFrame;
  27. import org.orekit.models.earth.ionosphere.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. import org.orekit.utils.TrackingCoordinates;

  33. /** Class modifying theoretical angular measurement with ionospheric delay.
  34.  * <p>
  35.  * The effect of ionospheric correction on the angular measurement is computed
  36.  * through the computation of the ionospheric delay. The spacecraft state
  37.  * is shifted by the computed delay time and elevation and azimuth are computed
  38.  * again with the new spacecraft state.
  39.  * </p>
  40.  * <p>
  41.  * The ionospheric delay depends on the frequency of the signal (GNSS, VLBI, ...).
  42.  * For optical measurements (e.g. SLR), the ray is not affected by ionosphere charged particles.
  43.  * </p>
  44.  * <p>
  45.  * Since 10.0, state derivatives and ionospheric parameters derivates are computed
  46.  * using automatic differentiation.
  47.  * </p>
  48.  * @author Thierry Ceolin
  49.  * @since 8.0
  50.  */
  51. public class AngularIonosphericDelayModifier implements EstimationModifier<AngularAzEl> {

  52.     /** Ionospheric delay model. */
  53.     private final IonosphericModel ionoModel;

  54.     /** Frequency [Hz]. */
  55.     private final double frequency;

  56.     /** Constructor.
  57.      *
  58.      * @param model  Ionospheric delay model appropriate for the current angular measurement method.
  59.      * @param freq frequency of the signal in Hz
  60.      */
  61.     public AngularIonosphericDelayModifier(final IonosphericModel model,
  62.                                            final double freq) {
  63.         ionoModel = model;
  64.         frequency = freq;
  65.     }

  66.     /** Compute the measurement error due to ionosphere.
  67.      * @param station station
  68.      * @param state spacecraft state
  69.      * @return the measurement error due to ionosphere
  70.      */
  71.     private double angularErrorIonosphericModel(final GroundStation station,
  72.                                                 final SpacecraftState state) {
  73.         // Base frame associated with the station
  74.         final TopocentricFrame baseFrame = station.getBaseFrame();
  75.         // delay in meters
  76.         return ionoModel.pathDelay(state, baseFrame, frequency, ionoModel.getParameters(state.getDate()));
  77.     }

  78.     /** {@inheritDoc} */
  79.     @Override
  80.     public List<ParameterDriver> getParametersDrivers() {
  81.         return ionoModel.getParametersDrivers();
  82.     }

  83.     @Override
  84.     public void modifyWithoutDerivatives(final EstimatedMeasurementBase<AngularAzEl> estimated) {
  85.         final AngularAzEl     measure = estimated.getObservedMeasurement();
  86.         final GroundStation   station = measure.getStation();
  87.         final SpacecraftState state   = estimated.getStates()[0];

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

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

  93.         // Update estimated value taking into account the ionospheric delay.
  94.         final AbsoluteDate date     = transitState.getDate();
  95.         final Vector3D     position = transitState.getPosition();
  96.         final Frame        inertial = transitState.getFrame();

  97.         // Elevation and azimuth in radians
  98.         final TrackingCoordinates tc = station.getBaseFrame().getTrackingCoordinates(position, inertial, date);
  99.         final double twoPiWrap   = MathUtils.normalizeAngle(tc.getAzimuth(), measure.getObservedValue()[0]) - tc.getAzimuth();
  100.         final double azimuth     = tc.getAzimuth() + twoPiWrap;

  101.         // Update estimated value taking into account the ionospheric delay.
  102.         // Azimuth - elevation values
  103.         estimated.modifyEstimatedValue(this, azimuth, tc.getElevation());
  104.     }

  105. }