ITRFProvider.java

  1. /* Copyright 2002-2025 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.frames;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.geometry.euclidean.threed.FieldRotation;
  20. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  21. import org.hipparchus.geometry.euclidean.threed.Rotation;
  22. import org.hipparchus.geometry.euclidean.threed.RotationConvention;
  23. import org.hipparchus.geometry.euclidean.threed.RotationOrder;
  24. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  25. import org.orekit.time.AbsoluteDate;
  26. import org.orekit.time.FieldAbsoluteDate;
  27. import org.orekit.utils.Constants;


  28. /** International Terrestrial Reference Frame.
  29.  * <p> Handles pole motion effects and depends on {@link TIRFProvider}, its
  30.  * parent frame.</p>
  31.  * @author Luc Maisonobe
  32.  */
  33. class ITRFProvider implements EOPBasedTransformProvider {

  34.     /** S' rate in radians per julian century.
  35.      * Approximately -47 microarcsecond per julian century (Lambert and Bizouard, 2002)
  36.      */
  37.     private static final double S_PRIME_RATE = -47e-6 * Constants.ARC_SECONDS_TO_RADIANS;

  38.     /** EOP history. */
  39.     private final EOPHistory eopHistory;

  40.     /** Simple constructor.
  41.      * @param eopHistory EOP history
  42.      */
  43.     ITRFProvider(final EOPHistory eopHistory) {
  44.         this.eopHistory = eopHistory;
  45.     }

  46.     /** {@inheritDoc} */
  47.     @Override
  48.     public EOPHistory getEOPHistory() {
  49.         return eopHistory;
  50.     }

  51.     /** {@inheritDoc} */
  52.     @Override
  53.     public ITRFProvider getNonInterpolatingProvider() {
  54.         return new ITRFProvider(eopHistory.getEOPHistoryWithoutCachedTidalCorrection());
  55.     }

  56.     /** {@inheritDoc} */
  57.     @Override
  58.     public Transform getTransform(final AbsoluteDate date) {

  59.         // offset from J2000 epoch in Julian centuries
  60.         final double tts = date.durationFrom(eopHistory.getTimeScales().getJ2000Epoch());
  61.         final double ttc =  tts / Constants.JULIAN_CENTURY;

  62.         // pole correction parameters
  63.         final PoleCorrection eop = eopHistory.getPoleCorrection(date);

  64.         // pole motion in terrestrial frame
  65.         final Rotation wRot = new Rotation(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM,
  66.                                            eop.getYp(), eop.getXp(), -S_PRIME_RATE * ttc);

  67.         // combined effects
  68.         final Rotation combined = wRot.revert();

  69.         // set up the transform from parent TIRF
  70.         return new Transform(date, combined, Vector3D.ZERO);

  71.     }

  72.     /** {@inheritDoc} */
  73.     @Override
  74.     public <T extends CalculusFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {

  75.         // offset from J2000 epoch in Julian centuries
  76.         final T tts = date.durationFrom(eopHistory.getTimeScales().getJ2000Epoch());
  77.         final T ttc =  tts.divide(Constants.JULIAN_CENTURY);

  78.         // pole correction parameters
  79.         final FieldPoleCorrection<T> eop = eopHistory.getPoleCorrection(date);

  80.         // pole motion in terrestrial frame
  81.         final FieldRotation<T> wRot = new FieldRotation<>(RotationOrder.XYZ, RotationConvention.FRAME_TRANSFORM,
  82.                                                           eop.getYp(),
  83.                                                           eop.getXp(),
  84.                                                           ttc.multiply(-S_PRIME_RATE));

  85.         // combined effects
  86.         final FieldRotation<T> combined = wRot.revert();

  87.         // set up the transform from parent TIRF
  88.         return new FieldTransform<>(date, combined, FieldVector3D.getZero(date.getField()));

  89.     }

  90. }