CCSDSFrame.java

  1. /* Copyright 2002-2019 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.files.ccsds;

  18. import org.orekit.bodies.CelestialBodyFactory;
  19. import org.orekit.errors.OrekitException;
  20. import org.orekit.errors.OrekitMessages;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.frames.FramesFactory;
  23. import org.orekit.frames.ITRFVersion;
  24. import org.orekit.frames.LOFType;
  25. import org.orekit.utils.IERSConventions;

  26. /** Frames used in CCSDS Orbit Data Messages.
  27.  * @author Steven Ports
  28.  * @since 6.1
  29.  */
  30. public enum CCSDSFrame {

  31.     /** Earth Mean Equator and Equinox of J2000. */
  32.     EME2000(null) {

  33.         /** {@inheritDoc} */
  34.         @Override
  35.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  36.             return FramesFactory.getEME2000();
  37.         }

  38.     },

  39.     /** Geocentric Celestial Reference Frame. */
  40.     GCRF(null) {

  41.         /** {@inheritDoc} */
  42.         @Override
  43.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  44.             return FramesFactory.getGCRF();
  45.         }

  46.     },

  47.     /** Greenwich Rotating Coordinates. */
  48.     GRC(null) {

  49.         /** {@inheritDoc} */
  50.         @Override
  51.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  52.             if (conventions == null) {
  53.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  54.             }
  55.             return FramesFactory.getITRFEquinox(conventions, simpleEOP);
  56.         }

  57.     },

  58.     /** International Celestial Reference Frame. */
  59.     ICRF(null) {

  60.         /** {@inheritDoc} */
  61.         @Override
  62.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  63.             return FramesFactory.getICRF();
  64.         }

  65.     },

  66.     /** International Terrestrial Reference Frame 2014. */
  67.     ITRF2014(null) {

  68.         /** {@inheritDoc} */
  69.         @Override
  70.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  71.             if (conventions == null) {
  72.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  73.             }
  74.             return FramesFactory.getITRF(ITRFVersion.ITRF_2014, conventions, simpleEOP);
  75.         }

  76.     },

  77.     /** International Terrestrial Reference Frame 2008. */
  78.     ITRF2008(null) {

  79.         /** {@inheritDoc} */
  80.         @Override
  81.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  82.             if (conventions == null) {
  83.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  84.             }
  85.             return FramesFactory.getITRF(ITRFVersion.ITRF_2008, conventions, simpleEOP);
  86.         }

  87.     },

  88.     /** International Terrestrial Reference Frame 2005. */
  89.     ITRF2005(null) {

  90.         /** {@inheritDoc} */
  91.         @Override
  92.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  93.             if (conventions == null) {
  94.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  95.             }
  96.             return FramesFactory.getITRF(ITRFVersion.ITRF_2005, conventions, simpleEOP);
  97.         }

  98.     },

  99.     /** International Terrestrial Reference Frame 2000. */
  100.     ITRF2000(null) {

  101.         /** {@inheritDoc} */
  102.         @Override
  103.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  104.             if (conventions == null) {
  105.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  106.             }
  107.             return FramesFactory.getITRF(ITRFVersion.ITRF_2000, conventions, simpleEOP);
  108.         }

  109.     },

  110.     /** International Terrestrial Reference Frame 1993. */
  111.     ITRF93(null) {

  112.         /** {@inheritDoc} */
  113.         @Override
  114.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  115.             if (conventions == null) {
  116.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  117.             }
  118.             return FramesFactory.getITRF(ITRFVersion.ITRF_93, conventions, simpleEOP);
  119.         }

  120.     },

  121.     /** International Terrestrial Reference Frame 1997. */
  122.     ITRF97(null) {

  123.         /** {@inheritDoc} */
  124.         @Override
  125.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  126.             if (conventions == null) {
  127.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  128.             }
  129.             return FramesFactory.getITRF(ITRFVersion.ITRF_97, conventions, simpleEOP);
  130.         }

  131.     },

  132.     /** Mars Centered Inertial. */
  133.     MCI(null) {

  134.         /** {@inheritDoc} */
  135.         @Override
  136.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  137.             return CelestialBodyFactory.getMars().getInertiallyOrientedFrame();
  138.         }

  139.     },

  140.     /** True of Date, Rotating. */
  141.     TDR(null) {

  142.         /** {@inheritDoc} */
  143.         @Override
  144.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  145.             if (conventions == null) {
  146.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  147.             }
  148.             return FramesFactory.getGTOD(conventions, simpleEOP);
  149.         }

  150.     },

  151.     /**
  152.      * True Equator Mean Equinox.
  153.      * TEME may be used only for OMMs based on NORAD
  154.      * Two Line Element sets, and in no other circumstances.
  155.      */
  156.     TEME(null) {

  157.         /** {@inheritDoc} */
  158.         @Override
  159.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  160.             return FramesFactory.getTEME();
  161.         }

  162.     },

  163.     /** True of Date. */
  164.     TOD(null) {

  165.         /** {@inheritDoc} */
  166.         @Override
  167.         public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  168.             if (conventions == null) {
  169.                 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
  170.             }
  171.             return FramesFactory.getTOD(conventions, simpleEOP);
  172.         }

  173.     },

  174.     /** Radial, Transverse (along-track) and Normal. */
  175.     RTN(LOFType.QSW),

  176.     /** Another name for Radial, Transverse (along-track) and Normal. */
  177.     RSW(LOFType.QSW),

  178.     /** TNW : x-axis along the velocity vector, W along the orbital angular momentum vector and
  179.     N completes the right handed system. */
  180.     TNW(LOFType.TNW);

  181.     /** Type of Local Orbital Frame (may be null). */
  182.     private final LOFType lofType;

  183.     /** Simple constructor.
  184.      * @param lofType type of Local Orbital Frame (null if frame is not a Local Orbital Frame)
  185.      */
  186.     CCSDSFrame(final LOFType lofType) {
  187.         this.lofType = lofType;
  188.     }

  189.     /** Check if the frame is a Local Orbital frame.
  190.      * @return true if the frame is a Local Orbital Frame
  191.      */
  192.     public boolean isLof() {
  193.         return lofType != null;
  194.     }

  195.     /** Get the type of Local Orbital frame.
  196.      * <p>
  197.      * If the frame is not a Local Orbital frame (i.e. if this method returns null),
  198.      * then the {@link #getFrame(IERSConventions, boolean) getFrame} method must be used to
  199.      * retrieve the absolute frame.
  200.      * </p>
  201.      * @return type of Local Orbital Frame, or null if the frame is not a local orbital frame
  202.      * @see #isLof()
  203.      */
  204.     public LOFType getLofType() {
  205.         return lofType;
  206.     }

  207.     /**
  208.      * Get the frame corresponding to the CCSDS constant.
  209.      * @param conventions IERS conventions to use
  210.      * @param simpleEOP if true, tidal effects are ignored when interpolating EOP
  211.      * @return frame corresponding to the CCSDS constant
  212.      * @see #isLof()
  213.      */
  214.     public Frame getFrame(final IERSConventions conventions, final boolean simpleEOP) {
  215.         throw new OrekitException(OrekitMessages.CCSDS_INVALID_FRAME, toString());
  216.     }

  217. }