1   /* Copyright 2002-2021 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  
18  package org.orekit.files.ccsds.ndm.odm.omm;
19  
20  import org.orekit.files.ccsds.section.CommentsContainer;
21  
22  /** Container for TLE data.
23   * @author sports
24   * @since 6.1
25   */
26  public class OmmTle extends CommentsContainer {
27  
28      /** Ephemeris Type, only required if MEAN_ELEMENT_THEORY = SGP/SGP4. Some sources suggest the coding for
29       * the EPHEMERIS_TYPE keyword: 1 = SGP, 2 = SGP4, 3 = SDP4, 4 = SGP8, 5 = SDP8. Default value = 0.
30       */
31      private int ephemerisType;
32  
33      /** Classification Type, only required if MEAN_ELEMENT_THEORY = SGP/SGP4. Some sources suggest the
34       *  following coding for the CLASSIFICATION_TYPE keyword: U = unclassified, S = secret. Default value = U.
35       */
36      private char classificationType;
37  
38      /** NORAD Catalog Number ("Satellite Number"), an integer of up to nine digits. */
39      private int noradID;
40  
41      /** Element set number for this satellite, only required if MEAN_ELEMENT_THEORY = SGP/SGP4.
42       * Normally incremented sequentially, but may be out of sync if it is generated from a backup source.
43       * Used to distinguish different TLEs, and therefore only meaningful if TLE based data is being exchanged. */
44      private int elementSetNo;
45  
46      /** Revolution Number, only required if MEAN_ELEMENT_THEORY = SGP/SGP4. */
47      private int revAtEpoch;
48  
49      /** SGP/SGP4 drag-like coefficient (in units 1/[Earth radii]), only required if MEAN_ELEMENT_THEORY = SGP/SGP4. */
50      private double bStar;
51  
52      /** First Time Derivative of the Mean Motion, only required if MEAN_ELEMENT_THEORY = SGP. */
53      private double meanMotionDot;
54  
55      /** Second Time Derivative of Mean Motion, only required if MEAN_ELEMENT_THEORY = SGP. */
56      private double meanMotionDotDot;
57  
58      /** Create an empty data set.
59       */
60      public OmmTle() {
61          ephemerisType      = 0;
62          classificationType = 'U';
63          noradID            = -1;
64          elementSetNo       = -1;
65          revAtEpoch         = -1;
66          bStar              =  Double.NaN;
67          meanMotionDot      =  Double.NaN;
68          meanMotionDotDot   =  Double.NaN;
69      }
70  
71      /** {@inheritDoc} */
72      @Override
73      public void validate(final double version) {
74          super.validate(version);
75          checkNotNaN(meanMotionDot,     OmmTleKey.MEAN_MOTION_DOT);
76          checkNotNaN(meanMotionDotDot,  OmmTleKey.MEAN_MOTION_DDOT);
77          checkNotNegative(noradID,      OmmTleKey.NORAD_CAT_ID);
78          checkNotNegative(elementSetNo, OmmTleKey.ELEMENT_SET_NO);
79          checkNotNegative(revAtEpoch,   OmmTleKey.REV_AT_EPOCH);
80      }
81  
82      /** Get the ephemeris type.
83       * @return the ephemerisType
84       */
85      public int getEphemerisType() {
86          return ephemerisType;
87      }
88  
89      /** Set the ephemeris type.
90       * @param ephemerisType the ephemeris type to be set
91       */
92      public void setEphemerisType(final int ephemerisType) {
93          refuseFurtherComments();
94          this.ephemerisType = ephemerisType;
95      }
96  
97      /** Get the classification type.
98       * @return the classificationType
99       */
100     public char getClassificationType() {
101         return classificationType;
102     }
103 
104     /** Set the classification type.
105      * @param classificationType the classification type to be set
106      */
107     public void setClassificationType(final char classificationType) {
108         refuseFurtherComments();
109         this.classificationType = classificationType;
110     }
111 
112     /** Get the NORAD Catalog Number ("Satellite Number").
113      * @return the NORAD Catalog Number
114      */
115     public int getNoradID() {
116         return noradID;
117     }
118 
119     /** Set the NORAD Catalog Number ("Satellite Number").
120      * @param noradID the element set number to be set
121      */
122     public void setNoradID(final int noradID) {
123         refuseFurtherComments();
124         this.noradID = noradID;
125     }
126 
127     /** Get the element set number for this satellite.
128      * @return the element set number for this satellite
129      */
130     public int getElementSetNumber() {
131         return elementSetNo;
132     }
133 
134     /** Set the element set number for this satellite.
135      * @param elementSetNo the element set number to be set
136      */
137     public void setElementSetNo(final int elementSetNo) {
138         refuseFurtherComments();
139         this.elementSetNo = elementSetNo;
140     }
141 
142     /** Get the revolution rumber.
143      * @return the revolution rumber
144      */
145     public int getRevAtEpoch() {
146         return revAtEpoch;
147     }
148 
149     /** Set the revolution rumber.
150      * @param revAtEpoch the Revolution Number to be set
151      */
152     public void setRevAtEpoch(final int revAtEpoch) {
153         refuseFurtherComments();
154         this.revAtEpoch = revAtEpoch;
155     }
156 
157     /** Get the SGP/SGP4 drag-like coefficient.
158      * @return the SGP/SGP4 drag-like coefficient
159      */
160     public double getBStar() {
161         return bStar;
162     }
163 
164     /** Set the SGP/SGP4 drag-like coefficient.
165      * @param bstar the SGP/SGP4 drag-like coefficient to be set
166      */
167     public void setBStar(final double bstar) {
168         refuseFurtherComments();
169         this.bStar = bstar;
170     }
171 
172     /** Get the first time derivative of the mean motion.
173      * @return the first time derivative of the mean motion
174      */
175     public double getMeanMotionDot() {
176         return meanMotionDot;
177     }
178 
179     /** Set the first time derivative of the mean motion.
180      * @param meanMotionDot the first time derivative of the mean motion to be set
181      */
182     public void setMeanMotionDot(final double meanMotionDot) {
183         refuseFurtherComments();
184         this.meanMotionDot = meanMotionDot;
185     }
186 
187     /** Get the second time derivative of the mean motion.
188      * @return the second time derivative of the mean motion
189      */
190     public double getMeanMotionDotDot() {
191         return meanMotionDotDot;
192     }
193 
194     /** Set the second time derivative of the mean motion.
195      * @param meanMotionDotDot the second time derivative of the mean motion to be set
196      */
197     public void setMeanMotionDotDot(final double meanMotionDotDot) {
198         refuseFurtherComments();
199         this.meanMotionDotDot = meanMotionDotDot;
200     }
201 
202 }