1   /* Copyright 2002-2026 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.ndm.cdm;
18  
19  import java.util.Optional;
20  
21  import org.orekit.annotation.Nullable;
22  import org.orekit.files.ccsds.section.CommentsContainer;
23  import org.orekit.time.AbsoluteDate;
24  
25  /**
26   * Container for OD parameters data block.
27   * <p>
28   * Beware that the Orekit getters and setters all rely on SI units. The parsers
29   * and writers take care of converting these SI units into CCSDS mandatory units.
30   * The {@link org.orekit.utils.units.Unit Unit} class provides useful
31   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
32   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} methods in case the callers
33   * already use CCSDS units instead of the API SI units. The general-purpose
34   * {@link org.orekit.utils.units.Unit Unit} class (without an 's') and the
35   * CCSDS-specific {@link org.orekit.files.ccsds.definitions.Units Units} class
36   * (with an 's') also provide some predefined units. These predefined units and the
37   * {@link org.orekit.utils.units.Unit#fromSI(double) fromSi} and
38   * {@link org.orekit.utils.units.Unit#toSI(double) toSI} conversion methods are indeed
39   * what the parsers and writers use for the conversions.
40   * </p>
41   * @author Melina Vanel
42   * @since 11.2
43   */
44  public class ODParameters extends CommentsContainer {
45  
46      /** The start of a time interval (UTC) that contains the time of the last accepted observation. */
47      @Nullable
48      private AbsoluteDate timeLastObsStart;
49  
50      /** The end of a time interval (UTC) that contains the time of the last accepted observation. */
51      @Nullable
52      private AbsoluteDate timeLastObsEnd;
53  
54      /** The recommended OD time span calculated for the object. */
55      @Nullable
56      private Double recommendedOdSpan;
57  
58      /** Based on the observations available and the RECOMMENDED_OD_SPAN, the actual time span used for the OD of the object. */
59      @Nullable
60      private Double actualOdSpan;
61  
62      /** The number of observations available for the OD of the object. */
63      @Nullable
64      private Integer obsAvailable;
65  
66      /** The number of observations accepted for the OD of the object. */
67      @Nullable
68      private Integer obsUsed;
69  
70      /** The number of sensor tracks available for the OD of the object. */
71      @Nullable
72      private Integer tracksAvailable;
73  
74      /** The number of sensor tracks accepted for the OD of the object. */
75      @Nullable
76      private Integer tracksUsed;
77  
78      /** The percentage of residuals accepted in the OD of the object (from 0 to 100). */
79      @Nullable
80      private Double residualsAccepted;
81  
82      /** The weighted Root Mean Square (RMS) of the residuals from a batch least squares OD. */
83      @Nullable
84      private Double weightedRMS;
85  
86      /** The epoch of the orbit determination used for this message (UTC). */
87      @Nullable
88      private AbsoluteDate odEpoch;
89  
90      /** Simple constructor.
91       */
92      public ODParameters() {
93      }
94  
95      /** {@inheritDoc} */
96      @Override
97      public void validate(final double version) {
98          super.validate(version);
99      }
100 
101     /**
102      * Get the start of a time interval (UTC) that contains the time of the last accepted observation.
103      * @return the start of a time interval (UTC)
104      */
105     public Optional<AbsoluteDate> getTimeLastObsStart() {
106         return Optional.ofNullable(timeLastObsStart);
107     }
108 
109     /**
110      * Set the start of a time interval (UTC) that contains the time of the last accepted observation.
111      * @param timeLastObsStart the start of a time interval (UTC)
112      */
113     public void setTimeLastObsStart(final AbsoluteDate timeLastObsStart) {
114         refuseFurtherComments();
115         this.timeLastObsStart = timeLastObsStart;
116     }
117 
118     /**
119      * Get the start of a time interval (UTC) that contains the time of the last accepted observation.
120      * @return the start of a time interval (UTC)
121      */
122     public Optional<AbsoluteDate> getTimeLastObsEnd() {
123         return Optional.ofNullable(timeLastObsEnd);
124     }
125 
126     /**
127      * Set the start of a time interval (UTC) that contains the time of the last accepted observation.
128      * @param timeLastObsEnd the start of a time interval (UTC)
129      */
130     public void setTimeLastObsEnd(final AbsoluteDate timeLastObsEnd) {
131         refuseFurtherComments();
132         this.timeLastObsEnd = timeLastObsEnd;
133     }
134 
135     /**
136      * Get the recommended OD time span calculated for the object.
137      * @return the recommended OD time span (in days) calculated for the object
138      */
139     public Optional<Double> getRecommendedOdSpan() {
140         return Optional.ofNullable(recommendedOdSpan);
141     }
142 
143     /**
144      * Set the recommended OD time span calculated for the object.
145      * @param recommendedOdSpan recommended OD time span (in days) calculated for the object
146      */
147     public void setRecommendedOdSpan(final double recommendedOdSpan) {
148         refuseFurtherComments();
149         this.recommendedOdSpan = recommendedOdSpan;
150     }
151 
152     /**
153      * Get the actual OD time based on the observations available and the RECOMMENDED_OD_SPAN.
154      * @return the actual OD time (in days)
155      */
156     public Optional<Double> getActualOdSpan() {
157         return Optional.ofNullable(actualOdSpan);
158     }
159 
160     /**
161      * Set the actual OD time based on the observations available and the RECOMMENDED_OD_SPAN.
162      * @param actualOdSpan the actual OD time (in days)
163      */
164     public void setActualOdSpan(final double actualOdSpan) {
165         refuseFurtherComments();
166         this.actualOdSpan = actualOdSpan;
167     }
168 
169     /**
170      * Get the number of observations available for the OD of the object.
171      * @return the number of observations available
172      */
173     public Optional<Integer> getObsAvailable() {
174         return Optional.ofNullable(obsAvailable);
175     }
176 
177     /**
178      * Set the number of observations available for the OD of the object.
179      * @param obsAvailable the number of observations available
180      */
181     public void setObsAvailable(final int obsAvailable) {
182         refuseFurtherComments();
183         this.obsAvailable = obsAvailable;
184     }
185 
186     /**
187      * Get the number of observations accepted for the OD of the object.
188      * @return the number of observations used
189      */
190     public Optional<Integer> getObsUsed() {
191         return Optional.ofNullable(obsUsed);
192     }
193 
194     /**
195      * Set the number of observations accepted for the OD of the object.
196      * @param obsUsed the number of observations used
197      */
198     public void setObsUsed(final int obsUsed) {
199         refuseFurtherComments();
200         this.obsUsed = obsUsed;
201     }
202 
203     /**
204      * Get the number of sensor tracks available for the OD of the object.
205      * @return the number of sensor tracks available
206      */
207     public Optional<Integer> getTracksAvailable() {
208         return Optional.ofNullable(tracksAvailable);
209     }
210 
211     /**
212      * Set the number of sensor tracks available for the OD of the object.
213      * @param tracksAvailable the number of sensor tracks available
214      */
215     public void setTracksAvailable(final int tracksAvailable) {
216         refuseFurtherComments();
217         this.tracksAvailable = tracksAvailable;
218     }
219 
220     /**
221      * Get the number of sensor tracks used for the OD of the object.
222      * @return the number of sensor tracks used
223      */
224     public Optional<Integer> getTracksUsed() {
225         return Optional.ofNullable(tracksUsed);
226     }
227 
228     /**
229      * Set the number of sensor tracks used for the OD of the object.
230      * @param tracksUsed the number of sensor tracks used
231      */
232     public void setTracksUsed(final int tracksUsed) {
233         refuseFurtherComments();
234         this.tracksUsed = tracksUsed;
235     }
236 
237     /**
238      * Get the percentage of residuals accepted in the OD of the object (from 0 to 100).
239      * @return the percentage of residuals accepted in the OD
240      */
241     public Optional<Double> getResidualsAccepted() {
242         return Optional.ofNullable(residualsAccepted);
243     }
244 
245     /**
246      * Set the percentage of residuals accepted in the OD of the object (from 0 to 100).
247      * @param residualsAccepted the percentage of residuals accepted in the OD to be set
248      */
249     public void setResidualsAccepted(final double residualsAccepted) {
250         refuseFurtherComments();
251         this.residualsAccepted = residualsAccepted;
252     }
253 
254     /**
255      * Get the weighted Root Mean Square (RMS) of the residuals from a batch least squares OD.
256      * @return the weighted Root Mean Square (RMS) of the residuals from a batch least squares OD
257      */
258     public Optional<Double> getWeightedRMS() {
259         return Optional.ofNullable(weightedRMS);
260     }
261 
262     /**
263      * Set the weighted Root Mean Square (RMS) of the residuals from a batch least squares OD.
264      * @param WeightedRMS the weighted Root Mean Square (RMS) of the residuals from a batch least squares OD
265      */
266     public void setWeightedRMS(final double WeightedRMS) {
267         refuseFurtherComments();
268         this.weightedRMS = WeightedRMS;
269     }
270 
271     /** Get the epoch of the orbit determination used for this message.
272      * @return the odEpoch the epoch of the orbit determination used for this message
273      */
274     public Optional<AbsoluteDate> getOdEpoch() {
275         return Optional.ofNullable(odEpoch);
276     }
277 
278     /** Set the epoch of the orbit determination used for this message.
279      * @param odEpoch the odEpoch to set
280      */
281     public void setOdEpoch(final AbsoluteDate odEpoch) {
282         this.odEpoch = odEpoch;
283     }
284 
285 }