1   /* Copyright 2022-2025 Luc Maisonobe
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.adm.acm;
19  
20  import java.util.List;
21  
22  import org.orekit.data.DataContext;
23  import org.orekit.files.ccsds.ndm.adm.AdmMetadata;
24  import org.orekit.files.ccsds.ndm.adm.AdmMetadataKey;
25  import org.orekit.files.ccsds.section.MetadataKey;
26  import org.orekit.time.AbsoluteDate;
27  
28  /** Meta-data for {@link AcmMetadata Attitude Comprehensive Message}.
29   * @since 12.0
30   */
31  public class AcmMetadata extends AdmMetadata {
32  
33      /** Specification of satellite catalog source. */
34      private String catalogName;
35  
36      /** Unique satellite identification designator for the object. */
37      private String objectDesignator;
38  
39      /** Programmatic Point Of Contact at originator. */
40      private String originatorPOC;
41  
42      /** Position of Programmatic Point Of Contact at originator. */
43      private String originatorPosition;
44  
45      /** Phone number of Programmatic Point Of Contact at originator. */
46      private String originatorPhone;
47  
48      /** Email address of Programmatic Point Of Contact at originator. */
49      private String originatorEmail;
50  
51      /** Address of Programmatic Point Of Contact at originator. */
52      private String originatorAddress;
53  
54      /** Unique identifier of Orbit Data Message linked to this Orbit Data Message. */
55      private String odmMessageLink;
56  
57      /** Epoch to which <em>all</em> relative times are referenced in data blocks;
58       * unless overridden by block-specific {@code EPOCH_TZERO} values. */
59      private AbsoluteDate epochT0;
60  
61      /** List of elements of information data blocks included in this message. */
62      private List<AcmElements> acmDataElements;
63  
64      /** Time of the earliest data contained in the OCM. */
65      private AbsoluteDate startTime;
66  
67      /** Time of the latest data contained in the OCM. */
68      private AbsoluteDate stopTime;
69  
70      /** Difference (TAI – UTC) in seconds at epoch {@link #epochT0}. */
71      private double taimutcT0;
72  
73      /** Epoch of next leap second. */
74      private AbsoluteDate nextLeapEpoch;
75  
76      /** Difference (TAI – UTC) in seconds incorporated at {@link #nextLeapEpoch}. */
77      private double nextLeapTaimutc;
78  
79      /** Create a new meta-data.
80       * @param dataContext data context
81       */
82      public AcmMetadata(final DataContext dataContext) {
83  
84          // set up the few fields that have default values as per CCSDS standard
85          taimutcT0         = Double.NaN;
86          nextLeapTaimutc   = Double.NaN;
87  
88      }
89  
90      /** {@inheritDoc} */
91      @Override
92      public void validate(final double version) {
93          // we don't call super.checkMandatoryEntries() because
94          // all of the parameters considered mandatory at ADM level
95          // for APM and AEM are in fact optional in ACM
96          // only OBJECT_NAME, TIME_SYSTEM and EPOCH_TZERO are mandatory
97          checkNotNull(getObjectName(), AdmMetadataKey.OBJECT_NAME.name());
98          checkNotNull(getTimeSystem(), MetadataKey.TIME_SYSTEM.name());
99          checkNotNull(epochT0,         AcmMetadataKey.EPOCH_TZERO.name());
100         if (nextLeapEpoch != null) {
101             checkNotNaN(nextLeapTaimutc, AcmMetadataKey.NEXT_LEAP_TAIMUTC.name());
102         }
103     }
104 
105     /** Get the international designator for the object.
106      * @return international designator for the object
107      */
108     public String getInternationalDesignator() {
109         return getObjectID();
110     }
111 
112     /** Set the international designator for the object.
113      * @param internationalDesignator international designator for the object
114      */
115     public void setInternationalDesignator(final String internationalDesignator) {
116         setObjectID(internationalDesignator);
117     }
118 
119     /** Get the specification of satellite catalog source.
120      * @return specification of satellite catalog source
121      */
122     public String getCatalogName() {
123         return catalogName;
124     }
125 
126     /** Set the specification of satellite catalog source.
127      * @param catalogName specification of satellite catalog source
128      */
129     public void setCatalogName(final String catalogName) {
130         refuseFurtherComments();
131         this.catalogName = catalogName;
132     }
133 
134     /** Get the unique satellite identification designator for the object.
135      * @return unique satellite identification designator for the object.
136      */
137     public String getObjectDesignator() {
138         return objectDesignator;
139     }
140 
141     /** Set the unique satellite identification designator for the object.
142      * @param objectDesignator unique satellite identification designator for the object
143      */
144     public void setObjectDesignator(final String objectDesignator) {
145         refuseFurtherComments();
146         this.objectDesignator = objectDesignator;
147     }
148 
149     /** Get the programmatic Point Of Contact at originator.
150      * @return programmatic Point Of Contact at originator
151      */
152     public String getOriginatorPOC() {
153         return originatorPOC;
154     }
155 
156     /** Set the programmatic Point Of Contact at originator.
157      * @param originatorPOC programmatic Point Of Contact at originator
158      */
159     public void setOriginatorPOC(final String originatorPOC) {
160         refuseFurtherComments();
161         this.originatorPOC = originatorPOC;
162     }
163 
164     /** Get the position of Programmatic Point Of Contact at originator.
165      * @return position of Programmatic Point Of Contact at originator
166      */
167     public String getOriginatorPosition() {
168         return originatorPosition;
169     }
170 
171     /** Set the position of Programmatic Point Of Contact at originator.
172      * @param originatorPosition position of Programmatic Point Of Contact at originator
173      */
174     public void setOriginatorPosition(final String originatorPosition) {
175         refuseFurtherComments();
176         this.originatorPosition = originatorPosition;
177     }
178 
179     /** Get the phone number of Programmatic Point Of Contact at originator.
180      * @return phone number of Programmatic Point Of Contact at originator
181      */
182     public String getOriginatorPhone() {
183         return originatorPhone;
184     }
185 
186     /** Set the phone number of Programmatic Point Of Contact at originator.
187      * @param originatorPhone phone number of Programmatic Point Of Contact at originator
188      */
189     public void setOriginatorPhone(final String originatorPhone) {
190         refuseFurtherComments();
191         this.originatorPhone = originatorPhone;
192     }
193 
194     /** Get the email address of Programmatic Point Of Contact at originator.
195      * @return email address of Programmatic Point Of Contact at originator
196      */
197     public String getOriginatorEmail() {
198         return originatorEmail;
199     }
200 
201     /** Set the email address of Programmatic Point Of Contact at originator.
202      * @param originatorEmail email address of Programmatic Point Of Contact at originator
203      */
204     public void setOriginatorEmail(final String originatorEmail) {
205         refuseFurtherComments();
206         this.originatorEmail = originatorEmail;
207     }
208 
209     /** Get the address of Programmatic Point Of Contact at originator.
210      * @return address of Programmatic Point Of Contact at originator
211      */
212     public String getOriginatorAddress() {
213         return originatorAddress;
214     }
215 
216     /** Set the address of Programmatic Point Of Contact at originator.
217      * @param originatorAddress address of Programmatic Point Of Contact at originator
218      */
219     public void setOriginatorAddress(final String originatorAddress) {
220         refuseFurtherComments();
221         this.originatorAddress = originatorAddress;
222     }
223 
224     /** Get the Unique identifier of Orbit Data Message linked to this Attitude Data Message.
225      * @return Unique identifier of Orbit Data Message linked to this Attitude Data Message
226      */
227     public String getOdmMessageLink() {
228         return odmMessageLink;
229     }
230 
231     /** Set the Unique identifier of Orbit Data Message linked to this Attitude Data Message.
232      * @param odmMessageLink Unique identifier of Orbit Data Message linked to this Attitude Data Message
233      */
234     public void setOdmMessageLink(final String odmMessageLink) {
235         refuseFurtherComments();
236         this.odmMessageLink = odmMessageLink;
237     }
238 
239     /** Get the epoch to which <em>all</em> relative times are referenced in data blocks.
240      * @return epoch to which <em>all</em> relative times are referenced in data blocks
241      */
242     public AbsoluteDate getEpochT0() {
243         return epochT0;
244     }
245 
246     /** Set the epoch to which <em>all</em> relative times are referenced in data blocks.
247      * @param epochT0 epoch to which <em>all</em> relative times are referenced in data blocks
248      */
249     public void setEpochT0(final AbsoluteDate epochT0) {
250         refuseFurtherComments();
251         this.epochT0 = epochT0;
252     }
253 
254     /** Get the list of elements of information data blocks included in this message.
255      * @return list of elements of information data blocks included in this message
256      */
257     public List<AcmElements> getAcmDataElements() {
258         return acmDataElements;
259     }
260 
261     /** Set the list of elements of information data blocks included in this message.
262      * @param acmDataElements list of elements of information data blocks included in this message
263      */
264     public void setAcmDataElements(final List<AcmElements> acmDataElements) {
265         refuseFurtherComments();
266         this.acmDataElements = acmDataElements;
267     }
268 
269     /** Get the time of the earliest data contained in the OCM.
270      * @return time of the earliest data contained in the OCM
271      */
272     public AbsoluteDate getStartTime() {
273         return startTime;
274     }
275 
276     /** Set the time of the earliest data contained in the OCM.
277      * @param startTime time of the earliest data contained in the OCM
278      */
279     public void setStartTime(final AbsoluteDate startTime) {
280         refuseFurtherComments();
281         this.startTime = startTime;
282     }
283 
284     /** Get the time of the latest data contained in the OCM.
285      * @return time of the latest data contained in the OCM
286      */
287     public AbsoluteDate getStopTime() {
288         return stopTime;
289     }
290 
291     /** Set the time of the latest data contained in the OCM.
292      * @param stopTime time of the latest data contained in the OCM
293      */
294     public void setStopTime(final AbsoluteDate stopTime) {
295         refuseFurtherComments();
296         this.stopTime = stopTime;
297     }
298 
299     /** Get the difference (TAI – UTC) in seconds at epoch {@link #getEpochT0()}.
300      * @return difference (TAI – UTC) in seconds at epoch {@link #getEpochT0()}
301      */
302     public double getTaimutcT0() {
303         return taimutcT0;
304     }
305 
306     /** Set the difference (TAI – UTC) in seconds at epoch {@link #getEpochT0()}.
307      * @param taimutcT0 difference (TAI – UTC) in seconds at epoch {@link #getEpochT0()}
308      */
309     public void setTaimutcT0(final double taimutcT0) {
310         refuseFurtherComments();
311         this.taimutcT0 = taimutcT0;
312     }
313 
314     /** Get the epoch of next leap second.
315      * @return epoch of next leap second
316      */
317     public AbsoluteDate getNextLeapEpoch() {
318         return nextLeapEpoch;
319     }
320 
321     /** Set the epoch of next leap second.
322      * @param nextLeapEpoch epoch of next leap second
323      */
324     public void setNextLeapEpoch(final AbsoluteDate nextLeapEpoch) {
325         refuseFurtherComments();
326         this.nextLeapEpoch = nextLeapEpoch;
327     }
328 
329     /** Get the difference (TAI – UTC) in seconds incorporated at epoch {@link #getNextLeapEpoch()}.
330      * @return difference (TAI – UTC) in seconds incorporated at epoch {@link #getNextLeapEpoch()}
331      */
332     public double getNextLeapTaimutc() {
333         return nextLeapTaimutc;
334     }
335 
336     /** Set the difference (TAI – UTC) in seconds incorporated at epoch {@link #getNextLeapEpoch()}.
337      * @param nextLeapTaimutc difference (TAI – UTC) in seconds incorporated at epoch {@link #getNextLeapEpoch()}
338      */
339     public void setNextLeapTaimutc(final double nextLeapTaimutc) {
340         refuseFurtherComments();
341         this.nextLeapTaimutc = nextLeapTaimutc;
342     }
343 
344 }