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      /** Clock correction in s. */
41      private final double clock;
42  
43      /** Clock rate in s / s. */
44      private final double clockRate;
45  
46      /** Position accuracy. */
47      private final Vector3D positionAccuracy;
48  
49      /** Velocity accuracy. */
50      private final Vector3D velocityAccuracy;
51  
52      /** Clock accuracy. */
53      private final double clockAccuracy;
54  
55      /** Clock rate accuracy. */
56      private final double clockRateAccuracy;
57  
58      /** Clock event flag. */
59      private final boolean clockEvent;
60  
61      /** Clock prediction flag. */
62      private final boolean clockPrediction;
63  
64      /** Orbit maneuver event flag. */
65      private final boolean orbitManeuverEvent;
66  
67      /** Clock orbit prediction flag. */
68      private final boolean orbitPrediction;
69  
70      /** Create a coordinate with position and velocity.
71       * @param date      of validity.
72       * @param position  of the satellite.
73       * @param positionAccuracy  of the satellite (null if not known).
74       * @param velocity  of the satellite.
75       * @param velocityAccuracy  of the satellite (null if not known).
76       * @param clock     correction in s.
77       * @param clockAccuracy     correction in s ({@code Double.NaN} if not known).
78       * @param clockRate in s / s.
79       * @param clockRateAccuracy in s / s ({@code Double.NaN} if not known).
80       * @param clockEvent clock event flag
81       * @param clockPrediction clock prediction flag
82       * @param orbitManeuverEvent orbit maneuver event flag
83       * @param orbitPrediction flag
84       */
85      public SP3Coordinate(final AbsoluteDate date,
86                           final Vector3D position,          final Vector3D positionAccuracy,
87                           final Vector3D velocity,          final Vector3D velocityAccuracy,
88                           final double clock,               final double clockAccuracy,
89                           final double clockRate,           final double clockRateAccuracy,
90                           final boolean clockEvent,         final boolean clockPrediction,
91                           final boolean orbitManeuverEvent, final boolean orbitPrediction) {
92  
93          super(date, position, velocity, Vector3D.ZERO);
94          this.clock     = clock;
95          this.clockRate = clockRate;
96  
97          this.positionAccuracy   = positionAccuracy;
98          this.velocityAccuracy   = velocityAccuracy;
99          this.clockAccuracy      = clockAccuracy;
100         this.clockRateAccuracy  = clockRateAccuracy;
101         this.clockEvent         = clockEvent;
102         this.clockPrediction    = clockPrediction;
103         this.orbitManeuverEvent = orbitManeuverEvent;
104         this.orbitPrediction    = orbitPrediction;
105 
106     }
107 
108     /** Get the clock correction value.
109      * @return the clock correction in s.
110      */
111     public double getClockCorrection() {
112         return clock;
113     }
114 
115     /** Get the clock rate.
116      * @return the clock rate of change in s/s.
117      */
118     public double getClockRateChange() {
119         return clockRate;
120     }
121 
122     /** Get the position accuracy.
123      * @return position accuracy in m (null if not known).
124      */
125     public Vector3D getPositionAccuracy() {
126         return positionAccuracy;
127     }
128 
129     /** Get the velocity accuracy.
130      * @return velocity accuracy in m/s (null if not known).
131      */
132     public Vector3D getVelocityAccuracy() {
133         return velocityAccuracy;
134     }
135 
136     /** Get the clock accuracy.
137      * @return clock accuracy in s ({@code Double.NaN} if not known).
138      */
139     public double getClockAccuracy() {
140         return clockAccuracy;
141     }
142 
143     /** Get the clock rate accuracy.
144      * @return clock rate accuracy in s/s ({@code Double.NaN} if not known).
145      */
146     public double getClockRateAccuracy() {
147         return clockRateAccuracy;
148     }
149 
150     /** Get clock event flag.
151      * @return true if clock event flag is set
152      */
153     public boolean hasClockEvent() {
154         return clockEvent;
155     }
156 
157     /** Get clock prediction flag.
158      * @return true if clock prediction flag is set
159      */
160     public boolean hasClockPrediction() {
161         return clockPrediction;
162     }
163 
164     /** Get orbit maneuver event flag.
165      * @return true if orbit maneuver event flag is set
166      */
167     public boolean hasOrbitManeuverEvent() {
168         return orbitManeuverEvent;
169     }
170 
171     /** Get orbit prediction flag.
172      * @return true if orbit prediction flag is set
173      */
174     public boolean hasOrbitPrediction() {
175         return orbitPrediction;
176     }
177 
178 }