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