1 /* Copyright 2002-2020 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.gnss;
18
19 import org.hipparchus.util.FastMath;
20 import org.orekit.annotation.DefaultDataContext;
21 import org.orekit.data.DataContext;
22 import org.orekit.propagation.analytical.gnss.GalileoOrbitalElements;
23 import org.orekit.time.AbsoluteDate;
24 import org.orekit.time.GNSSDate;
25
26 /**
27 * Class for Galileo almanac.
28 *
29 * @see "European GNSS (Galileo) Open Service, Signal In Space,
30 * Interface Control Document, Table 75"
31 *
32 * @author Bryan Cazabonne
33 * @since 10.0
34 *
35 */
36 public class GalileoAlmanac implements GalileoOrbitalElements {
37
38 // Nominal parameters
39 /** Nominal inclination (Ref: Galileo ICD - Table 75). */
40 private static final double I0 = FastMath.toRadians(56.0);
41
42 /** Nominal semi-major axis in meters (Ref: Galileo ICD - Table 75). */
43 private static final double A0 = 29600000;
44
45 /** PRN number. */
46 private final int prn;
47
48 /** Satellite E5a signal health status. */
49 private final int healthE5a;
50
51 /** Satellite E5b signal health status. */
52 private final int healthE5b;
53
54 /** Satellite E1-B/C signal health status. */
55 private final int healthE1;
56
57 /** Galileo week. */
58 private final int week;
59
60 /** Time of applicability. */
61 private final double toa;
62
63 /** Semi-major axis. */
64 private final double sma;
65
66 /** Eccentricity. */
67 private final double ecc;
68
69 /** Inclination. */
70 private final double inc;
71
72 /** Longitude of Orbital Plane. */
73 private final double om0;
74
75 /** Rate of Right Ascension. */
76 private final double dom;
77
78 /** Argument of perigee. */
79 private final double aop;
80
81 /** Mean anomaly. */
82 private final double anom;
83
84 /** Zeroth order clock correction. */
85 private final double af0;
86
87 /** First order clock correction. */
88 private final double af1;
89
90 /** Almanac Issue Of Data. */
91 private final int iod;
92
93 /** Date of validity. */
94 private final AbsoluteDate date;
95
96 /**
97 * Build a new almanac.
98 *
99 * <p>This method uses the {@link DataContext#getDefault() default data context}.
100 *
101 * @param prn the PRN number
102 * @param week the Galileo week
103 * @param toa the Almanac Time of Applicability (s)
104 * @param dsqa difference between the square root of the semi-major axis
105 * and the square root of the nominal semi-major axis
106 * @param ecc the eccentricity
107 * @param dinc the correction of orbit reference inclination at reference time (rad)
108 * @param iod the issue of data
109 * @param om0 the geographic longitude of the orbital plane at the weekly epoch (rad)
110 * @param dom the Rate of Right Ascension (rad/s)
111 * @param aop the Argument of Perigee (rad)
112 * @param anom the Mean Anomaly (rad)
113 * @param af0 the Zeroth Order Clock Correction (s)
114 * @param af1 the First Order Clock Correction (s/s)
115 * @param healthE5a the E5a signal health status
116 * @param healthE5b the E5b signal health status
117 * @param healthE1 the E1-B/C signal health status
118 * @see #GalileoAlmanac(int, int, double, double, double, double, int, double, double,
119 * double, double, double, double, int, int, int, AbsoluteDate)
120 */
121 @DefaultDataContext
122 public GalileoAlmanac(final int prn, final int week, final double toa,
123 final double dsqa, final double ecc, final double dinc,
124 final int iod, final double om0, final double dom,
125 final double aop, final double anom, final double af0,
126 final double af1, final int healthE5a, final int healthE5b,
127 final int healthE1) {
128 this(prn, week, toa, dsqa, ecc, dinc, iod, om0, dom, aop, anom, af0, af1,
129 healthE5a, healthE5b, healthE1,
130 new GNSSDate(week, toa * 1000., SatelliteSystem.GALILEO,
131 DataContext.getDefault().getTimeScales()).getDate());
132 }
133
134 /**
135 * Build a new almanac.
136 *
137 * @param prn the PRN number
138 * @param week the Galileo week
139 * @param toa the Almanac Time of Applicability (s)
140 * @param dsqa difference between the square root of the semi-major axis
141 * and the square root of the nominal semi-major axis
142 * @param ecc the eccentricity
143 * @param dinc the correction of orbit reference inclination at reference time (rad)
144 * @param iod the issue of data
145 * @param om0 the geographic longitude of the orbital plane at the weekly epoch (rad)
146 * @param dom the Rate of Right Ascension (rad/s)
147 * @param aop the Argument of Perigee (rad)
148 * @param anom the Mean Anomaly (rad)
149 * @param af0 the Zeroth Order Clock Correction (s)
150 * @param af1 the First Order Clock Correction (s/s)
151 * @param healthE5a the E5a signal health status
152 * @param healthE5b the E5b signal health status
153 * @param healthE1 the E1-B/C signal health status
154 * @param date corresponding to {@code week} and {@code toa}.
155 * @since 10.1
156 */
157 public GalileoAlmanac(final int prn, final int week, final double toa,
158 final double dsqa, final double ecc, final double dinc,
159 final int iod, final double om0, final double dom,
160 final double aop, final double anom, final double af0,
161 final double af1, final int healthE5a, final int healthE5b,
162 final int healthE1, final AbsoluteDate date) {
163 this.prn = prn;
164 this.week = week;
165 this.toa = toa;
166 this.ecc = ecc;
167 this.inc = I0 + dinc;
168 this.iod = iod;
169 this.om0 = om0;
170 this.dom = dom;
171 this.aop = aop;
172 this.anom = anom;
173 this.af0 = af0;
174 this.af1 = af1;
175 this.healthE1 = healthE1;
176 this.healthE5a = healthE5a;
177 this.healthE5b = healthE5b;
178 this.date = date;
179
180 // semi-major axis computation
181 final double sqa = dsqa + FastMath.sqrt(A0);
182 this.sma = sqa * sqa;
183 }
184
185 @Override
186 public AbsoluteDate getDate() {
187 return date;
188 }
189
190 @Override
191 public int getPRN() {
192 return prn;
193 }
194
195 @Override
196 public int getWeek() {
197 return week;
198 }
199
200 @Override
201 public double getTime() {
202 return toa;
203 }
204
205 @Override
206 public double getSma() {
207 return sma;
208 }
209
210 @Override
211 public double getMeanMotion() {
212 final double absA = FastMath.abs(sma);
213 return FastMath.sqrt(GALILEO_MU / absA) / absA;
214 }
215
216 @Override
217 public double getE() {
218 return ecc;
219 }
220
221 @Override
222 public double getI0() {
223 return inc;
224 }
225
226 @Override
227 public double getIDot() {
228 return 0;
229 }
230
231 @Override
232 public double getOmega0() {
233 return om0;
234 }
235
236 @Override
237 public double getOmegaDot() {
238 return dom;
239 }
240
241 @Override
242 public double getPa() {
243 return aop;
244 }
245
246 @Override
247 public double getM0() {
248 return anom;
249 }
250
251 @Override
252 public double getCuc() {
253 return 0;
254 }
255
256 @Override
257 public double getCus() {
258 return 0;
259 }
260
261 @Override
262 public double getCrc() {
263 return 0;
264 }
265
266 @Override
267 public double getCrs() {
268 return 0;
269 }
270
271 @Override
272 public double getCic() {
273 return 0;
274 }
275
276 @Override
277 public double getCis() {
278 return 0;
279 }
280
281 @Override
282 public double getAf0() {
283 return af0;
284 }
285
286 @Override
287 public double getAf1() {
288 return af1;
289 }
290
291 /** Get the Issue of Data (IOD).
292 * @return the Issue Of Data
293 */
294 public int getIOD() {
295 return iod;
296 }
297
298 /**
299 * Gets the E1-B/C signal health status.
300 *
301 * @return the E1-B/C signal health status
302 */
303 public int getHealthE1() {
304 return healthE1;
305 }
306
307 /**
308 * Gets the E5a signal health status.
309 *
310 * @return the E5a signal health status
311 */
312 public int getHealthE5a() {
313 return healthE5a;
314 }
315 /**
316 * Gets the E5b signal health status.
317 *
318 * @return the E5b signal health status
319 */
320 public int getHealthE5b() {
321 return healthE5b;
322 }
323
324 }