TrajectoryStateHistoryMetadata.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.files.ccsds.ndm.odm.ocm;

  18. import java.util.List;

  19. import org.orekit.data.DataContext;
  20. import org.orekit.errors.OrekitException;
  21. import org.orekit.errors.OrekitMessages;
  22. import org.orekit.files.ccsds.definitions.BodyFacade;
  23. import org.orekit.files.ccsds.definitions.CelestialBodyFrame;
  24. import org.orekit.files.ccsds.definitions.ElementsType;
  25. import org.orekit.files.ccsds.definitions.FrameFacade;
  26. import org.orekit.files.ccsds.ndm.odm.oem.InterpolationMethod;
  27. import org.orekit.files.ccsds.section.CommentsContainer;
  28. import org.orekit.time.AbsoluteDate;
  29. import org.orekit.utils.units.Unit;

  30. /** Metadata for trajectory state history.
  31.  * @author Luc Maisonobe
  32.  * @since 11.0
  33.  */
  34. public class TrajectoryStateHistoryMetadata extends CommentsContainer {

  35.     /** Trajectory identification number. */
  36.     private String trajID;

  37.     /** Identification number of previous trajectory. */
  38.     private String trajPrevID;

  39.     /** Identification number of next trajectory. */
  40.     private String trajNextID;

  41.     /** Basis of this trajectory state time history data. */
  42.     private String trajBasis;

  43.     /** Identification number of the orbit determination or simulation upon which this trajectory is based. */
  44.     private String trajBasisID;

  45.     /** Interpolation method. */
  46.     private InterpolationMethod interpolationMethod;

  47.     /** Interpolation degree. */
  48.     private int interpolationDegree;

  49.     /** Type of averaging (Osculating, mean Brouwer, other...). */
  50.     private String orbAveraging;

  51.     /** Origin of reference frame. */
  52.     private BodyFacade center;

  53.     /** Reference frame of the trajectory. */
  54.     private FrameFacade trajReferenceFrame;

  55.     /** Epoch of the trajectory reference frame. */
  56.     private AbsoluteDate trajFrameEpoch;

  57.     /** Start of useable time span covered by ephemerides data, it may be
  58.      * necessary to allow for proper interpolation. */
  59.     private AbsoluteDate useableStartTime;

  60.     /** End of useable time span covered by ephemerides data, it may be
  61.      * necessary to allow for proper interpolation. */
  62.     private AbsoluteDate useableStopTime;

  63.     /** Integer orbit revolution number. */
  64.     private int orbRevNum;

  65.     /** Basis for orbit revolution counter (i.e is first launch/deployment on orbit 0 or 1). */
  66.     private int orbRevNumBasis;

  67.     /** Trajectory element set type. */
  68.     private ElementsType trajType;

  69.     /** Units of trajectory element set. */
  70.     private List<Unit> trajUnits;

  71.     /** Simple constructor.
  72.      * @param epochT0 T0 epoch from file metadata
  73.      * @param dataContext data context
  74.      */
  75.     TrajectoryStateHistoryMetadata(final AbsoluteDate epochT0, final DataContext dataContext) {
  76.         // we don't call the setXxx() methods in order to avoid
  77.         // calling refuseFurtherComments as a side effect
  78.         trajBasis           = "PREDICTED";
  79.         interpolationMethod = InterpolationMethod.HERMITE;
  80.         interpolationDegree = 3;
  81.         orbAveraging        = "OSCULATING";
  82.         center              = new BodyFacade("EARTH",
  83.                                              dataContext.getCelestialBodies().getEarth());
  84.         trajReferenceFrame  = new FrameFacade(dataContext.getFrames().getICRF(),
  85.                                               CelestialBodyFrame.ICRF, null, null,
  86.                                               CelestialBodyFrame.ICRF.name());
  87.         trajFrameEpoch      = epochT0;
  88.         trajType            = ElementsType.CARTPV;
  89.         orbRevNum           = -1;
  90.         orbRevNumBasis      = -1;
  91.     }

  92.     /** {@inheritDoc} */
  93.     @Override
  94.     public void validate(final double version) {
  95.         super.validate(version);
  96.         if (trajUnits != null) {
  97.             trajType.checkUnits(trajUnits);
  98.         }
  99.         if (orbRevNum >= 0 && orbRevNumBasis < 0) {
  100.             throw new OrekitException(OrekitMessages.UNINITIALIZED_VALUE_FOR_KEY,
  101.                                       TrajectoryStateHistoryMetadataKey.ORB_REVNUM_BASIS.name());
  102.         }
  103.     }

  104.     /** Get trajectory identification number.
  105.      * @return trajectory identification number
  106.      */
  107.     public String getTrajID() {
  108.         return trajID;
  109.     }

  110.     /** Set trajectory identification number.
  111.      * @param trajID trajectory identification number
  112.      */
  113.     public void setTrajID(final String trajID) {
  114.         refuseFurtherComments();
  115.         this.trajID = trajID;
  116.     }

  117.     /** Get identification number of previous trajectory.
  118.      * @return identification number of previous trajectory
  119.      */
  120.     public String getTrajPrevID() {
  121.         return trajPrevID;
  122.     }

  123.     /** Set identification number of previous trajectory.
  124.      * @param trajPrevID identification number of previous trajectory
  125.      */
  126.     public void setTrajPrevID(final String trajPrevID) {
  127.         refuseFurtherComments();
  128.         this.trajPrevID = trajPrevID;
  129.     }

  130.     /** Get identification number of next trajectory.
  131.      * @return identification number of next trajectory
  132.      */
  133.     public String getTrajNextID() {
  134.         return trajNextID;
  135.     }

  136.     /** Set identification number of next trajectory.
  137.      * @param trajNextID identification number of next trajectory
  138.      */
  139.     public void setTrajNextID(final String trajNextID) {
  140.         refuseFurtherComments();
  141.         this.trajNextID = trajNextID;
  142.     }

  143.     /** Get basis of this trajectory state time history data.
  144.      * @return basis of this trajectory state time history data
  145.      */
  146.     public String getTrajBasis() {
  147.         return trajBasis;
  148.     }

  149.     /** Set basis of this trajectory state time history data.
  150.      * @param trajBasis basis of this trajectory state time history data
  151.      */
  152.     public void setTrajBasis(final String trajBasis) {
  153.         refuseFurtherComments();
  154.         this.trajBasis = trajBasis;
  155.     }

  156.     /** Get identification number of the orbit determination or simulation upon which this trajectory is based.
  157.      * @return identification number of the orbit determination or simulation upon which this trajectory is based
  158.      */
  159.     public String getTrajBasisID() {
  160.         return trajBasisID;
  161.     }

  162.     /** Set identification number of the orbit determination or simulation upon which this trajectory is based.
  163.      * @param trajBasisID identification number of the orbit determination or simulation upon which this trajectory is based
  164.      */
  165.     public void setTrajBasisID(final String trajBasisID) {
  166.         refuseFurtherComments();
  167.         this.trajBasisID = trajBasisID;
  168.     }

  169.     /** Get the interpolation method to be used.
  170.      * @return the interpolation method
  171.      */
  172.     public InterpolationMethod getInterpolationMethod() {
  173.         return interpolationMethod;
  174.     }

  175.     /** Set the interpolation method to be used.
  176.      * @param interpolationMethod the interpolation method to be set
  177.      */
  178.     public void setInterpolationMethod(final InterpolationMethod interpolationMethod) {
  179.         refuseFurtherComments();
  180.         this.interpolationMethod = interpolationMethod;
  181.     }

  182.     /** Get the interpolation degree.
  183.      * @return the interpolation degree
  184.      */
  185.     public int getInterpolationDegree() {
  186.         return interpolationDegree;
  187.     }

  188.     /** Set the interpolation degree.
  189.      * @param interpolationDegree the interpolation degree to be set
  190.      */
  191.     public void setInterpolationDegree(final int interpolationDegree) {
  192.         refuseFurtherComments();
  193.         this.interpolationDegree = interpolationDegree;
  194.     }

  195.     /** Get type of averaging (Osculating, mean Brouwer, other.
  196.      * @return type of averaging (Osculating, mean Brouwer, other
  197.      .). */
  198.     public String getOrbAveraging() {
  199.         return orbAveraging;
  200.     }

  201.     /** Set type of averaging (Osculating, mean Brouwer, other.
  202.      * @param orbAveraging type of averaging (Osculating, mean Brouwer, other
  203.      .). */
  204.     public void setOrbAveraging(final String orbAveraging) {
  205.         refuseFurtherComments();
  206.         this.orbAveraging = orbAveraging;
  207.     }

  208.     /** Get the origin of reference frame.
  209.      * @return the origin of reference frame.
  210.      */
  211.     public BodyFacade getCenter() {
  212.         return center;
  213.     }

  214.     /** Set the origin of reference frame.
  215.      * @param center origin of reference frame to be set
  216.      */
  217.     public void setCenter(final BodyFacade center) {
  218.         refuseFurtherComments();
  219.         this.center = center;
  220.     }

  221.     /** Get reference frame of the trajectory.
  222.      * @return reference frame of the trajectory
  223.      */
  224.     public FrameFacade getTrajReferenceFrame() {
  225.         return trajReferenceFrame;
  226.     }

  227.     /** Set reference frame of the trajectory.
  228.      * @param trajReferenceFrame the reference frame to be set
  229.      */
  230.     public void setTrajReferenceFrame(final FrameFacade trajReferenceFrame) {
  231.         refuseFurtherComments();
  232.         this.trajReferenceFrame = trajReferenceFrame;
  233.     }

  234.     /** Get epoch of the {@link #getTrajReferenceFrame() trajectory reference frame}.
  235.      * @return epoch of the {@link #getTrajReferenceFrame() trajectory reference frame}
  236.      */
  237.     public AbsoluteDate getTrajFrameEpoch() {
  238.         return trajFrameEpoch;
  239.     }

  240.     /** Set epoch of the {@link #getTrajReferenceFrame() trajectory reference frame}.
  241.      * @param trajFrameEpoch epoch of the {@link #getTrajReferenceFrame() trajectory reference frame}
  242.      */
  243.     public void setTrajFrameEpoch(final AbsoluteDate trajFrameEpoch) {
  244.         refuseFurtherComments();
  245.         this.trajFrameEpoch = trajFrameEpoch;
  246.     }

  247.     /** Get start of useable time span covered by ephemerides data, it may be
  248.      * necessary to allow for proper interpolation.
  249.      * @return the useable start time
  250.      */
  251.     public AbsoluteDate getUseableStartTime() {
  252.         return useableStartTime;
  253.     }

  254.     /** Set start of useable time span covered by ephemerides data, it may be
  255.      * necessary to allow for proper interpolation.
  256.      * @param useableStartTime the time to be set
  257.      */
  258.     public void setUseableStartTime(final AbsoluteDate useableStartTime) {
  259.         refuseFurtherComments();
  260.         this.useableStartTime = useableStartTime;
  261.     }

  262.     /** Get end of useable time span covered by ephemerides data, it may be
  263.      * necessary to allow for proper interpolation.
  264.      * @return the useable stop time
  265.      */
  266.     public AbsoluteDate getUseableStopTime() {
  267.         return useableStopTime;
  268.     }

  269.     /** Set end of useable time span covered by ephemerides data, it may be
  270.      * necessary to allow for proper interpolation.
  271.      * @param useableStopTime the time to be set
  272.      */
  273.     public void setUseableStopTime(final AbsoluteDate useableStopTime) {
  274.         refuseFurtherComments();
  275.         this.useableStopTime = useableStopTime;
  276.     }

  277.     /** Get the integer orbit revolution number.
  278.      * @return integer orbit revolution number (-1 if not set)
  279.      */
  280.     public int getOrbRevNum() {
  281.         return orbRevNum;
  282.     }

  283.     /** Set the integer orbit revolution number.
  284.      * @param orbRevNum integer orbit revolution number
  285.      */
  286.     public void setOrbRevNum(final int orbRevNum) {
  287.         this.orbRevNum = orbRevNum;
  288.     }

  289.     /** Get the basis for orbit revolution number.
  290.      * <p>
  291.      * This specifies if first launch/deployment is on orbit 0 or 1.
  292.      * </p>
  293.      * @return basis for orbit revolution number (-1 if not set)
  294.      */
  295.     public int getOrbRevNumBasis() {
  296.         return orbRevNumBasis;
  297.     }

  298.     /** Set the basis for orbit revolution number.
  299.      * <p>
  300.      * This specifies if first launch/deployment is on orbit 0 or 1.
  301.      * </p>
  302.      * @param orbRevNumBasis basis for orbit revolution number
  303.      */
  304.     public void setOrbRevNumBasis(final int orbRevNumBasis) {
  305.         this.orbRevNumBasis = orbRevNumBasis;
  306.     }

  307.     /** Get trajectory element set type.
  308.      * @return trajectory element set type
  309.      */
  310.     public ElementsType getTrajType() {
  311.         return trajType;
  312.     }

  313.     /** Set trajectory element set type.
  314.      * @param trajType trajectory element set type
  315.      */
  316.     public void setTrajType(final ElementsType trajType) {
  317.         refuseFurtherComments();
  318.         this.trajType = trajType;
  319.     }

  320.     /** Get trajectory element set units.
  321.      * @return trajectory element set units
  322.      */
  323.     public List<Unit> getTrajUnits() {
  324.         return trajUnits;
  325.     }

  326.     /** Set trajectory element set units.
  327.      * @param trajUnits trajectory element set units
  328.      */
  329.     public void setTrajUnits(final List<Unit> trajUnits) {
  330.         refuseFurtherComments();
  331.         this.trajUnits = trajUnits;
  332.     }

  333. }