OmmTle.java

  1. /* Copyright 2002-2024 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.omm;

  18. import org.orekit.files.ccsds.section.CommentsContainer;

  19. /** Container for TLE data.
  20.  * @author sports
  21.  * @since 6.1
  22.  */
  23. public class OmmTle extends CommentsContainer {

  24.     /** Constant for EPHEMERIS_TYPE SGP.
  25.      * @since 12.0
  26.      */
  27.     public static final int EPHEMERIS_TYPE_SGP = 0;

  28.     /** Constant for EPHEMERIS_TYPE SGP4.
  29.      * @since 12.0
  30.      */
  31.     public static final int EPHEMERIS_TYPE_SGP4 = 2;

  32.     /** Constant for EPHEMERIS_TYPE PPT3.
  33.      * @since 12.0
  34.      */
  35.     public static final int EPHEMERIS_TYPE_PPT3 = 3;

  36.     /** Constant for EPHEMERIS_TYPE SGP4-XP.
  37.      * @since 12.0
  38.      */
  39.     public static final int EPHEMERIS_TYPE_SGP4_XP = 4;

  40.     /** Constant for EPHEMERIS_TYPE Special Perturbations.
  41.      * @since 12.0
  42.      */
  43.     public static final int EPHEMERIS_TYPE_SPECIAL_PERTURBATIONS = 6;

  44.     /** Ephemeris Type, only required if MEAN_ELEMENT_THEORY = SGP/SGP4. Some sources suggest the coding for
  45.      * the EPHEMERIS_TYPE keyword: 0 = SGP, 2 = SGP4, 3 = PPT3, 4 = SGP4-XP, 6 = Special Perturbations. Default value = 0.
  46.      */
  47.     private int ephemerisType;

  48.     /** Classification Type, only required if MEAN_ELEMENT_THEORY = SGP/SGP4. Some sources suggest the
  49.      *  following coding for the CLASSIFICATION_TYPE keyword: U = unclassified, S = secret. Default value = U.
  50.      */
  51.     private char classificationType;

  52.     /** NORAD Catalog Number ("Satellite Number"), an integer of up to nine digits. */
  53.     private int noradID;

  54.     /** Element set number for this satellite, only required if MEAN_ELEMENT_THEORY = SGP/SGP4.
  55.      * Normally incremented sequentially, but may be out of sync if it is generated from a backup source.
  56.      * Used to distinguish different TLEs, and therefore only meaningful if TLE based data is being exchanged. */
  57.     private int elementSetNo;

  58.     /** Revolution Number, only required if MEAN_ELEMENT_THEORY = SGP/SGP4. */
  59.     private int revAtEpoch;

  60.     /** SGP/SGP4 drag-like coefficient (in units 1/[Earth radii]), only required if MEAN_ELEMENT_THEORY = SGP/SGP4. */
  61.     private double bStar;

  62.     /** SGP4-XP drag-like coefficient (in m²/kg), only required if MEAN_ELEMENT_THEORY = SGP4-XP.
  63.      * @since 12.0
  64.      */
  65.     private double bTerm;

  66.     /** First Time Derivative of the Mean Motion, only required if MEAN_ELEMENT_THEORY = SGP. */
  67.     private double meanMotionDot;

  68.     /** Second Time Derivative of Mean Motion, only required if MEAN_ELEMENT_THEORY = SGP. */
  69.     private double meanMotionDotDot;

  70.     /** SGP4-XP solar radiation pressure-like coefficient Aγ/m (in m²/kg), only required if MEAN_ELEMENT_THEORY = SGP4-XP.
  71.      * @since 12.0
  72.      */
  73.     private double agOm;

  74.     /** Create an empty data set.
  75.      */
  76.     public OmmTle() {
  77.         ephemerisType      = EPHEMERIS_TYPE_SGP;
  78.         classificationType = 'U';
  79.         noradID            = -1;
  80.         elementSetNo       = -1;
  81.         revAtEpoch         = -1;
  82.         bStar              =  Double.NaN;
  83.         bTerm              =  Double.NaN;
  84.         meanMotionDot      =  Double.NaN;
  85.         meanMotionDotDot   =  Double.NaN;
  86.         agOm               =  Double.NaN;
  87.     }

  88.     /** {@inheritDoc} */
  89.     @Override
  90.     public void validate(final double version) {
  91.         super.validate(version);

  92.         checkNotNegative(noradID,      OmmTleKey.NORAD_CAT_ID.name());
  93.         checkNotNegative(elementSetNo, OmmTleKey.ELEMENT_SET_NO.name());
  94.         checkNotNegative(revAtEpoch,   OmmTleKey.REV_AT_EPOCH.name());

  95.         if (ephemerisType == EPHEMERIS_TYPE_SGP4) {
  96.             checkNotNaN(bStar, OmmTleKey.BSTAR.name());
  97.         } else if (ephemerisType == EPHEMERIS_TYPE_SGP4_XP) {
  98.             checkNotNaN(bTerm, OmmTleKey.BTERM.name());
  99.         }

  100.         if (ephemerisType == EPHEMERIS_TYPE_SGP  || ephemerisType == EPHEMERIS_TYPE_PPT3) {
  101.             checkNotNaN(meanMotionDot, OmmTleKey.MEAN_MOTION_DOT.name());
  102.         }

  103.         if (ephemerisType == EPHEMERIS_TYPE_SGP  || ephemerisType == EPHEMERIS_TYPE_PPT3) {
  104.             checkNotNaN(meanMotionDotDot, OmmTleKey.MEAN_MOTION_DDOT.name());
  105.         } else if (ephemerisType == EPHEMERIS_TYPE_SGP4_XP) {
  106.             checkNotNaN(agOm, OmmTleKey.AGOM.name());
  107.         }

  108.     }

  109.     /** Get the ephemeris type.
  110.      * @return the ephemerisType
  111.      */
  112.     public int getEphemerisType() {
  113.         return ephemerisType;
  114.     }

  115.     /** Set the ephemeris type.
  116.      * @param ephemerisType the ephemeris type to be set
  117.      */
  118.     public void setEphemerisType(final int ephemerisType) {
  119.         refuseFurtherComments();
  120.         this.ephemerisType = ephemerisType;
  121.     }

  122.     /** Get the classification type.
  123.      * @return the classificationType
  124.      */
  125.     public char getClassificationType() {
  126.         return classificationType;
  127.     }

  128.     /** Set the classification type.
  129.      * @param classificationType the classification type to be set
  130.      */
  131.     public void setClassificationType(final char classificationType) {
  132.         refuseFurtherComments();
  133.         this.classificationType = classificationType;
  134.     }

  135.     /** Get the NORAD Catalog Number ("Satellite Number").
  136.      * @return the NORAD Catalog Number
  137.      */
  138.     public int getNoradID() {
  139.         return noradID;
  140.     }

  141.     /** Set the NORAD Catalog Number ("Satellite Number").
  142.      * @param noradID the element set number to be set
  143.      */
  144.     public void setNoradID(final int noradID) {
  145.         refuseFurtherComments();
  146.         this.noradID = noradID;
  147.     }

  148.     /** Get the element set number for this satellite.
  149.      * @return the element set number for this satellite
  150.      */
  151.     public int getElementSetNumber() {
  152.         return elementSetNo;
  153.     }

  154.     /** Set the element set number for this satellite.
  155.      * @param elementSetNo the element set number to be set
  156.      */
  157.     public void setElementSetNo(final int elementSetNo) {
  158.         refuseFurtherComments();
  159.         this.elementSetNo = elementSetNo;
  160.     }

  161.     /** Get the revolution rumber.
  162.      * @return the revolution rumber
  163.      */
  164.     public int getRevAtEpoch() {
  165.         return revAtEpoch;
  166.     }

  167.     /** Set the revolution rumber.
  168.      * @param revAtEpoch the Revolution Number to be set
  169.      */
  170.     public void setRevAtEpoch(final int revAtEpoch) {
  171.         refuseFurtherComments();
  172.         this.revAtEpoch = revAtEpoch;
  173.     }

  174.     /** Get the SGP/SGP4 drag-like coefficient.
  175.      * @return the SGP/SGP4 drag-like coefficient
  176.      */
  177.     public double getBStar() {
  178.         return bStar;
  179.     }

  180.     /** Set the SGP/SGP4 drag-like coefficient.
  181.      * @param bstar the SGP/SGP4 drag-like coefficient to be set
  182.      */
  183.     public void setBStar(final double bstar) {
  184.         refuseFurtherComments();
  185.         this.bStar = bstar;
  186.     }

  187.     /** Get the SGP4-XP drag-like coefficient.
  188.      * @return the SGP4-XP drag-like coefficient
  189.      * @since 12.0
  190.      */
  191.     public double getBTerm() {
  192.         return bTerm;
  193.     }

  194.     /** Set the SGP4-XP drag-like coefficient.
  195.      * @param bterm the SGP4-XP drag-like coefficient to be set
  196.      * @since 12.0
  197.      */
  198.     public void setBTerm(final double bterm) {
  199.         refuseFurtherComments();
  200.         this.bTerm = bterm;
  201.     }

  202.     /** Get the first time derivative of the mean motion.
  203.      * @return the first time derivative of the mean motion
  204.      */
  205.     public double getMeanMotionDot() {
  206.         return meanMotionDot;
  207.     }

  208.     /** Set the first time derivative of the mean motion.
  209.      * @param meanMotionDot the first time derivative of the mean motion to be set
  210.      */
  211.     public void setMeanMotionDot(final double meanMotionDot) {
  212.         refuseFurtherComments();
  213.         this.meanMotionDot = meanMotionDot;
  214.     }

  215.     /** Get the second time derivative of the mean motion.
  216.      * @return the second time derivative of the mean motion
  217.      */
  218.     public double getMeanMotionDotDot() {
  219.         return meanMotionDotDot;
  220.     }

  221.     /** Set the second time derivative of the mean motion.
  222.      * @param meanMotionDotDot the second time derivative of the mean motion to be set
  223.      */
  224.     public void setMeanMotionDotDot(final double meanMotionDotDot) {
  225.         refuseFurtherComments();
  226.         this.meanMotionDotDot = meanMotionDotDot;
  227.     }

  228.     /** Get the SGP4-XP solar radiation pressure-like coefficient Aγ/m.
  229.      * @return the SGP4-XP solar radiation pressure-like coefficient Aγ/m
  230.      * @since 12.0
  231.      */
  232.     public double getAGoM() {
  233.         return agOm;
  234.     }

  235.     /** Set the SGP4-XP solar radiation pressure-like coefficient Aγ/m.
  236.      * @param agom the SGP4-XP solar radiation pressure-like coefficient Aγ/m to be set
  237.      * @since 12.0
  238.      */
  239.     public void setAGoM(final double agom) {
  240.         refuseFurtherComments();
  241.         this.agOm = agom;
  242.     }

  243. }