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.Rotation;
21 import org.hipparchus.geometry.euclidean.threed.Vector3D;
22 import org.orekit.errors.OrekitException;
23 import org.orekit.errors.OrekitMessages;
24 import org.orekit.files.ccsds.definitions.FrameFacade;
25 import org.orekit.files.ccsds.section.CommentsContainer;
26
27 /** Maneuver entry.
28 * @author Luc Maisonobe
29 * @since 12.0
30 */
31 public class AttitudeManeuver extends CommentsContainer {
32
33 /** Maneuver identification number. */
34 private String id;
35
36 /** Identification number of previous maneuver. */
37 private String prevID;
38
39 /** Purpose of the maneuver. */
40 private String manPurpose;
41
42 /** Start time of actual maneuver, relative to t₀. */
43 private double beginTime;
44
45 /** End time of actual maneuver, relative to t₀. */
46 private double endTime;
47
48 /** Duration. */
49 private double duration;
50
51 /** Actuator used. */
52 private String actuatorUsed;
53
54 /** Target momentum (if purpose is momentum desaturation). */
55 private Vector3D targetMomentum;
56
57 /** Reference frame for {@link #targetMomentum}. */
58 private FrameFacade targetMomFrame;
59
60 /** Target attitude (if purpose is attitude adjustment). */
61 private Rotation targetAttitude;
62
63 /** Target spin rate (if purpose is spin rate adjustment). */
64 private double targetSpinRate;
65
66 /** Build an uninitialized maneuver.
67 */
68 public AttitudeManeuver() {
69 beginTime = Double.NaN;
70 endTime = Double.NaN;
71 duration = Double.NaN;
72 targetSpinRate = Double.NaN;
73 }
74
75 /** {@inheritDoc} */
76 @Override
77 public void validate(final double version) {
78 checkNotNull(manPurpose, AttitudeManeuverKey.MAN_PURPOSE.name());
79 checkNotNaN(beginTime, AttitudeManeuverKey.MAN_BEGIN_TIME.name());
80 if (!Double.isNaN(endTime + duration)) {
81 throw new OrekitException(OrekitMessages.CCSDS_INCOMPATIBLE_KEYS_BOTH_USED,
82 AttitudeManeuverKey.MAN_END_TIME,
83 AttitudeManeuverKey.MAN_DURATION);
84 }
85 if (targetMomFrame != null) {
86 checkNotNull(targetMomentum, AttitudeManeuverKey.TARGET_MOMENTUM.name());
87 }
88 }
89
90 /** Get maneuver identification number.
91 * @return maneuver identification number
92 */
93 public String getID() {
94 return id;
95 }
96
97 /** Set maneuver identification number.
98 * @param manId maneuver identification number
99 */
100 public void setID(final String manId) {
101 refuseFurtherComments();
102 this.id = manId;
103 }
104
105 /** Get identification number of previous maneuver.
106 * @return identification number of previous maneuver
107 */
108 public String getPrevID() {
109 return prevID;
110 }
111
112 /** Set identification number of previous maneuver.
113 * @param prevID identification number of previous maneuver
114 */
115 public void setPrevID(final String prevID) {
116 refuseFurtherComments();
117 this.prevID = prevID;
118 }
119
120 /** Get purpose of maneuver.
121 * @return purpose of maneuver
122 */
123 public String getManPurpose() {
124 return manPurpose;
125 }
126
127 /** Set purpose of maneuver.
128 * @param manPurpose purpose of maneuver
129 */
130 public void setManPurpose(final String manPurpose) {
131 refuseFurtherComments();
132 this.manPurpose = manPurpose;
133 }
134
135 /** Get start time of actual maneuver, relative to t₀.
136 * @return start time of actual maneuver, relative to t₀
137 */
138 public double getBeginTime() {
139 return beginTime;
140 }
141
142 /** Set start time of actual maneuver, relative to t₀.
143 * @param beginTime start time of actual maneuver, relative to t₀
144 */
145 public void setBeginTime(final double beginTime) {
146 this.beginTime = beginTime;
147 }
148
149 /** Get end time of actual maneuver, relative to t₀.
150 * @return end time of actual maneuver, relative to t₀
151 */
152 public double getEndTime() {
153 return endTime;
154 }
155
156 /** Set end time of actual maneuver, relative to t₀.
157 * @param endTime end time of actual maneuver, relative to t₀
158 */
159 public void setEndTime(final double endTime) {
160 this.endTime = endTime;
161 }
162
163 /** Get duration.
164 * @return duration
165 */
166 public double getDuration() {
167 return duration;
168 }
169
170 /** Set duration.
171 * @param duration duration
172 */
173 public void setDuration(final double duration) {
174 this.duration = duration;
175 }
176
177 /** Get the actuator used.
178 * @return actuator used
179 */
180 public String getActuatorUsed() {
181 return actuatorUsed;
182 }
183
184 /** Set actuator used.
185 * @param actuatorUsed actuator used
186 */
187 public void setActuatorUsed(final String actuatorUsed) {
188 this.actuatorUsed = actuatorUsed;
189 }
190
191 /** Get target momentum (if purpose is momentum desaturation).
192 * @return target momentum
193 */
194 public Vector3D getTargetMomentum() {
195 return targetMomentum;
196 }
197
198 /** Set target momentum (if purpose is momentum desaturation).
199 * @param targetMomentum target momentum
200 */
201 public void setTargetMomentum(final Vector3D targetMomentum) {
202 this.targetMomentum = targetMomentum;
203 }
204
205 /** Get reference frame for {@link #getTargetMomentum()}.
206 * @return reference frame for {@link #getTargetMomentum()}
207 */
208 public FrameFacade getTargetMomFrame() {
209 return targetMomFrame;
210 }
211
212 /** Set reference frame for {@link #getTargetMomentum()}.
213 * @param targetMomFrame reference frame for {@link #getTargetMomentum()}
214 */
215 public void setTargetMomFrame(final FrameFacade targetMomFrame) {
216 this.targetMomFrame = targetMomFrame;
217 }
218
219 /** Get target attitude (if purpose is attitude adjustment).
220 * @return target attitude
221 */
222 public Rotation getTargetAttitude() {
223 return targetAttitude;
224 }
225
226 /** Set target attitude (if purpose is attitude adjustment).
227 * @param targetAttitude target attitude
228 */
229 public void setTargetAttitude(final Rotation targetAttitude) {
230 this.targetAttitude = targetAttitude;
231 }
232
233 /** Get target spin rate (if purpose is spin rate adjustment).
234 * @return target spin rate
235 */
236 public double getTargetSpinRate() {
237 return targetSpinRate;
238 }
239
240 /** Set target spin rate (if purpose is spin rate adjustment).
241 * @param targetSpinRate target spin rate
242 */
243 public void setTargetSpinRate(final double targetSpinRate) {
244 this.targetSpinRate = targetSpinRate;
245 }
246
247 }