ITRFProvider.java

  1. /* Copyright 2002-2022 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.     /** Serializable UID. */
  35.     private static final long serialVersionUID = 20130922L;

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

  40.     /** EOP history. */
  41.     private final EOPHistory eopHistory;

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

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

  53.     /** {@inheritDoc} */
  54.     @Override
  55.     public ITRFProvider getNonInterpolatingProvider() {
  56.         return new ITRFProvider(eopHistory.getNonInterpolatingEOPHistory());
  57.     }

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

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

  64.         // pole correction parameters
  65.         final PoleCorrection eop = eopHistory.getPoleCorrection(date);

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

  69.         // combined effects
  70.         final Rotation combined = wRot.revert();

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

  73.     }

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

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

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

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

  87.         // combined effects
  88.         final FieldRotation<T> combined = wRot.revert();

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

  91.     }

  92. }