VEISProvider.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.Vector3D;
  24. import org.hipparchus.util.MathUtils;
  25. import org.orekit.errors.OrekitException;
  26. import org.orekit.time.AbsoluteDate;
  27. import org.orekit.time.DateComponents;
  28. import org.orekit.time.FieldAbsoluteDate;
  29. import org.orekit.time.TimeScalesFactory;
  30. import org.orekit.utils.Constants;

  31. /** Veis 1950 Frame.
  32.  * <p>Its parent frame is the {@link GTODProvider} without EOP correction application.
  33.  * <p>This frame is mainly provided for consistency with legacy softwares.</p>
  34.  * @author Pascal Parraud
  35.  */
  36. class VEISProvider implements TransformProvider {

  37.     /** Serializable UID. */
  38.     private static final long serialVersionUID = 20130530L;

  39.     /** Reference date. */
  40.     private static AbsoluteDate VST_REFERENCE =
  41.         new AbsoluteDate(DateComponents.FIFTIES_EPOCH, TimeScalesFactory.getTAI());

  42.     /** 1st coef for Veis sidereal time computation in radians (100.075542 deg). */
  43.     private static final double VST0 = 1.746647708617871;

  44.     /** 2nd coef for Veis sidereal time computation in rad/s (0.985612288 deg/s). */
  45.     private static final double VST1 = 0.17202179573714597e-1;

  46.     /** Veis sidereal time derivative in rad/s. */
  47.     private static final double VSTD = 7.292115146705209e-5;

  48.     /** Constructor for the singleton.
  49.      */
  50.     VEISProvider() {
  51.     }

  52.     /** {@inheritDoc} */
  53.     @Override
  54.     public Transform getTransform(final AbsoluteDate date) throws OrekitException {

  55.         // offset from FIFTIES epoch (UT1 scale)
  56.         final double dtai = date.durationFrom(VST_REFERENCE);
  57.         final double dutc = TimeScalesFactory.getUTC().offsetFromTAI(date);
  58.         final double dut1 = 0.0; // fixed at 0 since Veis parent is GTOD frame WITHOUT EOP corrections

  59.         final double tut1 = dtai + dutc + dut1;
  60.         final double ttd  = tut1 / Constants.JULIAN_DAY;
  61.         final double rdtt = ttd - (int) ttd;

  62.         // compute Veis sidereal time, in radians
  63.         final double vst = (VST0 + VST1 * ttd + MathUtils.TWO_PI * rdtt) % MathUtils.TWO_PI;

  64.         // compute angular rotation of Earth, in rad/s
  65.         final Vector3D rotationRate = new Vector3D(-VSTD, Vector3D.PLUS_K);

  66.         // set up the transform from parent GTOD
  67.         return new Transform(date,
  68.                              new Rotation(Vector3D.PLUS_K, vst, RotationConvention.VECTOR_OPERATOR),
  69.                              rotationRate);

  70.     }

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

  75.         // offset from FIFTIES epoch (UT1 scale)
  76.         final T dtai = date.durationFrom(VST_REFERENCE);
  77.         final double dutc = TimeScalesFactory.getUTC().offsetFromTAI(date.toAbsoluteDate());
  78.         final double dut1 = 0.0; // fixed at 0 since Veis parent is GTOD frame WITHOUT EOP corrections

  79.         final T tut1 = dtai.add(dutc + dut1);
  80.         final T ttd  = tut1.divide(Constants.JULIAN_DAY);
  81.         final T rdtt = ttd.subtract((int) ttd.getReal());

  82.         // compute Veis sidereal time, in radians
  83.         final T vst = ttd.multiply(VST1).add(rdtt.multiply(MathUtils.TWO_PI)).add(VST0).remainder(MathUtils.TWO_PI);

  84.         // compute angular rotation of Earth, in rad/s
  85.         final FieldVector3D<T> rotationRate = new FieldVector3D<>(date.getField().getZero().add(-VSTD),
  86.                                                                   Vector3D.PLUS_K);

  87.         // set up the transform from parent GTOD
  88.         return new FieldTransform<>(date,
  89.                                     new FieldRotation<>(FieldVector3D.getPlusK(date.getField()), vst,
  90.                                                         RotationConvention.VECTOR_OPERATOR),
  91.                                     rotationRate);

  92.     }

  93. }