1   /* Copyright 2002-2025 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.ocm;
19  
20  import java.util.List;
21  
22  import org.orekit.files.ccsds.definitions.FrameFacade;
23  import org.orekit.files.ccsds.definitions.OrbitRelativeFrame;
24  import org.orekit.files.ccsds.section.CommentsContainer;
25  import org.orekit.time.AbsoluteDate;
26  import org.orekit.utils.units.Unit;
27  
28  /** Metadata for covariance history.
29   * <p>
30   * Beware that the Orekit getters and setters all rely on SI units. The parsers
31   * and writers take care of converting these SI units into CCSDS mandatory units.
32   * The {@link org.orekit.utils.units.Unit Unit} class provides useful
33   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
34   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
35   * already use CCSDS units instead of the API SI units. The general-purpose
36   * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
37   * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
38   * (with an 's') also provide some predefined units. These predefined units and the
39   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
40   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
41   * what the parsers and writers use for the conversions.
42   * </p>
43   * @author Luc Maisonobe
44   * @since 11.0
45   */
46  public class OrbitCovarianceHistoryMetadata extends CommentsContainer {
47  
48      /** Covariance identification number. */
49      private String covID;
50  
51      /** Identification number of previous covariance. */
52      private String covPrevID;
53  
54      /** Identification number of next covariance. */
55      private String covNextID;
56  
57      /** Basis of this covariance time history data. */
58      private String covBasis;
59  
60      /** Identification number of the covariance determination or simulation upon which this covariance is based. */
61      private String covBasisID;
62  
63      /** Reference frame of the covariance. */
64      private FrameFacade covReferenceFrame;
65  
66      /** Epoch of the covariance reference frame. */
67      private AbsoluteDate covFrameEpoch;
68  
69      /** Minimum scale factor to apply to achieve realism. */
70      private double covScaleMin;
71  
72      /** Maximum scale factor to apply to achieve realism. */
73      private double covScaleMax;
74  
75      /** Measure of confidence in covariance error matching reality. */
76      private double covConfidence;
77  
78      /** Covariance element set type. */
79      private OrbitElementsType covType;
80  
81      /** Covariance ordering. */
82      private Ordering covOrdering;
83  
84      /** Units of covariance element set. */
85      private List<Unit> covUnits;
86  
87      /** Simple constructor.
88       * @param epochT0 T0 epoch from file metadata
89       */
90      public OrbitCovarianceHistoryMetadata(final AbsoluteDate epochT0) {
91          // we don't call the setXxx() methods in order to avoid
92          // calling refuseFurtherComments as a side effect
93          covBasis          = null;
94          covReferenceFrame = new FrameFacade(null, null,
95                                              OrbitRelativeFrame.TNW_INERTIAL, null,
96                                              OrbitRelativeFrame.TNW_INERTIAL.name());
97          covFrameEpoch     = epochT0;
98          covScaleMin       = Double.NaN;
99          covScaleMax       = Double.NaN;
100         covConfidence     = Double.NaN;
101         covType           = OrbitElementsType.CARTPV;
102         covOrdering       = Ordering.LTM;
103     }
104 
105     /** {@inheritDoc} */
106     @Override
107     public void validate(final double version) {
108         super.validate(version);
109         if (covUnits != null) {
110             Unit.ensureCompatible(covType.toString(), covType.getUnits(), false, covUnits);
111         }
112     }
113 
114     /** Get covariance identification number.
115      * @return covariance identification number
116      */
117     public String getCovID() {
118         return covID;
119     }
120 
121     /** Set covariance identification number.
122      * @param covID covariance identification number
123      */
124     public void setCovID(final String covID) {
125         refuseFurtherComments();
126         this.covID = covID;
127     }
128 
129     /** Get identification number of previous covariance.
130      * @return identification number of previous covariance
131      */
132     public String getCovPrevID() {
133         return covPrevID;
134     }
135 
136     /** Set identification number of previous covariance.
137      * @param covPrevID identification number of previous covariance
138      */
139     public void setCovPrevID(final String covPrevID) {
140         refuseFurtherComments();
141         this.covPrevID = covPrevID;
142     }
143 
144     /** Get identification number of next covariance.
145      * @return identification number of next covariance
146      */
147     public String getCovNextID() {
148         return covNextID;
149     }
150 
151     /** Set identification number of next covariance.
152      * @param covNextID identification number of next covariance
153      */
154     public void setCovNextID(final String covNextID) {
155         refuseFurtherComments();
156         this.covNextID = covNextID;
157     }
158 
159     /** Get basis of this covariance time history data.
160      * @return basis of this covariance time history data
161      */
162     public String getCovBasis() {
163         return covBasis;
164     }
165 
166     /** Set basis of this covariance time history data.
167      * @param covBasis basis of this covariance time history data
168      */
169     public void setCovBasis(final String covBasis) {
170         refuseFurtherComments();
171         this.covBasis = covBasis;
172     }
173 
174     /** Get identification number of the orbit determination or simulation upon which this covariance is based.
175      * @return identification number of the orbit determination or simulation upon which this covariance is based
176      */
177     public String getCovBasisID() {
178         return covBasisID;
179     }
180 
181     /** Set identification number of the orbit determination or simulation upon which this covariance is based.
182      * @param covBasisID identification number of the orbit determination or simulation upon which this covariance is based
183      */
184     public void setCovBasisID(final String covBasisID) {
185         refuseFurtherComments();
186         this.covBasisID = covBasisID;
187     }
188 
189     /** Get reference frame of the covariance.
190      * @return reference frame of the covariance
191      */
192     public FrameFacade getCovReferenceFrame() {
193         return covReferenceFrame;
194     }
195 
196     /** Set reference frame of the covariance.
197      * @param covReferenceFrame the reference frame to be set
198      */
199     public void setCovReferenceFrame(final FrameFacade covReferenceFrame) {
200         refuseFurtherComments();
201         this.covReferenceFrame = covReferenceFrame;
202     }
203 
204     /** Get epoch of the {@link #getCovReferenceFrame() covariance reference frame}.
205      * @return epoch of the {@link #getCovReferenceFrame() covariance reference frame}
206      */
207     public AbsoluteDate getCovFrameEpoch() {
208         return covFrameEpoch;
209     }
210 
211     /** Set epoch of the {@link #getCovReferenceFrame() covariance reference frame}.
212      * @param covFrameEpoch epoch of the {@link #getCovReferenceFrame() covariance reference frame}
213      */
214     public void setCovFrameEpoch(final AbsoluteDate covFrameEpoch) {
215         refuseFurtherComments();
216         this.covFrameEpoch = covFrameEpoch;
217     }
218 
219     /** Set the minimum scale factor to apply to achieve realism.
220      * @param covScaleMin minimum scale factor to apply to achieve realism
221      */
222     public void setCovScaleMin(final double covScaleMin) {
223         this.covScaleMin = covScaleMin;
224     }
225 
226     /** Get the minimum scale factor to apply to achieve realism.
227      * @return minimum scale factor to apply to achieve realism
228      */
229     public double getCovScaleMin() {
230         return covScaleMin;
231     }
232 
233     /** Set the maximum scale factor to apply to achieve realism.
234      * @param covScaleMax maximum scale factor to apply to achieve realism
235      */
236     public void setCovScaleMax(final double covScaleMax) {
237         this.covScaleMax = covScaleMax;
238     }
239 
240     /** Get the maximum scale factor to apply to achieve realism.
241      * @return maximum scale factor to apply to achieve realism
242      */
243     public double getCovScaleMax() {
244         return covScaleMax;
245     }
246 
247     /** Set the measure of confidence in covariance error matching reality.
248      * @param covConfidence measure of confidence in covariance error matching reality
249      */
250     public void setCovConfidence(final double covConfidence) {
251         this.covConfidence = covConfidence;
252     }
253 
254     /** Get the measure of confidence in covariance error matching reality.
255      * @return measure of confidence in covariance error matching reality
256      */
257     public double getCovConfidence() {
258         return covConfidence;
259     }
260 
261     /** Get covariance element set type.
262      * @return covariance element set type
263      */
264     public OrbitElementsType getCovType() {
265         return covType;
266     }
267 
268     /** Set covariance element set type.
269      * @param covType covariance element set type
270      */
271     public void setCovType(final OrbitElementsType covType) {
272         refuseFurtherComments();
273         this.covType = covType;
274     }
275 
276     /** Get covariance ordering.
277      * @return covariance ordering
278      */
279     public Ordering getCovOrdering() {
280         return covOrdering;
281     }
282 
283     /** Set covariance ordering.
284      * @param covOrdering covariance ordering
285      */
286     public void setCovOrdering(final Ordering covOrdering) {
287         refuseFurtherComments();
288         this.covOrdering = covOrdering;
289     }
290 
291     /** Get covariance element set units.
292      * @return covariance element set units
293      */
294     public List<Unit> getCovUnits() {
295         return covUnits;
296     }
297 
298     /** Set covariance element set units.
299      * @param covUnits covariance element set units
300      */
301     public void setCovUnits(final List<Unit> covUnits) {
302         refuseFurtherComments();
303         this.covUnits = covUnits;
304     }
305 
306 }