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 package org.orekit.files.ccsds.ndm.adm.apm;
18
19 import java.util.Arrays;
20
21 import org.hipparchus.geometry.euclidean.threed.Vector3D;
22 import org.orekit.files.ccsds.definitions.FrameFacade;
23 import org.orekit.files.ccsds.section.CommentsContainer;
24 import org.orekit.time.AbsoluteDate;
25
26 /**
27 * Maneuver in an APM file.
28 * @author Bryan Cazabonne
29 * @since 10.2
30 */
31 public class Maneuver extends CommentsContainer {
32
33 /** Epoch of start of maneuver . */
34 private AbsoluteDate epochStart;
35
36 /** Coordinate system for the torque vector. */
37 private FrameFacade frame;
38
39 /** Duration (value is 0 for impulsive maneuver). */
40 private double duration;
41
42 /** Torque vector (N.m). */
43 private double[] torque;
44
45 /** Mass change during maneuver (kg).
46 * @since 12.0
47 */
48 private double deltaMass;
49
50 /**
51 * Simple constructor.
52 */
53 public Maneuver() {
54 duration = Double.NaN;
55 torque = new double[3];
56 deltaMass = Double.NaN;
57 Arrays.fill(torque, Double.NaN);
58 }
59
60 /** {@inheritDoc} */
61 @Override
62 public void validate(final double version) {
63 super.validate(version);
64 checkNotNull(epochStart, ManeuverKey.MAN_EPOCH_START.name());
65 checkNotNaN(duration, ManeuverKey.MAN_DURATION.name());
66 checkNotNull(frame, ManeuverKey.MAN_REF_FRAME.name());
67 checkNotNaN(torque[0], ManeuverKey.MAN_TOR_1.name());
68 checkNotNaN(torque[1], ManeuverKey.MAN_TOR_2.name());
69 checkNotNaN(torque[2], ManeuverKey.MAN_TOR_3.name());
70 }
71
72 /**
73 * Get epoch start.
74 * @return epoch start
75 */
76 public AbsoluteDate getEpochStart() {
77 return epochStart;
78 }
79
80 /**
81 * Set epoch start.
82 * @param epochStart epoch start
83 */
84 public void setEpochStart(final AbsoluteDate epochStart) {
85 refuseFurtherComments();
86 this.epochStart = epochStart;
87 }
88
89 /**
90 * Get Coordinate system for the torque vector.
91 * @return coordinate system for the torque vector
92 */
93 public FrameFacade getFrame() {
94 return frame;
95 }
96
97 /**
98 * Set Coordinate system for the torque vector.
99 * @param frame coordinate system for the torque vector
100 */
101 public void setFrame(final FrameFacade frame) {
102 refuseFurtherComments();
103 this.frame = frame;
104 }
105
106 /**
107 * Get duration (value is 0 for impulsive maneuver).
108 * @return duration (value is 0 for impulsive maneuver)
109 */
110 public double getDuration() {
111 return duration;
112 }
113
114 /**
115 * Set duration (value is 0 for impulsive maneuver).
116 * @param duration duration (value is 0 for impulsive maneuver)
117 */
118 public void setDuration(final double duration) {
119 refuseFurtherComments();
120 this.duration = duration;
121 }
122
123 /**
124 * Get the torque vector (N.m).
125 * @return torque vector
126 */
127 public Vector3D getTorque() {
128 return new Vector3D(torque);
129 }
130
131 /**
132 * Set the torque vector (N.m).
133 * @param index vector component index (counting from 0)
134 * @param value component value
135 */
136 public void setTorque(final int index, final double value) {
137 refuseFurtherComments();
138 this.torque[index] = value;
139 }
140
141 /**
142 * Get mass change during maneuver.
143 * @return mass change during maneuver (kg, negative)
144 * @since 12.0
145 */
146 public double getDeltaMass() {
147 return deltaMass;
148 }
149
150 /**
151 * Set mass change during maneuver.
152 * @param deltaMass mass change during maneuver (kg)
153 * @since 12.0
154 */
155 public void setDeltaMass(final double deltaMass) {
156 refuseFurtherComments();
157 this.deltaMass = deltaMass;
158 }
159
160 }