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