1   /* Copyright 2002-2021 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 GPSNavigationMessage
28   * @see GalileoNavigationMessage
29   * @see BeidouNavigationMessage
30   * @see QZSSNavigationMessage
31   * @see IRNSSNavigationMessage
32   */
33  public abstract class AbstractNavigationMessage extends CommonGnssData {
34  
35      /** Mean Motion Difference from Computed Value. */
36      private double deltaN;
37  
38      /** Rate of Inclination Angle (rad/s). */
39      private double iDot;
40  
41      /** Drift Rate Correction Coefficient (s/s²). */
42      private double af2;
43  
44      /** Time of clock epoch. */
45      private AbsoluteDate epochToc;
46  
47      /** Amplitude of Cosine Harmonic Correction Term to the Argument of Latitude. */
48      private double cuc;
49  
50      /** Amplitude of Sine Harmonic Correction Term to the Argument of Latitude. */
51      private double cus;
52  
53      /** Amplitude of the Cosine Harmonic Correction Term to the Orbit Radius. */
54      private double crc;
55  
56      /** Amplitude of the Sine Correction Term to the Orbit Radius. */
57      private double crs;
58  
59      /** Amplitude of the Cosine Harmonic Correction Term to the Angle of Inclination. */
60      private double cic;
61  
62      /** Amplitude of the Sine Harmonic Correction Term to the Angle of Inclination. */
63      private double cis;
64  
65      /**
66       * Constructor.
67       * @param mu Earth's universal gravitational parameter
68       * @param angularVelocity mean angular velocity of the Earth for the GNSS model
69       * @param weekNumber number of weeks in the GNSS cycle
70       */
71      public AbstractNavigationMessage(final double mu,
72                                       final double angularVelocity,
73                                       final int weekNumber) {
74          super(mu, angularVelocity, weekNumber);
75      }
76  
77      /**
78       * Setter for the Square Root of Semi-Major Axis (m^1/2).
79       * <p>
80       * In addition, this method set the value of the Semi-Major Axis.
81       * </p>
82       * @param sqrtA the Square Root of Semi-Major Axis (m^1/2)
83       */
84      public void setSqrtA(final double sqrtA) {
85          super.setSma(sqrtA * sqrtA);
86      }
87  
88      /**
89       * Getter for the mean motion.
90       * @return the mean motion
91       */
92      public double getMeanMotion() {
93          final double absA = FastMath.abs(getSma());
94          return FastMath.sqrt(getMu() / absA) / absA + deltaN;
95      }
96  
97      /**
98       * Setter for the delta of satellite mean motion.
99       * @param deltaN the value to set
100      */
101     public void setDeltaN(final double deltaN) {
102         this.deltaN = deltaN;
103     }
104 
105     /**
106      * Getter for the rate of inclination angle.
107      * @return the rate of inclination angle in rad/s
108      */
109     public double getIDot() {
110         return iDot;
111     }
112 
113     /**
114      * Setter for the Rate of Inclination Angle (rad/s).
115      * @param iRate the rate of inclination angle to set
116      */
117     public void setIDot(final double iRate) {
118         this.iDot = iRate;
119     }
120 
121     /**
122      * Getter for the Drift Rate Correction Coefficient.
123      * @return the Drift Rate Correction Coefficient (s/s²).
124      */
125     public double getAf2() {
126         return af2;
127     }
128 
129     /**
130      * Setter for the Drift Rate Correction Coefficient (s/s²).
131      * @param af2 the Drift Rate Correction Coefficient to set
132      */
133     public void setAf2(final double af2) {
134         this.af2 = af2;
135     }
136 
137     /**
138      * Getter for the time of clock epoch.
139      * @return the time of clock epoch
140      */
141     public AbsoluteDate getEpochToc() {
142         return epochToc;
143     }
144 
145     /**
146      * Setter for the time of clock epoch.
147      * @param epochToc the epoch to set
148      */
149     public void setEpochToc(final AbsoluteDate epochToc) {
150         this.epochToc = epochToc;
151     }
152 
153     /**
154      * Getter for the Cuc parameter.
155      * @return the Cuc parameter
156      */
157     public double getCuc() {
158         return cuc;
159     }
160 
161     /**
162      * Setter for the Cuc parameter.
163      * @param cuc the value to set
164      */
165     public void setCuc(final double cuc) {
166         this.cuc = cuc;
167     }
168 
169     /**
170      * Getter for the Cus parameter.
171      * @return the Cus parameter
172      */
173     public double getCus() {
174         return cus;
175     }
176 
177     /**
178      * Setter for the Cus parameter.
179      * @param cus the value to set
180      */
181     public void setCus(final double cus) {
182         this.cus = cus;
183     }
184 
185     /**
186      * Getter for the Crc parameter.
187      * @return the Crc parameter
188      */
189     public double getCrc() {
190         return crc;
191     }
192 
193     /**
194      * Setter for the Crc parameter.
195      * @param crc the value to set
196      */
197     public void setCrc(final double crc) {
198         this.crc = crc;
199     }
200 
201     /**
202      * Getter for the Crs parameter.
203      * @return the Crs parameter
204      */
205     public double getCrs() {
206         return crs;
207     }
208 
209     /**
210      * Setter for the Crs parameter.
211      * @param crs the value to set
212      */
213     public void setCrs(final double crs) {
214         this.crs = crs;
215     }
216 
217     /**
218      * Getter for the Cic parameter.
219      * @return the Cic parameter
220      */
221     public double getCic() {
222         return cic;
223     }
224 
225     /**
226      * Setter for te Cic parameter.
227      * @param cic the value to set
228      */
229     public void setCic(final double cic) {
230         this.cic = cic;
231     }
232 
233     /**
234      * Getter for the Cis parameter.
235      * @return the Cis parameter
236      */
237     public double getCis() {
238         return cis;
239     }
240 
241     /**
242      * Setter for the Cis parameter.
243      * @param cis the value to sets
244      */
245     public void setCis(final double cis) {
246         this.cis = cis;
247     }
248 
249 }