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  package org.orekit.files.ccsds.ndm.adm.apm;
18  
19  import org.orekit.files.ccsds.definitions.FrameFacade;
20  import org.orekit.files.ccsds.ndm.adm.AttitudeEndpoints;
21  import org.orekit.files.ccsds.section.CommentsContainer;
22  
23  /**
24   * Container for Attitude Parameter Message data lines.
25   * @author Luc Maisonobe
26   * @since 12.0
27   */
28  public class AngularVelocity extends CommentsContainer {
29  
30      /** Endpoints (i.e. frames A, B and their relationship). */
31      private final AttitudeEndpoints endpoints;
32  
33      /** The frame in which angular velocities are specified. */
34      private FrameFacade frame;
35  
36      /** Angular velocity around X axis (rad/s). */
37      private double angVelX;
38  
39      /** Angular velocity around Y axis (rad/s). */
40      private double angVelY;
41  
42      /** Angular velocity around Z axis (rad/s). */
43      private double angVelZ;
44  
45      /** Simple constructor.
46       */
47      public AngularVelocity() {
48          endpoints = new AttitudeEndpoints();
49          frame     = null;
50          angVelX   = Double.NaN;
51          angVelY   = Double.NaN;
52          angVelZ   = Double.NaN;
53      }
54  
55      /** {@inheritDoc} */
56      @Override
57      public void validate(final double version) {
58          super.validate(version);
59          endpoints.checkMandatoryEntriesExceptExternalFrame(version,
60                                                             AngularVelocityKey.REF_FRAME_A,
61                                                             AngularVelocityKey.REF_FRAME_B,
62                                                             null);
63          endpoints.checkExternalFrame(AngularVelocityKey.REF_FRAME_A, AngularVelocityKey.REF_FRAME_B);
64          checkNotNull(frame, AngularVelocityKey.ANGVEL_FRAME.name());
65          checkNotNaN(angVelX, AngularVelocityKey.ANGVEL_X.name());
66          checkNotNaN(angVelY, AngularVelocityKey.ANGVEL_Y.name());
67          checkNotNaN(angVelZ, AngularVelocityKey.ANGVEL_Z.name());
68      }
69  
70      /** Get the endpoints (i.e. frames A, B and their relationship).
71       * @return endpoints
72       */
73      public AttitudeEndpoints getEndpoints() {
74          return endpoints;
75      }
76  
77      /** Set frame in which angular velocities are specified.
78       * @param frame frame in which angular velocities are specified
79       */
80      public void setFrame(final FrameFacade frame) {
81          this.frame = frame;
82      }
83  
84      /** Get frame in which angular velocities are specified.
85       * @return frame in which angular velocities are specified
86       */
87      public FrameFacade getFrame() {
88          return frame;
89      }
90  
91      /** Get the angular velocity around X axis (rad/s).
92       * @return angular velocity around X axis (rad/s)
93       */
94      public double getAngVelX() {
95          return angVelX;
96      }
97  
98      /** Set the angular velocity around X axis (rad/s).
99       * @param angVelX angular velocity around X axis (rad/s)
100      */
101     public void setAngVelX(final double angVelX) {
102         refuseFurtherComments();
103         this.angVelX = angVelX;
104     }
105 
106     /** Get the angular velocity around Y axis (rad/s).
107      * @return angular velocity around Y axis (rad/s)
108      */
109     public double getAngVelY() {
110         return angVelY;
111     }
112 
113     /** Set the angular velocity around Z axis (rad/s).
114      * @param angVelZ angular velocity around Z axis (rad/s)
115      */
116     public void setAngVelZ(final double angVelZ) {
117         refuseFurtherComments();
118         this.angVelZ = angVelZ;
119     }
120 
121     /** Get the angular velocity around Z axis (rad/s).
122      * @return angular velocity around Z axis (rad/s)
123      */
124     public double getAngVelZ() {
125         return angVelZ;
126     }
127 
128     /** Set the angular velocity around Y axis (rad/s).
129      * @param angVelY angular velocity around Y axis (rad/s)
130      */
131     public void setAngVelY(final double angVelY) {
132         refuseFurtherComments();
133         this.angVelY = angVelY;
134     }
135 
136 }