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.propagation.analytical.gnss.data;
18  
19  import org.hipparchus.util.FastMath;
20  import org.orekit.time.AbsoluteDate;
21  
22  /**
23   * Base class for GNSS navigation messages.
24   * @author Bryan Cazabonne
25   * @since 11.0
26   *
27   * @see GPSLegacyNavigationMessage
28   * @see GalileoNavigationMessage
29   * @see BeidouLegacyNavigationMessage
30   * @see QZSSLegacyNavigationMessage
31   * @see IRNSSNavigationMessage
32   */
33  public abstract class AbstractNavigationMessage extends CommonGnssData implements GNSSOrbitalElements {
34  
35      /** Square root of a. */
36      private double sqrtA;
37  
38      /** Mean Motion Difference from Computed Value. */
39      private double deltaN;
40  
41      /** Rate of Inclination Angle (rad/s). */
42      private double iDot;
43  
44      /** Drift Rate Correction Coefficient (s/s²). */
45      private double af2;
46  
47      /** Time of clock epoch. */
48      private AbsoluteDate epochToc;
49  
50      /** Amplitude of Cosine Harmonic Correction Term to the Argument of Latitude. */
51      private double cuc;
52  
53      /** Amplitude of Sine Harmonic Correction Term to the Argument of Latitude. */
54      private double cus;
55  
56      /** Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius. */
57      private double crc;
58  
59      /** Amplitude of the Sine Correction Term to the Orbit Radius. */
60      private double crs;
61  
62      /** Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination. */
63      private double cic;
64  
65      /** Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. */
66      private double cis;
67  
68      /** Transmission time.
69       * @since 12.0
70       */
71      private double transmissionTime;
72  
73      /**
74       * Constructor.
75       * @param mu Earth's universal gravitational parameter
76       * @param angularVelocity mean angular velocity of the Earth for the GNSS model
77       * @param weekNumber number of weeks in the GNSS cycle
78       */
79      public AbstractNavigationMessage(final double mu,
80                                       final double angularVelocity,
81                                       final int weekNumber) {
82          super(mu, angularVelocity, weekNumber);
83      }
84  
85      /**
86       * Getter for Square Root of Semi-Major Axis (√m).
87       * @return Square Root of Semi-Major Axis (√m)
88       */
89      public double getSqrtA() {
90          return sqrtA;
91      }
92  
93      /**
94       * Setter for the Square Root of Semi-Major Axis (√m).
95       * <p>
96       * In addition, this method set the value of the Semi-Major Axis.
97       * </p>
98       * @param sqrtA the Square Root of Semi-Major Axis (√m)
99       */
100     public void setSqrtA(final double sqrtA) {
101         this.sqrtA = sqrtA;
102         setSma(sqrtA * sqrtA);
103     }
104 
105     /**
106      * Getter for the mean motion.
107      * @return the mean motion
108      */
109     public double getMeanMotion() {
110         final double absA = FastMath.abs(getSma());
111         return FastMath.sqrt(getMu() / absA) / absA + deltaN;
112     }
113 
114     /**
115      * Getter for the delta of satellite mean motion.
116      * @return delta of satellite mean motion
117      */
118     public double getDeltaN() {
119         return deltaN;
120     }
121 
122     /**
123      * Setter for the delta of satellite mean motion.
124      * @param deltaN the value to set
125      */
126     public void setDeltaN(final double deltaN) {
127         this.deltaN = deltaN;
128     }
129 
130     /**
131      * Getter for the rate of inclination angle.
132      * @return the rate of inclination angle in rad/s
133      */
134     public double getIDot() {
135         return iDot;
136     }
137 
138     /**
139      * Setter for the Rate of Inclination Angle (rad/s).
140      * @param iRate the rate of inclination angle to set
141      */
142     public void setIDot(final double iRate) {
143         this.iDot = iRate;
144     }
145 
146     /**
147      * Getter for the Drift Rate Correction Coefficient.
148      * @return the Drift Rate Correction Coefficient (s/s²).
149      */
150     public double getAf2() {
151         return af2;
152     }
153 
154     /**
155      * Setter for the Drift Rate Correction Coefficient (s/s²).
156      * @param af2 the Drift Rate Correction Coefficient to set
157      */
158     public void setAf2(final double af2) {
159         this.af2 = af2;
160     }
161 
162     /**
163      * Getter for the time of clock epoch.
164      * @return the time of clock epoch
165      */
166     public AbsoluteDate getEpochToc() {
167         return epochToc;
168     }
169 
170     /**
171      * Setter for the time of clock epoch.
172      * @param epochToc the epoch to set
173      */
174     public void setEpochToc(final AbsoluteDate epochToc) {
175         this.epochToc = epochToc;
176     }
177 
178     /**
179      * Getter for the Cuc parameter.
180      * @return the Cuc parameter
181      */
182     public double getCuc() {
183         return cuc;
184     }
185 
186     /**
187      * Setter for the Cuc parameter.
188      * @param cuc the value to set
189      */
190     public void setCuc(final double cuc) {
191         this.cuc = cuc;
192     }
193 
194     /**
195      * Getter for the Cus parameter.
196      * @return the Cus parameter
197      */
198     public double getCus() {
199         return cus;
200     }
201 
202     /**
203      * Setter for the Cus parameter.
204      * @param cus the value to set
205      */
206     public void setCus(final double cus) {
207         this.cus = cus;
208     }
209 
210     /**
211      * Getter for the Crc parameter.
212      * @return the Crc parameter
213      */
214     public double getCrc() {
215         return crc;
216     }
217 
218     /**
219      * Setter for the Crc parameter.
220      * @param crc the value to set
221      */
222     public void setCrc(final double crc) {
223         this.crc = crc;
224     }
225 
226     /**
227      * Getter for the Crs parameter.
228      * @return the Crs parameter
229      */
230     public double getCrs() {
231         return crs;
232     }
233 
234     /**
235      * Setter for the Crs parameter.
236      * @param crs the value to set
237      */
238     public void setCrs(final double crs) {
239         this.crs = crs;
240     }
241 
242     /**
243      * Getter for the Cic parameter.
244      * @return the Cic parameter
245      */
246     public double getCic() {
247         return cic;
248     }
249 
250     /**
251      * Setter for te Cic parameter.
252      * @param cic the value to set
253      */
254     public void setCic(final double cic) {
255         this.cic = cic;
256     }
257 
258     /**
259      * Getter for the Cis parameter.
260      * @return the Cis parameter
261      */
262     public double getCis() {
263         return cis;
264     }
265 
266     /**
267      * Setter for the Cis parameter.
268      * @param cis the value to sets
269      */
270     public void setCis(final double cis) {
271         this.cis = cis;
272     }
273 
274     /**
275      * Getter for transmission time.
276      * @return transmission time
277      * @since 12.0
278      */
279     public double getTransmissionTime() {
280         return transmissionTime;
281     }
282 
283     /**
284      * Setter for transmission time.
285      * @param transmissionTime transmission time
286      * @since 12.0
287      */
288     public void setTransmissionTime(final double transmissionTime) {
289         this.transmissionTime = transmissionTime;
290     }
291 
292 }