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.orekit.annotation.DefaultDataContext;
20 import org.orekit.data.DataContext;
21 import org.orekit.time.AbsoluteDate;
22 import org.orekit.time.DateComponents;
23 import org.orekit.time.GLONASSDate;
24 import org.orekit.time.TimeComponents;
25 import org.orekit.time.TimeScale;
26
27 /**
28 * This class holds a GLONASS almanac as read from .agl files.
29 *
30 * @author Bryan Cazabonne
31 * @since 10.0
32 *
33 */
34 public class GLONASSAlmanac implements GLONASSOrbitalElements {
35
36 /** Frequency channel (-7...6). */
37 private final int channel;
38
39 /** Health status. */
40 private final int health;
41
42 /** Day of Almanac. */
43 private final int day;
44
45 /** Month of Almanac. */
46 private final int month;
47
48 /** Year of Almanac. */
49 private final int year;
50
51 /** Reference time of the almanac. */
52 private final double ta;
53
54 /** Greenwich longitude of ascending node of orbit. */
55 private final double lambda;
56
57 /** Correction to the mean value of inclination. */
58 private final double deltaI;
59
60 /** Argument of perigee. */
61 private final double pa;
62
63 /** Eccentricity. */
64 private final double ecc;
65
66 /** Correction to the mean value of Draconian period. */
67 private final double deltaT;
68
69 /** Rate of change of orbital period. */
70 private final double deltaTDot;
71
72 /** Correction from GLONASS to UTC. */
73 private final double tGlo2UTC;
74
75 /** Correction to GPS time relative GLONASS. */
76 private final double tGPS2Glo;
77
78 /** Correction of time relative to GLONASS system time. */
79 private final double tGlo;
80
81 /** GLONASS time scale. */
82 private final TimeScale glonass;
83
84 /**
85 * Constructor.
86 *
87 * <p>This method uses the {@link DataContext#getDefault() default data context}.
88 *
89 * @param channel the frequency channel from -7 to 6)
90 * @param health the Health status
91 * @param day the day of Almanac
92 * @param month the month of Almanac
93 * @param year the year of Almanac
94 * @param ta the reference time of the almanac (s)
95 * @param lambda the Greenwich longitude of ascending node of orbit (rad)
96 * @param deltaI the correction to the mean value of inclination (rad)
97 * @param pa the argument of perigee (rad)
98 * @param ecc the eccentricity
99 * @param deltaT the correction to the mean value of Draconian period (s)
100 * @param deltaTDot the rate of change of orbital period
101 * @param tGlo2UTC the correction from GLONASS to UTC (s)
102 * @param tGPS2Glo the correction to GPS time relative GLONASS (s)
103 * @param tGlo the correction of time relative to GLONASS system time (s)
104 * @see #GLONASSAlmanac(int, int, int, int, int, double, double, double, double,
105 * double, double, double, double, double, double, TimeScale)
106 */
107 @DefaultDataContext
108 public GLONASSAlmanac(final int channel, final int health,
109 final int day, final int month, final int year,
110 final double ta, final double lambda,
111 final double deltaI, final double pa,
112 final double ecc, final double deltaT, final double deltaTDot,
113 final double tGlo2UTC, final double tGPS2Glo, final double tGlo) {
114 this(channel, health, day, month, year, ta, lambda, deltaI, pa, ecc, deltaT,
115 deltaTDot, tGlo2UTC, tGPS2Glo, tGlo,
116 DataContext.getDefault().getTimeScales().getGLONASS());
117 }
118
119 /**
120 * Constructor.
121 *
122 * @param channel the frequency channel from -7 to 6)
123 * @param health the Health status
124 * @param day the day of Almanac
125 * @param month the month of Almanac
126 * @param year the year of Almanac
127 * @param ta the reference time of the almanac (s)
128 * @param lambda the Greenwich longitude of ascending node of orbit (rad)
129 * @param deltaI the correction to the mean value of inclination (rad)
130 * @param pa the argument of perigee (rad)
131 * @param ecc the eccentricity
132 * @param deltaT the correction to the mean value of Draconian period (s)
133 * @param deltaTDot the rate of change of orbital period
134 * @param tGlo2UTC the correction from GLONASS to UTC (s)
135 * @param tGPS2Glo the correction to GPS time relative GLONASS (s)
136 * @param tGlo the correction of time relative to GLONASS system time (s)
137 * @param glonass GLONASS time scale.
138 * @since 10.1
139 */
140 public GLONASSAlmanac(final int channel, final int health,
141 final int day, final int month, final int year,
142 final double ta, final double lambda,
143 final double deltaI, final double pa,
144 final double ecc, final double deltaT, final double deltaTDot,
145 final double tGlo2UTC, final double tGPS2Glo, final double tGlo,
146 final TimeScale glonass) {
147 this.channel = channel;
148 this.health = health;
149 this.day = day;
150 this.month = month;
151 this.year = year;
152 this.ta = ta;
153 this.lambda = lambda;
154 this.deltaI = deltaI;
155 this.pa = pa;
156 this.ecc = ecc;
157 this.deltaT = deltaT;
158 this.deltaTDot = deltaTDot;
159 this.tGlo2UTC = tGlo2UTC;
160 this.tGPS2Glo = tGPS2Glo;
161 this.tGlo = tGlo;
162 this.glonass = glonass;
163 }
164
165 @Override
166 public AbsoluteDate getDate() {
167 final DateComponents date = new DateComponents(year, month, day);
168 final TimeComponents time = new TimeComponents(ta);
169 return new AbsoluteDate(date, time, glonass);
170 }
171
172 @Override
173 public double getTime() {
174 return ta;
175 }
176
177 @Override
178 public double getLambda() {
179 return lambda;
180 }
181
182 @Override
183 public double getE() {
184 return ecc;
185 }
186
187 @Override
188 public double getPa() {
189 return pa;
190 }
191
192 @Override
193 public double getDeltaI() {
194 return deltaI;
195 }
196
197 @Override
198 public double getDeltaT() {
199 return deltaT;
200 }
201
202 @Override
203 public double getDeltaTDot() {
204 return deltaTDot;
205 }
206
207 /**
208 * Get the Health status.
209 *
210 * @return the Health status
211 */
212 public int getHealth() {
213 return health;
214 }
215
216 /**
217 * Get the frequency channel.
218 *
219 * @return the frequency channel
220 */
221 public int getFrequencyChannel() {
222 return channel;
223 }
224
225 /**
226 * Get the correction from GLONASS to UTC.
227 *
228 * @return the correction from GLONASS to UTC (s)
229 */
230 public double getGlo2UTC() {
231 return tGlo2UTC;
232 }
233
234 /**
235 * Get the correction to GPS time relative GLONASS.
236 *
237 * @return the to GPS time relative GLONASS (s)
238 */
239 public double getGPS2Glo() {
240 return tGPS2Glo;
241 }
242
243 /**
244 * Get the correction of time relative to GLONASS system time.
245 *
246 * @return the correction of time relative to GLONASS system time (s)
247 */
248 public double getGloOffset() {
249 return tGlo;
250 }
251
252 @Override
253 public int getNa() {
254 final GLONASSDate gloDate = new GLONASSDate(getDate(), glonass);
255 return gloDate.getDayNumber();
256 }
257
258 @Override
259 public int getN4() {
260 final GLONASSDate gloDate = new GLONASSDate(getDate(), glonass);
261 return gloDate.getIntervalNumber();
262 }
263 }