1 /* Copyright 2002-2024 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 org.hipparchus.geometry.euclidean.threed.RotationOrder;
21 import org.orekit.errors.OrekitException;
22 import org.orekit.errors.OrekitMessages;
23 import org.orekit.files.ccsds.ndm.adm.AttitudeEndpoints;
24 import org.orekit.files.ccsds.section.CommentsContainer;
25
26 /** Metadata for attitude state history.
27 * @author Luc Maisonobe
28 * @since 12.0
29 */
30 public class AttitudeStateHistoryMetadata extends CommentsContainer {
31
32 /** Endpoints (i.e. frames A, B and their relationship). */
33 private final AttitudeEndpoints endpoints;
34
35 /** Attitude identification number. */
36 private String attID;
37
38 /** Identification number of previous attitude. */
39 private String attPrevID;
40
41 /** Basis of this attitude state time history data. */
42 private String attBasis;
43
44 /** Identification number of the attitude determination or simulation upon which this attitude is based. */
45 private String attBasisID;
46
47 /** Rotation order for Euler angles. */
48 private RotationOrder eulerRotSeq;
49
50 /** Number of data states included (attitude components plus rates components). */
51 private int nbStates;
52
53 /** Attitude element set type. */
54 private AttitudeElementsType attitudeType;
55
56 /** Attitude rate element set type. */
57 private RateElementsType rateType;
58
59 /** Simple constructor.
60 */
61 public AttitudeStateHistoryMetadata() {
62 endpoints = new AttitudeEndpoints();
63 }
64
65 /** {@inheritDoc} */
66 @Override
67 public void validate(final double version) {
68 super.validate(version);
69 endpoints.checkExternalFrame(AttitudeStateHistoryMetadataKey.REF_FRAME_A,
70 AttitudeStateHistoryMetadataKey.REF_FRAME_B);
71 checkNotNull(attitudeType, AttitudeStateHistoryMetadataKey.ATT_TYPE.name());
72 final int rateSize = rateType == null ? 0 : rateType.getUnits().size();
73 if (nbStates != attitudeType.getUnits().size() + rateSize) {
74 throw new OrekitException(OrekitMessages.CCSDS_INCONSISTENT_NUMBER_OF_ATTITUDE_STATES,
75 attitudeType.toString(), rateType.toString(),
76 attitudeType.getUnits().size() + rateSize, nbStates);
77 }
78 if (attitudeType == AttitudeElementsType.EULER_ANGLES) {
79 checkNotNull(eulerRotSeq, AttitudeStateHistoryMetadataKey.EULER_ROT_SEQ.name());
80 }
81 }
82
83 /** Get the endpoints (i.e. frames A, B and their relationship).
84 * @return endpoints
85 */
86 public AttitudeEndpoints getEndpoints() {
87 return endpoints;
88 }
89
90 /** Get attitude identification number.
91 * @return attitude identification number
92 */
93 public String getAttID() {
94 return attID;
95 }
96
97 /** Set attitude identification number.
98 * @param attID attitude identification number
99 */
100 public void setAttID(final String attID) {
101 refuseFurtherComments();
102 this.attID = attID;
103 }
104
105 /** Get identification number of previous attitude.
106 * @return identification number of previous attitude
107 */
108 public String getAttPrevID() {
109 return attPrevID;
110 }
111
112 /** Set identification number of previous attitude.
113 * @param attPrevID identification number of previous attitude
114 */
115 public void setAttPrevID(final String attPrevID) {
116 refuseFurtherComments();
117 this.attPrevID = attPrevID;
118 }
119
120 /** Get basis of this attitude state time history data.
121 * @return basis of this attitude state time history data
122 */
123 public String getAttBasis() {
124 return attBasis;
125 }
126
127 /** Set basis of this attitude state time history data.
128 * @param attBasis basis of this attitude state time history data
129 */
130 public void setAttBasis(final String attBasis) {
131 refuseFurtherComments();
132 this.attBasis = attBasis;
133 }
134
135 /** Get identification number of the orbit determination or simulation upon which this attitude is based.
136 * @return identification number of the orbit determination or simulation upon which this attitude is based
137 */
138 public String getAttBasisID() {
139 return attBasisID;
140 }
141
142 /** Set identification number of the orbit determination or simulation upon which this attitude is based.
143 * @param attBasisID identification number of the orbit determination or simulation upon which this attitude is based
144 */
145 public void setAttBasisID(final String attBasisID) {
146 refuseFurtherComments();
147 this.attBasisID = attBasisID;
148 }
149
150 /** Get the rotation order for Euler angles.
151 * @return rotation order for Euler angles
152 */
153 public RotationOrder getEulerRotSeq() {
154 return eulerRotSeq;
155 }
156
157 /** Set the rotation order for Euler angles.
158 * @param eulerRotSeq rotation order for Euler angles
159 */
160 public void setEulerRotSeq(final RotationOrder eulerRotSeq) {
161 this.eulerRotSeq = eulerRotSeq;
162 }
163
164 /** Get the number of data states included (attitude components plus rates components).
165 * @return number of data states included (attitude components plus rates components)
166 */
167 public int getNbStates() {
168 return nbStates;
169 }
170
171 /** Set the number of data states included (attitude components plus rates components).
172 * @param nbStates number of data states included (attitude components plus rates components)
173 */
174 public void setNbStates(final int nbStates) {
175 this.nbStates = nbStates;
176 }
177
178 /** Get attitude element set type.
179 * @return attitude element set type
180 */
181 public AttitudeElementsType getAttitudeType() {
182 return attitudeType;
183 }
184
185 /** Set attitude element set type.
186 * @param attitudeType attitude element set type
187 */
188 public void setAttitudeType(final AttitudeElementsType attitudeType) {
189 refuseFurtherComments();
190 this.attitudeType = attitudeType;
191 }
192
193 /** Get attitude rate element set type.
194 * @return attitude rate element set type
195 */
196 public RateElementsType getRateType() {
197 return rateType;
198 }
199
200 /** Set attitude rate element set type.
201 * @param rateType attitude rate element set type
202 */
203 public void setRateType(final RateElementsType rateType) {
204 refuseFurtherComments();
205 this.rateType = rateType;
206 }
207
208 }