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
18 package org.orekit.files.ccsds;
19
20 import org.orekit.errors.OrekitException;
21 import org.orekit.errors.OrekitMessages;
22
23 /**
24 * The ODMFile (Orbit Data Message) class represents any of the three orbit messages used by the CCSDS,
25 * i.e. the Orbit Parameter Message (OPM), the Mean-Elements Message (OMM) and the Orbit Ephemeris Message (OEM).
26 * It contains the information of the message's header and configuration data (set in the parser).
27 * @author sports
28 * @since 6.1
29 */
30 public abstract class ODMFile extends NDMFile {
31
32 /** Gravitational coefficient set by the user in the parser. */
33 private double muSet;
34
35 /** Gravitational coefficient parsed in the ODM File. */
36 private double muParsed;
37
38 /** Gravitational coefficient created from the knowledge of the central body. */
39 private double muCreated;
40
41 /** Final gravitational coefficient (used for the public methods that need such a parameter, ex: generateCartesianOrbit).
42 * In order of decreasing priority, finalMU is equal to: the coefficient parsed in the file, the coefficient set by the
43 * user with the parser's method setMu, the coefficient created from the knowledge of the central body.
44 */
45 private double muUsed;
46
47 /** ODMFile constructor. */
48 public ODMFile() {
49 muSet = Double.NaN;
50 muParsed = Double.NaN;
51 muCreated = Double.NaN;
52 muUsed = Double.NaN;
53 }
54
55 /**
56 * Get the gravitational coefficient set by the user.
57 * @return the coefficient
58 */
59 public double getMuSet() {
60 return muSet;
61 }
62
63 /**
64 * Set the gravitational coefficient set by the user.
65 * @param muSet the coefficient to be set
66 */
67 public void setMuSet(final double muSet) {
68 this.muSet = muSet;
69 }
70
71 /**
72 * Get the gravitational coefficient parsed in the ODM File.
73 * @return the coefficient
74 */
75 public double getMuParsed() {
76 return muParsed;
77 }
78
79 /**
80 * Set the gravitational coefficient parsed in the ODM File.
81 * @param muParsed the coefficient to be set
82 */
83 void setMuParsed(final double muParsed) {
84 this.muParsed = muParsed;
85 }
86
87 /**
88 * Get the gravitational coefficient created from the knowledge of the central body.
89 * @return the coefficient
90 */
91 public double getMuCreated() {
92 return muCreated;
93 }
94
95 /**
96 * Set the gravitational coefficient created from the knowledge of the central body.
97 * @param muCreated the coefficient to be set
98 */
99 void setMuCreated(final double muCreated) {
100 this.muCreated = muCreated;
101 }
102
103 /**
104 * Get the used gravitational coefficient.
105 * @return the coefficient
106 */
107 public double getMuUsed() {
108 return muUsed;
109 }
110
111 /**
112 * Set the gravitational coefficient created from the knowledge of the central body.
113 * In order of decreasing priority, finalMU is set equal to:
114 * <ol>
115 * <li>the coefficient parsed in the file,</li>
116 * <li>the coefficient set by the user with the parser's method setMu,</li>
117 * <li>the coefficient created from the knowledge of the central body.</li>
118 * </ol>
119 */
120 protected void setMuUsed() {
121 if (!Double.isNaN(muParsed)) {
122 muUsed = muParsed;
123 } else if (!Double.isNaN(muSet)) {
124 muUsed = muSet;
125 } else if (!Double.isNaN(muCreated)) {
126 muUsed = muCreated;
127 } else {
128 throw new OrekitException(OrekitMessages.CCSDS_UNKNOWN_GM);
129 }
130 }
131
132 }
133