1   /* Copyright 2002-2012 Space Applications Services
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.sp3;
18  
19  import org.hipparchus.geometry.euclidean.threed.Vector3D;
20  import org.orekit.time.AbsoluteDate;
21  import org.orekit.utils.TimeStampedPVCoordinates;
22  
23  /** A single record of position clock and possibly derivatives in an SP3 file.
24   * @author Thomas Neidhart
25   * @author Evan Ward
26   * @author Luc Maisonobe
27   * @since 12.0
28   */
29  public class SP3Coordinate extends TimeStampedPVCoordinates {
30  
31      /** Dummy coordinate with all fields set to 0.0. */
32      public static final SP3Coordinate DUMMY = new SP3Coordinate(AbsoluteDate.ARBITRARY_EPOCH,
33                                                                  Vector3D.ZERO, null, Vector3D.ZERO, null,
34                                                                  SP3Utils.CLOCK_UNIT.toSI(SP3Utils.DEFAULT_CLOCK_VALUE),
35                                                                  Double.NaN,
36                                                                  SP3Utils.CLOCK_RATE_UNIT.toSI(SP3Utils.DEFAULT_CLOCK_RATE_VALUE),
37                                                                  Double.NaN,
38                                                                  false, false, false, false);
39  
40      /** Serializable UID. */
41      private static final long serialVersionUID = 20230903L;
42  
43      /** Clock correction in s. */
44      private final double clock;
45  
46      /** Clock rate in s / s. */
47      private final double clockRate;
48  
49      /** Position accuracy. */
50      private final Vector3D positionAccuracy;
51  
52      /** Velocity accuracy. */
53      private final Vector3D velocityAccuracy;
54  
55      /** Clock accuracy. */
56      private final double clockAccuracy;
57  
58      /** Clock rate accuracy. */
59      private final double clockRateAccuracy;
60  
61      /** Clock event flag. */
62      private final boolean clockEvent;
63  
64      /** Clock prediction flag. */
65      private final boolean clockPrediction;
66  
67      /** Orbit maneuver event flag. */
68      private final boolean orbitManeuverEvent;
69  
70      /** Clock orbit prediction flag. */
71      private final boolean orbitPrediction;
72  
73      /** Create a coordinate with position and velocity.
74       * @param date      of validity.
75       * @param position  of the satellite.
76       * @param positionAccuracy  of the satellite (null if not known).
77       * @param velocity  of the satellite.
78       * @param velocityAccuracy  of the satellite (null if not known).
79       * @param clock     correction in s.
80       * @param clockAccuracy     correction in s ({@code Double.NaN} if not known).
81       * @param clockRate in s / s.
82       * @param clockRateAccuracy in s / s ({@code Double.NaN} if not known).
83       * @param clockEvent clock event flag
84       * @param clockPrediction clock prediction flag
85       * @param orbitManeuverEvent orbit maneuver event flag
86       * @param orbitPrediction flag
87       */
88      public SP3Coordinate(final AbsoluteDate date,
89                           final Vector3D position,          final Vector3D positionAccuracy,
90                           final Vector3D velocity,          final Vector3D velocityAccuracy,
91                           final double clock,               final double clockAccuracy,
92                           final double clockRate,           final double clockRateAccuracy,
93                           final boolean clockEvent,         final boolean clockPrediction,
94                           final boolean orbitManeuverEvent, final boolean orbitPrediction) {
95  
96          super(date, position, velocity, Vector3D.ZERO);
97          this.clock     = clock;
98          this.clockRate = clockRate;
99  
100         this.positionAccuracy   = positionAccuracy;
101         this.velocityAccuracy   = velocityAccuracy;
102         this.clockAccuracy      = clockAccuracy;
103         this.clockRateAccuracy  = clockRateAccuracy;
104         this.clockEvent         = clockEvent;
105         this.clockPrediction    = clockPrediction;
106         this.orbitManeuverEvent = orbitManeuverEvent;
107         this.orbitPrediction    = orbitPrediction;
108 
109     }
110 
111     /** Get the clock correction value.
112      * @return the clock correction in s.
113      */
114     public double getClockCorrection() {
115         return clock;
116     }
117 
118     /** Get the clock rate.
119      * @return the clock rate of change in s/s.
120      */
121     public double getClockRateChange() {
122         return clockRate;
123     }
124 
125     /** Get the position accuracy.
126      * @return position accuracy in m (null if not known).
127      */
128     public Vector3D getPositionAccuracy() {
129         return positionAccuracy;
130     }
131 
132     /** Get the velocity accuracy.
133      * @return velocity accuracy in m/s (null if not known).
134      */
135     public Vector3D getVelocityAccuracy() {
136         return velocityAccuracy;
137     }
138 
139     /** Get the clock accuracy.
140      * @return clock accuracy in s ({@code Double.NaN} if not known).
141      */
142     public double getClockAccuracy() {
143         return clockAccuracy;
144     }
145 
146     /** Get the clock rate accuracy.
147      * @return clock rate accuracy in s/s ({@code Double.NaN} if not known).
148      */
149     public double getClockRateAccuracy() {
150         return clockRateAccuracy;
151     }
152 
153     /** Get clock event flag.
154      * @return true if clock event flag is set
155      */
156     public boolean hasClockEvent() {
157         return clockEvent;
158     }
159 
160     /** Get clock prediction flag.
161      * @return true if clock prediction flag is set
162      */
163     public boolean hasClockPrediction() {
164         return clockPrediction;
165     }
166 
167     /** Get orbit maneuver event flag.
168      * @return true if orbit maneuver event flag is set
169      */
170     public boolean hasOrbitManeuverEvent() {
171         return orbitManeuverEvent;
172     }
173 
174     /** Get orbit prediction flag.
175      * @return true if orbit prediction flag is set
176      */
177     public boolean hasOrbitPrediction() {
178         return orbitPrediction;
179     }
180 
181 }