1   /* Copyright 2002-2020 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;
18  
19  import java.util.ArrayList;
20  import java.util.List;
21  
22  import org.orekit.data.DataContext;
23  import org.orekit.errors.OrekitException;
24  import org.orekit.errors.OrekitMessages;
25  import org.orekit.time.AbsoluteDate;
26  import org.orekit.utils.IERSConventions;
27  
28  /**
29   * The NDMFile (Navigation Data Message) class represents the navigation
30   * messages used by the CCSDS format, (i.e. the Attitude Data Message (ADM),
31   * the Orbit Data Message (ODM) and the Tracking Data Message (TDM)).
32   * It contains the information of the message's header and configuration data
33   * (set in the parser).
34   * @see ADMFile
35   * @see ODMFile
36   * @see TDMFile
37   * @author Bryan Cazabonne
38   * @since 10.2
39   */
40  public abstract class NDMFile {
41  
42      /** CCSDS Format version. */
43      private double formatVersion;
44  
45      /** Header comments. The list contains a string for each line of comment. */
46      private List<String> headerComment;
47  
48      /** File creation date and time in UTC. */
49      private AbsoluteDate creationDate;
50  
51      /** Creating agency or operator. */
52      private String originator;
53  
54      /** Data context. */
55      private DataContext dataContext;
56  
57      /** IERS conventions used. */
58      private IERSConventions conventions;
59  
60      /** Gravitational coefficient. */
61      private double mu;
62  
63      /** Initial Date for MET or MRT time systems. */
64      private AbsoluteDate missionReferenceDate;
65  
66      /**
67       * Constructor.
68       */
69      public NDMFile() {
70          mu = Double.NaN;
71      }
72  
73      /**
74       * Get the used gravitational coefficient.
75       * @return the coefficient
76       */
77      public double getMu() {
78          return mu;
79      }
80  
81      /**
82       * Set the used gravitational coefficient.
83       * @param mu the coefficient to set
84       */
85      public void setMu(final double mu) {
86          this.mu = mu;
87      }
88  
89      /**
90       * Get the CCSDS NDM (ADM or ODM) format version.
91       * @return format version
92       */
93      public double getFormatVersion() {
94          return formatVersion;
95      }
96  
97      /**
98       * Set the CCSDS NDM (ADM or ODM) format version.
99       * @param formatVersion the format version to be set
100      */
101     public void setFormatVersion(final double formatVersion) {
102         this.formatVersion = formatVersion;
103     }
104 
105     /**
106      * Get the header comment.
107      * @return header comment
108      */
109     public List<String> getHeaderComment() {
110         return headerComment;
111     }
112 
113     /**
114      * Set the header comment.
115      * @param headerComment header comment
116      */
117     public void setHeaderComment(final List<String> headerComment) {
118         this.headerComment = new ArrayList<String>(headerComment);
119     }
120 
121     /**
122      * Get the file creation date and time in UTC.
123      * @return the file creation date and time in UTC.
124      */
125     public AbsoluteDate getCreationDate() {
126         return creationDate;
127     }
128 
129     /**
130      * Set the file creation date and time in UTC.
131      * @param creationDate the creation date to be set
132      */
133     public void setCreationDate(final AbsoluteDate creationDate) {
134         this.creationDate = creationDate;
135     }
136 
137     /**
138      * Get the file originator.
139      * @return originator the file originator.
140      */
141     public String getOriginator() {
142         return originator;
143     }
144 
145     /**
146      * Set the file originator.
147      * @param originator the originator to be set
148      */
149     public void setOriginator(final String originator) {
150         this.originator = originator;
151     }
152 
153     /**
154      * Get IERS conventions.
155      * @return conventions IERS conventions
156      */
157     public IERSConventions getConventions() {
158         if (conventions != null) {
159             return conventions;
160         } else {
161             throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_CONVENTIONS);
162         }
163     }
164 
165     /**
166      * Set IERS conventions.
167      * @param conventions IERS conventions to be set
168      */
169     public void setConventions(final IERSConventions conventions) {
170         this.conventions = conventions;
171     }
172 
173     /**
174      * Get reference date for Mission Elapsed Time and Mission Relative Time time systems.
175      * @return the reference date
176      */
177     public AbsoluteDate getMissionReferenceDate() {
178         return missionReferenceDate;
179     }
180 
181     /**
182      * Set reference date for Mission Elapsed Time and Mission Relative Time time systems.
183      * @param missionReferenceDate reference date for Mission Elapsed Time and Mission Relative Time time systems.
184      */
185     public void setMissionReferenceDate(final AbsoluteDate missionReferenceDate) {
186         this.missionReferenceDate = missionReferenceDate;
187     }
188 
189     /**
190      * Get the data context.
191      * @return the data context used for creating frames, time scales, etc.
192      */
193     public DataContext getDataContext() {
194         return dataContext;
195     }
196 
197     /**
198      * Set the data context.
199      * @param dataContext used for creating frames, time scales, etc.
200      */
201     public void setDataContext(final DataContext dataContext) {
202         this.dataContext = dataContext;
203     }
204 
205 }