ITRFProvider.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.frames;

  18. import org.hipparchus.RealFieldElement;
  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.errors.OrekitException;
  26. import org.orekit.time.AbsoluteDate;
  27. import org.orekit.time.FieldAbsoluteDate;
  28. import org.orekit.utils.Constants;


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

  35.     /** Serializable UID. */
  36.     private static final long serialVersionUID = 20130922L;

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

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

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

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

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

  60.     /** {@inheritDoc} */
  61.     @Override
  62.     public Transform getTransform(final AbsoluteDate date) throws OrekitException {

  63.         // offset from J2000 epoch in Julian centuries
  64.         final double tts = date.durationFrom(AbsoluteDate.J2000_EPOCH);
  65.         final double ttc =  tts / Constants.JULIAN_CENTURY;

  66.         // pole correction parameters
  67.         final PoleCorrection eop = eopHistory.getPoleCorrection(date);

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

  71.         // combined effects
  72.         final Rotation combined = wRot.revert();

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

  75.     }

  76.     /** {@inheritDoc} */
  77.     @Override
  78.     public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date)
  79.         throws OrekitException {

  80.         // offset from J2000 epoch in Julian centuries
  81.         final T tts = date.durationFrom(AbsoluteDate.J2000_EPOCH);
  82.         final T ttc =  tts.divide(Constants.JULIAN_CENTURY);

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

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

  90.         // combined effects
  91.         final FieldRotation<T> combined = wRot.revert();

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

  94.     }

  95. }