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.orekit.orbits.FieldKeplerianOrbit;
21  import org.orekit.time.FieldGNSSDate;
22  import org.orekit.time.TimeScales;
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 final T svAccuracy;
41  
42      /** Satellite health status. */
43      private final int svHealth;
44  
45      /** Inter Signal Delay for L1 C/A. */
46      private final T iscL1CA;
47  
48      /** Inter Signal Delay for L1 CD. */
49      private final T iscL1CD;
50  
51      /** Inter Signal Delay for L1 CP. */
52      private final T iscL1CP;
53  
54      /** Inter Signal Delay for L2 C. */
55      private final T iscL2C;
56  
57      /** Inter Signal Delay for L5I. */
58      private final T iscL5I5;
59  
60      /** Inter Signal Delay for L5Q. */
61      private final T iscL5Q5;
62  
63      /** Elevation-Dependent User Range Accuracy. */
64      private final int uraiEd;
65  
66      /** Term 0 of Non-Elevation-Dependent User Range Accuracy. */
67      private final int uraiNed0;
68  
69      /** Term 1 of Non-Elevation-Dependent User Range Accuracy. */
70      private final int uraiNed1;
71  
72      /** Term 2 of Non-Elevation-Dependent User Range Accuracy. */
73      private final int uraiNed2;
74  
75      /** Flags.
76       * @since 14.0
77       */
78      private final int flags;
79  
80      /** Creates a new instance.
81       * @param cnv2             indicator for CNV2 messages
82       * @param angularVelocity  mean angular velocity of the Earth for the GNSS model
83       * @param weeksInCycle     number of weeks in the GNSS cycle
84       * @param timeScales       known time scales
85       * @param type             type (null if not a navigation message)
86       * @param prn              PRN number of the satellite
87       * @param toe              time of ephemeris (<em>must</em> be consistent with {@code orbit})
88       * @param orbit            Keplerian orbit in Earth-frozen frame
89       * @param nonKeplerian     15 non-Keplerian parameters (in the order given by {@link NonKeplerianDriversFactory}
90       * @param tgd              group delay differential TGD for L1-L2 correction
91       * @param toc              time of clock
92       * @param transmissionTime transmission time
93       * @param svAccuracy       user SV accuracy (m)
94       * @param svHealth         satellite health status
95       * @param iscL1CA          inter signal delay for L1 C/A
96       * @param iscL1CD          inter signal delay for L1 CD
97       * @param iscL1CP          inter signal delay for L1 CP
98       * @param iscL2C           inter signal delay for L2 C
99       * @param iscL5I5          inter signal delay for L5I
100      * @param iscL5Q5          inter signal delay for L5Q
101      * @param uraiEd           elevation-dependent user range accuracy
102      * @param uraiNed0         term 0 of non-elevation-dependent user range accuracy
103      * @param uraiNed1         term 1 of non-elevation-dependent user range accuracy
104      * @param uraiNed2         term 2 of non-elevation-dependent user range accuracy
105      * @param flags            flags
106      * @since 14.0
107      */
108     public FieldCivilianNavigationMessage(final boolean cnv2,
109                                           final double angularVelocity, final int weeksInCycle,
110                                           final TimeScales timeScales, final String type, final int prn,
111                                           final FieldGNSSDate<T> toe, final FieldKeplerianOrbit<T> orbit,
112                                           final T[] nonKeplerian, final T tgd,
113                                           final FieldGNSSDate<T> toc, final FieldGNSSDate<T>  transmissionTime,
114                                           final T svAccuracy, final int svHealth,
115                                           final T iscL1CA, final T iscL1CD, final T iscL1CP,
116                                           final T iscL2C, final T iscL5I5, final T iscL5Q5,
117                                           final int uraiEd, final int uraiNed0, final int uraiNed1, final int uraiNed2,
118                                           final int flags) {
119         super(angularVelocity, weeksInCycle, timeScales, type, prn, toe, orbit, nonKeplerian,
120               tgd, toc, transmissionTime);
121         this.cnv2       = cnv2;
122         this.svAccuracy = svAccuracy;
123         this.svHealth   = svHealth;
124         this.iscL1CA    = iscL1CA;
125         this.iscL1CD    = iscL1CD;
126         this.iscL1CP    = iscL1CP;
127         this.iscL2C     = iscL2C;
128         this.iscL5I5    = iscL5I5;
129         this.iscL5Q5    = iscL5Q5;
130         this.uraiEd     = uraiEd;
131         this.uraiNed0   = uraiNed0;
132         this.uraiNed1   = uraiNed1;
133         this.uraiNed2   = uraiNed2;
134         this.flags      = flags;
135     }
136 
137     /** {@inheritDoc} */
138     @Override
139     public boolean isCivilianMessage() {
140         return true;
141     }
142 
143     /** Check it message is a CNV2 message.
144      * @return true if message is a CNV2 message
145      */
146     public boolean isCnv2() {
147         return cnv2;
148     }
149 
150     /**
151      * Getter for the user SV accuray (meters).
152      * @return the user SV accuracy
153      */
154     public T getSvAccuracy() {
155         return svAccuracy;
156     }
157 
158     /**
159      * Getter for the satellite health status.
160      * @return the satellite health status
161      */
162     public int getSvHealth() {
163         return svHealth;
164     }
165 
166     /**
167      * Getter for inter Signal Delay for L1 C/A.
168      * @return inter signal delay
169      */
170     public T getIscL1CA() {
171         return iscL1CA;
172     }
173 
174     /**
175      * Getter for inter Signal Delay for L1 CD.
176      * @return inter signal delay
177      */
178     public T getIscL1CD() {
179         return iscL1CD;
180     }
181 
182     /**
183      * Getter for inter Signal Delay for L1 CP.
184      * @return inter signal delay
185      */
186     public T getIscL1CP() {
187         return iscL1CP;
188     }
189 
190     /**
191      * Getter for inter Signal Delay for L2 C.
192      * @return inter signal delay
193      */
194     public T getIscL2C() {
195         return iscL2C;
196     }
197 
198     /**
199      * Getter for inter Signal Delay for L5I.
200      * @return inter signal delay
201      */
202     public T getIscL5I5() {
203         return iscL5I5;
204     }
205 
206     /**
207      * Getter for inter Signal Delay for L5Q.
208      * @return inter signal delay
209      */
210     public T getIscL5Q5() {
211         return iscL5Q5;
212     }
213 
214     /**
215      * Getter for Elevation-Dependent User Range Accuracy.
216      * @return Elevation-Dependent User Range Accuracy
217      */
218     public int getUraiEd() {
219         return uraiEd;
220     }
221 
222     /**
223      * Getter for term 0 of Non-Elevation-Dependent User Range Accuracy.
224      * @return term 0 of Non-Elevation-Dependent User Range Accuracy
225      */
226     public int getUraiNed0() {
227         return uraiNed0;
228     }
229 
230     /**
231      * Getter for term 1 of Non-Elevation-Dependent User Range Accuracy.
232      * @return term 1 of Non-Elevation-Dependent User Range Accuracy
233      */
234     public int getUraiNed1() {
235         return uraiNed1;
236     }
237 
238     /**
239      * Getter for term 2 of Non-Elevation-Dependent User Range Accuracy.
240      * @return term 2 of Non-Elevation-Dependent User Range Accuracy
241      */
242     public int getUraiNed2() {
243         return uraiNed2;
244     }
245 
246     /** Get the flags.
247      * @return flags
248      * @since 14.0
249      */
250     public int getFlags() {
251         return flags;
252     }
253 
254 }