1 /* Copyright 2022-2025 Luc Maisonobe
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.CalculusFieldElement;
20 import org.hipparchus.Field;
21
22 import java.util.function.Function;
23
24 /**
25 * Container for data contained in a GPS/QZNSS civilian navigation message.
26 * @param <T> type of the field elements
27 * @param <O> type of the orbital elements (non-field version)
28 * @author Luc Maisonobe
29 * @since 13.0
30 */
31 public abstract class FieldCivilianNavigationMessage<T extends CalculusFieldElement<T>,
32 O extends CivilianNavigationMessage<O>>
33 extends FieldAbstractNavigationMessage<T, O>
34 implements FieldGNSSClockElements<T> {
35
36 /** Indicator for CNV 2 messages. */
37 private final boolean cnv2;
38
39 /** Change rate in semi-major axis (m/s). */
40 private T aDot;
41
42 /** Change rate in Δn₀. */
43 private T deltaN0Dot;
44
45 /** The user SV accuracy (m). */
46 private T svAccuracy;
47
48 /** Satellite health status. */
49 private int svHealth;
50
51 /** Inter Signal Delay for L1 C/A. */
52 private T iscL1CA;
53
54 /** Inter Signal Delay for L1 CD. */
55 private T iscL1CD;
56
57 /** Inter Signal Delay for L1 CP. */
58 private T iscL1CP;
59
60 /** Inter Signal Delay for L2 C. */
61 private T iscL2C;
62
63 /** Inter Signal Delay for L5I. */
64 private T iscL5I5;
65
66 /** Inter Signal Delay for L5Q. */
67 private T iscL5Q5;
68
69 /** Elevation-Dependent User Range Accuracy. */
70 private int uraiEd;
71
72 /** Term 0 of Non-Elevation-Dependent User Range Accuracy. */
73 private int uraiNed0;
74
75 /** Term 1 of Non-Elevation-Dependent User Range Accuracy. */
76 private int uraiNed1;
77
78 /** Term 2 of Non-Elevation-Dependent User Range Accuracy. */
79 private int uraiNed2;
80
81 /** Constructor from non-field instance.
82 * @param field field to which elements belong
83 * @param original regular non-field instance
84 */
85 protected FieldCivilianNavigationMessage(final Field<T> field, final O original) {
86 super(field, original);
87 this.cnv2 = original.isCnv2();
88 setADot(field.getZero().newInstance(original.getADot()));
89 setDeltaN0Dot(field.getZero().newInstance(original.getDeltaN0Dot()));
90 setSvAccuracy(field.getZero().newInstance(original.getSvAccuracy()));
91 setSvHealth(original.getSvHealth());
92 setIscL1CA(field.getZero().newInstance(original.getIscL1CA()));
93 setIscL1CD(field.getZero().newInstance(original.getIscL1CD()));
94 setIscL1CP(field.getZero().newInstance(original.getIscL1CP()));
95 setIscL2C(field.getZero().newInstance(original.getIscL2C()));
96 setIscL5I5(field.getZero().newInstance(original.getIscL5I5()));
97 setIscL5Q5(field.getZero().newInstance(original.getIscL5Q5()));
98 setUraiEd(original.getUraiEd());
99 setUraiNed0(original.getUraiNed0());
100 setUraiNed1(original.getUraiNed1());
101 setUraiNed2(original.getUraiNed2());
102 }
103
104 /** Constructor from different field instance.
105 * @param <V> type of the old field elements
106 * @param original regular non-field instance
107 * @param converter for field elements
108 */
109 protected <V extends CalculusFieldElement<V>> FieldCivilianNavigationMessage(final Function<V, T> converter,
110 final FieldCivilianNavigationMessage<V, O> original) {
111 super(converter, original);
112 this.cnv2 = original.isCnv2();
113 setADot(converter.apply(original.getADot()));
114 setDeltaN0Dot(converter.apply(original.getDeltaN0Dot()));
115 setSvAccuracy(converter.apply(original.getSvAccuracy()));
116 setSvHealth(original.getSvHealth());
117 setIscL1CA(converter.apply(original.getIscL1CA()));
118 setIscL1CD(converter.apply(original.getIscL1CD()));
119 setIscL1CP(converter.apply(original.getIscL1CP()));
120 setIscL2C(converter.apply(original.getIscL2C()));
121 setIscL5I5(converter.apply(original.getIscL5I5()));
122 setIscL5Q5(converter.apply(original.getIscL5Q5()));
123 setUraiEd(original.getUraiEd());
124 setUraiNed0(original.getUraiNed0());
125 setUraiNed1(original.getUraiNed1());
126 setUraiNed2(original.getUraiNed2());
127 }
128
129 /** Check it message is a CNV2 message.
130 * @return true if message is a CNV2 message
131 */
132 public boolean isCnv2() {
133 return cnv2;
134 }
135
136 /** {@inheritDoc} */
137 @Override
138 public T getADot() {
139 return aDot;
140 }
141
142 /**
143 * Setter for the change rate in semi-major axis.
144 * @param value the change rate in semi-major axis
145 */
146 public void setADot(final T value) {
147 this.aDot = value;
148 }
149
150 /** {@inheritDoc} */
151 @Override
152 public T getDeltaN0Dot() {
153 return deltaN0Dot;
154 }
155
156 /**
157 * Setter for change rate in Δn₀.
158 * @param deltaN0Dot change rate in Δn₀
159 */
160 public void setDeltaN0Dot(final T deltaN0Dot) {
161 this.deltaN0Dot = deltaN0Dot;
162 }
163
164 /**
165 * Getter for the user SV accuray (meters).
166 * @return the user SV accuracy
167 */
168 public T getSvAccuracy() {
169 return svAccuracy;
170 }
171
172 /**
173 * Setter for the user SV accuracy.
174 * @param svAccuracy the value to set
175 */
176 public void setSvAccuracy(final T svAccuracy) {
177 this.svAccuracy = svAccuracy;
178 }
179
180 /**
181 * Getter for the satellite health status.
182 * @return the satellite health status
183 */
184 public int getSvHealth() {
185 return svHealth;
186 }
187
188 /**
189 * Setter for the satellite health status.
190 * @param svHealth the value to set
191 */
192 public void setSvHealth(final int svHealth) {
193 this.svHealth = svHealth;
194 }
195
196 /**
197 * Getter for inter Signal Delay for L1 C/A.
198 * @return inter signal delay
199 */
200 public T getIscL1CA() {
201 return iscL1CA;
202 }
203
204 /**
205 * Setter for inter Signal Delay for L1 C/A.
206 * @param delay delay to set
207 */
208 public void setIscL1CA(final T delay) {
209 this.iscL1CA = delay;
210 }
211
212 /**
213 * Getter for inter Signal Delay for L1 CD.
214 * @return inter signal delay
215 */
216 public T getIscL1CD() {
217 return iscL1CD;
218 }
219
220 /**
221 * Setter for inter Signal Delay for L1 CD.
222 * @param delay delay to set
223 */
224 public void setIscL1CD(final T delay) {
225 this.iscL1CD = delay;
226 }
227
228 /**
229 * Getter for inter Signal Delay for L1 CP.
230 * @return inter signal delay
231 */
232 public T getIscL1CP() {
233 return iscL1CP;
234 }
235
236 /**
237 * Setter for inter Signal Delay for L1 CP.
238 * @param delay delay to set
239 */
240 public void setIscL1CP(final T delay) {
241 this.iscL1CP = delay;
242 }
243
244 /**
245 * Getter for inter Signal Delay for L2 C.
246 * @return inter signal delay
247 */
248 public T getIscL2C() {
249 return iscL2C;
250 }
251
252 /**
253 * Setter for inter Signal Delay for L2 C.
254 * @param delay delay to set
255 */
256 public void setIscL2C(final T delay) {
257 this.iscL2C = delay;
258 }
259
260 /**
261 * Getter for inter Signal Delay for L5I.
262 * @return inter signal delay
263 */
264 public T getIscL5I5() {
265 return iscL5I5;
266 }
267
268 /**
269 * Setter for inter Signal Delay for L5I.
270 * @param delay delay to set
271 */
272 public void setIscL5I5(final T delay) {
273 this.iscL5I5 = delay;
274 }
275
276 /**
277 * Getter for inter Signal Delay for L5Q.
278 * @return inter signal delay
279 */
280 public T getIscL5Q5() {
281 return iscL5Q5;
282 }
283
284 /**
285 * Setter for inter Signal Delay for L5Q.
286 * @param delay delay to set
287 */
288 public void setIscL5Q5(final T delay) {
289 this.iscL5Q5 = delay;
290 }
291
292 /**
293 * Getter for Elevation-Dependent User Range Accuracy.
294 * @return Elevation-Dependent User Range Accuracy
295 */
296 public int getUraiEd() {
297 return uraiEd;
298 }
299
300 /**
301 * Setter for Elevation-Dependent User Range Accuracy.
302 * @param uraiEd Elevation-Dependent User Range Accuracy
303 */
304 public void setUraiEd(final int uraiEd) {
305 this.uraiEd = uraiEd;
306 }
307
308 /**
309 * Getter for term 0 of Non-Elevation-Dependent User Range Accuracy.
310 * @return term 0 of Non-Elevation-Dependent User Range Accuracy
311 */
312 public int getUraiNed0() {
313 return uraiNed0;
314 }
315
316 /**
317 * Setter for term 0 of Non-Elevation-Dependent User Range Accuracy.
318 * @param uraiNed0 term 0 of Non-Elevation-Dependent User Range Accuracy
319 */
320 public void setUraiNed0(final int uraiNed0) {
321 this.uraiNed0 = uraiNed0;
322 }
323
324 /**
325 * Getter for term 1 of Non-Elevation-Dependent User Range Accuracy.
326 * @return term 1 of Non-Elevation-Dependent User Range Accuracy
327 */
328 public int getUraiNed1() {
329 return uraiNed1;
330 }
331
332 /**
333 * Setter for term 1 of Non-Elevation-Dependent User Range Accuracy.
334 * @param uraiNed1 term 1 of Non-Elevation-Dependent User Range Accuracy
335 */
336 public void setUraiNed1(final int uraiNed1) {
337 this.uraiNed1 = uraiNed1;
338 }
339
340 /**
341 * Getter for term 2 of Non-Elevation-Dependent User Range Accuracy.
342 * @return term 2 of Non-Elevation-Dependent User Range Accuracy
343 */
344 public int getUraiNed2() {
345 return uraiNed2;
346 }
347
348 /**
349 * Setter for term 2 of Non-Elevation-Dependent User Range Accuracy.
350 * @param uraiNed2 term 2 of Non-Elevation-Dependent User Range Accuracy
351 */
352 public void setUraiNed2(final int uraiNed2) {
353 this.uraiNed2 = uraiNed2;
354 }
355
356 }