1   /* Copyright 2002-2012 Space Applications Services
2    * Licensed to CS Systèmes d'Information (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.general;
18  
19  import java.io.Serializable;
20  
21  import org.hipparchus.geometry.euclidean.threed.Vector3D;
22  import org.orekit.time.AbsoluteDate;
23  import org.orekit.time.TimeStamped;
24  import org.orekit.utils.PVCoordinates;
25  
26  /** Contains the position/velocity of a satellite at an specific epoch.
27   * @author Thomas Neidhart
28   */
29  public class SatelliteTimeCoordinate implements TimeStamped, Serializable {
30  
31      /** Serializable UID. */
32      private static final long serialVersionUID = -2099947583052252633L;
33  
34      /** Epoch for this entry. */
35      private AbsoluteDate epoch;
36  
37      /** Position/velocity coordinates for this entry. */
38      private PVCoordinates coordinate;
39  
40      /** Clock correction in micro-seconds. */
41      private double clockCorrection;
42  
43      /** Clock rate change. */
44      private double clockRateChange;
45  
46      /** Creates a new {@link SatelliteTimeCoordinate} instance with
47       * a given epoch and coordinate.
48       * @param time the epoch of the entry
49       * @param coord the coordinate of the entry
50       */
51      public SatelliteTimeCoordinate(final AbsoluteDate time,
52                                     final PVCoordinates coord) {
53          this(time, coord, 0.0d, 0.0d);
54      }
55  
56      /** Creates a new {@link SatelliteTimeCoordinate} object with a given epoch
57       * and position coordinate. The velocity is set to a zero vector.
58       * @param time the epoch of the entry
59       * @param pos the position coordinate of the entry
60       * @param clock the clock value in (micro-seconds)
61       */
62      public SatelliteTimeCoordinate(final AbsoluteDate time,
63                                     final Vector3D pos, final double clock) {
64          this(time, new PVCoordinates(pos, Vector3D.ZERO), clock, 0.0d);
65      }
66  
67      /** Creates a new {@link SatelliteTimeCoordinate} instance with a given
68       * epoch, coordinate and clock value / rate change.
69       * @param time the epoch of the entry
70       * @param coord the coordinate of the entry
71       * @param clockCorr the clock value that corresponds to this coordinate
72       * @param rateChange the clock rate change
73       */
74      public SatelliteTimeCoordinate(final AbsoluteDate time,
75                                     final PVCoordinates coord,
76                                     final double clockCorr,
77                                     final double rateChange) {
78          this.epoch = time;
79          this.coordinate = coord;
80          this.clockCorrection = clockCorr;
81          this.clockRateChange = rateChange;
82      }
83  
84      /** Returns the epoch for this coordinate.
85       * @return the epoch
86       */
87      public AbsoluteDate getEpoch() {
88          return epoch;
89      }
90  
91      /** {@inheritDoc} */
92      public AbsoluteDate getDate() {
93          return getEpoch();
94      }
95  
96      /** Set the epoch for this coordinate.
97       * @param epoch the epoch to be set
98       */
99      public void setEpoch(final AbsoluteDate epoch) {
100         this.epoch = epoch;
101     }
102 
103     /** Returns the coordinate of this entry.
104      * @return the coordinate
105      */
106     public PVCoordinates getCoordinate() {
107         return coordinate;
108     }
109 
110     /** Set the coordinate for this entry.
111      * @param coordinate the coordinate to be set
112      */
113     public void setCoordinate(final PVCoordinates coordinate) {
114         this.coordinate = coordinate;
115     }
116 
117     /** Returns the clock correction value.
118      * @return the clock correction
119      */
120     public double getClockCorrection() {
121         return clockCorrection;
122     }
123 
124     /** Set the clock correction to the given value.
125      * @param corr the clock correction value
126      */
127     public void setClockCorrection(final double corr) {
128         this.clockCorrection = corr;
129     }
130 
131     /** Returns the clock rate change value.
132      * @return the clock rate change
133      */
134     public double getClockRateChange() {
135         return clockRateChange;
136     }
137 
138     /** Set the clock rate change to the given value.
139      * @param rateChange the clock rate change value
140      */
141     public void setClockRateChange(final double rateChange) {
142         this.clockRateChange = rateChange;
143     }
144 }