Frames.java

  1. /* Contributed in the public domain.
  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 java.util.Collection;
  19. import java.util.function.BiFunction;
  20. import java.util.function.Supplier;

  21. import org.orekit.bodies.CelestialBodies;
  22. import org.orekit.time.TimeScales;
  23. import org.orekit.utils.IERSConventions;

  24. /**
  25.  * A collection of commonly used {@link Frame}s. This interface defines methods for
  26.  * obtaining instances of many commonly used reference frames.
  27.  *
  28.  * @author Guylaine Prat
  29.  * @author Luc Maisonobe
  30.  * @author Pascal Parraud
  31.  * @author Evan Ward
  32.  * @see FramesFactory
  33.  * @since 10.0
  34.  */
  35. public interface Frames {

  36.     /** Get Earth Orientation Parameters history.
  37.      * @param conventions conventions for which EOP history is requested
  38.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  39.      * @return Earth Orientation Parameters history
  40.      */
  41.     EOPHistory getEOPHistory(IERSConventions conventions, boolean simpleEOP);

  42.     /** Get one of the predefined frames.
  43.      * @param factoryKey key of the frame within the factory
  44.      * @return the predefined frame
  45.      */
  46.     Frame getFrame(Predefined factoryKey);

  47.     /** Get the unique GCRF frame.
  48.      * <p>The GCRF frame is the root frame in the frame tree.</p>
  49.      * @return the unique instance of the GCRF frame
  50.      */
  51.     Frame getGCRF();

  52.     /** Get the unique ICRF frame.
  53.      * <p>The ICRF frame is centered at solar system barycenter and aligned
  54.      * with GCRF.</p>
  55.      * @return the unique instance of the ICRF frame
  56.      */
  57.     Frame getICRF();

  58.     /** Get the ecliptic frame.
  59.      * The IAU defines the ecliptic as "the plane perpendicular to the mean heliocentric
  60.      * orbital angular momentum vector of the Earth-Moon barycentre in the BCRS (IAU 2006
  61.      * Resolution B1)." The +z axis is aligned with the angular momentum vector, and the +x
  62.      * axis is aligned with +x axis of {@link #getMOD(IERSConventions) MOD}.
  63.      *
  64.      * <p> This implementation agrees with the JPL 406 ephemerides to within 0.5 arc seconds.
  65.      * @param conventions IERS conventions to apply
  66.      * @return the selected reference frame singleton.
  67.      */
  68.     Frame getEcliptic(IERSConventions conventions);

  69.     /** Get the unique EME2000 frame.
  70.      * <p>The EME2000 frame is also called the J2000 frame.
  71.      * The former denomination is preferred in Orekit.</p>
  72.      * @return the unique instance of the EME2000 frame
  73.      */
  74.     FactoryManagedFrame getEME2000();

  75.     /** Get an unspecified International Terrestrial Reference Frame.
  76.      * <p>
  77.      * The frame returned uses the {@link EOPEntry Earth Orientation Parameters}
  78.      * blindly. So if for example one loads only EOP 14 C04 files to retrieve
  79.      * the parameters, the frame will be an {@link ITRFVersion#ITRF_2014}. However,
  80.      * if parameters are loaded from different files types, or even for file
  81.      * types that changed their reference (like Bulletin A switching from
  82.      * {@link ITRFVersion#ITRF_2008} to {@link ITRFVersion#ITRF_2014} starting
  83.      * with Vol. XXXI No. 013 published on 2018-03-29), then the ITRF returned
  84.      * by this method will jump from one version to another version.
  85.      * </p>
  86.      * <p>
  87.      * IF a specific version of ITRF is needed, then {@link #getITRF(ITRFVersion,
  88.      * IERSConventions, boolean)} should be used instead.
  89.      * </p>
  90.      * @param conventions IERS conventions to apply
  91.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  92.      * @return the selected reference frame singleton.
  93.      * @see #getITRF(ITRFVersion, IERSConventions, boolean)
  94.      * @since 6.1
  95.      */
  96.     FactoryManagedFrame getITRF(IERSConventions conventions,
  97.                                 boolean simpleEOP);

  98.     /** Get the TIRF reference frame, ignoring tidal effects.
  99.      * @param conventions IERS conventions to apply
  100.      * @return the selected reference frame singleton.
  101.      * library cannot be read.
  102.      */
  103.     FactoryManagedFrame getTIRF(IERSConventions conventions);

  104.     /** Get an specific International Terrestrial Reference Frame.
  105.      * <p>
  106.      * Note that if a specific version of ITRF is required, then {@code simpleEOP}
  107.      * should most probably be set to {@code false}, as ignoring tidal effects
  108.      * has an effect of the same order of magnitude as the differences between
  109.      * the various {@link ITRFVersion ITRF versions}.
  110.      * </p>
  111.      * @param version ITRF version
  112.      * @param conventions IERS conventions to apply
  113.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  114.      * @return the selected reference frame singleton.
  115.      * @since 9.2
  116.      */
  117.     VersionedITRF getITRF(ITRFVersion version,
  118.                           IERSConventions conventions,
  119.                           boolean simpleEOP);

  120.     /** Get the TIRF reference frame.
  121.      * @param conventions IERS conventions to apply
  122.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  123.      * @return the selected reference frame singleton.
  124.      * @since 6.1
  125.      */
  126.     FactoryManagedFrame getTIRF(IERSConventions conventions,
  127.                                 boolean simpleEOP);

  128.     /** Get the CIRF2000 reference frame.
  129.      * @param conventions IERS conventions to apply
  130.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  131.      * @return the selected reference frame singleton.
  132.      */
  133.     FactoryManagedFrame getCIRF(IERSConventions conventions,
  134.                                 boolean simpleEOP);

  135.     /** Get the VEIS 1950 reference frame.
  136.      * <p>Its parent frame is the GTOD frame with IERS 1996 conventions without EOP corrections.<p>
  137.      * @return the selected reference frame singleton.
  138.      */
  139.     FactoryManagedFrame getVeis1950();

  140.     /** Get the equinox-based ITRF reference frame.
  141.      * @param conventions IERS conventions to apply
  142.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  143.      * @return the selected reference frame singleton.
  144.      * @since 6.1
  145.      */
  146.     FactoryManagedFrame getITRFEquinox(IERSConventions conventions,
  147.                                        boolean simpleEOP);

  148.     /** Get the GTOD reference frame.
  149.      * <p>
  150.      * The applyEOPCorr parameter is available mainly for testing purposes or for
  151.      * consistency with legacy software that don't handle EOP correction parameters.
  152.      * Beware that setting this parameter to {@code false} leads to crude accuracy
  153.      * (order of magnitudes for errors might be above 250m in LEO and 1400m in GEO).
  154.      * For this reason, setting this parameter to false is restricted to {@link
  155.      * IERSConventions#IERS_1996 IERS 1996} conventions, and hence the {@link
  156.      * IERSConventions IERS conventions} cannot be freely chosen here.
  157.      * </p>
  158.      * @param applyEOPCorr if true, EOP corrections are applied (here, dut1 and lod)
  159.      * @return the selected reference frame singleton.
  160.      */
  161.     FactoryManagedFrame getGTOD(boolean applyEOPCorr);

  162.     /** Get the GTOD reference frame.
  163.      * @param conventions IERS conventions to apply
  164.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  165.      * @return the selected reference frame singleton.
  166.      */
  167.     FactoryManagedFrame getGTOD(IERSConventions conventions,
  168.                                 boolean simpleEOP);

  169.     /** Get the TOD reference frame.
  170.      * <p>
  171.      * The applyEOPCorr parameter is available mainly for testing purposes or for
  172.      * consistency with legacy software that don't handle EOP correction parameters.
  173.      * Beware that setting this parameter to {@code false} leads to crude accuracy
  174.      * (order of magnitudes for errors might be above 1m in LEO and 10m in GEO).
  175.      * For this reason, setting this parameter to false is restricted to {@link
  176.      * IERSConventions#IERS_1996 IERS 1996} conventions, and hence the {@link
  177.      * IERSConventions IERS conventions} cannot be freely chosen here.
  178.      * </p>
  179.      * @param applyEOPCorr if true, EOP corrections are applied (here, nutation)
  180.      * @return the selected reference frame singleton.
  181.      */
  182.     FactoryManagedFrame getTOD(boolean applyEOPCorr);

  183.     /** Get the TOD reference frame.
  184.      * @param conventions IERS conventions to apply
  185.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  186.      * @return the selected reference frame singleton.
  187.      */
  188.     FactoryManagedFrame getTOD(IERSConventions conventions,
  189.                                boolean simpleEOP);

  190.     /** Get the MOD reference frame.
  191.      * <p>
  192.      * The applyEOPCorr parameter is available mainly for testing purposes or for
  193.      * consistency with legacy software that don't handle EOP correction parameters.
  194.      * Beware that setting this parameter to {@code false} leads to crude accuracy
  195.      * (order of magnitudes for errors might be above 1m in LEO and 10m in GEO).
  196.      * For this reason, setting this parameter to false is restricted to {@link
  197.      * IERSConventions#IERS_1996 IERS 1996} conventions, and hence the {@link
  198.      * IERSConventions IERS conventions} cannot be freely chosen here.
  199.      * </p>
  200.      * @param applyEOPCorr if true, EOP corrections are applied (EME2000/GCRF bias compensation)
  201.      * @return the selected reference frame singleton.
  202.      */
  203.     FactoryManagedFrame getMOD(boolean applyEOPCorr);

  204.     /** Get the MOD reference frame.
  205.      * @param conventions IERS conventions to apply
  206.      * @return the selected reference frame singleton.
  207.      */
  208.     FactoryManagedFrame getMOD(IERSConventions conventions);

  209.     /** Get the TEME reference frame.
  210.      * <p>
  211.      * The TEME frame is used for the SGP4 model in TLE propagation. This frame has <em>no</em>
  212.      * official definition and there are some ambiguities about whether it should be used
  213.      * as "of date" or "of epoch". This frame should therefore be used <em>only</em> for
  214.      * TLE propagation and not for anything else, as recommended by the CCSDS Orbit Data Message
  215.      * blue book.
  216.      * </p>
  217.      * @return the selected reference frame singleton.
  218.      */
  219.     FactoryManagedFrame getTEME();

  220.     /** Get the PZ-90.11 (Parametry Zemly  – 1990.11) reference frame.
  221.      * <p>
  222.      * The PZ-90.11 reference system was updated on all operational
  223.      * GLONASS satellites starting from 3:00 pm on December 31, 2013.
  224.      * </p>
  225.      * <p>
  226.      * The transition between parent frame (ITRF-2008) and PZ-90.11 frame is performed using
  227.      * a seven parameters Helmert transformation.
  228.      * <pre>
  229.      *    From       To      ΔX(m)   ΔY(m)   ΔZ(m)   RX(mas)   RY(mas)  RZ(mas)   Epoch
  230.      * ITRF-2008  PZ-90.11  +0.003  +0.001  -0.000   +0.019    -0.042   +0.002     2010
  231.      * </pre>
  232.      * @see "Springer Handbook of Global Navigation Satellite Systems, Peter Teunissen & Oliver Montenbruck"
  233.      *
  234.      * @param convention IERS conventions to apply
  235.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  236.      * @return the selected reference frame singleton.
  237.      */
  238.     FactoryManagedFrame getPZ9011(IERSConventions convention,
  239.                                   boolean simpleEOP);

  240.     /* Helpers for creating instances */

  241.     /**
  242.      * Create a set of frames from the given data.
  243.      *
  244.      * @param timeScales      used to build the frames as well as the EOP data set.
  245.      * @param celestialBodies used to get {@link #getICRF()} which is the inertial frame
  246.      *                        of the solar system barycenter.
  247.      * @return a set of reference frame constructed from the given data.
  248.      * @see #of(TimeScales, Supplier)
  249.      */
  250.     static Frames of(final TimeScales timeScales,
  251.                      final CelestialBodies celestialBodies) {
  252.         return of(timeScales, () -> celestialBodies.getSolarSystemBarycenter()
  253.                 .getInertiallyOrientedFrame());
  254.     }

  255.     /**
  256.      * Create a set of frames from the given data.
  257.      *
  258.      * @param timeScales   used to build the frames as well as the EOP data set.
  259.      * @param icrfSupplier used to get {@link #getICRF()}. For example, {@code
  260.      *                     celestialBodies.getSolarSystemBarycenter().getInertiallyOrientedFrame()}
  261.      * @return a set of reference frame constructed from the given data.
  262.      * @see CelestialBodies
  263.      * @see TimeScales#of(Collection, BiFunction)
  264.      */
  265.     static Frames of(final TimeScales timeScales,
  266.                      final Supplier<Frame> icrfSupplier) {
  267.         return new AbstractFrames(timeScales, icrfSupplier) {
  268.             @Override
  269.             public EOPHistory getEOPHistory(final IERSConventions conventions,
  270.                                             final boolean simpleEOP) {
  271.                 return getTimeScales().getUT1(conventions, simpleEOP).getEOPHistory();
  272.             }
  273.         };
  274.     }

  275. }